All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Add of helper for linux,stdout-path
@ 2012-10-05 16:12 ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:12 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Grant Likely, Rob Herring,
	linux-kernel, devicetree-discuss, linux-arm-kernel

This adds a helper function to match the linux,stdout-path property
against a struct device and adds support for this property to the i.MX
serial driver.

Sascha

----------------------------------------------------------------
Sascha Hauer (3):
      serial_core: Add helper for matching against linux,stdout-path
      serial: i.MX: Make console support non optional
      serial: i.MX: evaluate linux,stdout-path property

 drivers/tty/serial/Kconfig       |   16 +---------------
 drivers/tty/serial/imx.c         |   11 ++++-------
 drivers/tty/serial/serial_core.c |   30 ++++++++++++++++++++++++++++++
 include/linux/serial_core.h      |    3 +++
 4 files changed, 38 insertions(+), 22 deletions(-)

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

* [PATCH v2] Add of helper for linux,stdout-path
@ 2012-10-05 16:12 ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:12 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Grant Likely, Rob Herring,
	linux-kernel, devicetree-discuss, linux-arm-kernel

This adds a helper function to match the linux,stdout-path property
against a struct device and adds support for this property to the i.MX
serial driver.

Sascha

----------------------------------------------------------------
Sascha Hauer (3):
      serial_core: Add helper for matching against linux,stdout-path
      serial: i.MX: Make console support non optional
      serial: i.MX: evaluate linux,stdout-path property

 drivers/tty/serial/Kconfig       |   16 +---------------
 drivers/tty/serial/imx.c         |   11 ++++-------
 drivers/tty/serial/serial_core.c |   30 ++++++++++++++++++++++++++++++
 include/linux/serial_core.h      |    3 +++
 4 files changed, 38 insertions(+), 22 deletions(-)

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

* [PATCH v2] Add of helper for linux,stdout-path
@ 2012-10-05 16:12 ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:12 UTC (permalink / raw)
  To: linux-arm-kernel

This adds a helper function to match the linux,stdout-path property
against a struct device and adds support for this property to the i.MX
serial driver.

Sascha

----------------------------------------------------------------
Sascha Hauer (3):
      serial_core: Add helper for matching against linux,stdout-path
      serial: i.MX: Make console support non optional
      serial: i.MX: evaluate linux,stdout-path property

 drivers/tty/serial/Kconfig       |   16 +---------------
 drivers/tty/serial/imx.c         |   11 ++++-------
 drivers/tty/serial/serial_core.c |   30 ++++++++++++++++++++++++++++++
 include/linux/serial_core.h      |    3 +++
 4 files changed, 38 insertions(+), 22 deletions(-)

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

* [PATCH 1/3] serial_core: Add helper for matching against linux,stdout-path
  2012-10-05 16:12 ` Sascha Hauer
  (?)
@ 2012-10-05 16:12   ` Sascha Hauer
  -1 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:12 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Grant Likely, Rob Herring,
	linux-kernel, devicetree-discuss, linux-arm-kernel, Sascha Hauer

devicetrees may have a linux,stdout-path property in the chosen
node describing the console device. This adds a helper function
to match a device against this property so a driver can call
add_preferred_console for a matching device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/serial_core.c |   30 ++++++++++++++++++++++++++++++
 include/linux/serial_core.h      |    3 +++
 2 files changed, 33 insertions(+)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index a21dc8e..f4a9f26 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -33,6 +33,7 @@
 #include <linux/serial_core.h>
 #include <linux/delay.h>
 #include <linux/mutex.h>
+#include <linux/of.h>
 
 #include <asm/irq.h>
 #include <asm/uaccess.h>
@@ -2540,6 +2541,35 @@ void uart_insert_char(struct uart_port *port, unsigned int status,
 }
 EXPORT_SYMBOL_GPL(uart_insert_char);
 
