All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] tty: serial: Add earlycon support to MT8173 SoC
@ 2014-12-18  8:33 ` Eddie Huang
  0 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-18  8:33 UTC (permalink / raw)
  To: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger
  Cc: srv_heupstream, Rob Herring, Pawel Moll, Ian Campbell,
	Kumar Gala, Catalin Marinas, Will Deacon, Jiri Slaby,
	Eddie Huang, Alan Cox, devicetree, linux-arm-kernel,
	linux-kernel, linux-serial, Sascha Hauer, yingjoe.chen, yh.chen

This series add earlycon support to Mediatek MT8173 SoC. Although 8250 driver
already has earlycon support, but Mediatek UART has highspeed register that
not in 8250_early.c, so I port earlycon in 8250_mtk.c, and add stdout device
tree support.

This patchset is based on 3.18, and my basic support for Mediatek MT8173 Soc [1].

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-December/311238.html

Eddie Huang (2):
  tty: serial: 8250_mtk: Add earlycon
  arm64: dts: Add mediatek MT8173 earlycon support

 arch/arm64/boot/dts/mt8173-evb.dts |  4 +++-
 drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

--
1.8.1.1.dirty


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 0/2] tty: serial: Add earlycon support to MT8173 SoC
@ 2014-12-18  8:33 ` Eddie Huang
  0 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-18  8:33 UTC (permalink / raw)
  To: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger
  Cc: srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, Rob Herring, Pawel Moll,
	Ian Campbell, Kumar Gala, Catalin Marinas, Will Deacon,
	Jiri Slaby, Eddie Huang, Alan Cox,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer,
	yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w,
	yh.chen-NuS5LvNUpcJWk0Htik3J/w

This series add earlycon support to Mediatek MT8173 SoC. Although 8250 driver
already has earlycon support, but Mediatek UART has highspeed register that
not in 8250_early.c, so I port earlycon in 8250_mtk.c, and add stdout device
tree support.

This patchset is based on 3.18, and my basic support for Mediatek MT8173 Soc [1].

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-December/311238.html

Eddie Huang (2):
  tty: serial: 8250_mtk: Add earlycon
  arm64: dts: Add mediatek MT8173 earlycon support

 arch/arm64/boot/dts/mt8173-evb.dts |  4 +++-
 drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

--
1.8.1.1.dirty

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 0/2] tty: serial: Add earlycon support to MT8173 SoC
@ 2014-12-18  8:33 ` Eddie Huang
  0 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-18  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

This series add earlycon support to Mediatek MT8173 SoC. Although 8250 driver
already has earlycon support, but Mediatek UART has highspeed register that
not in 8250_early.c, so I port earlycon in 8250_mtk.c, and add stdout device
tree support.

This patchset is based on 3.18, and my basic support for Mediatek MT8173 Soc [1].

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-December/311238.html

Eddie Huang (2):
  tty: serial: 8250_mtk: Add earlycon
  arm64: dts: Add mediatek MT8173 earlycon support

 arch/arm64/boot/dts/mt8173-evb.dts |  4 +++-
 drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

--
1.8.1.1.dirty

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
  2014-12-18  8:33 ` Eddie Huang
  (?)
@ 2014-12-18  8:33   ` Eddie Huang
  -1 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-18  8:33 UTC (permalink / raw)
  To: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger
  Cc: srv_heupstream, Rob Herring, Pawel Moll, Ian Campbell,
	Kumar Gala, Catalin Marinas, Will Deacon, Jiri Slaby,
	Eddie Huang, Alan Cox, devicetree, linux-arm-kernel,
	linux-kernel, linux-serial, Sascha Hauer, yingjoe.chen, yh.chen

Mediatek UART has highspeed register, but 8250_early.c doesn't
support this, so add earlycon in 8250_mtk.c

Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
---
 drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index de7aae5..65dd569 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -23,6 +23,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/serial_8250.h>
 #include <linux/serial_reg.h>
+#include <linux/console.h>
 
 #include "8250.h"
 
@@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
 };
 module_platform_driver(mtk8250_platform_driver);
 
+#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
+
+static void __init mtk8250_serial_putc(struct uart_port *port, int c)
+{
+	while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
+		BOTH_EMPTY)
+		;
+	writel(c, port->membase + (UART_TX << 2));
+}
+
+static void __init early_mtk8250_write(struct console *console,
+					const char *s, unsigned int count)
+{
+	struct earlycon_device *dev = console->data;
+
+	uart_console_write(&dev->port, s, count, mtk8250_serial_putc);
+}
+
+static int __init early_mtk8250_setup(struct earlycon_device *device,
+					const char *options)
+{
+	if (!device->port.membase)
+		return -ENODEV;
+
+	device->con->write = early_mtk8250_write;
+
+	return 0;
+}
+
+EARLYCON_DECLARE(mtk8250, early_mtk8250_setup);
+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


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-18  8:33   ` Eddie Huang
  0 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-18  8:33 UTC (permalink / raw)
  To: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger
  Cc: srv_heupstream, Rob Herring, Pawel Moll, Ian Campbell,
	Kumar Gala, Catalin Marinas, Will Deacon, Jiri Slaby,
	Eddie Huang, Alan Cox, devicetree, linux-arm-kernel,
	linux-kernel, linux-serial, Sascha Hauer, yingjoe.chen, yh.chen

Mediatek UART has highspeed register, but 8250_early.c doesn't
support this, so add earlycon in 8250_mtk.c

Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
---
 drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index de7aae5..65dd569 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -23,6 +23,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/serial_8250.h>
 #include <linux/serial_reg.h>
+#include <linux/console.h>
 
 #include "8250.h"
 
@@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
 };
 module_platform_driver(mtk8250_platform_driver);
 
