linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: "Dr. H. Nikolaus Schaller" <hns@goldelico.com>
Cc: Peter Hurley <peter@hurleysoftware.com>,
	Pavel Machek <pavel@ucw.cz>,
	List for communicating with real GTA04 owners 
	<gta04-owner@goldelico.com>, NeilBrown <neil@brown.name>,
	One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sebastian Reichel <sre@kernel.org>,
	"grant.likely@linaro.org" <grant.likely@linaro.org>,
	Jiri Slaby <jslaby@suse.cz>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Gta04-owner] [PATCH 0/3] tty slave device support - version 3.
Date: Wed, 6 May 2015 18:18:02 +0100	[thread overview]
Message-ID: <20150506171802.GE2974@leverpostej> (raw)
In-Reply-To: <EA4AC398-CAEA-40E1-A998-BC528B3788E1@goldelico.com>

On Wed, May 06, 2015 at 05:09:20PM +0100, Dr. H. Nikolaus Schaller wrote:
> Hi Mark,
> 
> Am 06.05.2015 um 16:15 schrieb Mark Rutland <mark.rutland@arm.com>:
> 
> >>>>>> No, I am not playing devil’s advocate (which would imply that I am doing this
> >>>>>> for fun to tease the dog), but I feel I have to be the advocate of future board
> >>>>>> designers who want to easily import an existing board DT and overwrite device
> >>>>>> tree nodes to describe design changes, i.e. what slave device is connected to
> >>>>>> which uart.
> > 
> > [...]
> > 
> >>> If this happens, you can move the slave device into a fragment that you
> >>> can include under the correct node. That's trivial.
> >> 
> >> But less readable. And that is important as well.
> > 
> > I disagree. The manipulation you have to perform to override properties
> > is at least as bad as including a file.
> 
> What about:
> 
> #include "omap3-beagle-xm.dts"
> 
> / {
> 	/* HS USB Port 2 Power enable was inverted with the xM C */
> 	hsusb2_power: hsusb2_power_reg {
> 		enable-active-high;
> 	};
> };
> 
> compared to 
> 
> #include “board1.dts”
> 
> / {
> 	/* slave was reconnected to uart4 */
> 	slave {
> 		uart = <&uart4>;
> 	};
> };

As I mentioned, you can easily carve up your DTS to make that work with
includes if you really must:

/* UART0 board variant */
#include "board.dtsi"
&uart0 {
	#include "some-uart-slave.dtsi"
};

/* UART1 board variant */
#include "board.dtsi"
&uart1 {
	#include "some-uart-slave.dtsi"
};

If you happen to find includes ugly then you can say it's ugly, but it's
functionally equivalent, and also means you can avoid having
disabled/partial nodes all over the place.

If you really wanted you could macro the label instead and have the
slaved node in full.

[...]

> > As Neil mentioned earlier, ignore "bus". Here we're caring about a 1-1
> > connection between master (UART) and slave (device), and it happens that
> > in most other cases the master is actually a bus, so that's how things
> > happen to be named.
> 
> So you also mean that all master-slave connections must be represented
> by DT subnodes and everything else is not acceptable?
> 
> What about:
> 
> 	sound {
> 		compatible = "ti,omap-twl4030";
> 		ti,model = "omap3beagle";
> 
> 		ti,mcbsp = <&mcbsp2>;
> 	};
> 
> Isn’t McBSP a “bus” with your definition as well? Like a “master”. And the “twl4030”
> is the slave (codec)?

I'm nowhere near familiar enough with the audio hardware nor their
bindings to comment on that, I'm afraid. My rough understanding was that
the twl4030 node here was referring to the logical subsystem as a whole,
with the mcbsp being a physical component, but that's almost certainly
somewhat wrong.

> &usb_otg_hs {
> 	interface-type = <0>;
> 	usb-phy = <&usb2_phy>;
> 	phys = <&usb2_phy>;
> 	phy-names = "usb2-phy";
> 	mode = <3>;
> 	power = <50>;
> };
> 
> Isn’t a PHY interface (e.g. ULPI-PHY) a “slave” connected to a 12 wire ULPI “bus” as well?

Not necessarily. If you took a look at the bindings you'd notice that
many PHYs have MMIO interfaces for configuration which we have to poke.
Those MMIO interfaces live on an MMIO bus so we describe those and link
to the phy by phandle reference.

A given device could operate as a PHY to multiple controllers, hence
phy-cells, and hence in general a PHY cannot be considered a slave
device.

> At least in this two areas everything done so far appears to contradict your argument.

Not really. You've found bindings with a different idiom, but those seem
to be organised as they are for reasons which don't appear to apply to
UART slave devices as you describe them.

> This is for me the blueprint how it should be done for UART slaves like any point-to-point
> multi-wire interfaces (question not even discussed: does UART-to-UART have clear master
> and slave roles? Isn’t the connected device the “master”? but I don’t want to broaden the
> discussion again).
> 
> This is basically why I keep this discussion open, because it is not that obvious
> that Neil’s proposal is right and mine is wrong.
> 
> > 
> >>> for other
> >>> interfaces like SPI and I2C. I do not see a compelling reason to do
> >>> otherwise for devices

