diff mbox

arm64: dts: rockchip: add spiX aliases for rk3399

Message ID 1468545873-134339-1-git-send-email-briannorris@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Brian Norris July 15, 2016, 1:24 a.m. UTC
It's nicer to see this:

    # ls -l /sys/bus/spi/devices/
    total 0
    lrwxrwxrwx 1 root root 0 Dec 31  1969 spi0.0 -> ../../../devices/platform/ff1c0000.spi/spi_master/spi0/spi0.0
    lrwxrwxrwx 1 root root 0 Dec 31  1969 spi1.0 -> ../../../devices/platform/ff1d0000.spi/spi_master/spi1/spi1.0
    lrwxrwxrwx 1 root root 0 Dec 31  1969 spi2.0 -> ../../../devices/platform/ff1e0000.spi/spi_master/spi2/spi2.0
    lrwxrwxrwx 1 root root 0 Dec 31  1969 spi5.0 -> ../../../devices/platform/ff200000.spi/spi_master/spi5/spi5.0

than this:

    # ls -l /sys/bus/spi/devices/
    total 0
    lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32763.0 -> ../../../devices/platform/ff200000.spi/spi_master/spi32763/spi32763.0
    lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32764.0 -> ../../../devices/platform/ff1e0000.spi/spi_master/spi32764/spi32764.0
    lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32765.0 -> ../../../devices/platform/ff1d0000.spi/spi_master/spi32765/spi32765.0
    lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32766.0 -> ../../../devices/platform/ff1c0000.spi/spi_master/spi32766/spi32766.0

With the latter, it's much clearer which bus devices are on.

Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Heiko Stübner July 18, 2016, 8:50 p.m. UTC | #1
Am Donnerstag, 14. Juli 2016, 18:24:33 schrieb Brian Norris:
> It's nicer to see this:
> 
>     # ls -l /sys/bus/spi/devices/
>     total 0
>     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi0.0 ->
> ../../../devices/platform/ff1c0000.spi/spi_master/spi0/spi0.0 lrwxrwxrwx 1
> root root 0 Dec 31  1969 spi1.0 ->
> ../../../devices/platform/ff1d0000.spi/spi_master/spi1/spi1.0 lrwxrwxrwx 1
> root root 0 Dec 31  1969 spi2.0 ->
> ../../../devices/platform/ff1e0000.spi/spi_master/spi2/spi2.0 lrwxrwxrwx 1
> root root 0 Dec 31  1969 spi5.0 ->
> ../../../devices/platform/ff200000.spi/spi_master/spi5/spi5.0
> 
> than this:
> 
>     # ls -l /sys/bus/spi/devices/
>     total 0
>     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32763.0 ->
> ../../../devices/platform/ff200000.spi/spi_master/spi32763/spi32763.0
> lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32764.0 ->
> ../../../devices/platform/ff1e0000.spi/spi_master/spi32764/spi32764.0
> lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32765.0 ->
> ../../../devices/platform/ff1d0000.spi/spi_master/spi32765/spi32765.0
> lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32766.0 ->
> ../../../devices/platform/ff1c0000.spi/spi_master/spi32766/spi32766.0
> 
> With the latter, it's much clearer which bus devices are on.
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>

applied for 4.9

Thanks
Heiko
Uwe Kleine-König July 19, 2016, 6:39 a.m. UTC | #2
Hello,