+#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
+
+static void __init mtk8250_serial_putc(struct uart_port *port, int c)
+{
+	while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
+		BOTH_EMPTY)
+		;
+	writel(c, port->membase + (UART_TX << 2));
+}
+
+static void __init early_mtk8250_write(struct console *console,
+					const char *s, unsigned int count)
+{
+	struct earlycon_device *dev = console->data;
+
+	uart_console_write(&dev->port, s, count, mtk8250_serial_putc);
+}
+
+static int __init early_mtk8250_setup(struct earlycon_device *device,
+					const char *options)
+{
+	if (!device->port.membase)
+		return -ENODEV;
+
+	device->con->write = early_mtk8250_write;
+
+	return 0;
+}
+
+EARLYCON_DECLARE(mtk8250, early_mtk8250_setup);
+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

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-18  8:33   ` Eddie Huang
  0 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-18  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

Mediatek UART has highspeed register, but 8250_early.c doesn't
support this, so add earlycon in 8250_mtk.c

Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
---
 drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index de7aae5..65dd569 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -23,6 +23,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/serial_8250.h>
 #include <linux/serial_reg.h>
+#include <linux/console.h>
 
 #include "8250.h"
 
@@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
 };
 module_platform_driver(mtk8250_platform_driver);
 
+#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
+
+static void __init mtk8250_serial_putc(struct uart_port *port, int c)
+{
+	while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
+		BOTH_EMPTY)
+		;
+	writel(c, port->membase + (UART_TX << 2));
+}
+
+static void __init early_mtk8250_write(struct console *console,
+					const char *s, unsigned int count)
+{
+	struct earlycon_device *dev = console->data;
+
+	uart_console_write(&dev->port, s, count, mtk8250_serial_putc);
+}
+
+static int __init early_mtk8250_setup(struct earlycon_device *device,
+					const char *options)
+{
+	if (!device->port.membase)
+		return -ENODEV;
+
+	device->con->write = early_mtk8250_write;
+
+	return 0;
+}
+
+EARLYCON_DECLARE(mtk8250, early_mtk8250_setup);
+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

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/2] arm64: dts: Add mediatek MT8173 earlycon support
@ 2014-12-18  8:33   ` Eddie Huang
  0 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-18  8:33 UTC (permalink / raw)
  To: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger
  Cc: srv_heupstream, Rob Herring, Pawel Moll, Ian Campbell,
	Kumar Gala, Catalin Marinas, Will Deacon, Jiri Slaby,
	Eddie Huang, Alan Cox, devicetree, linux-arm-kernel,
	linux-kernel, linux-serial, Sascha Hauer, yingjoe.chen, yh.chen

Add earlycon support to mediatek MT8173 evaluation board dts.

Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
---
 arch/arm64/boot/dts/mt8173-evb.dts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mt8173-evb.dts b/arch/arm64/boot/dts/mt8173-evb.dts
index b8b2621..b8802fd 100644
--- a/arch/arm64/boot/dts/mt8173-evb.dts
+++ b/arch/arm64/boot/dts/mt8173-evb.dts
@@ -30,5 +30,7 @@
 		reg = <0 0x40000000 0 0x80000000>;
 	};
 
-	chosen { };
+	chosen {
+		linux,stdout-path = &uart0;
+	};
 };
-- 
1.8.1.1.dirty


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/2] arm64: dts: Add mediatek MT8173 earlycon support
@ 2014-12-18  8:33   ` Eddie Huang
  0 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-18  8:33 UTC (permalink / raw)
  To: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger
  Cc: srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, Rob Herring, Pawel Moll,
	Ian Campbell, Kumar Gala, Catalin Marinas, Will Deacon,
	Jiri Slaby, Eddie Huang, Alan Cox,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer,
	yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w,
	yh.chen-NuS5LvNUpcJWk0Htik3J/w

Add earlycon support to mediatek MT8173 evaluation board dts.

Signed-off-by: Eddie Huang <eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
 arch/arm64/boot/dts/mt8173-evb.dts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mt8173-evb.dts b/arch/arm64/boot/dts/mt8173-evb.dts
index b8b2621..b8802fd 100644
--- a/arch/arm64/boot/dts/mt8173-evb.dts
+++ b/arch/arm64/boot/dts/mt8173-evb.dts
@@ -30,5 +30,7 @@
 		reg = <0 0x40000000 0 0x80000000>;
 	};
 
-	chosen { };
+	chosen {
+		linux,stdout-path = &uart0;
+	};
 };
-- 
1.8.1.1.dirty

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/2] arm64: dts: Add mediatek MT8173 earlycon support
@ 2014-12-18  8:33   ` Eddie Huang
  0 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-18  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

Add earlycon support to mediatek MT8173 evaluation board dts.

Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
---
 arch/arm64/boot/dts/mt8173-evb.dts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mt8173-evb.dts b/arch/arm64/boot/dts/mt8173-evb.dts
index b8b2621..b8802fd 100644
--- a/arch/arm64/boot/dts/mt8173-evb.dts
+++ b/arch/arm64/boot/dts/mt8173-evb.dts
@@ -30,5 +30,7 @@
 		reg = <0 0x40000000 0 0x80000000>;
 	};
 
-	chosen { };
+	chosen {
+		linux,stdout-path = &uart0;
+	};
 };
-- 
1.8.1.1.dirty

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
  2014-12-18  8:33   ` Eddie Huang
@ 2014-12-18  8:48     ` Matthias Brugger
  -1 siblings, 0 replies; 25+ messages in thread
From: Matthias Brugger @ 2014-12-18  8:48 UTC (permalink / raw)
  To: Eddie Huang
  Cc: Mark Rutland, Greg Kroah-Hartman, srv_heupstream, Rob Herring,
	Pawel Moll, Ian Campbell, Kumar Gala, Catalin Marinas,
	Will Deacon, Jiri Slaby, Alan Cox, devicetree, linux-arm-kernel,
	linux-kernel, linux-serial, Sascha Hauer, Yingjoe Chen,
	YH Chen (陳昱豪)

