2015-04-28 13:41:00

by Eddie Huang (黃智傑)

[permalink] [raw]
Subject: [PATCH v3 0/3] tty: serial: Add earlycon support to MT8173 SoC

This patch add earlycon support to MT8173 SoC platform.
To use earlycon, need
1. Add earlycon in boot parameters
2. Add "linux,sdtout-path" property in device tree file

This patch based on 4.1-rc1.

Change in v3:
Remove noinit options, not necessary, because 8250_early.c will not init hardware
if not provide baudrate.

Change v2:
1. Add noinit options.
2. Remove duplicate code in 8250_mtk.c, reuse the 8250_early.c existed function.

Eddie Huang (3):
tty: serial: 8250: export early_serial8250_setup function
tty: serial: 8250_mtk: Add earlycon
arm64: dts: Add mediatek MT8173 earlycon support

arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 4 +++-
drivers/tty/serial/8250/8250_early.c | 2 +-
drivers/tty/serial/8250/8250_mtk.c | 13 +++++++++++++
include/linux/serial_8250.h | 2 ++
4 files changed, 19 insertions(+), 2 deletions(-)

--
1.8.1.1.dirty


2015-04-28 13:41:03

by Eddie Huang (黃智傑)

[permalink] [raw]
Subject: [PATCH v3 1/3] tty: serial: 8250: export early_serial8250_setup function

8250-like uart driver may call early_serial8250_setup to
reuse 8250_early.c character output function.

Signed-off-by: Eddie Huang <[email protected]>
---
drivers/tty/serial/8250/8250_early.c | 2 +-
include/linux/serial_8250.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index 6c0fd8b..771dda2 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -131,7 +131,7 @@ static void __init init_port(struct earlycon_device *device)
serial8250_early_out(port, UART_LCR, c & ~UART_LCR_DLAB);
}

-static int __init early_serial8250_setup(struct earlycon_device *device,
+int __init early_serial8250_setup(struct earlycon_device *device,
const char *options)
{
if (!(device->port.membase || device->port.iobase))
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 78097e7..f0c68d8 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -137,6 +137,8 @@ extern int early_serial_setup(struct uart_port *port);

extern unsigned int serial8250_early_in(struct uart_port *port, int offset);
extern void serial8250_early_out(struct uart_port *port, int offset, int value);
+extern int early_serial8250_setup(struct earlycon_device *device,
+ const char *options);
extern void serial8250_do_set_termios(struct uart_port *port,
struct ktermios *termios, struct ktermios *old);
extern int serial8250_do_startup(struct uart_port *port);
--
1.8.1.1.dirty

2015-04-28 13:41:59

by Eddie Huang (黃智傑)

[permalink] [raw]
Subject: [PATCH v3 2/3] tty: serial: 8250_mtk: Add earlycon

Add 8250 MTK UART driver to support earlycon device tree.
Earlycon take effect by
add "earlycon" in kernel boot argument
add "linux,sdtout-path" property in device tree file

Signed-off-by: Eddie Huang <[email protected]>
---
drivers/tty/serial/8250/8250_mtk.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index 7a11fac..8b2a666 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -289,6 +289,19 @@ static struct platform_driver mtk8250_platform_driver = {
};
module_platform_driver(mtk8250_platform_driver);

+static int __init early_mtk8250_setup(struct earlycon_device *device,
+ const char *options)
+{
+ if (!device->port.membase)
+ return -ENODEV;
+
+ device->port.iotype = UPIO_MEM32;
+
+ return early_serial8250_setup(device, NULL);
+}
+
+OF_EARLYCON_DECLARE(mtk8250, "mediatek,mt6577-uart", early_mtk8250_setup);
+
MODULE_AUTHOR("Matthias Brugger");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Mediatek 8250 serial port driver");
--
1.8.1.1.dirty

2015-04-28 13:41:28

by Eddie Huang (黃智傑)

[permalink] [raw]
Subject: [PATCH v3 3/3] arm64: dts: Add mediatek MT8173 earlycon support

Add earlycon support to mediatek MT8173 evaluation board dts.

Signed-off-by: Eddie Huang <[email protected]>
---
arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
index 43d5401..d4cf751 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
@@ -30,7 +30,9 @@
reg = <0 0x40000000 0 0x80000000>;
};

- chosen { };
+ chosen {
+ linux,stdout-path = &uart0;
+ };
};

&uart0 {
--
1.8.1.1.dirty

2015-04-29 06:45:25

by Sascha Hauer

[permalink] [raw]
Subject: Re: [PATCH v3 3/3] arm64: dts: Add mediatek MT8173 earlycon support

Hi Eddie,

On Tue, Apr 28, 2015 at 09:40:34PM +0800, Eddie Huang wrote:
> Add earlycon support to mediatek MT8173 evaluation board dts.

This is not about earlycon support. It adds the stdout-path property
which is generally about console. It only happens to used for earlycon,
but would be used as a regular console aswell if it wasn't broken for
some kernel revisisions.

>
> - chosen { };
> + chosen {
> + linux,stdout-path = &uart0;
> + };

Please use stdout-path, without the 'linux,'.

Sascha

--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2015-04-29 06:46:23

by Sascha Hauer

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] tty: serial: Add earlycon support to MT8173 SoC

On Tue, Apr 28, 2015 at 09:40:31PM +0800, Eddie Huang wrote:
> This patch add earlycon support to MT8173 SoC platform.
> To use earlycon, need
> 1. Add earlycon in boot parameters
> 2. Add "linux,sdtout-path" property in device tree file
>
> This patch based on 4.1-rc1.
>
> Change in v3:
> Remove noinit options, not necessary, because 8250_early.c will not init hardware
> if not provide baudrate.
>
> Change v2:
> 1. Add noinit options.
> 2. Remove duplicate code in 8250_mtk.c, reuse the 8250_early.c existed function.
>
> Eddie Huang (3):
> tty: serial: 8250: export early_serial8250_setup function
> tty: serial: 8250_mtk: Add earlycon
> arm64: dts: Add mediatek MT8173 earlycon support

Works fine here:

Tested-by: Sascha Hauer <[email protected]>

Sascha


--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2015-04-29 08:19:14

by Vineet Gupta

[permalink] [raw]
Subject: Re: [PATCH v3 3/3] arm64: dts: Add mediatek MT8173 earlycon support

On Wednesday 29 April 2015 12:15 PM, Sascha Hauer wrote:
> Hi Eddie,
>
> On Tue, Apr 28, 2015 at 09:40:34PM +0800, Eddie Huang wrote:
>> Add earlycon support to mediatek MT8173 evaluation board dts.
> This is not about earlycon support. It adds the stdout-path property
> which is generally about console.

Indeed, this is shorter way of specifying the default console by referring to uart
device.

> It only happens to used for earlycon,
> but would be used as a regular console aswell if it wasn't broken for
> some kernel revisisions.

Really - I'm confused. When I last tried this for arc_uart (in 3.17 time frame),
it would setup default console, but to use it for earlycon we needed
bootargs=earlycon in chosen. However I had to revet that change since OF core
still was fixing a few things in that area.

See mainline 22524b02b17b901f28 ("Revert "ARC: [arcfpga] stdout-path now suffices
for earlycon/console"")

-Vineet

>
>>
>> - chosen { };
>> + chosen {
>> + linux,stdout-path = &uart0;
>> + };
> Please use stdout-path, without the 'linux,'.
>
> Sascha
>