On Thu, Jul 14, 2016 at 06:24:33PM -0700, Brian Norris wrote:
> It's nicer to see this:
> 
>     # ls -l /sys/bus/spi/devices/
>     total 0
>     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi0.0 -> ../../../devices/platform/ff1c0000.spi/spi_master/spi0/spi0.0
>     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi1.0 -> ../../../devices/platform/ff1d0000.spi/spi_master/spi1/spi1.0
>     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi2.0 -> ../../../devices/platform/ff1e0000.spi/spi_master/spi2/spi2.0
>     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi5.0 -> ../../../devices/platform/ff200000.spi/spi_master/spi5/spi5.0
> 
> than this:
> 
>     # ls -l /sys/bus/spi/devices/
>     total 0
>     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32763.0 -> ../../../devices/platform/ff200000.spi/spi_master/spi32763/spi32763.0
>     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32764.0 -> ../../../devices/platform/ff1e0000.spi/spi_master/spi32764/spi32764.0
>     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32765.0 -> ../../../devices/platform/ff1d0000.spi/spi_master/spi32765/spi32765.0
>     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32766.0 -> ../../../devices/platform/ff1c0000.spi/spi_master/spi32766/spi32766.0
> 
> With the latter, it's much clearer which bus devices are on.
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---
>  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> index 4c84229789ef..b04abbfd4898 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> @@ -70,6 +70,12 @@
>  		serial2 = &uart2;
>  		serial3 = &uart3;
>  		serial4 = &uart4;
> +		spi0 = &spi0;
> +		spi1 = &spi1;
> +		spi2 = &spi2;
> +		spi3 = &spi3;
> +		spi4 = &spi4;
> +		spi5 = &spi5;

Note that Rob Herring (with his dt-maintainer hat on) doesn't like these
aliases.
See for example:
	http://mid.gmane.org/20160705140546.GA10601@rob-hp-laptop

Best regards
Uwe
Heiko Stübner July 19, 2016, 6:56 p.m. UTC | #3
Hi Uwe,

Am Dienstag, 19. Juli 2016, 08:39:55 schrieb Uwe Kleine-König:
> On Thu, Jul 14, 2016 at 06:24:33PM -0700, Brian Norris wrote:
> > It's nicer to see this:
> >     # ls -l /sys/bus/spi/devices/
> >     total 0
> >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi0.0 ->
> >     ../../../devices/platform/ff1c0000.spi/spi_master/spi0/spi0.0
> >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi1.0 ->
> >     ../../../devices/platform/ff1d0000.spi/spi_master/spi1/spi1.0
> >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi2.0 ->
> >     ../../../devices/platform/ff1e0000.spi/spi_master/spi2/spi2.0
> >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi5.0 ->
> >     ../../../devices/platform/ff200000.spi/spi_master/spi5/spi5.0> 
> > than this:
> >     # ls -l /sys/bus/spi/devices/
> >     total 0
> >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32763.0 ->
> >     ../../../devices/platform/ff200000.spi/spi_master/spi32763/spi32763.0
> >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32764.0 ->
> >     ../../../devices/platform/ff1e0000.spi/spi_master/spi32764/spi32764.0
> >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32765.0 ->
> >     ../../../devices/platform/ff1d0000.spi/spi_master/spi32765/spi32765.0
> >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32766.0 ->
> >     ../../../devices/platform/ff1c0000.spi/spi_master/spi32766/spi32766.0> 
> > With the latter, it's much clearer which bus devices are on.
> > 
> > Signed-off-by: Brian Norris <briannorris@chromium.org>
> > ---
> > 
> >  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index
> > 4c84229789ef..b04abbfd4898 100644
> > --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > @@ -70,6 +70,12 @@
> > 
> >  		serial2 = &uart2;
> >  		serial3 = &uart3;
> >  		serial4 = &uart4;
> > 
> > +		spi0 = &spi0;
> > +		spi1 = &spi1;
> > +		spi2 = &spi2;
> > +		spi3 = &spi3;
> > +		spi4 = &spi4;
> > +		spi5 = &spi5;
> 
> Note that Rob Herring (with his dt-maintainer hat on) doesn't like these
> aliases.
> See for example:
> 	http://mid.gmane.org/20160705140546.GA10601@rob-hp-laptop

thanks for the heads up on this. I've dropped this patch again.


Thanks
Heiko
Brian Norris July 19, 2016, 7:27 p.m. UTC | #4
+ Rob

Hi,