2014-12-18 9:33 GMT+01:00 Eddie Huang <eddie.huang@mediatek.com>:
> Mediatek UART has highspeed register, but 8250_early.c doesn't
> support this, so add earlycon in 8250_mtk.c
>
> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
> ---
>  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> index de7aae5..65dd569 100644
> --- a/drivers/tty/serial/8250/8250_mtk.c
> +++ b/drivers/tty/serial/8250/8250_mtk.c
> @@ -23,6 +23,7 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/serial_8250.h>
>  #include <linux/serial_reg.h>
> +#include <linux/console.h>
>
>  #include "8250.h"
>
> @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
>  };
>  module_platform_driver(mtk8250_platform_driver);
>
> +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
> +
> +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
> +{
> +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
> +               BOTH_EMPTY)
> +               ;

Please delete newline before the semicolon.

> +       writel(c, port->membase + (UART_TX << 2));
> +}
> +
> +static void __init early_mtk8250_write(struct console *console,
> +                                       const char *s, unsigned int count)
> +{
> +       struct earlycon_device *dev = console->data;
> +
> +       uart_console_write(&dev->port, s, count, mtk8250_serial_putc);
> +}
> +
> +static int __init early_mtk8250_setup(struct earlycon_device *device,
> +                                       const char *options)
> +{
> +       if (!device->port.membase)
> +               return -ENODEV;
> +
> +       device->con->write = early_mtk8250_write;
> +
> +       return 0;
> +}
> +
> +EARLYCON_DECLARE(mtk8250, early_mtk8250_setup);
> +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
>



-- 
motzblog.wordpress.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-18  8:48     ` Matthias Brugger
  0 siblings, 0 replies; 25+ messages in thread
From: Matthias Brugger @ 2014-12-18  8:48 UTC (permalink / raw)
  To: linux-arm-kernel

2014-12-18 9:33 GMT+01:00 Eddie Huang <eddie.huang@mediatek.com>:
> Mediatek UART has highspeed register, but 8250_early.c doesn't
> support this, so add earlycon in 8250_mtk.c
>
> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
> ---
>  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> index de7aae5..65dd569 100644
> --- a/drivers/tty/serial/8250/8250_mtk.c
> +++ b/drivers/tty/serial/8250/8250_mtk.c
> @@ -23,6 +23,7 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/serial_8250.h>
>  #include <linux/serial_reg.h>
> +#include <linux/console.h>
>
>  #include "8250.h"
>
> @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
>  };
>  module_platform_driver(mtk8250_platform_driver);
>
> +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
> +
> +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
> +{
> +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
> +               BOTH_EMPTY)
> +               ;

Please delete newline before the semicolon.

> +       writel(c, port->membase + (UART_TX << 2));
> +}
> +
> +static void __init early_mtk8250_write(struct console *console,
> +                                       const char *s, unsigned int count)
> +{
> +       struct earlycon_device *dev = console->data;
> +
> +       uart_console_write(&dev->port, s, count, mtk8250_serial_putc);
> +}
> +
> +static int __init early_mtk8250_setup(struct earlycon_device *device,
> +                                       const char *options)
> +{
> +       if (!device->port.membase)
> +               return -ENODEV;
> +
> +       device->con->write = early_mtk8250_write;
> +
> +       return 0;
> +}
> +
> +EARLYCON_DECLARE(mtk8250, early_mtk8250_setup);
> +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
>



-- 
motzblog.wordpress.com

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
  2014-12-18  8:48     ` Matthias Brugger
@ 2014-12-18  9:12       ` Arnd Bergmann
  -1 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2014-12-18  9:12 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: Eddie Huang, Mark Rutland, Greg Kroah-Hartman, srv_heupstream,
	Rob Herring, Pawel Moll, Ian Campbell, Kumar Gala,
	Catalin Marinas, Will Deacon, Jiri Slaby, Alan Cox, devicetree,
	linux-arm-kernel, linux-kernel, linux-serial, Sascha Hauer,
	Yingjoe Chen, YH Chen (陳昱豪)

On Thursday 18 December 2014 09:48:31 Matthias Brugger wrote:
> > +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
> > +{
> > +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
> > +               BOTH_EMPTY)
> > +               ;
> 
> Please delete newline before the semicolon.
> 

No, that newline is best kept in there for clarity. An even better way
to write this would be using cpu_relax():

	while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) != BOTH_EMPTY)
		cpu_relax();

which the kernel convention for doing busy-loops.

	Arnd

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-18  9:12       ` Arnd Bergmann
  0 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2014-12-18  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 18 December 2014 09:48:31 Matthias Brugger wrote:
> > +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
> > +{
> > +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
> > +               BOTH_EMPTY)
> > +               ;
> 
> Please delete newline before the semicolon.
> 

No, that newline is best kept in there for clarity. An even better way
to write this would be using cpu_relax():

	while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) != BOTH_EMPTY)
		cpu_relax();

