linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Lee Jones <lee.jones@linaro.org>,
	radu_nicolae.pirea@upb.ro, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Mark Brown <broonie@kernel.org>, Jiri Slaby <jslaby@suse.com>,
	Richard Genoud <richard.genoud@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
	<devicetree@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>,
	linux-spi <linux-spi@
Subject: Re: [PATCH v12 0/6] Driver for at91 usart in spi mode
Date: Tue, 11 Sep 2018 17:36:21 +0200	[thread overview]
Message-ID: <20180911153621.GP2494@piout.net> (raw)
In-Reply-To: <CAMuHMdXH8gNjKGOHGFc+K03U2zsVCSN7G_Q4wtepQr859nRQKg@mail.gmail.com>

On 11/09/2018 16:59:09+0200, Geert Uytterhoeven wrote:
> Hi Alexandre,
> 
> On Tue, Sep 11, 2018 at 11:40 AM Alexandre Belloni
> <alexandre.belloni@bootlin.com> wrote:
> > On 11/09/2018 10:33:56+0100, Lee Jones wrote:
> > > On Tue, 04 Sep 2018, Radu Pirea wrote:
> > > > Radu Pirea (6):
> > > >   MAINTAINERS: add at91 usart mfd driver
> > > >   dt-bindings: add binding for atmel-usart in SPI mode
> > > >   mfd: at91-usart: added mfd driver for usart
> > > >   MAINTAINERS: add at91 usart spi driver
> > > >   spi: at91-usart: add driver for at91-usart as spi
> > > >   tty/serial: atmel: change the driver to work under at91-usart mfd
> > > >
> > > >  .../bindings/{serial => mfd}/atmel-usart.txt  |  25 +-
> > > >  MAINTAINERS                                   |  16 +
> > > >  drivers/mfd/Kconfig                           |   9 +
> > > >  drivers/mfd/Makefile                          |   1 +
> > > >  drivers/mfd/at91-usart.c                      |  71 +++
> > > >  drivers/spi/Kconfig                           |   8 +
> > > >  drivers/spi/Makefile                          |   1 +
> > > >  drivers/spi/spi-at91-usart.c                  | 432 ++++++++++++++++++
> > > >  drivers/tty/serial/Kconfig                    |   1 +
> > > >  drivers/tty/serial/atmel_serial.c             |  42 +-
> > > >  include/dt-bindings/mfd/at91-usart.h          |  17 +
> > > >  11 files changed, 606 insertions(+), 17 deletions(-)
> > > >  rename Documentation/devicetree/bindings/{serial => mfd}/atmel-usart.txt (76%)
> > > >  create mode 100644 drivers/mfd/at91-usart.c
> > > >  create mode 100644 drivers/spi/spi-at91-usart.c
> > > >  create mode 100644 include/dt-bindings/mfd/at91-usart.h
> > >
> > > Seeing as this patch-set has caused some issues this morning, I took
> > > the liberty to peruse back into its history to figure out where things
> > > started to go wrong.  I also re-reviewed the MFD driver - and I'm glad
> > > I did!
> > >
> > > My Acked-by has been attached to the MFD portion since v5, which is
> > > why the code hasn't caught my eye before today.  I reviewed the
> > > relocation of the *binding document* (serial => mfd with no changes)
> > > in v4 and nothing else.  It appears as though you mistakenly added it
> > > to the *MFD driver* instead.  This explains my confusion in v10 when I
> > > told you I'd already reviewed the binding document.
> > >
> > > As I said, I have re-reviewed the MFD driver and I'm afraid to say
> > > that I do not like what I see.  Besides the missing header file and
> > > the whitespace tabbing errors, I do not agree with the implementation.
> > > Using MFD as a shim to hack around driver selection is not a valid
> > > use-case.
> > >
> > > What's stopping you from just using the compatible string directly to
> > > select which driver you need to probe?
> > >
> >
> > Then you'd have multiple compatible strings for the same IP which is a
> > big no-no.
> 
> It's still the same hardware device, isn't?
> What if the SPI or UART slave is not on-board, but on an expansion board?
> Then the SoC-specific .dtsi has no idea what mode should be used.
> 
> Hence shouldn't the software derive the hardware mode from the full
> hardware description in DT? If that's impossible (I didn't look into detail
> whether an SPI bus can easily be distinguished from a UART bus), perhaps
> a mode property should be added?
> 