On Tue, Jul 19, 2016 at 08:56:47PM +0200, Heiko Stuebner wrote:
> Am Dienstag, 19. Juli 2016, 08:39:55 schrieb Uwe Kleine-König:
> > On Thu, Jul 14, 2016 at 06:24:33PM -0700, Brian Norris wrote:
> > > It's nicer to see this:
> > >     # ls -l /sys/bus/spi/devices/
> > >     total 0
> > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi0.0 ->
> > >     ../../../devices/platform/ff1c0000.spi/spi_master/spi0/spi0.0
> > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi1.0 ->
> > >     ../../../devices/platform/ff1d0000.spi/spi_master/spi1/spi1.0
> > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi2.0 ->
> > >     ../../../devices/platform/ff1e0000.spi/spi_master/spi2/spi2.0
> > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi5.0 ->
> > >     ../../../devices/platform/ff200000.spi/spi_master/spi5/spi5.0> 
> > > than this:
> > >     # ls -l /sys/bus/spi/devices/
> > >     total 0
> > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32763.0 ->
> > >     ../../../devices/platform/ff200000.spi/spi_master/spi32763/spi32763.0
> > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32764.0 ->
> > >     ../../../devices/platform/ff1e0000.spi/spi_master/spi32764/spi32764.0
> > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32765.0 ->
> > >     ../../../devices/platform/ff1d0000.spi/spi_master/spi32765/spi32765.0
> > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32766.0 ->
> > >     ../../../devices/platform/ff1c0000.spi/spi_master/spi32766/spi32766.0> 
> > > With the latter, it's much clearer which bus devices are on.
> > > 
> > > Signed-off-by: Brian Norris <briannorris@chromium.org>
> > > ---
> > > 
> > >  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index
> > > 4c84229789ef..b04abbfd4898 100644
> > > --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > @@ -70,6 +70,12 @@
> > > 
> > >  		serial2 = &uart2;
> > >  		serial3 = &uart3;
> > >  		serial4 = &uart4;
> > > 
> > > +		spi0 = &spi0;
> > > +		spi1 = &spi1;
> > > +		spi2 = &spi2;
> > > +		spi3 = &spi3;
> > > +		spi4 = &spi4;
> > > +		spi5 = &spi5;
> > 
> > Note that Rob Herring (with his dt-maintainer hat on) doesn't like these
> > aliases.
> > See for example:
> > 	http://mid.gmane.org/20160705140546.GA10601@rob-hp-laptop

But why? I believe half the arguments in the linked thread were
Catch-22's -- there were no "mainline" users (which is a false target
IMO anyway, as Christer Weinigel mentioned somewhere in the thread Rob
linked), and so we couldn't accept more documentation (or users) for the
feature. FWIW, my quick grep now shows there are currently 43 mainline
users.

This feature is very useful. Some of the thread Rob pointed to argued
that the indexing isn't HW documentation; in this case, it most
certainly is. The RK3399 TRM explicitly has these SPI buses named SPI0,
SPI1, SPI2, SPI3, SPI4, and SPI5, and schematics that I've seen use the
same terminology. It is therefore *much* nicer to have my device show up
as 'spi2.0' (reflecting their correct HW name) rather than spi32764.0.
Sometimes I can't even get as far as mounting sysfs to check what this
maps to, but having spi2.0 in the kernel log can clearly tell me what
device is causing problems.

If Rob can support a better alternative solution, I'd be happy to
switch. But I don't understand why we can't use a useful (not just to
me, but presumably to at least 43 other independent users, and many
more out of tree), existing, and long-supported feature here.

> thanks for the heads up on this. I've dropped this patch again.