which the kernel convention for doing busy-loops.

	Arnd

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-26 21:24     ` Rob Herring
  0 siblings, 0 replies; 25+ messages in thread
From: Rob Herring @ 2014-12-26 21:24 UTC (permalink / raw)
  To: Eddie Huang
  Cc: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger,
	srv_heupstream, Rob Herring, Pawel Moll, Ian Campbell,
	Kumar Gala, Catalin Marinas, Will Deacon, Jiri Slaby, Alan Cox,
	devicetree, linux-arm-kernel, linux-kernel, linux-serial,
	Sascha Hauer, yingjoe.chen, yh.chen

On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang@mediatek.com> wrote:
> Mediatek UART has highspeed register, but 8250_early.c doesn't
> support this, so add earlycon in 8250_mtk.c

I don't see any highspeed register setup here. More generically,
aren't you just skipping any UART setup? That may be useful on other
platforms with 8250s, too. With the kernel command line version, you
could perhaps add a "noinit" flag. The DT case is harder, and I'm not
sure how we should handle that. We could perhaps add a
"stdout-path-initialized" flag to chosen.

>
> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
> ---
>  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> index de7aae5..65dd569 100644
> --- a/drivers/tty/serial/8250/8250_mtk.c
> +++ b/drivers/tty/serial/8250/8250_mtk.c
> @@ -23,6 +23,7 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/serial_8250.h>
>  #include <linux/serial_reg.h>
> +#include <linux/console.h>
>
>  #include "8250.h"
>
> @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
>  };
>  module_platform_driver(mtk8250_platform_driver);
>
> +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
> +
> +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
> +{
> +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
> +               BOTH_EMPTY)
> +               ;
> +       writel(c, port->membase + (UART_TX << 2));
> +}
> +
> +static void __init early_mtk8250_write(struct console *console,
> +                                       const char *s, unsigned int count)

Is there a reason early_serial8250_write can't work for you other than
it is currently static?

Rob

> +{
> +       struct earlycon_device *dev = console->data;
> +
> +       uart_console_write(&dev->port, s, count, mtk8250_serial_putc);
> +}
> +
> +static int __init early_mtk8250_setup(struct earlycon_device *device,
> +                                       const char *options)
> +{
> +       if (!device->port.membase)
> +               return -ENODEV;
> +
> +       device->con->write = early_mtk8250_write;
> +
> +       return 0;
> +}
> +
> +EARLYCON_DECLARE(mtk8250, early_mtk8250_setup);
> +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
>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-26 21:24     ` Rob Herring
  0 siblings, 0 replies; 25+ messages in thread
From: Rob Herring @ 2014-12-26 21:24 UTC (permalink / raw)
  To: Eddie Huang
  Cc: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger,
	srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, Rob Herring, Pawel Moll,
	Ian Campbell, Kumar Gala, Catalin Marinas, Will Deacon,
	Jiri Slaby, Alan Cox, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer,
	yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w,
	yh.chen-NuS5LvNUpcJWk0Htik3J/w

On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
> Mediatek UART has highspeed register, but 8250_early.c doesn't
> support this, so add earlycon in 8250_mtk.c

I don't see any highspeed register setup here. More generically,
aren't you just skipping any UART setup? That may be useful on other
platforms with 8250s, too. With the kernel command line version, you
could perhaps add a "noinit" flag. The DT case is harder, and I'm not
sure how we should handle that. We could perhaps add a
"stdout-path-initialized" flag to chosen.

>
> Signed-off-by: Eddie Huang <eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> index de7aae5..65dd569 100644
> --- a/drivers/tty/serial/8250/8250_mtk.c
> +++ b/drivers/tty/serial/8250/8250_mtk.c
> @@ -23,6 +23,7 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/serial_8250.h>
>  #include <linux/serial_reg.h>
> +#include <linux/console.h>
>
>  #include "8250.h"
>
> @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
>  };
>  module_platform_driver(mtk8250_platform_driver);
>
> +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
> +
> +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
> +{
> +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
> +               BOTH_EMPTY)
> +               ;
> +       writel(c, port->membase + (UART_TX << 2));
> +}
> +
> +static void __init early_mtk8250_write(struct console *console,
> +                                       const char *s, unsigned int count)

Is there a reason early_serial8250_write can't work for you other than
it is currently static?

Rob

> +{
> +       struct earlycon_device *dev = console->data;
> +
> +       uart_console_write(&dev->port, s, count, mtk8250_serial_putc);
> +}
> +
> +static int __init early_mtk8250_setup(struct earlycon_device *device,
> +                                       const char *options)
> +{
> +       if (!device->port.membase)
> +               return -ENODEV;
> +
> +       device->con->write = early_mtk8250_write;
> +
> +       return 0;
> +}
> +
> +EARLYCON_DECLARE(mtk8250, early_mtk8250_setup);
> +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
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-26 21:24     ` Rob Herring
  0 siblings, 0 replies; 25+ messages in thread
From: Rob Herring @ 2014-12-26 21:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang@mediatek.com> wrote:
> Mediatek UART has highspeed register, but 8250_early.c doesn't
> support this, so add earlycon in 8250_mtk.c

I don't see any highspeed register setup here. More generically,
aren't you just skipping any UART setup? That may be useful on other
platforms with 8250s, too. With the kernel command line version, you
could perhaps add a "noinit" flag. The DT case is harder, and I'm not
sure how we should handle that. We could perhaps add a
"stdout-path-initialized" flag to chosen.

>
> Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
> ---
>  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> index de7aae5..65dd569 100644
> --- a/drivers/tty/serial/8250/8250_mtk.c
> +++ b/drivers/tty/serial/8250/8250_mtk.c
> @@ -23,6 +23,7 @@
>  #include <linux/pm_runtime.h>
>  #include <linux/serial_8250.h>
>  #include <linux/serial_reg.h>
> +#include <linux/console.h>
>
>  #include "8250.h"
>
> @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
>  };
>  module_platform_driver(mtk8250_platform_driver);
>
> +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
> +
> +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
> +{
> +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
> +               BOTH_EMPTY)
> +               ;
> +       writel(c, port->membase + (UART_TX << 2));
> +}
> +
> +static void __init early_mtk8250_write(struct console *console,
> +                                       const char *s, unsigned int count)

Is there a reason early_serial8250_write can't work for you other than
it is currently static?

Rob

> +{
> +       struct earlycon_device *dev = console->data;
> +
> +       uart_console_write(&dev->port, s, count, mtk8250_serial_putc);
> +}
> +
> +static int __init early_mtk8250_setup(struct earlycon_device *device,
> +                                       const char *options)
> +{
> +       if (!device->port.membase)
> +               return -ENODEV;
> +
> +       device->con->write = early_mtk8250_write;
> +
> +       return 0;
> +}
> +
> +EARLYCON_DECLARE(mtk8250, early_mtk8250_setup);
> +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
>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
  2014-12-26 21:24     ` Rob Herring
  (?)
