All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
To: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>,
	"amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org"
	<amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org"
	<tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Catalin Marinas <Catalin.Marinas-5wv7dgnIgG8@public.gmane.org>,
	Will Deacon <Will.Deacon-5wv7dgnIgG8@public.gmane.org>,
	"pwalmsley-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org"
	<pwalmsley-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Allen Martin <amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Pawel Moll <Pawel.Moll-5wv7dgnIgG8@public.gmane.org>,
	Ian Campbell
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	Alexandre Courbot
	<gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] arm64: dts: Add initial device tree support for Tegra132
Date: Fri, 23 Jan 2015 12:17:47 +0000	[thread overview]
Message-ID: <20150123121747.GI23493@leverpostej> (raw)
In-Reply-To: <20150123120355.GA15126-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>

On Fri, Jan 23, 2015 at 12:03:57PM +0000, Thierry Reding wrote:
> On Fri, Jan 23, 2015 at 11:44:24AM +0000, Mark Rutland wrote:
> > On Fri, Jan 23, 2015 at 11:31:24AM +0000, Paul Walmsley wrote:
> > > On Wed, 21 Jan 2015, Mark Rutland wrote:
> > > > On Fri, Jan 16, 2015 at 11:45:29AM +0000, Paul Walmsley wrote:
> [...]
> > > > > +
> > > > > +               clocks = <&tegra_car TEGRA124_CLK_PCIE>,
> > > > > +                        <&tegra_car TEGRA124_CLK_AFI>,
> > > > > +                        <&tegra_car TEGRA124_CLK_PLL_E>,
> > > > > +                        <&tegra_car TEGRA124_CLK_CML0>;
> > > > > +               clock-names = "pex", "afi", "pll_e", "cml";
> > > > > +               resets = <&tegra_car 70>,
> > > > > +                        <&tegra_car 72>,
> > > > > +                        <&tegra_car 74>;
> > > > > +               reset-names = "pex", "afi", "pcie_x";
> > > > > +               status = "disabled";
> > > > > +
> > > > > +               phys = <&xusb_padctl TEGRA_XUSB_PADCTL_PCIE>;
> > > > > +               phy-names = "pcie";
> > > > > +
> > > > > +               pci@1,0 {
> > > > > +                       device_type = "pci";
> > > > > +                       assigned-addresses = <0x82000800 0 0x01000000 0 0x1000>;
> > > > > +                       reg = <0x000800 0 0 0 0>;
> > > > > +                       status = "disabled";
> > > > > +
> > > > > +                       #address-cells = <3>;
> > > > > +                       #size-cells = <2>;
> > > > > +                       ranges;
> > > >
> > > > I'm not sure why these three properties are here. Surely this is a
> > > > separate address space (so isn't ranges invalid?), and do we define any
> > > > sub-nodes anywhere?
> > > 
> > > Hmm not sure.  This was originally copied from
> > > arch/arm/boot/dts/tegra124.dtsi.  Will plan to drop them for now, and then
> > > if the properties (or ones like them) turn out to be needed in the future,
> > > someone else can deal with it :-)
> > 
> > That sounds sane to me.
> 
> This follows the bindings defined almost two years ago. There was a lot
> of discussion back then and this is what we agreed upon. #address-cells
> and #size-cells are needed as per the PCI device tree bindings and the
> ranges property needed because the PCIe root ports translate addresses
> between the host bridge and the PCI endpoint devices.

Ok. That sounds a little surprising to me, but I am admittedly not
familiar with this binding and PCI more generally. I'll dig a bit
deeper.

> > > > > +       host1x@0,50000000 {
> > > > > +               compatible = "nvidia,tegra132-host1x", "nvidia,tegra124-host1x", "simple-bus";
> > > >
> > > > Regarding simple-bus, are the sub-nodes usable if this didn't probe as
> > > > "nvidia,tegra124-host1x" or "nvidia,tegra132-host1x"?
> > > > Do the subnodes require anything from this node?
> > > >
> > > > It looks like we expect/require the host1x node to be probed and
> > > > initialised before we probe the children. Which would imply the
> > > > simple-bus annotation is wrong.
> > > 
> > > Haven't tried booting with just simple-bus here.  I believe these devices
> > > are accessible without the involvement of host1x.  In other words, host1x
> > > is not a bus; I believe it might be most accurately described as a type of
> > > DMA controller.  So in theory it should be possible for the CPU complex to
> > > read and write to these devices directly without the involvement of
> > > host1x, although I believe NVIDIA discourages this.
> > > 
> > > Under the theory that DT data should be hardware-specific, not
> > > software-specific, in an ideal world I think we would list these devices
> > > outside the embrace of the host1x node.  However the existing Tegra124 DT
> > > file listed them together, and I am unsure whether that is required for
> > > the host1x code to function correctly.
> > >
> > > Arto may be able to comment further.
> > 
> > Hmm, It would be good to hear from someone familar with that then. I'll
> > wait for Arto.
> 
> We actually rely on the parent-child relationship in drivers, so we
> can't just go and reorganize things at will. This is documented in the
> existing binding for host1x, which again, was agreed upon a long time
> ago.
> 
> As for the simple-bus compatible, I think that was used way back to make
> sure of_platform_populate() gets called. I suppose we could drop it and
> call of_platform_populate() from the driver if its not there. The reason
> why we never considered cases where it would probe as simple-bus is that
> it was deemed unreasonable for a driver to bind to simple-bus.

Labelling something as simple-bus just to get an implicit
of_platform_populate is an abuse of simple-bus. If you have a driver for
handling the device as something more complex than a simple-bus, it
absolutely must do that probing itself (because there could be some
ordering requirement on re-initialisation of the bus).

If the sub-nodes don't make sense on their own, the "simple-bus" string
is not appropriate regardless.

One thing I've been hoping/trying to do for a while (with little success
so far) was to split simple-bus handling into a simple MMIO bus driver,
which exposes and/or blows up in cases like this.

> > > > > +       cpus {
> > > > > +               #address-cells = <2>;
> > > > > +               #size-cells = <0>;
> > > > > +
> > > > > +               cpu@0 {
> > > > > +                       device_type = "cpu";
> > > > > +                       compatible = "nvidia,denver", "arm,armv8";
> > > > > +                       reg = <0x0 0x0>;
> > > > > +                       enable-method = "spin-table";
> > > > > +                       cpu-release-addr = <0x0 0x80000008>;
> > > > > +               };
> > > > > +
> > > > > +               cpu@1 {
> > > > > +                       device_type = "cpu";
> > > > > +                       compatible = "nvidia,denver", "arm,armv8";
> > > > > +                       reg = <0x0 0x1>;
> > > > > +                       enable-method = "spin-table";
> > > > > +                       cpu-release-addr = <0x0 0x80000008>;
> > > > > +               };
> > > > > +       };
> > > >
> > > > It would be nice if this were near the top, as in other dts files.
> > > 
> > > OK will move.
> 
> Actually this follows the rules that we've been following with every DTS
> so far. Nodes with a unit address go first, sorted by unit address. They
> are followed by nodes without a unit address, sorted alphabetically.
> 
> I'd prefer keeping it this way for consistency across Tegra DTS files.

Ok.

I guess the ordering of this w.r.t. other nodes isn't too important.
While I find it surprising, at least it shouldn't cause issues in the
DTB itself.

However, it would be nice if we aligned all dts a bit better long-term.

Thanks,
Mark.

WARNING: multiple messages have this Message-ID (diff)
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: dts: Add initial device tree support for Tegra132
Date: Fri, 23 Jan 2015 12:17:47 +0000	[thread overview]
Message-ID: <20150123121747.GI23493@leverpostej> (raw)
In-Reply-To: <20150123120355.GA15126@ulmo.nvidia.com>

On Fri, Jan 23, 2015 at 12:03:57PM +0000, Thierry Reding wrote:
> On Fri, Jan 23, 2015 at 11:44:24AM +0000, Mark Rutland wrote:
> > On Fri, Jan 23, 2015 at 11:31:24AM +0000, Paul Walmsley wrote:
> > > On Wed, 21 Jan 2015, Mark Rutland wrote:
> > > > On Fri, Jan 16, 2015 at 11:45:29AM +0000, Paul Walmsley wrote:
> [...]
> > > > > +
> > > > > +               clocks = <&tegra_car TEGRA124_CLK_PCIE>,
> > > > > +                        <&tegra_car TEGRA124_CLK_AFI>,
> > > > > +                        <&tegra_car TEGRA124_CLK_PLL_E>,
> > > > > +                        <&tegra_car TEGRA124_CLK_CML0>;
> > > > > +               clock-names = "pex", "afi", "pll_e", "cml";
> > > > > +               resets = <&tegra_car 70>,
> > > > > +                        <&tegra_car 72>,
> > > > > +                        <&tegra_car 74>;
> > > > > +               reset-names = "pex", "afi", "pcie_x";
> > > > > +               status = "disabled";
> > > > > +
> > > > > +               phys = <&xusb_padctl TEGRA_XUSB_PADCTL_PCIE>;
> > > > > +               phy-names = "pcie";
> > > > > +
> > > > > +               pci at 1,0 {
> > > > > +                       device_type = "pci";
> > > > > +                       assigned-addresses = <0x82000800 0 0x01000000 0 0x1000>;
> > > > > +                       reg = <0x000800 0 0 0 0>;
> > > > > +                       status = "disabled";
> > > > > +
> > > > > +                       #address-cells = <3>;
> > > > > +                       #size-cells = <2>;
> > > > > +                       ranges;
> > > >
> > > > I'm not sure why these three properties are here. Surely this is a
> > > > separate address space (so isn't ranges invalid?), and do we define any
> > > > sub-nodes anywhere?
> > > 
> > > Hmm not sure.  This was originally copied from
> > > arch/arm/boot/dts/tegra124.dtsi.  Will plan to drop them for now, and then
> > > if the properties (or ones like them) turn out to be needed in the future,
> > > someone else can deal with it :-)
> > 
> > That sounds sane to me.
> 
> This follows the bindings defined almost two years ago. There was a lot
> of discussion back then and this is what we agreed upon. #address-cells
> and #size-cells are needed as per the PCI device tree bindings and the
> ranges property needed because the PCIe root ports translate addresses
> between the host bridge and the PCI endpoint devices.

Ok. That sounds a little surprising to me, but I am admittedly not
familiar with this binding and PCI more generally. I'll dig a bit
deeper.

> > > > > +       host1x at 0,50000000 {
> > > > > +               compatible = "nvidia,tegra132-host1x", "nvidia,tegra124-host1x", "simple-bus";
> > > >
> > > > Regarding simple-bus, are the sub-nodes usable if this didn't probe as
> > > > "nvidia,tegra124-host1x" or "nvidia,tegra132-host1x"?
> > > > Do the subnodes require anything from this node?
> > > >
> > > > It looks like we expect/require the host1x node to be probed and
> > > > initialised before we probe the children. Which would imply the
> > > > simple-bus annotation is wrong.
> > > 
> > > Haven't tried booting with just simple-bus here.  I believe these devices
> > > are accessible without the involvement of host1x.  In other words, host1x
> > > is not a bus; I believe it might be most accurately described as a type of
> > > DMA controller.  So in theory it should be possible for the CPU complex to
> > > read and write to these devices directly without the involvement of
> > > host1x, although I believe NVIDIA discourages this.
> > > 
> > > Under the theory that DT data should be hardware-specific, not
> > > software-specific, in an ideal world I think we would list these devices
> > > outside the embrace of the host1x node.  However the existing Tegra124 DT
> > > file listed them together, and I am unsure whether that is required for
> > > the host1x code to function correctly.
> > >
> > > Arto may be able to comment further.
> > 
> > Hmm, It would be good to hear from someone familar with that then. I'll
> > wait for Arto.
> 
> We actually rely on the parent-child relationship in drivers, so we
> can't just go and reorganize things at will. This is documented in the
> existing binding for host1x, which again, was agreed upon a long time
> ago.
> 
> As for the simple-bus compatible, I think that was used way back to make
> sure of_platform_populate() gets called. I suppose we could drop it and
> call of_platform_populate() from the driver if its not there. The reason
> why we never considered cases where it would probe as simple-bus is that
> it was deemed unreasonable for a driver to bind to simple-bus.

Labelling something as simple-bus just to get an implicit
of_platform_populate is an abuse of simple-bus. If you have a driver for
handling the device as something more complex than a simple-bus, it
absolutely must do that probing itself (because there could be some
ordering requirement on re-initialisation of the bus).

If the sub-nodes don't make sense on their own, the "simple-bus" string
is not appropriate regardless.

One thing I've been hoping/trying to do for a while (with little success
so far) was to split simple-bus handling into a simple MMIO bus driver,
which exposes and/or blows up in cases like this.

> > > > > +       cpus {
> > > > > +               #address-cells = <2>;
> > > > > +               #size-cells = <0>;
> > > > > +
> > > > > +               cpu at 0 {
> > > > > +                       device_type = "cpu";
> > > > > +                       compatible = "nvidia,denver", "arm,armv8";
> > > > > +                       reg = <0x0 0x0>;
> > > > > +                       enable-method = "spin-table";
> > > > > +                       cpu-release-addr = <0x0 0x80000008>;
> > > > > +               };
> > > > > +
> > > > > +               cpu at 1 {
> > > > > +                       device_type = "cpu";
> > > > > +                       compatible = "nvidia,denver", "arm,armv8";
> > > > > +                       reg = <0x0 0x1>;
> > > > > +                       enable-method = "spin-table";
> > > > > +                       cpu-release-addr = <0x0 0x80000008>;
> > > > > +               };
> > > > > +       };
> > > >
> > > > It would be nice if this were near the top, as in other dts files.
> > > 
> > > OK will move.
> 
> Actually this follows the rules that we've been following with every DTS
> so far. Nodes with a unit address go first, sorted by unit address. They
> are followed by nodes without a unit address, sorted alphabetically.
> 
> I'd prefer keeping it this way for consistency across Tegra DTS files.

Ok.

I guess the ordering of this w.r.t. other nodes isn't too important.
While I find it surprising, at least it shouldn't cause issues in the
DTB itself.

However, it would be nice if we aligned all dts a bit better long-term.

Thanks,
Mark.

  parent reply	other threads:[~2015-01-23 12:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16 11:45 [PATCH] arm64: dts: Add initial device tree support for Tegra132 Paul Walmsley
2015-01-16 11:45 ` Paul Walmsley
     [not found] ` <alpine.DEB.2.02.1501161139180.9776-rwI8Ez+7Ko+d5PgPZx9QOdBPR1lH4CV8@public.gmane.org>
2015-01-21 16:13   ` Mark Rutland
2015-01-21 16:13     ` Mark Rutland
2015-01-23 11:31     ` Paul Walmsley
2015-01-23 11:31       ` Paul Walmsley
     [not found]       ` <alpine.DEB.2.02.1501231038130.5450-rwI8Ez+7Ko+d5PgPZx9QOdBPR1lH4CV8@public.gmane.org>
2015-01-23 11:44         ` Mark Rutland
2015-01-23 11:44           ` Mark Rutland
2015-01-23 12:03           ` Thierry Reding
2015-01-23 12:03             ` Thierry Reding
     [not found]             ` <20150123120355.GA15126-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-01-23 12:17               ` Mark Rutland [this message]
2015-01-23 12:17                 ` Mark Rutland
2015-01-23 12:14         ` Arto Merilainen
2015-01-23 12:14           ` Arto Merilainen
     [not found]           ` <54C23B08.6070503-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-01-23 12:22             ` Mark Rutland
2015-01-23 12:22               ` Mark Rutland
2015-01-23 16:57         ` Stephen Warren
2015-01-23 16:57           ` Stephen Warren
     [not found]           ` <54C27D6F.9000006-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-01-23 17:34             ` Mark Rutland
2015-01-23 17:34               ` Mark Rutland
2015-01-23 17:47               ` Stephen Warren
2015-01-23 17:47                 ` Stephen Warren

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=20150123121747.GI23493@leverpostej \
    --to=mark.rutland-5wv7dgnigg8@public.gmane.org \
    --cc=Catalin.Marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=Pawel.Moll-5wv7dgnIgG8@public.gmane.org \
    --cc=Will.Deacon-5wv7dgnIgG8@public.gmane.org \
    --cc=amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org \
    --cc=pwalmsley-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=tbergstrom-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.