+#ifdef CONFIG_OF
+/**
+ * of_uart_is_stdoutpath - check if this device matches the linux,stdout-path
+ *                         property
+ *
+ * Check if this device matches the linux,stdout-path property
+ * in the chosen node. return true if yes, false otherwise.
+ */
+int of_uart_is_stdoutpath(struct device *dev)
+{
+	struct device_node *dn;
+	const char *name;
+
+	name = of_get_property(of_chosen, "linux,stdout-path", NULL);
+	if (name == NULL)
+		return 0;
+
+	dn = of_find_node_by_path(name);
+	if (!dn)
+		return 0;
+
+	if (dn == dev->of_node)
+		return 1;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_uart_is_stdoutpath);
+#endif
+
 EXPORT_SYMBOL(uart_write_wakeup);
 EXPORT_SYMBOL(uart_register_driver);
 EXPORT_SYMBOL(uart_unregister_driver);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 0253c20..35a61f6 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -560,6 +560,9 @@ static inline int uart_handle_break(struct uart_port *port)
 					 (cflag) & CRTSCTS || \
 					 !((cflag) & CLOCAL))
 
+/* check if a device matches the linux,stdout-path property */
+int of_uart_is_stdoutpath(struct device *dev);
+
 #endif
 
 #endif /* LINUX_SERIAL_CORE_H */
-- 
1.7.10.4


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

* [PATCH 1/3] serial_core: Add helper for matching against linux,stdout-path
@ 2012-10-05 16:12   ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:12 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Grant Likely, Rob Herring,
	linux-kernel, devicetree-discuss, linux-arm-kernel, Sascha Hauer

devicetrees may have a linux,stdout-path property in the chosen
node describing the console device. This adds a helper function
to match a device against this property so a driver can call
add_preferred_console for a matching device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/serial_core.c |   30 ++++++++++++++++++++++++++++++
 include/linux/serial_core.h      |    3 +++
 2 files changed, 33 insertions(+)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index a21dc8e..f4a9f26 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -33,6 +33,7 @@
 #include <linux/serial_core.h>
 #include <linux/delay.h>
 #include <linux/mutex.h>
+#include <linux/of.h>
 
 #include <asm/irq.h>
 #include <asm/uaccess.h>
@@ -2540,6 +2541,35 @@ void uart_insert_char(struct uart_port *port, unsigned int status,
 }
 EXPORT_SYMBOL_GPL(uart_insert_char);
 
+#ifdef CONFIG_OF
+/**
+ * of_uart_is_stdoutpath - check if this device matches the linux,stdout-path
+ *                         property
+ *
+ * Check if this device matches the linux,stdout-path property
+ * in the chosen node. return true if yes, false otherwise.
+ */
+int of_uart_is_stdoutpath(struct device *dev)
+{
+	struct device_node *dn;
+	const char *name;
+
+	name = of_get_property(of_chosen, "linux,stdout-path", NULL);
+	if (name == NULL)
+		return 0;
+
+	dn = of_find_node_by_path(name);
+	if (!dn)
+		return 0;
+
+	if (dn == dev->of_node)
+		return 1;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_uart_is_stdoutpath);
+#endif
+
 EXPORT_SYMBOL(uart_write_wakeup);
 EXPORT_SYMBOL(uart_register_driver);
 EXPORT_SYMBOL(uart_unregister_driver);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 0253c20..35a61f6 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -560,6 +560,9 @@ static inline int uart_handle_break(struct uart_port *port)
 					 (cflag) & CRTSCTS || \
 					 !((cflag) & CLOCAL))
 
+/* check if a device matches the linux,stdout-path property */
+int of_uart_is_stdoutpath(struct device *dev);
+
 #endif
 
 #endif /* LINUX_SERIAL_CORE_H */
-- 
1.7.10.4

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

* [PATCH 1/3] serial_core: Add helper for matching against linux, stdout-path
@ 2012-10-05 16:12   ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:12 UTC (permalink / raw)
  To: linux-arm-kernel

