Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5884196imm; Wed, 12 Sep 2018 12:38:36 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYPsepQLvj+vqlSpE+EMVLV+FOOvfUTrFg6Fy89h6WNg/6T0B9RcOQbdB6eagPNIh/3+/P4 X-Received: by 2002:a63:d54e:: with SMTP id v14-v6mr4001817pgi.264.1536781116114; Wed, 12 Sep 2018 12:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536781116; cv=none; d=google.com; s=arc-20160816; b=bcIMACS9CGpyHWjjaavO4W1jVVKBPzHhfblGvz5Mc93ahrCZGU1U9jBxfNiJV5N4ON gv3/x0gXbpPrEMKVkaw3vsSRdLsOv7JN4ojlNbWvso2wwgjzYRlSnMEztcEE4+ot6y0k njR+QRhyuLPyIc38y4FmdyCOis2C3J6AQpgVIxFs0Y8Scchvjn09zz2LD+A7sZn91Og1 A5J3HPddaSSRyRZLkP5Bs2WHDcjQ/JxFaXpFxgk62HQoLgGQwh4VsUAt7OGUPfGe25q0 /L0QEwzR26Im70Ek/C9kYGBvIa3M6mDuP2vSAvlcS/W2UCWUL5j4P6GrJT2s7ppsEohL mfww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:dkim-filter; bh=e3zRgIrHUlmbStt2hPoQp2spzwbWa9QtwJqxLv4027A=; b=lSR5oj/Fvo/lLYX6DcObxfrZcYYsS3dMdHuPDf9CWHW7OSR98XJWa7smFupSDwdHzS j43G37BcxMXPz5xKk/FI+jXXc7eAVNVaipTWXZ0+UgXG+5Or0DBm040AlNYp6fL1LFno Ane6PSV+X9m1xeSarrgT/moZIxV/axGjnnErjD+DISEBH14EMFtI0k4SRG2MWojG8FPs pgqVIDTvyfxwp29fv9RZErZvmb9k01Ep/68cwI1ckemHyIVDVmqXA+4OKH6oswfLXaLZ RpqZU4VvzZdlO+xC5wyETRW3QcvwyZeHty8B1KZ9s73RVe/4FYh23+SBKHyPTT0QP2LN AMlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@upb.ro header.s=96342B8A-77E4-11E5-BA93-D93D0963A2DF header.b=EsF1vIFL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a24-v6si2028933pgh.357.2018.09.12.12.38.20; Wed, 12 Sep 2018 12:38:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@upb.ro header.s=96342B8A-77E4-11E5-BA93-D93D0963A2DF header.b=EsF1vIFL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728164AbeIMAmm (ORCPT + 99 others); Wed, 12 Sep 2018 20:42:42 -0400 Received: from mail-sender200.upb.ro ([141.85.13.200]:35800 "EHLO mx.upb.ro" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727872AbeIMAmm (ORCPT ); Wed, 12 Sep 2018 20:42:42 -0400 Received: from mx.upb.ro (localhost [127.0.0.1]) by mx.upb.ro (Postfix) with ESMTPS id E1B63B57CA4A; Wed, 12 Sep 2018 22:36:37 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by mx.upb.ro (Postfix) with ESMTP id B9E99B566DC6; Wed, 12 Sep 2018 22:36:37 +0300 (EEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mx.upb.ro B9E99B566DC6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upb.ro; s=96342B8A-77E4-11E5-BA93-D93D0963A2DF; t=1536780997; bh=e3zRgIrHUlmbStt2hPoQp2spzwbWa9QtwJqxLv4027A=; h=Message-ID:From:To:Date:Mime-Version; b=EsF1vIFLGduLvpTPfux8H7nV9lyE4Yr1v1R/dhwCGo6PCm3z/Jq6wsCpA9ZexBnq7 j2kMB55WcEKzNMJMQB8kzGgwxzyaLAWFto/fpCvTIcJtUm8jFPc03TubNXZf45GXbb Cu4PxjlpwupRI2jBcBcKCvQWXT31RkgyxA+dP2nY= Received: from mx.upb.ro ([127.0.0.1]) by localhost (mx.upb.ro [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id riSnY_ru48Ge; Wed, 12 Sep 2018 22:36:37 +0300 (EEST) Received: from sabertooth (unknown [188.27.118.63]) by mx.upb.ro (Postfix) with ESMTPSA id 7F3CAB56345F; Wed, 12 Sep 2018 22:36:37 +0300 (EEST) Message-ID: Subject: Re: [PATCH v12 0/6] Driver for at91 usart in spi mode From: Radu Pirea To: Lee Jones , Alexandre Belloni Cc: Geert Uytterhoeven , Rob Herring , Mark Rutland , Nicolas Ferre , Greg KH , Mark Brown , Jiri Slaby , Richard Genoud , "David S. Miller" , Mauro Carvalho Chehab , Andrew Morton , Arnd Bergmann , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux ARM , Linux Kernel Mailing List , "open list:SERIAL DRIVERS" , linux-spi Date: Wed, 12 Sep 2018 22:36:40 +0300 In-Reply-To: <20180912131248.GA21544@dell> References: <20180911185839.GA25212@piout.net> <20180911224418.GK4185@dell> <20180911225440.GL4185@dell> <20180912073355.GB2557@piout.net> <20180912084143.GN4185@dell> <20180912105407.GR4185@dell> <20180912111757.GC2760@piout.net> <20180912114352.GT4185@dell> <20180912121420.GE2760@piout.net> <20180912131248.GA21544@dell> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-09-12 at 14:12 +0100, Lee Jones wrote: > On Wed, 12 Sep 2018, Alexandre Belloni wrote: > > > On 12/09/2018 12:43:52+0100, Lee Jones wrote: > > > > > But ... we can't have it both ways. *Either* it's a true > > > > > MFD, in > > > > > which case it can/should have 2 separate compatible strings > > > > > which can > > > > > be specified directly from the DT. *Or* it's not an MFD. In > > > > > the > > > > > latter case, which I think we're all agreeing on (else we'd > > > > > have 2 > > > > > compatible strings), MFD is not the place to handle this (my > > > > > original > > > > > point). > > > > > > > > > > > > > If that is what bothers you, then let's move it out of mfd. > > > > > > As I've already mentioned. I don't just want it moved out of MFD > > > and > > > shoved somewhere else. My aim is to fix this properly. > > > > > > > If it is out of MFD, then I'm not sure why you would care too much > > about > > it as you won't be maintaining that code. And I still this what was > > done > > was correct but I'm open to test what you suggest. > > I care for the kernel in general, not just the areas I'm responsible > for. I guess I'm just that kinda guy! ;) Well, Lee, like you, I think this driver should not be a MFD driver, but Alex has a good point of view. > > > > > > So ... this is a USART device which can do SPI, right? > > > > > > > > > > My current thinking is that; as this is a USART device first > > > > > & > > > > > foremost, the USART should be probed in the first instance > > > > > regardless, > > > > > then if SPI mode is specified it (the USART driver) registers > > > > > the SPI > > > > > platform driver (as MFD does currently) and exits gracefully, > > > > > allowing > > > > > the SPI driver to take over. > > > > > > > > > > Spanner in the works: is it physically possible to change the > > > > > mode at > > > > > run-time? :s > > > > > > > > Yes it is possible but on Linux that will not happen without > > > > probing > > > > the drivers again. > > > > > > Not sure I understand what you mean. > > > > I was just commenting on changing the mode at runtime. > > Oh I see. My question was relating to whether the H/W is physically > capable of changing modes on-the-fly, rather than how Linux would > handle that. If this is something we'd wish to support, then it > would > have to be a single driver, which is why I was asking. By separating > the drivers this way, we are blocking that as a > possibility. Although > I guess the OP has already thought about that and made the decision > not to support it. Is possible to change modes on-the-fly, but you have no reason to do that. On the PCB you will have a SPI slave or a serial console :) Anyway, the current form of the driver, and through this I want to say "this ugly hack", allows the user to switch from serial to SPI mode by adding only one property to the device tree node of USART. If the driver were in his first form, a simple SPI driver, how you will make a dtsi file for an IP like this? You will add two nodes for the same IP in dtsi and will take care to enable correct node in dts? I think this driver is only a tradeoff between having an ugly hack in kernel or having an messy device tree. > > > > I'm suggesting that you use the same platform_* interfaces MFD > > > uses to > > > register the SPI driver if SPI mode has been selected. Only do > > > so > > > from the appropriate driver i.e. USART. > > > > Yeah, I understood that but I didn't comment because I'm not sure > > this > > will work yet. > > Other drivers already do this. Can you give me an example please? I am open to suggestions. Sorry for that acked-by. There was a lot of "reviewed-by", "acked-by", etc in a single version and I messed up :).