Yes, this is exactly what is done:

https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git/tree/drivers/mfd/at91-usart.c?h=ib-mfd-spi-tty-4.20-1#n33

Only one compatbile for the IP and a property to know what is the mode.
That property should indeed be set in the board dts and not the SoC
dtsi.

the other, less robust alternative was to look for child nodes and
decide that if some where present it would indicate an SPI bus. But I
think at some point we may have child nodes under a UART node.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-09-11 15:36 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-04 11:13 [PATCH v12 0/6] Driver for at91 usart in spi mode Radu Pirea
2018-09-04 11:13 ` [PATCH v12 1/6] MAINTAINERS: add at91 usart mfd driver Radu Pirea
2018-09-04 11:13 ` [PATCH v12 2/6] dt-bindings: add binding for atmel-usart in SPI mode Radu Pirea
2018-09-04 11:13 ` [PATCH v12 3/6] mfd: at91-usart: added mfd driver for usart Radu Pirea
2018-09-04 11:13 ` [PATCH v12 4/6] MAINTAINERS: add at91 usart spi driver Radu Pirea
2018-09-04 11:13 ` [PATCH v12 5/6] spi: at91-usart: add driver for at91-usart as spi Radu Pirea
2018-09-04 11:13 ` [PATCH v12 6/6] tty/serial: atmel: change the driver to work under at91-usart mfd Radu Pirea
2018-09-10  9:48 ` [PATCH v12 0/6] Driver for at91 usart in spi mode Lee Jones
2018-09-10  9:51   ` Nicolas Ferre
2018-09-10 13:43     ` Lee Jones
2018-09-11  9:33 ` Lee Jones
2018-09-11  9:39   ` Alexandre Belloni
2018-09-11 14:59     ` Geert Uytterhoeven
2018-09-11 15:36       ` Alexandre Belloni [this message]
2018-09-11 16:23         ` Geert Uytterhoeven
2018-09-11 18:39           ` Lee Jones
2018-09-11 18:58             ` Alexandre Belloni
2018-09-11 19:04               ` Geert Uytterhoeven
2018-09-11 22:44               ` Lee Jones
2018-09-11 22:54                 ` Lee Jones
2018-09-12  7:33                   ` Alexandre Belloni
2018-09-12  8:41                     ` Lee Jones
2018-09-12  9:43                       ` Geert Uytterhoeven
2018-09-12 10:54                         ` Lee Jones
2018-09-12 11:17                           ` Alexandre Belloni
2018-09-12 11:43                             ` Lee Jones
2018-09-12 12:14                               ` Alexandre Belloni
2018-09-12 13:12                                 ` Lee Jones
2018-09-12 19:36                                   ` Radu Pirea
2018-10-09  9:04                                     ` Lee Jones
2018-09-11 18:59             ` Geert Uytterhoeven
2018-09-11 22:43               ` Lee Jones
2018-09-12  7:30                 ` Alexandre Belloni
2018-09-12  8:36                   ` Lee Jones
2018-09-11 11:18 ` [GIT PULL v2] Immutable branch between MFD, SPI and TTY due for the v4.20 merge window Lee Jones
2018-09-11 14:04   ` Greg KH
2018-09-11 14:07     ` Lee Jones
2018-09-11 14:12       ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180911153621.GP2494@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mchehab+samsung@kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=radu_nicolae.pirea@upb.ro \
    --cc=richard.genoud@gmail.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).