serial: samsung: add support for early console
cover serial: samsung: add support for early console
Hello,
This patchset adds support for early console defined in device tree. As an example, DTS files for all Exynos4 based machines are updated with the correct value for common chosen/sdtout property.
To get it fully functional additional improvements (support for early_ioremap) are needed in early console code.
Best regards
Marek Szyprowski
Samsung R&D Institute Poland
Patch summary:
Tomasz Figa (2):
serial: samsung: Add support for of_earlycon
ARM: dts: exynos4: Add stdout-path properties
arch/arm/boot/dts/exynos4210-origen.dts | 1 + arch/arm/boot/dts/exynos4210-smdkv310.dts | 1 + arch/arm/boot/dts/exynos4210-trats.dts | 1 + arch/arm/boot/dts/exynos4210-universal_c210.dts | 1 + arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 4 + arch/arm/boot/dts/exynos4412-origen.dts | 1 + arch/arm/boot/dts/exynos4412-smdk4412.dts | 1 + arch/arm/boot/dts/exynos4412-tiny4412.dts | 4 + arch/arm/boot/dts/exynos4412-trats2.dts | 1 + drivers/tty/serial/Kconfig | 1 + drivers/tty/serial/samsung.c | 97 +++++++++++++++++++++++++ 11 files changed, 113 insertions(+)
Signature · 1 line
1.9.2
PATCH 1/2 serial: samsung: Add support for of_earlycon
From: Tomasz Figa <[email protected]>
This patch adds support for early console initialized from device tree to all variants of Samsung serial driver.
--- drivers/tty/serial/Kconfig | 1 + drivers/tty/serial/samsung.c | 97 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+)
drivers/tty/serial/Kconfig +1 -0
@@ -222,6 +222,7 @@ config SERIAL_SAMSUNG tristate "Samsung SoC serial support" depends on PLAT_SAMSUNG select SERIAL_CORE + select SERIAL_EARLYCON help Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, providing /dev/ttySAC0, 1 and 2 (note, some machines may not
drivers/tty/serial/samsung.c +97 -0
103 lines not on this page · raw message
Signature · 1 line
1.9.2
PATCH 1/2 serial: samsung: Add support for of_earlycon
Hi Marek
Quoted 17 lines · Marek Szyprowski
From: Tomasz Figa <[email protected]>
This patch adds support for early console initialized from device tree to all variants of Samsung serial driver.
Signed-off-by Tomasz Figa <[email protected]>Signed-off-by Marek Szyprowski <[email protected]>--- drivers/tty/serial/Kconfig | 1 + drivers/tty/serial/samsung.c | 97 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+)drivers/tty/serial/Kconfig +0
-0
drivers/tty/serial/Kconfig config SERIAL_SAMSUNG · line 225
Quoted 4 lines
drivers/tty/serial/Kconfig +1
-0@@ -222,6 +222,7 @@ config SERIAL_SAMSUNG tristate "Samsung SoC serial support" depends on PLAT_SAMSUNG select SERIAL_CORE + select SERIAL_EARLYCON
Ideally this should be selected by SERIAL_SAMSUNG_CONSOLE. But this is also fine.
Quoted 51 lines
drivers/tty/serial/Kconfig +0
-0help Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, providing /dev/ttySAC0, 1 and 2 (note, some machines may notdrivers/tty/serial/samsung.c +40
-0@@ -1856,6 +1856,103 @@ static struct platform_driver samsung_serial_driver = {module_platform_driver (samsung_serial_driver); +/* +* Early console. +*/ + +struct samsung_early_console_data { +u32 txfull_mask; +}; + +static void samsung_early_busyuart (struct uart_port *port) +{ +while (!(readl (port->membase +S3C2410_UTRSTAT ) &S3C2410_UTRSTAT_TXFE )) + ; +} + +static void samsung_early_busyuart_fifo (struct uart_port *port) +{ +struct samsung_early_console_data *data = port->private_data; + +while (readl (port->membase +S3C2410_UFSTAT ) & data->txfull_mask) + ; +} + +static void samsung_early_putc (struct uart_port *port,int c) +{ +if (readl (port->membase +S3C2410_UFCON ) &S3C2410_UFCON_FIFOMODE ) +samsung_early_busyuart_fifo (port); +else +samsung_early_busyuart (port); + +writeb (c, port->membase +S3C2410_UTXH ); +} + +static void samsung_early_write (struct console *con,const char *s,unsigned n) +{ +struct earlycon_device *dev = con->data; + +uart_console_write (&dev->port, s, n, samsung_early_putc); +} + +static int __init samsung_early_console_setup(struct earlycon_device *device,
drivers/tty/serial/samsung.c static struct platform_driver samsung_serial_driver = { · line 1908
Quoted 10 lines
drivers/tty/serial/samsung.c +10
-0+ const char *opt) +{ +if (!device->port.membase) +return -ENODEV ; + + device->con->write = samsung_early_write; +return 0 ; +} + +/* S3C2410, S3C2412 */
Probably you should move S3C2412 below along with S3C64xx, see your OF_EARLYCON_DECLARE below.
Quoted 36 lines
drivers/tty/serial/samsung.c +36
-0+static struct samsung_early_console_data s3c2410_early_console_data = { + .txfull_mask =S3C2410_UFSTAT_TXFULL , +}; + +static int __init s3c2410_early_console_setup (struct earlycon_device *device, +const char *opt) +{ + device->port.private_data = &s3c2410_early_console_data; +return samsung_early_console_setup (device, opt); +} +OF_EARLYCON_DECLARE (s3c2410,"samsung,s3c2410-uart" , + s3c2410_early_console_setup); + +/* S3C2440, S3C64xx */ +static struct samsung_early_console_data s3c2440_early_console_data = { + .txfull_mask =S3C2440_UFSTAT_TXFULL , +}; + +static int __init s3c2440_early_console_setup (struct earlycon_device *device, +const char *opt) +{ + device->port.private_data = &s3c2440_early_console_data; +return samsung_early_console_setup (device, opt); +} +OF_EARLYCON_DECLARE (s3c2412,"samsung,s3c2412-uart" , + s3c2440_early_console_setup); +OF_EARLYCON_DECLARE (s3c2440,"samsung,s3c2440-uart" , + s3c2440_early_console_setup); +OF_EARLYCON_DECLARE (s3c6400,"samsung,s3c6400-uart" , + s3c2440_early_console_setup); + +/* S5PV210, EXYNOS */ +static struct samsung_early_console_data s5pv210_early_console_data = { + .txfull_mask =S5PV210_UFSTAT_TXFULL , +}; +
drivers/tty/serial/samsung.c static struct platform_driver samsung_serial_driver = { · line 1954
Quoted 10 lines
drivers/tty/serial/samsung.c +10
-0+static int __init s5pv210_early_console_setup (struct earlycon_device *device, +const char *opt) +{ + device->port.private_data = &s5pv210_early_console_data; +return samsung_early_console_setup (device, opt); +} +OF_EARLYCON_DECLARE (s5pv210,"samsung,s5pv210-uart" , + s5pv210_early_console_setup); +OF_EARLYCON_DECLARE (exynos4210,"samsung,exynos4210-uart" , + s5pv210_early_console_setup);
Please support command line earlycon support also for all type. You just need EARLYCON_DECLARE(exynos4210, s5pv210_early_console_setup); for exynos4210.
Quoted 12 lines
drivers/tty/serial/samsung.c +1
-1+MODULE_ALIAS ("platform:samsung-uart" );MODULE_DESCRIPTION ("Samsung SoC Serial port driver" );MODULE_AUTHOR ("Ben Dooks <[email protected]>" ); --1.9.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
Regards, Alim
PATCH 2/2 ARM: dts: exynos4: Add stdout-path properties
In reply to Marek SzyprowskiFrom: Tomasz Figa <[email protected]>
This patch adds stdout-path property to chosen nodes of Exynos4 boards to enable use of earlycon feature without the need to hardcode port number in kernel itself.
--- arch/arm/boot/dts/exynos4210-origen.dts | 1 + arch/arm/boot/dts/exynos4210-smdkv310.dts | 1 + arch/arm/boot/dts/exynos4210-trats.dts | 1 + arch/arm/boot/dts/exynos4210-universal_c210.dts | 1 + arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 4 ++++ arch/arm/boot/dts/exynos4412-origen.dts | 1 + arch/arm/boot/dts/exynos4412-smdk4412.dts | 1 + arch/arm/boot/dts/exynos4412-tiny4412.dts | 4 ++++ arch/arm/boot/dts/exynos4412-trats2.dts | 1 + 9 files changed, 15 insertions(+)
arch/arm/boot/dts/exynos4210-origen.dts +1 -0
@@ -31,6 +31,7 @@ chosen { bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc"; + stdout-path = &serial_2; }; regulators {
arch/arm/boot/dts/exynos4210-smdkv310.dts +1 -0
@@ -27,6 +27,7 @@ chosen { bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc"; + stdout-path = &serial_1; }; sdhci at 12530000 {
arch/arm/boot/dts/exynos4210-trats.dts +1 -0
@@ -28,6 +28,7 @@ chosen { bootargs = "console=ttySAC2,115200N8 root=/dev/mmcblk0p5 rootwait earlyprintk panic=5"; + stdout-path = &serial_2; }; regulators {
arch/arm/boot/dts/exynos4210-universal_c210.dts +1 -0
@@ -26,6 +26,7 @@ chosen { bootargs = "console=ttySAC2,115200N8 root=/dev/mmcblk0p5 rw rootwait earlyprintk panic=5 maxcpus=1"; + stdout-path = &serial_2; }; sysram at 02020000 {
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +4 -0
@@ -11,6 +11,10 @@ #include "exynos4412.dtsi" / { + chosen { + stdout-path = &serial_1; + }; + firmware at 0204F000 { compatible = "samsung,secure-firmware"; reg = <0x0204F000 0x1000>;
arch/arm/boot/dts/exynos4412-origen.dts +1 -0
@@ -26,6 +26,7 @@ chosen { bootargs ="console=ttySAC2,115200"; + stdout-path = &serial_2; }; firmware at 0203F000 {
arch/arm/boot/dts/exynos4412-smdk4412.dts +1 -0
@@ -25,6 +25,7 @@ chosen { bootargs ="root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc"; + stdout-path = &serial_1; }; g2d at 10800000 {
arch/arm/boot/dts/exynos4412-tiny4412.dts +4 -0
@@ -18,6 +18,10 @@ model = "FriendlyARM TINY4412 board based on Exynos4412"; compatible = "friendlyarm,tiny4412", "samsung,exynos4412", "samsung,exynos4"; + chosen { + stdout-path = &serial_0; + }; + memory { reg = <0x40000000 0x40000000>; };
arch/arm/boot/dts/exynos4412-trats2.dts +1 -0
@@ -30,6 +30,7 @@ chosen { bootargs = "console=ttySAC2,115200N8 root=/dev/mmcblk0p5 rootwait earlyprintk panic=5"; + stdout-path = &serial_2; }; firmware at 0204F000 {
Signature · 1 line
1.9.2
cover serial: samsung: add support for early console
In reply to Marek SzyprowskiHi Marek,
Quoted 9 lines · Marek Szyprowski
Hello,
This patchset adds support for early console defined in device tree. As an example, DTS files for all Exynos4 based machines are updated with the correct value for common chosen/sdtout property.
To get it fully functional additional improvements (support for
early_ioremap) are needed in early console code.
Is these really tested?
So that mean we need to wait till __ioremap__ support available for ARM. How to take this forward then? Here is a platform (exynos7) which needs earlycon support for debugging some of the early core things and ARM64 has ioremap support as well. There is no reason why we should hold earlycon support for exyons7.
I see two solution here:
1> How about re-spin patch-1 which will just add ealrycon support for __exynos4210__ serial type only? And rest of the types can be added as incremental patches, as and when ioremap for ARM available. Atleast this approch will solve exynos7 problem of not having earlycon support. And This patch can be tested on exynos7 (I can do that).
2> Take my patch which is working and tested for exynos7 and can be easily extended and generalized when ioremap for ARM is available.
My preference would be the the first one.
Let me know your thoughts please.
In case you are ok with 1st approach, can you please re-spin patch1 with needed changes?
Quoted 31 lines
Best regards
Marek Szyprowski
Samsung R&D Institute PolandPatch summary:
Tomasz Figa (2):
serial: samsung: Add support forof_earlycon
ARM: dts: exynos4: Add stdout-path propertiesarch/arm/boot/dts/exynos4210-origen.dts | 1 + arch/arm/boot/dts/exynos4210-smdkv310.dts | 1 + arch/arm/boot/dts/exynos4210-trats.dts | 1 + arch/arm/boot/dts/exynos4210-universal_c210.dts | 1 + arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 4 + arch/arm/boot/dts/exynos4412-origen.dts | 1 + arch/arm/boot/dts/exynos4412-smdk4412.dts | 1 + arch/arm/boot/dts/exynos4412-tiny4412.dts | 4 + arch/arm/boot/dts/exynos4412-trats2.dts | 1 + drivers/tty/serial/Kconfig | 1 + drivers/tty/serial/samsung.c | 97 +++++++++++++++++++++++++ 11 files changed, 113 insertions(+)--
1.9.2--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Regards, Alim
cover serial: samsung: add support for early console
Hello,
Quoted 6 lines · Alim Akhtar
Hi Marek,
Quoted 2 lines · Marek Szyprowski
Hello,
Quoted 8 lines
Quoted 7 lines
This patchset adds support for early console defined in device tree. As an example, DTS files for all Exynos4 based machines are updated with the correct value for common chosen/sdtout property.
To get it fully functional additional improvements (support for
early_ioremap) are needed in early console code.Is these really tested?
I've tested it on Exynos4412 based OdroidU3 board. It works fine, although early console is not initialized as early as it might be. That's the only drawback, besides that it works fine.
Quoted 5 lines
So that mean we need to wait till
__ioremap__support available for ARM. How to take this forward then? Here is a platform (exynos7) which needs earlycon support for debugging some of the early core things and ARM64 has ioremap support as well. There is no reason why we should hold earlycon support for exyons7.
I prefer to simply merge the patch as is. Once early con gets full functionality, all required samsung code will be already in then.
Quoted 9 lines
I see two solution here:
1> How about re-spin patch-1 which will just add ealrycon support for__exynos4210__serial type only? And rest of the types can be added as incremental patches, as and when ioremap for ARM available. Atleast this approch will solve exynos7 problem of not having earlycon support. And This patch can be tested on exynos7 (I can do that).
2> Take my patch which is working and tested for exynos7 and can be easily extended and generalized when ioremap for ARM is available.
Quoted 4 lines
My preference would be the the first one.
Let me know your thoughts please.
In case you are ok with 1st approach, can you please re-spin patch1 with needed changes?
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
cover serial: samsung: add support for early console
Hi Marek,
Quoted 32 lines · Marek Szyprowski
Hello,
Quoted 8 lines · Alim Akhtar
Hi Marek,
Quoted 3 lines · Marek Szyprowski
Hello,
Quoted 8 lines
Quoted 7 lines
This patchset adds support for early console defined in device tree. As an example, DTS files for all Exynos4 based machines are updated with the correct value for common chosen/sdtout property.
To get it fully functional additional improvements (support for
early_ioremap) are needed in early console code.Is these really tested?
I've tested it on Exynos4412 based OdroidU3 board. It works fine, although early console is not initialized as early as it might be. That's the only drawback, besides that it works fine.
Quoted 5 lines
So that mean we need to wait till
__ioremap__support available for ARM. How to take this forward then? Here is a platform (exynos7) which needs earlycon support for debugging some of the early core things and ARM64 has ioremap support as well. There is no reason why we should hold earlycon support for exyons7.
Quoted 3 lines
I prefer to simply merge the patch as is. Once early con gets full functionality, all required samsung code will be already in then.
Thats good then, I was thinking you (or someone else, might be) are going to hold this till __ioremap__ gets added for ARM.
Quoted 22 lines
Quoted 11 lines
I see two solution here:
1> How about re-spin patch-1 which will just add ealrycon support for__exynos4210__serial type only? And rest of the types can be added as incremental patches, as and when ioremap for ARM available. Atleast this approch will solve exynos7 problem of not having earlycon support.
And This patch can be tested on exynos7 (I can do that).
2> Take my patch which is working and tested for exynos7 and can be easily extended and generalized when ioremap for ARM is available.Quoted 4 lines
My preference would be the the first one.
Let me know your thoughts please.
In case you are ok with 1st approach, can you please re-spin patch1 with needed changes?Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Signature · 2 lines
Regards, Alim
cover serial: samsung: add support for early console
In reply to Alim AkhtarQuoted 10 lines · Alim Akhtar
Hi Marek,
Quoted 6 lines · Marek Szyprowski
Hello,
This patchset adds support for early console defined in device tree. As an example, DTS files for all Exynos4 based machines are updated with the correct value for common chosen/sdtout property.
Quoted 5 lines
Quoted 3 lines
To get it fully functional additional improvements (support for
early_ioremap) are needed in early console code.Is these really tested?
So that mean we need to wait till__ioremap__support available for ARM.
This was originally tested by creating a fixed mapping for all UART ports on respective platforms in .map_io() callback of machine descriptor. This might be the way to support this on 32-bit ARM platforms until early ioremap is available.
However if no mapping is available, the earlycon will simply not register and won't break anything, so it should be safe to keep.
Quoted 10 lines
How to take this forward then? Here is a platform (exynos7) which needs earlycon support for debugging some of the early core things and ARM64 has ioremap support as well. There is no reason why we should hold earlycon support for exyons7.
I see two solution here:
1> How about re-spin patch-1 which will just add ealrycon support for__exynos4210__serial type only? And rest of the types can be added as incremental patches, as and when ioremap for ARM available. Atleast this approch will solve exynos7 problem of not having earlycon support. And This patch can be tested on exynos7 (I can do that).
I don't really think there is a need to remove support for other variants. As I mentioned, they can be supported without early_ioremap() by static IO mapping.
Quoted 7 lines
2> Take my patch which is working and tested for exynos7 and can be easily extended and generalized when ioremap for ARM is available.
My preference would be the the first one.
Let me know your thoughts please.
In case you are ok with 1st approach, can you please re-spin patch1 with needed changes?
I'd say this patch could be merged as is. For 32-bit platforms additional patches might be posted separately to add early static mapping or just wait until early ioremap becomes availabl.e
Best regards,
Tomasz
cover serial: samsung: add support for early console
In reply to Marek SzyprowskiHi Marek,
Quoted 14 lines · Marek Szyprowski
Hello,
This patchset adds support for early console defined in device tree. As an example, DTS files for all Exynos4 based machines are updated with the correct value for common chosen/sdtout property.
To get it fully functional additional improvements (support for
early_ioremap) are needed in early console code.Best regards
Marek Szyprowski
Samsung R&D Institute Poland
Quoted 4 lines
Patch summary:
Tomasz Figa (2):
serial: samsung: Add support forof_earlycon
Probably you can re-spin this series without RFC tag and fixing a nit. Please add command line support also and update the Documentation with command line param.
Quoted 2 lines
ARM: dts: exynos4: Add stdout-path properties
Have tested this on ARM64 based exynos7, both DT and command line way. Both works.
Compile tested on ARM.
Probably you can rebase on top of
https://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg36208.html maybe.
Quoted 20 lines
arch/arm/boot/dts/exynos4210-origen.dts | 1 + arch/arm/boot/dts/exynos4210-smdkv310.dts | 1 + arch/arm/boot/dts/exynos4210-trats.dts | 1 + arch/arm/boot/dts/exynos4210-universal_c210.dts | 1 + arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 4 + arch/arm/boot/dts/exynos4412-origen.dts | 1 + arch/arm/boot/dts/exynos4412-smdk4412.dts | 1 + arch/arm/boot/dts/exynos4412-tiny4412.dts | 4 + arch/arm/boot/dts/exynos4412-trats2.dts | 1 + drivers/tty/serial/Kconfig | 1 + drivers/tty/serial/samsung.c | 97 +++++++++++++++++++++++++ 11 files changed, 113 insertions(+)--
1.9.2--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Regards, Alim