@ 2014-12-29  4:24       ` Eddie Huang
  -1 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-29  4:24 UTC (permalink / raw)
  To: Rob Herring
  Cc: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger,
	srv_heupstream, Rob Herring, Pawel Moll, Ian Campbell,
	Kumar Gala, Catalin Marinas, Will Deacon, Jiri Slaby, Alan Cox,
	devicetree, linux-arm-kernel, linux-kernel, linux-serial,
	Sascha Hauer, yingjoe.chen, yh.chen

Hi Rob,

On Fri, 2014-12-26 at 15:24 -0600, Rob Herring wrote:
> On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang@mediatek.com> wrote:
> > Mediatek UART has highspeed register, but 8250_early.c doesn't
> > support this, so add earlycon in 8250_mtk.c
> 
> I don't see any highspeed register setup here. More generically,
> aren't you just skipping any UART setup? That may be useful on other
> platforms with 8250s, too. With the kernel command line version, you
> could perhaps add a "noinit" flag. The DT case is harder, and I'm not
> sure how we should handle that. We could perhaps add a
> "stdout-path-initialized" flag to chosen.
> 

Yes, I skipped UART setup same as msm_serial.c and amba-pl011.c
(although they are standalone serial driver). Just like earlyprintk, I
think earlycon should reuse UART setting in loader. Since some other
platforms with 8250 already depend on this, it's ok to add flags to
distinguish whether 8250 earlycon driver should init hw or not. As you
said, add "noinit" flag is simple, but "stdout-path-initialized" need
more discussion. 

> >
> > Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
> > ---
> >  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> >
> > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> > index de7aae5..65dd569 100644
> > --- a/drivers/tty/serial/8250/8250_mtk.c
> > +++ b/drivers/tty/serial/8250/8250_mtk.c
> > @@ -23,6 +23,7 @@
> >  #include <linux/pm_runtime.h>
> >  #include <linux/serial_8250.h>
> >  #include <linux/serial_reg.h>
> > +#include <linux/console.h>
> >
> >  #include "8250.h"
> >
> > @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
> >  };
> >  module_platform_driver(mtk8250_platform_driver);
> >
> > +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
> > +
> > +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
> > +{
> > +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
> > +               BOTH_EMPTY)
> > +               ;
> > +       writel(c, port->membase + (UART_TX << 2));
> > +}
> > +
> > +static void __init early_mtk8250_write(struct console *console,
> > +                                       const char *s, unsigned int count)
> 
> Is there a reason early_serial8250_write can't work for you other than
> it is currently static?
> 
> Rob
> 

The reason is only static. I want to keep 8250_early.c untouchable, all
modifications in 8250_mtk.c



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-29  4:24       ` Eddie Huang
  0 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-29  4:24 UTC (permalink / raw)
  To: Rob Herring
  Cc: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger,
	srv_heupstream, Rob Herring, Pawel Moll, Ian Campbell,
	Kumar Gala, Catalin Marinas, Will Deacon, Jiri Slaby, Alan Cox,
	devicetree, linux-arm-kernel, linux-kernel, linux-serial,
	Sascha Hauer, yingjoe.chen, yh.chen

Hi Rob,

On Fri, 2014-12-26 at 15:24 -0600, Rob Herring wrote:
> On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang@mediatek.com> wrote:
> > Mediatek UART has highspeed register, but 8250_early.c doesn't
> > support this, so add earlycon in 8250_mtk.c
> 
> I don't see any highspeed register setup here. More generically,
> aren't you just skipping any UART setup? That may be useful on other
> platforms with 8250s, too. With the kernel command line version, you
> could perhaps add a "noinit" flag. The DT case is harder, and I'm not
> sure how we should handle that. We could perhaps add a
> "stdout-path-initialized" flag to chosen.
> 

Yes, I skipped UART setup same as msm_serial.c and amba-pl011.c
(although they are standalone serial driver). Just like earlyprintk, I
think earlycon should reuse UART setting in loader. Since some other
platforms with 8250 already depend on this, it's ok to add flags to
distinguish whether 8250 earlycon driver should init hw or not. As you
said, add "noinit" flag is simple, but "stdout-path-initialized" need
more discussion. 

> >
> > Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
> > ---
> >  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> >
> > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> > index de7aae5..65dd569 100644
> > --- a/drivers/tty/serial/8250/8250_mtk.c
> > +++ b/drivers/tty/serial/8250/8250_mtk.c
> > @@ -23,6 +23,7 @@
> >  #include <linux/pm_runtime.h>
> >  #include <linux/serial_8250.h>
> >  #include <linux/serial_reg.h>
> > +#include <linux/console.h>
> >
> >  #include "8250.h"
> >
> > @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
> >  };
> >  module_platform_driver(mtk8250_platform_driver);
> >
> > +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
> > +
> > +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
> > +{
> > +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
> > +               BOTH_EMPTY)
> > +               ;
> > +       writel(c, port->membase + (UART_TX << 2));
> > +}
> > +
> > +static void __init early_mtk8250_write(struct console *console,
> > +                                       const char *s, unsigned int count)
> 
> Is there a reason early_serial8250_write can't work for you other than
> it is currently static?
> 
> Rob
> 