[...]

> >>> hanging off of UARTs -- doing so would make things
> >>> less straightforward because you have a fundamentally different idiom.
> >> 
> >> Yes, my proposal is fundamentally different from I2C and SPI practice, but
> >> it is the same that is heavily used for e.g. GPIOs and Regulators.
> > 
> > Well, those cases are somewhat distinct, and I'd say that UART slaves
> > are much closer to SPI/I2C devices than GPIOs or regulators.
> 
> As shown above they are IMHO closer to McBSP and ULPI-PHY (and some
> other interfaces).

As above, I disagree.

> > Let's say I have a GPIO described via a phandle. That GPIO is actually
> > owned by some GPIO controller whose control interface is sat on an MMIO
> > bus. What we're describing with the phandle is use of the GPIO, but not
> > the main interface for interactive with the GPIO, which is the MMIO
> > interface of the controller.
> 
> Right. For the UART we do the same: the UART controller is connected
> to the MMIO and (in my proposal) the phandle describes the use of the UART
> (to connect to some slave device). Exactly the same situation.

Except that your fundamental interface to the device is via the UART,
which is not typically the case for things like regulators and/or GPIOs.
If I want a regulator to do something, I ask it to do so via the
controller's MMIO interface. If you want the device to do something, you
ask it to do so via the UART. 

> > In the case of UART slave devices the control interface is attached to
> > the UART, and effectively the slave sits on the UART's "bus". We could
> > refer to it from elsewhere by phandle, but its canonical parent should
> > be the UART, as that’s what its main interface is attached to.
> 
> What is the “main interface” of some device? Why should it have a special
> role in DT? I have doubts that it is useful to declare some interface as “main”,
> unless it is a MMIO bus connection.
> 
> There are e.g. chips with multi-interfaces like a twl4030. They have 2 I2C busses, 2 PCM
> “busses”, an ULIP-PHY and some GPIOs.

I think that would already be covered as an I2C device with two I2C IDs,
much like we would cater for an MMIO-interfaced PHY with two MMIO
control register regions

> Or some 3G/4G modems which have
> USB, UART (both useable for AT commands in parallel!), PCM and some GPIOs.

Of these I would expect that the USB or UART inerfaces would be the main
ones, though I would expect that we'd require two separate nodes which
we would have to link up.

> Which interface is “main”? For the twl4030 it happens that one of the I2C interfaces
> is chosen (because it allows to access the registers inside the chip).

Because it happens to be the "main" interface ;)

> Now you might say: yes, the registers of some uart connected device can
> be accessed through the uart as well. But usually there is a higher level
> protocol (AT commands) that give some sort of “register addressing”. But
> that is a different level than using I2C to access e.g. the gpio controller in the twl4030.
> 
> I just want to say that requiring and focussing on a “main” interface of a peripheral
> chip may lead to troubles.

I don't disagree that it falls apart in some cases. However, that's not
the general case, and it applies to other interface types too, so I
don't think it should matter in the context of this discussions.

> >> From my DT designer PoV I would say the UART exists in some SoC
> >> (independently of a device being connected) and then, a device is connected
> >> to the UART. Hence the proposal of adding this connection link to the device’s
> >> node and not making the device a subnode. And having the device driver do
> >> power management and only ask the uart/tty driver to be notified about open()
> >> and close() events. How power is managed in detail is then not any part of the
> >> tty/serial drivers.
> > 
> > The way that the power management interfaces are organised within Linux
> > is orthogonal to the way we describe things in the DT.
> 
> Agreed. And therefore power management registration, notifications etc.
> are to be hidden by the drivers and should not be an argument to say “with
> subnodes it is easier to implement and probing is done in the right order”.

While generally we shouldn't treat OS internals as an argument for DT
organisation, laying things out in a sensible manner for
discoverabilitiy is somewhat different from stating that the run-time
use of a device is fundamentally tied to its description in the DT.

We _could_ list all nodes in a flat list with cross references instead
of having a tree. But it would be horrible for _any_ OS to deal with, so
we don't do that.

