ARM: ux500: define serial port aliases
PATCH 1/2 ARM: ux500: define serial port aliases
This enumerates the PL011 serial ports on the Ux500. This is necessary to do if we want to remove one of the serial ports, since userspace depends on console to be present on ttyAMA2 and we must not break userspace.
---
ChangeLog v1->v2:
- Moved the alias definitions from the core SoC file to the toplevel DTS file, as requested by Arnd.
ARM SoC guys: if you find this patch OK, please apply this directly for fixes, as a prerequisite for patch 2/2, then apply 2/2.
--- arch/arm/boot/dts/ste-ccu8540.dts | 7 +++++++ arch/arm/boot/dts/ste-ccu9540.dts | 7 +++++++ arch/arm/boot/dts/ste-dbx5x0.dtsi | 6 +++--- arch/arm/boot/dts/ste-hrefprev60-stuib.dts | 7 +++++++ arch/arm/boot/dts/ste-hrefprev60-tvk.dts | 7 +++++++ arch/arm/boot/dts/ste-hrefv60plus-stuib.dts | 7 +++++++ arch/arm/boot/dts/ste-hrefv60plus-tvk.dts | 7 +++++++ arch/arm/boot/dts/ste-snowball.dts | 7 +++++++ 8 files changed, 52 insertions(+), 3 deletions(-)
arch/arm/boot/dts/ste-ccu8540.dts +7 -0
@@ -17,6 +17,13 @@ model = "ST-Ericsson U8540 platform with Device Tree"; compatible = "st-ericsson,ccu8540", "st-ericsson,u8540"; + /* This stablilizes the serial port enumeration */ + aliases { + serial0 = &ux500_serial0; + serial1 = &ux500_serial1; + serial2 = &ux500_serial2; + }; + memory at 0 { device_type = "memory"; reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>;
arch/arm/boot/dts/ste-ccu9540.dts +7 -0
@@ -16,6 +16,13 @@ model = "ST-Ericsson CCU9540 platform with Device Tree"; compatible = "st-ericsson,ccu9540", "st-ericsson,u9540"; + /* This stablilizes the serial port enumeration */ + aliases { + serial0 = &ux500_serial0; + serial1 = &ux500_serial1; + serial2 = &ux500_serial2; + }; + memory { reg = <0x00000000 0x20000000>; };
arch/arm/boot/dts/ste-dbx5x0.dtsi +3 -3
@@ -971,7 +971,7 @@ power-domains = <&pm_domains DOMAIN_VAPE>; }; - uart at 80120000 { + ux500_serial0: uart at 80120000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x80120000 0x1000>; interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>;
@@ -986,7 +986,7 @@ status = "disabled"; }; - uart at 80121000 { + ux500_serial1: uart at 80121000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x80121000 0x1000>; interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>;
@@ -1001,7 +1001,7 @@ status = "disabled"; }; - uart at 80007000 { + ux500_serial2: uart at 80007000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x80007000 0x1000>; interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>;
arch/arm/boot/dts/ste-hrefprev60-stuib.dts +7 -0
@@ -17,6 +17,13 @@ model = "ST-Ericsson HREF (pre-v60) and ST UIB"; compatible = "st-ericsson,mop500", "st-ericsson,u8500"; + /* This stablilizes the serial port enumeration */ + aliases { + serial0 = &ux500_serial0; + serial1 = &ux500_serial1; + serial2 = &ux500_serial2; + }; + soc { /* Reset line for the BU21013 touchscreen */ i2c at 80110000 {
arch/arm/boot/dts/ste-hrefprev60-tvk.dts +7 -0
@@ -16,4 +16,11 @@ / { model = "ST-Ericsson HREF (pre-v60) and TVK1281618 UIB"; compatible = "st-ericsson,mop500", "st-ericsson,u8500"; + + /* This stablilizes the serial port enumeration */ + aliases { + serial0 = &ux500_serial0; + serial1 = &ux500_serial1; + serial2 = &ux500_serial2; + }; };
arch/arm/boot/dts/ste-hrefv60plus-stuib.dts +7 -0
@@ -19,6 +19,13 @@ model = "ST-Ericsson HREF (v60+) and ST UIB"; compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500"; + /* This stablilizes the serial port enumeration */ + aliases { + serial0 = &ux500_serial0; + serial1 = &ux500_serial1; + serial2 = &ux500_serial2; + }; + soc { /* Reset line for the BU21013 touchscreen */ i2c at 80110000 {
arch/arm/boot/dts/ste-hrefv60plus-tvk.dts +7 -0
@@ -18,4 +18,11 @@ / { model = "ST-Ericsson HREF (v60+) and TVK1281618 UIB"; compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500"; + + /* This stablilizes the serial port enumeration */ + aliases { + serial0 = &ux500_serial0; + serial1 = &ux500_serial1; + serial2 = &ux500_serial2; + }; };
arch/arm/boot/dts/ste-snowball.dts +7 -0
@@ -18,6 +18,13 @@ model = "Calao Systems Snowball platform with device tree"; compatible = "calaosystems,snowball-a9500", "st-ericsson,u9500"; + /* This stablilizes the serial port enumeration */ + aliases { + serial0 = &ux500_serial0; + serial1 = &ux500_serial1; + serial2 = &ux500_serial2; + }; + memory { reg = <0x00000000 0x20000000>; };
Signature · 1 line
2.4.3
PATCH 1/2 ARM: ux500: define serial port aliases
Quoted 5 lines · On Friday 10 July 2015 11:32:15 Linus Walleij wrote:
This enumerates the PL011 serial ports on the Ux500. This is necessary to do if we want to remove one of the serial ports, since userspace depends on console to be present on ttyAMA2 and we must not break userspace.
Quoted 8 lines
Cc Ulf Hansson <[email protected]>Signed-off-by Linus Walleij <[email protected]>---
ChangeLogv1->v2:
- Moved the alias definitions from the core SoC file to the toplevel DTS file, as requested by Arnd.
Do all of the boards expose all three uarts in the same order?
Arnd
PATCH 1/2 ARM: ux500: define serial port aliases
Quoted 15 lines · Arnd Bergmann
Quoted 5 lines · On Friday 10 July 2015 11:32:15 Linus Walleij wrote:
This enumerates the PL011 serial ports on the Ux500. This is necessary to do if we want to remove one of the serial ports, since userspace depends on console to be present on ttyAMA2 and we must not break userspace.
Quoted 8 lines
Cc Ulf Hansson <[email protected]>Signed-off-by Linus Walleij <[email protected]>---
ChangeLogv1->v2:
- Moved the alias definitions from the core SoC file to the toplevel DTS file, as requested by Arnd.
Quoted 1 line
Do all of the boards expose all three uarts in the same order?
Yes and that is the reason the patch series needs this one to come first.
What happened historically was that userspace was hard-coded to use ttyAMA2 as console. So for this reason, all boards had to define ttyAMA0, 1, 2 in their board file (later device tree) so they would be enumerated in the right order, relying on the DT to be parsed top to bottom of course.
So when I realized (in patch 2/2) that ttyAMA1 was not really used on some boards, it was impossible to remove it as userspace relied on the enumeration.
However I have to remove ttyAMA1 because it is fundamentally wrong (the RC pin is used for MMC!). Incidentally it worked to steal
But that breaks userspace since
PATCH 1/2 ARM: ux500: define serial port aliases
Quoted 31 lines · Linus Walleij
Quoted 15 lines · Arnd Bergmann
Quoted 5 lines · On Friday 10 July 2015 11:32:15 Linus Walleij wrote:
This enumerates the PL011 serial ports on the Ux500. This is necessary to do if we want to remove one of the serial ports, since userspace depends on console to be present on ttyAMA2 and we must not break userspace.
Quoted 8 lines
Cc Ulf Hansson <[email protected]>Signed-off-by Linus Walleij <[email protected]>---
ChangeLogv1->v2:
- Moved the alias definitions from the core SoC file to the toplevel DTS file, as requested by Arnd.Quoted 1 line
Do all of the boards expose all three uarts in the same order?
Yes and that is the reason the patch series needs this one to come first.
What happened historically was that userspace was hard-coded to use ttyAMA2 as console. So for this reason, all boards had to define ttyAMA0, 1, 2 in their board file (later device tree) so they would be enumerated in the right order, relying on the DT to be parsed top to bottom of course.
So when I realized (in patch 2/2) that ttyAMA1 was not really used on some boards, it was impossible to remove it as userspace relied on the enumeration.
Quoted 5 lines
However I have to remove ttyAMA1 because it is fundamentally wrong (the RC pin is used for MMC!). Incidentally it worked to steal
But that breaks userspace since
Keyboard slip.
Incidentally it worked to steal the pin from ttyAMA1 even if it was connected to the UART, but it makes things pretty confused and we tightened the stringence of the pin control framework and it exploded.
It turns out that ttyAMA1 was only enabled on these boards (all boards) to get the enumeration right for userspace.
However the right way to get serial port enumeration right for userspace is to use alias. And that is what the patch does.
Since the original code just defined all three serial ports for all boards by them including ste-dbx500.dtsi I first made the patch to that file, and then as you said it had to be done on a per-toplevel file, I did it in the individual DTS files instead.
Yours,
Linus Walleij
PATCH 1/2 ARM: ux500: define serial port aliases
Quoted 5 lines · On Monday 13 July 2015 10:21:51 Linus Walleij wrote:
Since the original code just defined all three serial ports for all boards by them including
ste-dbx500.dtsiI first made the patch to that file, and then as you said it had to be done on a per-toplevel file, I did it in the individual DTS files instead.
I'm not following here. If you have boards that want port 1 to be disabled, shouldn't you remove that alias?
Arnd
PATCH 1/2 ARM: ux500: define serial port aliases
Quoted 9 lines · Arnd Bergmann
Quoted 5 lines · On Monday 13 July 2015 10:21:51 Linus Walleij wrote:
Since the original code just defined all three serial ports for all boards by them including
ste-dbx500.dtsiI first made the patch to that file, and then as you said it had to be done on a per-toplevel file, I did it in the individual DTS files instead.I'm not following here. If you have boards that want port 1 to be disabled, shouldn't you remove that alias?
No, that is done by not changing status = "disabled"; to status = "okay"; on a per-board basis.
This is what the second patch is doing.
The aliases are set also to disabled ports to ensure enumeration for the cases where a board file enabled a previously disabled UART.
Yours,
Linus Walleij
PATCH 1/2 ARM: ux500: define serial port aliases
Quoted 11 lines · On Thursday 16 July 2015 16:03:18 Linus Walleij wrote:
Quoted 9 lines · Arnd Bergmann
Quoted 5 lines · On Monday 13 July 2015 10:21:51 Linus Walleij wrote:
Since the original code just defined all three serial ports for all boards by them including
ste-dbx500.dtsiI first made the patch to that file, and then as you said it had to be done on a per-toplevel file, I did it in the individual DTS files instead.I'm not following here. If you have boards that want port 1 to be disabled, shouldn't you remove that alias?
Quoted 9 lines
No, that is done by not changing status = "disabled"; to status = "okay"; on a per-board basis.
This is what the second patch is doing.
The aliases are set also to disabled ports to ensure enumeration for the cases where a board file enabled a previously disabled UART.
Well, both really. The status property tells the kernel to not ever touch a device, while the alias is what traditionally gets used to assign an OS visible device name to a device in the tree. This is more true for MacOS and AIX than Linux, which sometimes does its own naming, but we really should not have an alias pointing at a disabled device node.
Arnd
PATCH 1/2 ARM: ux500: define serial port aliases
Quoted 7 lines · Arnd Bergmann
Quoted 4 lines · On Thursday 16 July 2015 16:03:18 Linus Walleij wrote:
The aliases are set also to disabled ports to ensure enumeration for the cases where a board file enabled a previously disabled UART.
Quoted 6 lines
Well, both really. The status property tells the kernel to not ever touch a device, while the alias is what traditionally gets used to assign an OS visible device name to a device in the tree. This is more true for MacOS and AIX than Linux, which sometimes does its own naming, but we really should not have an alias pointing at a disabled device node.
OK ... I will make a patch that remove the aliases for the disabled nodes.
But this makes me think of whether the DT compiler should allow it or at least warn about it?
Yours,
Linus Walleij
PATCH 1/2 ARM: ux500: define serial port aliases
Quoted 15 lines · On Thursday 16 July 2015 21:57:35 Linus Walleij wrote:
Quoted 7 lines · Arnd Bergmann
Quoted 4 lines · On Thursday 16 July 2015 16:03:18 Linus Walleij wrote:
The aliases are set also to disabled ports to ensure enumeration for the cases where a board file enabled a previously disabled UART.
Quoted 6 lines
Well, both really. The status property tells the kernel to not ever touch a device, while the alias is what traditionally gets used to assign an OS visible device name to a device in the tree. This is more true for MacOS and AIX than Linux, which sometimes does its own naming, but we really should not have an alias pointing at a disabled device node.
Quoted 5 lines
OK ... I will make a patch that remove the aliases for the disabled nodes.
But this makes me think of whether the DT compiler should allow it or at least warn about it?
We don't get a lot of warnings from dtc at the moment, but we could start adding them for stuff like this. It probably requires looking at the whole dtb a bit deeper than dtc does at the moment.
Arnd
Olof Johansson
AppliedPATCH 1/2 ARM: ux500: define serial port aliases
In reply to Linus WalleijQuoted 7 lines · Linus Walleij
This enumerates the PL011 serial ports on the Ux500. This is necessary to do if we want to remove one of the serial ports, since userspace depends on console to be present on ttyAMA2 and we must not break userspace.
Cc Ulf Hansson <[email protected]>Signed-off-by Linus Walleij <[email protected]>
Quoted 8 lines
---
ChangeLogv1->v2:
- Moved the alias definitions from the core SoC file to the toplevel DTS file, as requested by Arnd.ARM SoC guys: if you find this patch OK, please apply this directly for fixes, as a prerequisite for patch 2/2, then apply 2/2.
Thanks, applied.
-Olof