The reason is only static. I want to keep 8250_early.c untouchable, all
modifications in 8250_mtk.c

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-29  4:24       ` Eddie Huang
  0 siblings, 0 replies; 25+ messages in thread
From: Eddie Huang @ 2014-12-29  4:24 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Rob,

On Fri, 2014-12-26 at 15:24 -0600, Rob Herring wrote:
> On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang@mediatek.com> wrote:
> > Mediatek UART has highspeed register, but 8250_early.c doesn't
> > support this, so add earlycon in 8250_mtk.c
> 
> I don't see any highspeed register setup here. More generically,
> aren't you just skipping any UART setup? That may be useful on other
> platforms with 8250s, too. With the kernel command line version, you
> could perhaps add a "noinit" flag. The DT case is harder, and I'm not
> sure how we should handle that. We could perhaps add a
> "stdout-path-initialized" flag to chosen.
> 

Yes, I skipped UART setup same as msm_serial.c and amba-pl011.c
(although they are standalone serial driver). Just like earlyprintk, I
think earlycon should reuse UART setting in loader. Since some other
platforms with 8250 already depend on this, it's ok to add flags to
distinguish whether 8250 earlycon driver should init hw or not. As you
said, add "noinit" flag is simple, but "stdout-path-initialized" need
more discussion. 

> >
> > Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
> > ---
> >  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> >
> > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> > index de7aae5..65dd569 100644
> > --- a/drivers/tty/serial/8250/8250_mtk.c
> > +++ b/drivers/tty/serial/8250/8250_mtk.c
> > @@ -23,6 +23,7 @@
> >  #include <linux/pm_runtime.h>
> >  #include <linux/serial_8250.h>
> >  #include <linux/serial_reg.h>
> > +#include <linux/console.h>
> >
> >  #include "8250.h"
> >
> > @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
> >  };
> >  module_platform_driver(mtk8250_platform_driver);
> >
> > +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
> > +
> > +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
> > +{
> > +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
> > +               BOTH_EMPTY)
> > +               ;
> > +       writel(c, port->membase + (UART_TX << 2));
> > +}
> > +
> > +static void __init early_mtk8250_write(struct console *console,
> > +                                       const char *s, unsigned int count)
> 
> Is there a reason early_serial8250_write can't work for you other than
> it is currently static?
> 
> Rob
> 

The reason is only static. I want to keep 8250_early.c untouchable, all
modifications in 8250_mtk.c

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
  2014-12-29  4:24       ` Eddie Huang
  (?)
@ 2014-12-29 14:54         ` Rob Herring
  -1 siblings, 0 replies; 25+ messages in thread
From: Rob Herring @ 2014-12-29 14:54 UTC (permalink / raw)
  To: Eddie Huang
  Cc: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger,
	srv_heupstream, Rob Herring, Pawel Moll, Ian Campbell,
	Kumar Gala, Catalin Marinas, Will Deacon, Jiri Slaby, Alan Cox,
	devicetree, linux-arm-kernel, linux-kernel, linux-serial,
	Sascha Hauer, Yingjoe Chen, yh.chen

On Sun, Dec 28, 2014 at 10:24 PM, Eddie Huang <eddie.huang@mediatek.com> wrote:
> Hi Rob,
>
> On Fri, 2014-12-26 at 15:24 -0600, Rob Herring wrote:
>> On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang@mediatek.com> wrote:
>> > Mediatek UART has highspeed register, but 8250_early.c doesn't
>> > support this, so add earlycon in 8250_mtk.c
>>
>> I don't see any highspeed register setup here. More generically,
>> aren't you just skipping any UART setup? That may be useful on other
>> platforms with 8250s, too. With the kernel command line version, you
>> could perhaps add a "noinit" flag. The DT case is harder, and I'm not
>> sure how we should handle that. We could perhaps add a
>> "stdout-path-initialized" flag to chosen.
>>
>
> Yes, I skipped UART setup same as msm_serial.c and amba-pl011.c
> (although they are standalone serial driver). Just like earlyprintk, I
> think earlycon should reuse UART setting in loader. Since some other
> platforms with 8250 already depend on this, it's ok to add flags to
> distinguish whether 8250 earlycon driver should init hw or not. As you
> said, add "noinit" flag is simple, but "stdout-path-initialized" need
> more discussion.
>
>> >
>> > Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
>> > ---
>> >  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
>> >  1 file changed, 33 insertions(+)
>> >
>> > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
>> > index de7aae5..65dd569 100644
>> > --- a/drivers/tty/serial/8250/8250_mtk.c
>> > +++ b/drivers/tty/serial/8250/8250_mtk.c
>> > @@ -23,6 +23,7 @@
>> >  #include <linux/pm_runtime.h>
>> >  #include <linux/serial_8250.h>
>> >  #include <linux/serial_reg.h>
>> > +#include <linux/console.h>
>> >
>> >  #include "8250.h"
>> >
>> > @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
>> >  };
>> >  module_platform_driver(mtk8250_platform_driver);
>> >
>> > +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
>> > +
>> > +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
>> > +{
>> > +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
>> > +               BOTH_EMPTY)
>> > +               ;
>> > +       writel(c, port->membase + (UART_TX << 2));
>> > +}
>> > +
>> > +static void __init early_mtk8250_write(struct console *console,
>> > +                                       const char *s, unsigned int count)
>>
>> Is there a reason early_serial8250_write can't work for you other than
>> it is currently static?
>>
>> Rob
>>
>
> The reason is only static. I want to keep 8250_early.c untouchable, all
> modifications in 8250_mtk.c

That is not how kernel development works. You should fix 8250_early.c
to do what you need rather than duplicating code.

Rob

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-29 14:54         ` Rob Herring
  0 siblings, 0 replies; 25+ messages in thread
From: Rob Herring @ 2014-12-29 14:54 UTC (permalink / raw)
  To: Eddie Huang
  Cc: Mark Rutland, Greg Kroah-Hartman, Matthias Brugger,
	srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, Rob Herring, Pawel Moll,
	Ian Campbell, Kumar Gala, Catalin Marinas, Will Deacon,
	Jiri Slaby, Alan Cox, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer, Yingjoe Chen,
	yh.chen-NuS5LvNUpcJWk0Htik3J/w