devicetrees may have a linux,stdout-path property in the chosen
node describing the console device. This adds a helper function
to match a device against this property so a driver can call
add_preferred_console for a matching device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/serial_core.c |   30 ++++++++++++++++++++++++++++++
 include/linux/serial_core.h      |    3 +++
 2 files changed, 33 insertions(+)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index a21dc8e..f4a9f26 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -33,6 +33,7 @@
 #include <linux/serial_core.h>
 #include <linux/delay.h>
 #include <linux/mutex.h>
+#include <linux/of.h>
 
 #include <asm/irq.h>
 #include <asm/uaccess.h>
@@ -2540,6 +2541,35 @@ void uart_insert_char(struct uart_port *port, unsigned int status,
 }
 EXPORT_SYMBOL_GPL(uart_insert_char);
 
+#ifdef CONFIG_OF
+/**
+ * of_uart_is_stdoutpath - check if this device matches the linux,stdout-path
+ *                         property
+ *
+ * Check if this device matches the linux,stdout-path property
+ * in the chosen node. return true if yes, false otherwise.
+ */
+int of_uart_is_stdoutpath(struct device *dev)
+{
+	struct device_node *dn;
+	const char *name;
+
+	name = of_get_property(of_chosen, "linux,stdout-path", NULL);
+	if (name == NULL)
+		return 0;
+
+	dn = of_find_node_by_path(name);
+	if (!dn)
+		return 0;
+
+	if (dn == dev->of_node)
+		return 1;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_uart_is_stdoutpath);
+#endif
+
 EXPORT_SYMBOL(uart_write_wakeup);
 EXPORT_SYMBOL(uart_register_driver);
 EXPORT_SYMBOL(uart_unregister_driver);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 0253c20..35a61f6 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -560,6 +560,9 @@ static inline int uart_handle_break(struct uart_port *port)
 					 (cflag) & CRTSCTS || \
 					 !((cflag) & CLOCAL))
 
+/* check if a device matches the linux,stdout-path property */
+int of_uart_is_stdoutpath(struct device *dev);
+
 #endif
 
 #endif /* LINUX_SERIAL_CORE_H */
-- 
1.7.10.4

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

* [PATCH 2/3] serial: i.MX: Make console support non optional
  2012-10-05 16:12 ` Sascha Hauer
  (?)
@ 2012-10-05 16:13   ` Sascha Hauer
  -1 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:13 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Grant Likely, Rob Herring,
	linux-kernel, devicetree-discuss, linux-arm-kernel, Sascha Hauer

Traditionally console support is optional for serial drivers. This
makes it non optional for the i.MX driver since it's not worth
asking questions for a feature virtually every user of this driver
wants to have.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/Kconfig |   16 +---------------
 drivers/tty/serial/imx.c   |    8 +-------
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 4720b4b..920dd0d 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -515,26 +515,12 @@ config SERIAL_IMX
 	bool "IMX serial port support"
 	depends on ARCH_MXC
 	select SERIAL_CORE
+	select SERIAL_CORE_CONSOLE
 	select RATIONAL
 	help
 	  If you have a machine based on a Motorola IMX CPU you
 	  can enable its onboard serial port by enabling this option.
 