:(

Regards,
Brian
Brian Norris July 19, 2016, 7:29 p.m. UTC | #5
On Tue, Jul 19, 2016 at 12:27:54PM -0700, Brian Norris wrote:
> + Rob

+ Rob for real

> Hi,
> 
> On Tue, Jul 19, 2016 at 08:56:47PM +0200, Heiko Stuebner wrote:
> > Am Dienstag, 19. Juli 2016, 08:39:55 schrieb Uwe Kleine-König:
> > > On Thu, Jul 14, 2016 at 06:24:33PM -0700, Brian Norris wrote:
> > > > It's nicer to see this:
> > > >     # ls -l /sys/bus/spi/devices/
> > > >     total 0
> > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi0.0 ->
> > > >     ../../../devices/platform/ff1c0000.spi/spi_master/spi0/spi0.0
> > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi1.0 ->
> > > >     ../../../devices/platform/ff1d0000.spi/spi_master/spi1/spi1.0
> > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi2.0 ->
> > > >     ../../../devices/platform/ff1e0000.spi/spi_master/spi2/spi2.0
> > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi5.0 ->
> > > >     ../../../devices/platform/ff200000.spi/spi_master/spi5/spi5.0> 
> > > > than this:
> > > >     # ls -l /sys/bus/spi/devices/
> > > >     total 0
> > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32763.0 ->
> > > >     ../../../devices/platform/ff200000.spi/spi_master/spi32763/spi32763.0
> > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32764.0 ->
> > > >     ../../../devices/platform/ff1e0000.spi/spi_master/spi32764/spi32764.0
> > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32765.0 ->
> > > >     ../../../devices/platform/ff1d0000.spi/spi_master/spi32765/spi32765.0
> > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32766.0 ->
> > > >     ../../../devices/platform/ff1c0000.spi/spi_master/spi32766/spi32766.0> 
> > > > With the latter, it's much clearer which bus devices are on.
> > > > 
> > > > Signed-off-by: Brian Norris <briannorris@chromium.org>
> > > > ---
> > > > 
> > > >  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 6 ++++++
> > > >  1 file changed, 6 insertions(+)
> > > > 
> > > > diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > > b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index
> > > > 4c84229789ef..b04abbfd4898 100644
> > > > --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > > +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > > @@ -70,6 +70,12 @@
> > > > 
> > > >  		serial2 = &uart2;
> > > >  		serial3 = &uart3;
> > > >  		serial4 = &uart4;
> > > > 
> > > > +		spi0 = &spi0;
> > > > +		spi1 = &spi1;
> > > > +		spi2 = &spi2;
> > > > +		spi3 = &spi3;
> > > > +		spi4 = &spi4;
> > > > +		spi5 = &spi5;
> > > 
> > > Note that Rob Herring (with his dt-maintainer hat on) doesn't like these
> > > aliases.
> > > See for example:
> > > 	http://mid.gmane.org/20160705140546.GA10601@rob-hp-laptop
> 
> But why? I believe half the arguments in the linked thread were
> Catch-22's -- there were no "mainline" users (which is a false target
> IMO anyway, as Christer Weinigel mentioned somewhere in the thread Rob
> linked), and so we couldn't accept more documentation (or users) for the
> feature. FWIW, my quick grep now shows there are currently 43 mainline
> users.
> 
> This feature is very useful. Some of the thread Rob pointed to argued
> that the indexing isn't HW documentation; in this case, it most
> certainly is. The RK3399 TRM explicitly has these SPI buses named SPI0,
> SPI1, SPI2, SPI3, SPI4, and SPI5, and schematics that I've seen use the
> same terminology. It is therefore *much* nicer to have my device show up
> as 'spi2.0' (reflecting their correct HW name) rather than spi32764.0.
> Sometimes I can't even get as far as mounting sysfs to check what this
> maps to, but having spi2.0 in the kernel log can clearly tell me what
> device is causing problems.
> 
> If Rob can support a better alternative solution, I'd be happy to
> switch. But I don't understand why we can't use a useful (not just to
> me, but presumably to at least 43 other independent users, and many
> more out of tree), existing, and long-supported feature here.
> 
> > thanks for the heads up on this. I've dropped this patch again.
> 
> :(
> 
> Regards,
> Brian
Heiko Stübner July 19, 2016, 10:18 p.m. UTC | #6
Am Dienstag, 19. Juli 2016, 12:29:14 schrieb Brian Norris:
> On Tue, Jul 19, 2016 at 12:27:54PM -0700, Brian Norris wrote:
> > + Rob
> 
> + Rob for real
> 
> > Hi,
> > 
> > On Tue, Jul 19, 2016 at 08:56:47PM +0200, Heiko Stuebner wrote:
> > > Am Dienstag, 19. Juli 2016, 08:39:55 schrieb Uwe Kleine-König:
> > > > On Thu, Jul 14, 2016 at 06:24:33PM -0700, Brian Norris wrote:
> > > > > It's nicer to see this:
> > > > >     # ls -l /sys/bus/spi/devices/
> > > > >     total 0
> > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi0.0 ->
> > > > >     ../../../devices/platform/ff1c0000.spi/spi_master/spi0/spi0.0
> > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi1.0 ->
> > > > >     ../../../devices/platform/ff1d0000.spi/spi_master/spi1/spi1.0
> > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi2.0 ->
> > > > >     ../../../devices/platform/ff1e0000.spi/spi_master/spi2/spi2.0
> > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi5.0 ->
> > > > >     ../../../devices/platform/ff200000.spi/spi_master/spi5/spi5.0>
> > > > > 
> > > > > than this:
> > > > >     # ls -l /sys/bus/spi/devices/
> > > > >     total 0
> > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32763.0 ->
> > > > >     ../../../devices/platform/ff200000.spi/spi_master/spi32763/spi32
> > > > >     763.0
> > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32764.0 ->
> > > > >     ../../../devices/platform/ff1e0000.spi/spi_master/spi32764/spi32
> > > > >     764.0
> > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32765.0 ->
> > > > >     ../../../devices/platform/ff1d0000.spi/spi_master/spi32765/spi32
> > > > >     765.0
> > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32766.0 ->
> > > > >     ../../../devices/platform/ff1c0000.spi/spi_master/spi32766/spi32
> > > > >     766.0>
> > > > > 
> > > > > With the latter, it's much clearer which bus devices are on.
> > > > > 
> > > > > Signed-off-by: Brian Norris <briannorris@chromium.org>
> > > > > ---
> > > > > 
> > > > >  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 6 ++++++
> > > > >  1 file changed, 6 insertions(+)
> > > > > 
> > > > > diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > > > b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index
> > > > > 4c84229789ef..b04abbfd4898 100644
> > > > > --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > > > +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > > > @@ -70,6 +70,12 @@
> > > > > 
> > > > >  		serial2 = &uart2;
> > > > >  		serial3 = &uart3;
> > > > >  		serial4 = &uart4;
> > > > > 
> > > > > +		spi0 = &spi0;
> > > > > +		spi1 = &spi1;
> > > > > +		spi2 = &spi2;
> > > > > +		spi3 = &spi3;
> > > > > +		spi4 = &spi4;
> > > > > +		spi5 = &spi5;
> > > > 
> > > > Note that Rob Herring (with his dt-maintainer hat on) doesn't like
> > > > these
> > > > aliases.
> > > > 
> > > > See for example:
> > > > 	http://mid.gmane.org/20160705140546.GA10601@rob-hp-laptop
> > 
> > But why? I believe half the arguments in the linked thread were
> > Catch-22's -- there were no "mainline" users (which is a false target
> > IMO anyway, as Christer Weinigel mentioned somewhere in the thread Rob
> > linked), and so we couldn't accept more documentation (or users) for the
> > feature. FWIW, my quick grep now shows there are currently 43 mainline
> > users.
> > 
> > This feature is very useful. Some of the thread Rob pointed to argued
> > that the indexing isn't HW documentation; in this case, it most
> > certainly is. The RK3399 TRM explicitly has these SPI buses named SPI0,
> > SPI1, SPI2, SPI3, SPI4, and SPI5, and schematics that I've seen use the
> > same terminology. It is therefore *much* nicer to have my device show up
> > as 'spi2.0' (reflecting their correct HW name) rather than spi32764.0.
> > Sometimes I can't even get as far as mounting sysfs to check what this
> > maps to, but having spi2.0 in the kernel log can clearly tell me what
> > device is causing problems.
> > 
> > If Rob can support a better alternative solution, I'd be happy to
> > switch. But I don't understand why we can't use a useful (not just to
> > me, but presumably to at least 43 other independent users, and many
> > more out of tree), existing, and long-supported feature here.