On Sun, Dec 28, 2014 at 10:24 PM, Eddie Huang <eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
> Hi Rob,
>
> On Fri, 2014-12-26 at 15:24 -0600, Rob Herring wrote:
>> On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
>> > Mediatek UART has highspeed register, but 8250_early.c doesn't
>> > support this, so add earlycon in 8250_mtk.c
>>
>> I don't see any highspeed register setup here. More generically,
>> aren't you just skipping any UART setup? That may be useful on other
>> platforms with 8250s, too. With the kernel command line version, you
>> could perhaps add a "noinit" flag. The DT case is harder, and I'm not
>> sure how we should handle that. We could perhaps add a
>> "stdout-path-initialized" flag to chosen.
>>
>
> Yes, I skipped UART setup same as msm_serial.c and amba-pl011.c
> (although they are standalone serial driver). Just like earlyprintk, I
> think earlycon should reuse UART setting in loader. Since some other
> platforms with 8250 already depend on this, it's ok to add flags to
> distinguish whether 8250 earlycon driver should init hw or not. As you
> said, add "noinit" flag is simple, but "stdout-path-initialized" need
> more discussion.
>
>> >
>> > Signed-off-by: Eddie Huang <eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
>> > ---
>> >  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
>> >  1 file changed, 33 insertions(+)
>> >
>> > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
>> > index de7aae5..65dd569 100644
>> > --- a/drivers/tty/serial/8250/8250_mtk.c
>> > +++ b/drivers/tty/serial/8250/8250_mtk.c
>> > @@ -23,6 +23,7 @@
>> >  #include <linux/pm_runtime.h>
>> >  #include <linux/serial_8250.h>
>> >  #include <linux/serial_reg.h>
>> > +#include <linux/console.h>
>> >
>> >  #include "8250.h"
>> >
>> > @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
>> >  };
>> >  module_platform_driver(mtk8250_platform_driver);
>> >
>> > +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
>> > +
>> > +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
>> > +{
>> > +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
>> > +               BOTH_EMPTY)
>> > +               ;
>> > +       writel(c, port->membase + (UART_TX << 2));
>> > +}
>> > +
>> > +static void __init early_mtk8250_write(struct console *console,
>> > +                                       const char *s, unsigned int count)
>>
>> Is there a reason early_serial8250_write can't work for you other than
>> it is currently static?
>>
>> Rob
>>
>
> The reason is only static. I want to keep 8250_early.c untouchable, all
> modifications in 8250_mtk.c

That is not how kernel development works. You should fix 8250_early.c
to do what you need rather than duplicating code.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-29 14:54         ` Rob Herring
  0 siblings, 0 replies; 25+ messages in thread
From: Rob Herring @ 2014-12-29 14:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Dec 28, 2014 at 10:24 PM, Eddie Huang <eddie.huang@mediatek.com> wrote:
> Hi Rob,
>
> On Fri, 2014-12-26 at 15:24 -0600, Rob Herring wrote:
>> On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang@mediatek.com> wrote:
>> > Mediatek UART has highspeed register, but 8250_early.c doesn't
>> > support this, so add earlycon in 8250_mtk.c
>>
>> I don't see any highspeed register setup here. More generically,
>> aren't you just skipping any UART setup? That may be useful on other
>> platforms with 8250s, too. With the kernel command line version, you
>> could perhaps add a "noinit" flag. The DT case is harder, and I'm not
>> sure how we should handle that. We could perhaps add a
>> "stdout-path-initialized" flag to chosen.
>>
>
> Yes, I skipped UART setup same as msm_serial.c and amba-pl011.c
> (although they are standalone serial driver). Just like earlyprintk, I
> think earlycon should reuse UART setting in loader. Since some other
> platforms with 8250 already depend on this, it's ok to add flags to
> distinguish whether 8250 earlycon driver should init hw or not. As you
> said, add "noinit" flag is simple, but "stdout-path-initialized" need
> more discussion.
>
>> >
>> > Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
>> > ---
>> >  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
>> >  1 file changed, 33 insertions(+)
>> >
>> > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
>> > index de7aae5..65dd569 100644
>> > --- a/drivers/tty/serial/8250/8250_mtk.c
>> > +++ b/drivers/tty/serial/8250/8250_mtk.c
>> > @@ -23,6 +23,7 @@
>> >  #include <linux/pm_runtime.h>
>> >  #include <linux/serial_8250.h>
>> >  #include <linux/serial_reg.h>
>> > +#include <linux/console.h>
>> >
>> >  #include "8250.h"
>> >
>> > @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
>> >  };
>> >  module_platform_driver(mtk8250_platform_driver);
>> >
>> > +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
>> > +
>> > +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
>> > +{
>> > +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
>> > +               BOTH_EMPTY)
>> > +               ;
>> > +       writel(c, port->membase + (UART_TX << 2));
>> > +}
>> > +
>> > +static void __init early_mtk8250_write(struct console *console,
>> > +                                       const char *s, unsigned int count)
>>
>> Is there a reason early_serial8250_write can't work for you other than
>> it is currently static?
>>
>> Rob
>>
>
> The reason is only static. I want to keep 8250_early.c untouchable, all
> modifications in 8250_mtk.c

That is not how kernel development works. You should fix 8250_early.c
to do what you need rather than duplicating code.

Rob

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
  2014-12-29  4:24       ` Eddie Huang
  (?)