Thanks,
Mark.

  reply	other threads:[~2015-05-06 17:18 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  5:58 [PATCH 0/3] tty slave device support - version 3 NeilBrown
2015-03-18  5:58 ` [PATCH 2/3] TTY: add support for tty_slave devices NeilBrown
2015-03-18  9:11   ` Paul Bolle
2015-03-22  3:32     ` NeilBrown
2015-03-20 19:41   ` Pavel Machek
2015-03-22  3:42     ` [Gta04-owner] " NeilBrown
2015-03-22  7:58       ` Pavel Machek
2015-03-24 10:31   ` Jiri Slaby
2015-03-30 23:45     ` NeilBrown
2015-03-25 16:30   ` Peter Hurley
2015-03-25 21:17     ` [Gta04-owner] " NeilBrown
2015-03-27 11:09       ` Peter Hurley
2015-03-31  0:33         ` NeilBrown
2015-03-18  5:58 ` [PATCH 3/3] tty/slaves: add a driver to power on/off UART attached devices NeilBrown
2015-03-20  7:54   ` [Gta04-owner] " Dr. H. Nikolaus Schaller
2015-03-20  8:54     ` NeilBrown
2015-03-20  9:34       ` Dr. H. Nikolaus Schaller
2015-03-20 19:50         ` Pavel Machek
2015-03-20 23:31         ` NeilBrown
2015-03-24 17:58           ` Dr. H. Nikolaus Schaller
2015-03-25  1:45             ` Sebastian Reichel
2015-03-25  7:59               ` Dr. H. Nikolaus Schaller
2015-03-25 15:21                 ` Sebastian Reichel
2015-03-25 16:44                   ` Dr. H. Nikolaus Schaller
2015-03-26 18:08                     ` Sebastian Reichel
2015-03-27  9:22                       ` Dr. H. Nikolaus Schaller
2015-03-27 16:31                         ` Sebastian Reichel
2015-03-27 17:11                           ` Dr. H. Nikolaus Schaller
2015-04-27 20:35                             ` Pavel Machek
2015-04-29  6:56                               ` Dr. H. Nikolaus Schaller
2015-03-25 20:53                 ` Pavel Machek
2015-03-25 21:25                   ` Dr. H. Nikolaus Schaller
2015-03-26  5:56                     ` Pavel Machek
2015-03-26  6:44                       ` Dr. H. Nikolaus Schaller
2015-04-04  7:52                         ` Pavel Machek
2015-03-25 20:42             ` Pavel Machek
2015-03-25 21:22               ` Dr. H. Nikolaus Schaller
2015-03-18  5:58 ` [PATCH 1/3] TTY: use class_find_device to find port in uart_suspend/resume NeilBrown
2015-03-25 16:20   ` Peter Hurley
2015-03-29 21:49     ` [Gta04-owner] " NeilBrown
2015-03-20  7:54 ` [Gta04-owner] [PATCH 0/3] tty slave device support - version 3 Dr. H. Nikolaus Schaller
2015-03-20  8:43   ` NeilBrown
2015-03-20  8:54     ` Dr. H. Nikolaus Schaller
2015-03-20 13:08       ` Sebastian Reichel
2015-03-20 13:57         ` Dr. H. Nikolaus Schaller
2015-03-20 17:14           ` Sebastian Reichel
2015-03-20 19:31 ` Pavel Machek
2015-05-05 19:54 ` Peter Hurley
2015-05-05 20:46   ` NeilBrown
2015-05-06  5:19   ` [Gta04-owner] " Dr. H. Nikolaus Schaller
2015-05-06  9:27     ` Pavel Machek
2015-05-06 11:50       ` Dr. H. Nikolaus Schaller
2015-05-06 12:05         ` Peter Hurley
2015-05-06 12:27           ` Dr. H. Nikolaus Schaller
2015-05-06 12:36             ` Mark Rutland
2015-05-06 13:28               ` Dr. H. Nikolaus Schaller
2015-05-06 14:15                 ` Mark Rutland
2015-05-06 16:09                   ` Dr. H. Nikolaus Schaller
2015-05-06 17:18                     ` Mark Rutland [this message]
2015-05-07 12:46                       ` Dr. H. Nikolaus Schaller
2015-05-07 14:30                         ` Peter Hurley
2015-05-07 15:11                           ` Dr. H. Nikolaus Schaller
2015-05-07 16:18                             ` Peter Hurley
2015-05-07 16:57                               ` Dr. H. Nikolaus Schaller
2015-05-07 14:56                         ` Peter Hurley
2015-05-07 15:34                           ` Dr. H. Nikolaus Schaller
2015-05-07 15:51                             ` Peter Hurley
2015-05-07 16:46                               ` Dr. H. Nikolaus Schaller
2015-05-13  8:09                                 ` Dr. H. Nikolaus Schaller
2015-06-03 11:49                                   ` [PATCH RFC 0/3] UART slave device support Dr. H. Nikolaus Schaller
2015-06-06 13:09                                     ` Pavel Machek
     [not found]                                   ` <463356C5-E3C6-432C-A1C5-71F0287F1FEE@goldelico.com>
2015-06-03 12:09                                     ` [Gta04-owner] [PATCH RFC 3/3] misc: Add w2g0004 gps receiver driver Christ van Willegen
2015-05-07 15:37                 ` [Gta04-owner] [PATCH 0/3] tty slave device support - version 3 Peter Hurley
2015-05-06 14:28         ` Pavel Machek
2015-05-06 16:12           ` Dr. H. Nikolaus Schaller
2015-06-06 13:09             ` Pavel Machek
2015-06-06 18:53               ` Belisko Marek
2015-06-06 18:55                 ` Belisko Marek
2015-05-06 11:10     ` Peter Hurley
2015-05-07 15:48     ` Rob Herring

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=20150506171802.GE2974@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gta04-owner@goldelico.com \
    --cc=hns@goldelico.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=pavel@ucw.cz \
    --cc=peter@hurleysoftware.com \
    --cc=sre@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).