-config SERIAL_IMX_CONSOLE
-	bool "Console on IMX serial port"
-	depends on SERIAL_IMX
-	select SERIAL_CORE_CONSOLE
-	help
-	  If you have enabled the serial port on the Motorola IMX
-	  CPU you can make it the console by answering Y to this option.
-
-	  Even if you say Y here, the currently visible virtual console
-	  (/dev/tty0) will still be used as the system console by default, but
-	  you can alter that using a kernel command line option such as
-	  "console=ttySA0". (Try "man bootparam" or see the documentation of
-	  your boot loader (lilo or loadlin) about how to pass options to the
-	  kernel at boot time.)
-
 config SERIAL_UARTLITE
 	tristate "Xilinx uartlite serial port support"
 	depends on PPC32 || MICROBLAZE || MFD_TIMBERDALE
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index e309e8b..3a9337e 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1192,7 +1192,6 @@ static struct uart_ops imx_pops = {
 
 static struct imx_port *imx_ports[UART_NR];
 
-#ifdef CONFIG_SERIAL_IMX_CONSOLE
 static void imx_console_putchar(struct uart_port *port, int ch)
 {
 	struct imx_port *sport = (struct imx_port *)port;
@@ -1348,11 +1347,6 @@ static struct console imx_console = {
 	.data		= &imx_reg,
 };
 
-#define IMX_CONSOLE	&imx_console
-#else
-#define IMX_CONSOLE	NULL
-#endif
-
 static struct uart_driver imx_reg = {
 	.owner          = THIS_MODULE,
 	.driver_name    = DRIVER_NAME,
@@ -1360,7 +1354,7 @@ static struct uart_driver imx_reg = {
 	.major          = SERIAL_IMX_MAJOR,
 	.minor          = MINOR_START,
 	.nr             = ARRAY_SIZE(imx_ports),
-	.cons           = IMX_CONSOLE,
+	.cons           = &imx_console,
 };
 
 static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
-- 
1.7.10.4


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

* [PATCH 2/3] serial: i.MX: Make console support non optional
@ 2012-10-05 16:13   ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:13 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Grant Likely, Rob Herring,
	linux-kernel, devicetree-discuss, linux-arm-kernel, Sascha Hauer

Traditionally console support is optional for serial drivers. This
makes it non optional for the i.MX driver since it's not worth
asking questions for a feature virtually every user of this driver
wants to have.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/Kconfig |   16 +---------------
 drivers/tty/serial/imx.c   |    8 +-------
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 4720b4b..920dd0d 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -515,26 +515,12 @@ config SERIAL_IMX
 	bool "IMX serial port support"
 	depends on ARCH_MXC
 	select SERIAL_CORE
+	select SERIAL_CORE_CONSOLE
 	select RATIONAL
 	help
 	  If you have a machine based on a Motorola IMX CPU you
 	  can enable its onboard serial port by enabling this option.
 
-config SERIAL_IMX_CONSOLE
-	bool "Console on IMX serial port"
-	depends on SERIAL_IMX
-	select SERIAL_CORE_CONSOLE
-	help
-	  If you have enabled the serial port on the Motorola IMX
-	  CPU you can make it the console by answering Y to this option.
-
-	  Even if you say Y here, the currently visible virtual console
-	  (/dev/tty0) will still be used as the system console by default, but
-	  you can alter that using a kernel command line option such as
-	  "console=ttySA0". (Try "man bootparam" or see the documentation of
-	  your boot loader (lilo or loadlin) about how to pass options to the
-	  kernel at boot time.)
-
 config SERIAL_UARTLITE
 	tristate "Xilinx uartlite serial port support"
 	depends on PPC32 || MICROBLAZE || MFD_TIMBERDALE
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index e309e8b..3a9337e 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1192,7 +1192,6 @@ static struct uart_ops imx_pops = {
 
 static struct imx_port *imx_ports[UART_NR];
 
-#ifdef CONFIG_SERIAL_IMX_CONSOLE
 static void imx_console_putchar(struct uart_port *port, int ch)
 {
 	struct imx_port *sport = (struct imx_port *)port;
@@ -1348,11 +1347,6 @@ static struct console imx_console = {
 	.data		= &imx_reg,
 };
 
-#define IMX_CONSOLE	&imx_console
-#else
-#define IMX_CONSOLE	NULL
-#endif
-
 static struct uart_driver imx_reg = {
 	.owner          = THIS_MODULE,
 	.driver_name    = DRIVER_NAME,
@@ -1360,7 +1354,7 @@ static struct uart_driver imx_reg = {
 	.major          = SERIAL_IMX_MAJOR,
 	.minor          = MINOR_START,
 	.nr             = ARRAY_SIZE(imx_ports),
-	.cons           = IMX_CONSOLE,
+	.cons           = &imx_console,
 };
 
 static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
-- 
1.7.10.4


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

* [PATCH 2/3] serial: i.MX: Make console support non optional
@ 2012-10-05 16:13   ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:13 UTC (permalink / raw)
  To: linux-arm-kernel

Traditionally console support is optional for serial drivers. This
makes it non optional for the i.MX driver since it's not worth
asking questions for a feature virtually every user of this driver
wants to have.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/Kconfig |   16 +---------------
 drivers/tty/serial/imx.c   |    8 +-------
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 4720b4b..920dd0d 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -515,26 +515,12 @@ config SERIAL_IMX
 	bool "IMX serial port support"
 	depends on ARCH_MXC
 	select SERIAL_CORE
+	select SERIAL_CORE_CONSOLE
 	select RATIONAL
 	help
 	  If you have a machine based on a Motorola IMX CPU you
 	  can enable its onboard serial port by enabling this option.
 
-config SERIAL_IMX_CONSOLE
-	bool "Console on IMX serial port"
-	depends on SERIAL_IMX
-	select SERIAL_CORE_CONSOLE
-	help
-	  If you have enabled the serial port on the Motorola IMX
-	  CPU you can make it the console by answering Y to this option.
-
-	  Even if you say Y here, the currently visible virtual console
-	  (/dev/tty0) will still be used as the system console by default, but
-	  you can alter that using a kernel command line option such as
-	  "console=ttySA0". (Try "man bootparam" or see the documentation of
-	  your boot loader (lilo or loadlin) about how to pass options to the
-	  kernel at boot time.)
-
 config SERIAL_UARTLITE
 	tristate "Xilinx uartlite serial port support"
 	depends on PPC32 || MICROBLAZE || MFD_TIMBERDALE
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index e309e8b..3a9337e 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1192,7 +1192,6 @@ static struct uart_ops imx_pops = {
 
 static struct imx_port *imx_ports[UART_NR];
 
-#ifdef CONFIG_SERIAL_IMX_CONSOLE
 static void imx_console_putchar(struct uart_port *port, int ch)
 {
 	struct imx_port *sport = (struct imx_port *)port;
@@ -1348,11 +1347,6 @@ static struct console imx_console = {
 	.data		= &imx_reg,
 };
 
-#define IMX_CONSOLE	&imx_console
-#else
-#define IMX_CONSOLE	NULL
-#endif
-
 static struct uart_driver imx_reg = {
 	.owner          = THIS_MODULE,
 	.driver_name    = DRIVER_NAME,
@@ -1360,7 +1354,7 @@ static struct uart_driver imx_reg = {
 	.major          = SERIAL_IMX_MAJOR,
 	.minor          = MINOR_START,
 	.nr             = ARRAY_SIZE(imx_ports),
-	.cons           = IMX_CONSOLE,
+	.cons           = &imx_console,
 };
 
 static int serial_imx_suspend(struct platform_device *dev, pm_message_t state)
-- 
1.7.10.4

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

* [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property
  2012-10-05 16:12 ` Sascha Hauer
  (?)
@ 2012-10-05 16:13   ` Sascha Hauer
  -1 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:13 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Grant Likely, Rob Herring,
	linux-kernel, devicetree-discuss, linux-arm-kernel, Sascha Hauer

devicetrees may have the linux,stdout-path property to specify the
console. This patch adds support to the i.MX serial driver for this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/imx.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 3a9337e..bc8a7bfa 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1421,6 +1421,9 @@ static int serial_imx_probe_dt(struct imx_port *sport,
 
 	sport->devdata = of_id->data;
 
+	if (of_uart_is_stdoutpath(&pdev->dev))
+		add_preferred_console(imx_reg.cons->name, sport->port.line, 0);
+
 	return 0;
 }
 #else
-- 
1.7.10.4


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

* [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property
@ 2012-10-05 16:13   ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:13 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Grant Likely, Rob Herring,
	linux-kernel, devicetree-discuss, linux-arm-kernel, Sascha Hauer

devicetrees may have the linux,stdout-path property to specify the
console. This patch adds support to the i.MX serial driver for this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/imx.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 3a9337e..bc8a7bfa 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1421,6 +1421,9 @@ static int serial_imx_probe_dt(struct imx_port *sport,
 
 	sport->devdata = of_id->data;
 
+	if (of_uart_is_stdoutpath(&pdev->dev))
+		add_preferred_console(imx_reg.cons->name, sport->port.line, 0);
+
 	return 0;
 }
 #else
-- 
1.7.10.4


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

* [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property
@ 2012-10-05 16:13   ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-10-05 16:13 UTC (permalink / raw)
  To: linux-arm-kernel

devicetrees may have the linux,stdout-path property to specify the
console. This patch adds support to the i.MX serial driver for this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/imx.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 3a9337e..bc8a7bfa 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1421,6 +1421,9 @@ static int serial_imx_probe_dt(struct imx_port *sport,
 
 	sport->devdata = of_id->data;
 
+	if (of_uart_is_stdoutpath(&pdev->dev))
+		add_preferred_console(imx_reg.cons->name, sport->port.line, 0);
+
 	return 0;
 }
 #else
-- 
1.7.10.4

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

* Re: [PATCH 1/3] serial_core: Add helper for matching against linux,stdout-path
  2012-10-05 16:12   ` [PATCH 1/3] serial_core: Add helper for matching against linux,stdout-path Sascha Hauer
@ 2012-10-05 16:43     ` Rob Herring
  -1 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2012-10-05 16:43 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: linux-serial, Alan Cox, Greg Kroah-Hartman, Grant Likely,
	linux-kernel, devicetree-discuss, linux-arm-kernel

On 10/05/2012 11:12 AM, Sascha Hauer wrote:
> devicetrees may have a linux,stdout-path property in the chosen
> node describing the console device. This adds a helper function
> to match a device against this property so a driver can call
> add_preferred_console for a matching device.

Consoles can be on devices other than uarts, so this should really be
of_device_is_stdout_path() and in the DT core.

> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/tty/serial/serial_core.c |   30 ++++++++++++++++++++++++++++++
>  include/linux/serial_core.h      |    3 +++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index a21dc8e..f4a9f26 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -33,6 +33,7 @@
>  #include <linux/serial_core.h>
>  #include <linux/delay.h>
>  #include <linux/mutex.h>
> +#include <linux/of.h>
>  
>  #include <asm/irq.h>
>  #include <asm/uaccess.h>
> @@ -2540,6 +2541,35 @@ void uart_insert_char(struct uart_port *port, unsigned int status,
>  }
>  EXPORT_SYMBOL_GPL(uart_insert_char);
>  
> +#ifdef CONFIG_OF
> +/**
> + * of_uart_is_stdoutpath - check if this device matches the linux,stdout-path
> + *                         property
> + *
> + * Check if this device matches the linux,stdout-path property
> + * in the chosen node. return true if yes, false otherwise.
> + */
> +int of_uart_is_stdoutpath(struct device *dev)
> +{
> +	struct device_node *dn;
> +	const char *name;
> +
> +	name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> +	if (name == NULL)
> +		return 0;
> +
> +	dn = of_find_node_by_path(name);
> +	if (!dn)
> +		return 0;
> +
> +	if (dn == dev->of_node)

I know I said use struct device, but since only device_node ptr is
needed you should just use that. Then the function is usable if you only
have the device_node ptr.

> +		return 1;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(of_uart_is_stdoutpath);
> +#endif
> +
>  EXPORT_SYMBOL(uart_write_wakeup);
>  EXPORT_SYMBOL(uart_register_driver);
>  EXPORT_SYMBOL(uart_unregister_driver);
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 0253c20..35a61f6 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -560,6 +560,9 @@ static inline int uart_handle_break(struct uart_port *port)
>  					 (cflag) & CRTSCTS || \
>  					 !((cflag) & CLOCAL))
>  
> +/* check if a device matches the linux,stdout-path property */
> +int of_uart_is_stdoutpath(struct device *dev);

Need an empty version for !CONFIG_OF?

Rob

> +
>  #endif
>  
>  #endif /* LINUX_SERIAL_CORE_H */
> 

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

* [PATCH 1/3] serial_core: Add helper for matching against linux, stdout-path
@ 2012-10-05 16:43     ` Rob Herring
  0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2012-10-05 16:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/05/2012 11:12 AM, Sascha Hauer wrote:
> devicetrees may have a linux,stdout-path property in the chosen
> node describing the console device. This adds a helper function
> to match a device against this property so a driver can call
> add_preferred_console for a matching device.

Consoles can be on devices other than uarts, so this should really be
of_device_is_stdout_path() and in the DT core.

> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/tty/serial/serial_core.c |   30 ++++++++++++++++++++++++++++++
>  include/linux/serial_core.h      |    3 +++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index a21dc8e..f4a9f26 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -33,6 +33,7 @@
>  #include <linux/serial_core.h>
>  #include <linux/delay.h>
>  #include <linux/mutex.h>
> +#include <linux/of.h>
>  
>  #include <asm/irq.h>
>  #include <asm/uaccess.h>
> @@ -2540,6 +2541,35 @@ void uart_insert_char(struct uart_port *port, unsigned int status,
>  }
>  EXPORT_SYMBOL_GPL(uart_insert_char);
>  
> +#ifdef CONFIG_OF
> +/**
> + * of_uart_is_stdoutpath - check if this device matches the linux,stdout-path
> + *                         property
> + *
> + * Check if this device matches the linux,stdout-path property
> + * in the chosen node. return true if yes, false otherwise.
> + */
> +int of_uart_is_stdoutpath(struct device *dev)
> +{
> +	struct device_node *dn;
> +	const char *name;
> +
> +	name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> +	if (name == NULL)
> +		return 0;
> +
> +	dn = of_find_node_by_path(name);
> +	if (!dn)
> +		return 0;
> +
> +	if (dn == dev->of_node)

I know I said use struct device, but since only device_node ptr is
needed you should just use that. Then the function is usable if you only
have the device_node ptr.

> +		return 1;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(of_uart_is_stdoutpath);
> +#endif
> +
>  EXPORT_SYMBOL(uart_write_wakeup);
>  EXPORT_SYMBOL(uart_register_driver);
>  EXPORT_SYMBOL(uart_unregister_driver);
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 0253c20..35a61f6 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -560,6 +560,9 @@ static inline int uart_handle_break(struct uart_port *port)
>  					 (cflag) & CRTSCTS || \
>  					 !((cflag) & CLOCAL))
>  
> +/* check if a device matches the linux,stdout-path property */
> +int of_uart_is_stdoutpath(struct device *dev);

Need an empty version for !CONFIG_OF?

Rob

> +
>  #endif
>  
>  #endif /* LINUX_SERIAL_CORE_H */
> 

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

* [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property
  2012-11-15  9:31 [PATCH v4] linux,stdout-path helper Sascha Hauer
@ 2012-11-15  9:31   ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-11-15  9:31 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Grant Likely, linux-kernel,
	devicetree-discuss, linux-arm-kernel, kernel, Sascha Hauer

devicetrees may have the linux,stdout-path property to specify the
console. This patch adds support to the i.MX serial driver for this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/imx.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 07a8ca1..ac5a679 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1419,6 +1419,9 @@ static int serial_imx_probe_dt(struct imx_port *sport,
 
 	sport->devdata = of_id->data;
 
+	if (of_device_is_stdout_path(np))
+		add_preferred_console(imx_reg.cons->name, sport->port.line, 0);
+
 	return 0;
 }
 #else
-- 
1.7.10.4


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

* [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property
@ 2012-11-15  9:31   ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-11-15  9:31 UTC (permalink / raw)
  To: linux-arm-kernel

devicetrees may have the linux,stdout-path property to specify the
console. This patch adds support to the i.MX serial driver for this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/imx.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 07a8ca1..ac5a679 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1419,6 +1419,9 @@ static int serial_imx_probe_dt(struct imx_port *sport,
 
 	sport->devdata = of_id->data;
 
+	if (of_device_is_stdout_path(np))
+		add_preferred_console(imx_reg.cons->name, sport->port.line, 0);
+
 	return 0;
 }
 #else
-- 
1.7.10.4

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

* [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property
  2012-11-02  9:48 [PATCH v3] linux,stdout-path helper Sascha Hauer
@ 2012-11-02  9:48   ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-11-02  9:48 UTC (permalink / raw)
  To: linux-serial
  Cc: Alan Cox, Greg Kroah-Hartman, Grant Likely, linux-kernel,
	devicetree-discuss, linux-arm-kernel, kernel, Sascha Hauer

devicetrees may have the linux,stdout-path property to specify the
console. This patch adds support to the i.MX serial driver for this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/imx.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 3a9337e..41be237 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -47,6 +47,7 @@
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/of_stdout.h>
 #include <linux/pinctrl/consumer.h>
 
 #include <asm/io.h>
@@ -1421,6 +1422,9 @@ static int serial_imx_probe_dt(struct imx_port *sport,
 
 	sport->devdata = of_id->data;
 
+	if (of_device_is_stdout_path(np))
+		add_preferred_console(imx_reg.cons->name, sport->port.line, 0);
+
 	return 0;
 }
 #else
-- 
1.7.10.4


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

* [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property
@ 2012-11-02  9:48   ` Sascha Hauer
  0 siblings, 0 replies; 18+ messages in thread
From: Sascha Hauer @ 2012-11-02  9:48 UTC (permalink / raw)
  To: linux-arm-kernel

devicetrees may have the linux,stdout-path property to specify the
console. This patch adds support to the i.MX serial driver for this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/tty/serial/imx.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 3a9337e..41be237 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -47,6 +47,7 @@
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/of_stdout.h>
 #include <linux/pinctrl/consumer.h>
 
 #include <asm/io.h>
@@ -1421,6 +1422,9 @@ static int serial_imx_probe_dt(struct imx_port *sport,
 
 	sport->devdata = of_id->data;
 
+	if (of_device_is_stdout_path(np))
+		add_preferred_console(imx_reg.cons->name, sport->port.line, 0);
+
 	return 0;
 }
 #else
-- 
1.7.10.4

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

end of thread, other threads:[~2012-11-15  9:31 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-05 16:12 [PATCH v2] Add of helper for linux,stdout-path Sascha Hauer
2012-10-05 16:12 ` Sascha Hauer
2012-10-05 16:12 ` Sascha Hauer
2012-10-05 16:12 ` [PATCH 1/3] serial_core: Add helper for matching against linux,stdout-path Sascha Hauer
2012-10-05 16:12   ` [PATCH 1/3] serial_core: Add helper for matching against linux, stdout-path Sascha Hauer
2012-10-05 16:12   ` [PATCH 1/3] serial_core: Add helper for matching against linux,stdout-path Sascha Hauer
2012-10-05 16:43   ` Rob Herring
2012-10-05 16:43     ` [PATCH 1/3] serial_core: Add helper for matching against linux, stdout-path Rob Herring
2012-10-05 16:13 ` [PATCH 2/3] serial: i.MX: Make console support non optional Sascha Hauer
2012-10-05 16:13   ` Sascha Hauer
2012-10-05 16:13   ` Sascha Hauer
2012-10-05 16:13 ` [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property Sascha Hauer
2012-10-05 16:13   ` Sascha Hauer
2012-10-05 16:13   ` Sascha Hauer
2012-11-02  9:48 [PATCH v3] linux,stdout-path helper Sascha Hauer
2012-11-02  9:48 ` [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property Sascha Hauer
2012-11-02  9:48   ` Sascha Hauer
2012-11-15  9:31 [PATCH v4] linux,stdout-path helper Sascha Hauer
2012-11-15  9:31 ` [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property Sascha Hauer
2012-11-15  9:31   ` Sascha Hauer

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.