Personally, I don't have any real opinion on this but the argument sounds 
plausible to me (aka they are named with numbers in every manual, schematics) 
so it might be helpful to have that around - similar to i2c that is in the 
dtsi already.

I think I remember Doug having a similar discussion around mmc-aliases some 
time ago - that met opposition as well [0] - although I guess the numbering 
was a bit more arbitary there.

I guess we'll just see what Rob says.


Heiko

[0] https://lkml.org/lkml/2016/4/29/610
Heiko Stübner July 20, 2016, 8:11 a.m. UTC | #7
Am Mittwoch, 20. Juli 2016, 00:18:40 schrieb Heiko Stübner:
> Am Dienstag, 19. Juli 2016, 12:29:14 schrieb Brian Norris:
> > On Tue, Jul 19, 2016 at 12:27:54PM -0700, Brian Norris wrote:
> > > + Rob
> > 
> > + Rob for real
> > 
> > > Hi,
> > > 
> > > On Tue, Jul 19, 2016 at 08:56:47PM +0200, Heiko Stuebner wrote:
> > > > Am Dienstag, 19. Juli 2016, 08:39:55 schrieb Uwe Kleine-König:
> > > > > On Thu, Jul 14, 2016 at 06:24:33PM -0700, Brian Norris wrote:
> > > > > > It's nicer to see this:
> > > > > >     # ls -l /sys/bus/spi/devices/
> > > > > >     total 0
> > > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi0.0 ->
> > > > > >     ../../../devices/platform/ff1c0000.spi/spi_master/spi0/spi0.0
> > > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi1.0 ->
> > > > > >     ../../../devices/platform/ff1d0000.spi/spi_master/spi1/spi1.0
> > > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi2.0 ->
> > > > > >     ../../../devices/platform/ff1e0000.spi/spi_master/spi2/spi2.0
> > > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi5.0 ->
> > > > > >     ../../../devices/platform/ff200000.spi/spi_master/spi5/spi5.0>
> > > > > > 
> > > > > > than this:
> > > > > >     # ls -l /sys/bus/spi/devices/
> > > > > >     total 0
> > > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32763.0 ->
> > > > > >     ../../../devices/platform/ff200000.spi/spi_master/spi32763/spi
> > > > > >     32
> > > > > >     763.0
> > > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32764.0 ->
> > > > > >     ../../../devices/platform/ff1e0000.spi/spi_master/spi32764/spi
> > > > > >     32
> > > > > >     764.0
> > > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32765.0 ->
> > > > > >     ../../../devices/platform/ff1d0000.spi/spi_master/spi32765/spi
> > > > > >     32
> > > > > >     765.0
> > > > > >     lrwxrwxrwx 1 root root 0 Dec 31  1969 spi32766.0 ->
> > > > > >     ../../../devices/platform/ff1c0000.spi/spi_master/spi32766/spi
> > > > > >     32
> > > > > >     766.0>
> > > > > > 
> > > > > > With the latter, it's much clearer which bus devices are on.
> > > > > > 
> > > > > > Signed-off-by: Brian Norris <briannorris@chromium.org>
> > > > > > ---
> > > > > > 
> > > > > >  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 6 ++++++
> > > > > >  1 file changed, 6 insertions(+)
> > > > > > 
> > > > > > diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > > > > b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index
> > > > > > 4c84229789ef..b04abbfd4898 100644
> > > > > > --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > > > > +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > > > > @@ -70,6 +70,12 @@
> > > > > > 
> > > > > >  		serial2 = &uart2;
> > > > > >  		serial3 = &uart3;
> > > > > >  		serial4 = &uart4;
> > > > > > 
> > > > > > +		spi0 = &spi0;
> > > > > > +		spi1 = &spi1;
> > > > > > +		spi2 = &spi2;
> > > > > > +		spi3 = &spi3;
> > > > > > +		spi4 = &spi4;
> > > > > > +		spi5 = &spi5;
> > > > > 
> > > > > Note that Rob Herring (with his dt-maintainer hat on) doesn't like
> > > > > these
> > > > > aliases.
> > > > > 
> > > > > See for example:
> > > > > 	http://mid.gmane.org/20160705140546.GA10601@rob-hp-laptop
> > > 
> > > But why? I believe half the arguments in the linked thread were
> > > Catch-22's -- there were no "mainline" users (which is a false target
> > > IMO anyway, as Christer Weinigel mentioned somewhere in the thread Rob
> > > linked), and so we couldn't accept more documentation (or users) for the
> > > feature. FWIW, my quick grep now shows there are currently 43 mainline
> > > users.
> > > 
> > > This feature is very useful. Some of the thread Rob pointed to argued
> > > that the indexing isn't HW documentation; in this case, it most
> > > certainly is. The RK3399 TRM explicitly has these SPI buses named SPI0,
> > > SPI1, SPI2, SPI3, SPI4, and SPI5, and schematics that I've seen use the
> > > same terminology. It is therefore *much* nicer to have my device show up
> > > as 'spi2.0' (reflecting their correct HW name) rather than spi32764.0.
> > > Sometimes I can't even get as far as mounting sysfs to check what this
> > > maps to, but having spi2.0 in the kernel log can clearly tell me what
> > > device is causing problems.
> > > 
> > > If Rob can support a better alternative solution, I'd be happy to
> > > switch. But I don't understand why we can't use a useful (not just to
> > > me, but presumably to at least 43 other independent users, and many
> > > more out of tree), existing, and long-supported feature here.
> 
> Personally, I don't have any real opinion on this but the argument sounds
> plausible to me (aka they are named with numbers in every manual,
> schematics) so it might be helpful to have that around - similar to i2c
> that is in the dtsi already.
> 
> I think I remember Doug having a similar discussion around mmc-aliases some
> time ago - that met opposition as well [0] - although I guess the numbering
> was a bit more arbitary there.
> 
> I guess we'll just see what Rob says.