@ 2014-12-29 19:08         ` Arnd Bergmann
  -1 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2014-12-29 19:08 UTC (permalink / raw)
  To: Eddie Huang
  Cc: Rob Herring, Mark Rutland, Greg Kroah-Hartman, Matthias Brugger,
	srv_heupstream, Rob Herring, Pawel Moll, Ian Campbell,
	Kumar Gala, Catalin Marinas, Will Deacon, Jiri Slaby, Alan Cox,
	devicetree, linux-arm-kernel, linux-kernel, linux-serial,
	Sascha Hauer, yingjoe.chen, yh.chen

On Monday 29 December 2014 12:24:56 Eddie Huang wrote:
> Hi Rob,
> 
> On Fri, 2014-12-26 at 15:24 -0600, Rob Herring wrote:
> > On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang@mediatek.com> wrote:
> > > Mediatek UART has highspeed register, but 8250_early.c doesn't
> > > support this, so add earlycon in 8250_mtk.c
> > 
> > I don't see any highspeed register setup here. More generically,
> > aren't you just skipping any UART setup? That may be useful on other
> > platforms with 8250s, too. With the kernel command line version, you
> > could perhaps add a "noinit" flag. The DT case is harder, and I'm not
> > sure how we should handle that. We could perhaps add a
> > "stdout-path-initialized" flag to chosen.
> > 
> 
> Yes, I skipped UART setup same as msm_serial.c and amba-pl011.c
> (although they are standalone serial driver). Just like earlyprintk, I
> think earlycon should reuse UART setting in loader. Since some other
> platforms with 8250 already depend on this, it's ok to add flags to
> distinguish whether 8250 earlycon driver should init hw or not. As you
> said, add "noinit" flag is simple, but "stdout-path-initialized" need
> more discussion. 

It would definitely be nice to have consistent behavior, and I also
think it would be good to default to noinit for the console, because that
is the more likely case. Basically anything that can do debug_ll on ARM
already depends on this behavior because the debug_ll infrastructure
does not initialize the console before using it. I believe the same
is true for powerpc udbg.

	Arnd

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-29 19:08         ` Arnd Bergmann
  0 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2014-12-29 19:08 UTC (permalink / raw)
  To: Eddie Huang
  Cc: Rob Herring, Mark Rutland, Greg Kroah-Hartman, Matthias Brugger,
	srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, Rob Herring, Pawel Moll,
	Ian Campbell, Kumar Gala, Catalin Marinas, Will Deacon,
	Jiri Slaby, Alan Cox, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, Sascha Hauer,
	yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w,
	yh.chen-NuS5LvNUpcJWk0Htik3J/w

On Monday 29 December 2014 12:24:56 Eddie Huang wrote:
> Hi Rob,
> 
> On Fri, 2014-12-26 at 15:24 -0600, Rob Herring wrote:
> > On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
> > > Mediatek UART has highspeed register, but 8250_early.c doesn't
> > > support this, so add earlycon in 8250_mtk.c
> > 
> > I don't see any highspeed register setup here. More generically,
> > aren't you just skipping any UART setup? That may be useful on other
> > platforms with 8250s, too. With the kernel command line version, you
> > could perhaps add a "noinit" flag. The DT case is harder, and I'm not
> > sure how we should handle that. We could perhaps add a
> > "stdout-path-initialized" flag to chosen.
> > 
> 
> Yes, I skipped UART setup same as msm_serial.c and amba-pl011.c
> (although they are standalone serial driver). Just like earlyprintk, I
> think earlycon should reuse UART setting in loader. Since some other
> platforms with 8250 already depend on this, it's ok to add flags to
> distinguish whether 8250 earlycon driver should init hw or not. As you
> said, add "noinit" flag is simple, but "stdout-path-initialized" need
> more discussion. 

It would definitely be nice to have consistent behavior, and I also
think it would be good to default to noinit for the console, because that
is the more likely case. Basically anything that can do debug_ll on ARM
already depends on this behavior because the debug_ll infrastructure
does not initialize the console before using it. I believe the same
is true for powerpc udbg.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
@ 2014-12-29 19:08         ` Arnd Bergmann
  0 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2014-12-29 19:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 29 December 2014 12:24:56 Eddie Huang wrote:
> Hi Rob,
> 
> On Fri, 2014-12-26 at 15:24 -0600, Rob Herring wrote:
> > On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang@mediatek.com> wrote:
> > > Mediatek UART has highspeed register, but 8250_early.c doesn't
> > > support this, so add earlycon in 8250_mtk.c
> > 
> > I don't see any highspeed register setup here. More generically,
> > aren't you just skipping any UART setup? That may be useful on other
> > platforms with 8250s, too. With the kernel command line version, you
> > could perhaps add a "noinit" flag. The DT case is harder, and I'm not
> > sure how we should handle that. We could perhaps add a
> > "stdout-path-initialized" flag to chosen.
> > 
> 
> Yes, I skipped UART setup same as msm_serial.c and amba-pl011.c
> (although they are standalone serial driver). Just like earlyprintk, I
> think earlycon should reuse UART setting in loader. Since some other
> platforms with 8250 already depend on this, it's ok to add flags to
> distinguish whether 8250 earlycon driver should init hw or not. As you
> said, add "noinit" flag is simple, but "stdout-path-initialized" need
> more discussion. 

It would definitely be nice to have consistent behavior, and I also
think it would be good to default to noinit for the console, because that
is the more likely case. Basically anything that can do debug_ll on ARM
already depends on this behavior because the debug_ll infrastructure
does not initialize the console before using it. I believe the same
is true for powerpc udbg.

	Arnd

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2014-12-29 19:10 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-18  8:33 [PATCH 0/2] tty: serial: Add earlycon support to MT8173 SoC Eddie Huang
2014-12-18  8:33 ` Eddie Huang
2014-12-18  8:33 ` Eddie Huang
2014-12-18  8:33 ` [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon Eddie Huang
2014-12-18  8:33   ` Eddie Huang
2014-12-18  8:33   ` Eddie Huang
2014-12-18  8:48   ` Matthias Brugger
2014-12-18  8:48     ` Matthias Brugger
2014-12-18  9:12     ` Arnd Bergmann
2014-12-18  9:12       ` Arnd Bergmann
2014-12-26 21:24   ` Rob Herring
2014-12-26 21:24     ` Rob Herring
2014-12-26 21:24     ` Rob Herring
2014-12-29  4:24     ` Eddie Huang
2014-12-29  4:24       ` Eddie Huang
2014-12-29  4:24       ` Eddie Huang
2014-12-29 14:54       ` Rob Herring
2014-12-29 14:54         ` Rob Herring
2014-12-29 14:54         ` Rob Herring
2014-12-29 19:08       ` Arnd Bergmann
2014-12-29 19:08         ` Arnd Bergmann
2014-12-29 19:08         ` Arnd Bergmann
2014-12-18  8:33 ` [PATCH 2/2] arm64: dts: Add mediatek MT8173 earlycon support Eddie Huang
2014-12-18  8:33   ` Eddie Huang
2014-12-18  8:33   ` Eddie Huang

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.