Uwe pointed me to a very similar discussion and response from Rob about spi 
aliases at:
https://lkml.org/lkml/2016/5/25/566
Brian Norris July 29, 2016, 11:39 p.m. UTC | #8
+ Mark

On Wed, Jul 20, 2016 at 10:11:11AM +0200, Heiko Stuebner wrote:
> Am Mittwoch, 20. Juli 2016, 00:18:40 schrieb Heiko Stübner:
> > Am Dienstag, 19. Juli 2016, 12:29:14 schrieb Brian Norris:
> > > On Tue, Jul 19, 2016 at 12:27:54PM -0700, Brian Norris wrote:
> > > > On Tue, Jul 19, 2016 at 08:56:47PM +0200, Heiko Stuebner wrote:
> > > > > Am Dienstag, 19. Juli 2016, 08:39:55 schrieb Uwe Kleine-König:
> > > > > > > --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > > > > > +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
> > > > > > > @@ -70,6 +70,12 @@
> > > > > > > 
> > > > > > >  		serial2 = &uart2;
> > > > > > >  		serial3 = &uart3;
> > > > > > >  		serial4 = &uart4;
> > > > > > > 
> > > > > > > +		spi0 = &spi0;
> > > > > > > +		spi1 = &spi1;
> > > > > > > +		spi2 = &spi2;
> > > > > > > +		spi3 = &spi3;
> > > > > > > +		spi4 = &spi4;
> > > > > > > +		spi5 = &spi5;
> > > > > > 
> > > > > > Note that Rob Herring (with his dt-maintainer hat on) doesn't like
> > > > > > these
> > > > > > aliases.
> > > > > > 
> > > > > > See for example:
> > > > > > 	http://mid.gmane.org/20160705140546.GA10601@rob-hp-laptop
> > > > 
> > > > But why? I believe half the arguments in the linked thread were
> > > > Catch-22's -- there were no "mainline" users (which is a false target
> > > > IMO anyway, as Christer Weinigel mentioned somewhere in the thread Rob
> > > > linked), and so we couldn't accept more documentation (or users) for the
> > > > feature. FWIW, my quick grep now shows there are currently 43 mainline
> > > > users.
> > > > 
> > > > This feature is very useful. Some of the thread Rob pointed to argued
> > > > that the indexing isn't HW documentation; in this case, it most
> > > > certainly is. The RK3399 TRM explicitly has these SPI buses named SPI0,
> > > > SPI1, SPI2, SPI3, SPI4, and SPI5, and schematics that I've seen use the
> > > > same terminology. It is therefore *much* nicer to have my device show up
> > > > as 'spi2.0' (reflecting their correct HW name) rather than spi32764.0.
> > > > Sometimes I can't even get as far as mounting sysfs to check what this
> > > > maps to, but having spi2.0 in the kernel log can clearly tell me what
> > > > device is causing problems.
> > > > 
> > > > If Rob can support a better alternative solution, I'd be happy to
> > > > switch. But I don't understand why we can't use a useful (not just to
> > > > me, but presumably to at least 43 other independent users, and many
> > > > more out of tree), existing, and long-supported feature here.
> > 
> > Personally, I don't have any real opinion on this but the argument sounds
> > plausible to me (aka they are named with numbers in every manual,
> > schematics) so it might be helpful to have that around - similar to i2c
> > that is in the dtsi already.
> > 
> > I think I remember Doug having a similar discussion around mmc-aliases some
> > time ago - that met opposition as well [0] - although I guess the numbering
> > was a bit more arbitary there.
> > 
> > I guess we'll just see what Rob says.
> 
> Uwe pointed me to a very similar discussion and response from Rob about spi 
> aliases at:
> https://lkml.org/lkml/2016/5/25/566

I had read that already. I figured that was just rationale for not
documenting the feature (still silly IMO), and not for avoiding using
the existing feature.

What is this "label" feature Rob speaks of? Does it exist in practice
(AFAICT the answer is "no")? The description doesn't seem terrible,
depending on the implementation. Would that become the actual device
name (i.e., dev_name(dev))? Or just a filesystem symlink? And how does
one assign such a label?

Brian
Mark Brown July 30, 2016, 1:05 a.m. UTC | #9
On Fri, Jul 29, 2016 at 04:39:51PM -0700, Brian Norris wrote:

> + Mark

I very nearly deleted this unread based on the subject line...

> I had read that already. I figured that was just rationale for not
> documenting the feature (still silly IMO), and not for avoiding using
> the existing feature.

All in tree aliases provided for SPI buses are strings so if we're doing
anything with aliases we really ought to be parsing them as strings not
numbers (they're people describing the use of buses on their board).  

I quite seriously am more inclined to remove the numbering functionality
as stands than document it as stands given how many layers of
implementation specifics are required to make practical use of it and
the existing practical use for human readable purposes, all we're doing
is trying to be helpful with some random string we found somewhere and
we don't want to encourage people to do that rather than doing what
they're currently doing any providing human readable names.  We
shouldn't preclude being more helpful if we get better ideas and we
shouldn't encourage people to make bad decisions about identifying
things from userspace.  Or I suppose we could go the way of all
standards and document useful behaviour without implementing it but that
doesn't seem awesome either.

> What is this "label" feature Rob speaks of? Does it exist in practice
> (AFAICT the answer is "no")? The description doesn't seem terrible,

It's a property called "label" which is a standard thing in DT for
providing descriptive labels, if you look in git you can see quite a few
examples for other subsystems.  I'd expect to see it show up in the
string for the device name in place of the numbers (both if used for a
device, the bus number for the bus).  Nobody has written any code yet,
I've never personally found the motivation and nobody sent me any
patches.

> depending on the implementation. Would that become the actual device
> name (i.e., dev_name(dev))? Or just a filesystem symlink? And how does
> one assign such a label?

It should really show up in dev_name() since for most devices it'll be
more likely to show up in a log message than anywhere else.
diff mbox

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 4c84229789ef..b04abbfd4898 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -70,6 +70,12 @@ 
 		serial2 = &uart2;
 		serial3 = &uart3;
 		serial4 = &uart4;
+		spi0 = &spi0;
+		spi1 = &spi1;
+		spi2 = &spi2;
+		spi3 = &spi3;
+		spi4 = &spi4;
+		spi5 = &spi5;
 	};
 
 	cpus {