* [PATCH v4] linux,stdout-path helper
@ 2012-11-15 9:31 ` Sascha Hauer
0 siblings, 0 replies; 25+ 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
The following adds a helper for matching the linux,stdout-path property
in the chosen node and makes use of it in the i.MX serial driver.
changes since v3:
- move code from separate files to drivers/of/base.c and include/linux/of.h
changes since v2:
- move helper to OF core and make it independent of serial devices
changes since v1:
- move it out of the i.MX serial driver and make it generic for serial
devices.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v4] linux,stdout-path helper
@ 2012-11-15 9:31 ` Sascha Hauer
0 siblings, 0 replies; 25+ messages in thread
From: Sascha Hauer @ 2012-11-15 9:31 UTC (permalink / raw)
To: linux-arm-kernel
The following adds a helper for matching the linux,stdout-path property
in the chosen node and makes use of it in the i.MX serial driver.
changes since v3:
- move code from separate files to drivers/of/base.c and include/linux/of.h
changes since v2:
- move helper to OF core and make it independent of serial devices
changes since v1:
- move it out of the i.MX serial driver and make it generic for serial
devices.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
2012-11-15 9:31 ` Sascha Hauer
@ 2012-11-15 9:31 ` Sascha Hauer
-1 siblings, 0 replies; 25+ 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 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/of/base.c | 28 ++++++++++++++++++++++++++++
include/linux/of.h | 7 +++++++
2 files changed, 35 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index af3b22a..737feb8 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1358,3 +1358,31 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
return curv;
}
EXPORT_SYMBOL_GPL(of_prop_next_string);
+
+/**
+ * of_device_is_stdout_path - check if a device node matches the
+ * linux,stdout-path property
+ *
+ * Check if this device node matches the linux,stdout-path property
+ * in the chosen node. return true if yes, false otherwise.
+ */
+int of_device_is_stdout_path(struct device_node *dn)
+{
+ const char *name;
+ struct device_node *dn_stdout;
+ int is_stdout = 0;
+
+ name = of_get_property(of_chosen, "linux,stdout-path", NULL);
+ if (name == NULL)
+ return 0;
+
+ dn_stdout = of_find_node_by_path(name);
+
+ if (dn_stdout && dn_stdout == dn)
+ is_stdout = 1;
+
+ of_node_put(dn_stdout);
+
+ return is_stdout;
+}
+EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
diff --git a/include/linux/of.h b/include/linux/of.h
index b4e50d5..5f857b5 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -310,6 +310,8 @@ const char *of_prop_next_string(struct property *prop, const char *cur);
s; \
s = of_prop_next_string(prop, s))
+int of_device_is_stdout_path(struct device_node *dn);
+
#else /* CONFIG_OF */
static inline const char* of_node_full_name(struct device_node *np)
@@ -437,6 +439,11 @@ static inline int of_machine_is_compatible(const char *compat)
return 0;
}
+static inline int of_device_is_stdout_path(struct device_node *dn)
+{
+ return 0;
+}
+
#define of_match_ptr(_ptr) NULL
#define of_match_node(_matches, _node) NULL
#define of_property_for_each_u32(np, propname, prop, p, u) \
--
1.7.10.4
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
@ 2012-11-15 9:31 ` Sascha Hauer
0 siblings, 0 replies; 25+ messages in thread
From: Sascha Hauer @ 2012-11-15 9:31 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/of/base.c | 28 ++++++++++++++++++++++++++++
include/linux/of.h | 7 +++++++
2 files changed, 35 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index af3b22a..737feb8 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1358,3 +1358,31 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
return curv;
}
EXPORT_SYMBOL_GPL(of_prop_next_string);
+
+/**
+ * of_device_is_stdout_path - check if a device node matches the
+ * linux,stdout-path property
+ *
+ * Check if this device node matches the linux,stdout-path property
+ * in the chosen node. return true if yes, false otherwise.
+ */
+int of_device_is_stdout_path(struct device_node *dn)
+{
+ const char *name;
+ struct device_node *dn_stdout;
+ int is_stdout = 0;
+
+ name = of_get_property(of_chosen, "linux,stdout-path", NULL);
+ if (name == NULL)
+ return 0;
+
+ dn_stdout = of_find_node_by_path(name);
+
+ if (dn_stdout && dn_stdout == dn)
+ is_stdout = 1;
+
+ of_node_put(dn_stdout);
+
+ return is_stdout;
+}
+EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
diff --git a/include/linux/of.h b/include/linux/of.h
index b4e50d5..5f857b5 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -310,6 +310,8 @@ const char *of_prop_next_string(struct property *prop, const char *cur);
s; \
s = of_prop_next_string(prop, s))
+int of_device_is_stdout_path(struct device_node *dn);
+
#else /* CONFIG_OF */
static inline const char* of_node_full_name(struct device_node *np)
@@ -437,6 +439,11 @@ static inline int of_machine_is_compatible(const char *compat)
return 0;
}
+static inline int of_device_is_stdout_path(struct device_node *dn)
+{
+ return 0;
+}
+
#define of_match_ptr(_ptr) NULL
#define of_match_node(_matches, _node) NULL
#define of_property_for_each_u32(np, propname, prop, p, u) \
--
1.7.10.4
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 2/3] serial: i.MX: Make console support non optional
@ 2012-11-15 9:31 ` Sascha Hauer
0 siblings, 0 replies; 25+ 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
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 2a53be5..919b243 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -541,26 +541,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 5981912..07a8ca1 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] 25+ messages in thread
* [PATCH 2/3] serial: i.MX: Make console support non optional
@ 2012-11-15 9:31 ` Sascha Hauer
0 siblings, 0 replies; 25+ messages in thread
From: Sascha Hauer @ 2012-11-15 9:31 UTC (permalink / raw)
To: linux-serial-u79uwXL29TY76Z2rM5mHXA
Cc: Greg Kroah-Hartman, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ, Sascha Hauer,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Alan Cox
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-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
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 2a53be5..919b243 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -541,26 +541,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 5981912..07a8ca1 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] 25+ messages in thread
* [PATCH 2/3] serial: i.MX: Make console support non optional
@ 2012-11-15 9:31 ` Sascha Hauer
0 siblings, 0 replies; 25+ messages in thread
From: Sascha Hauer @ 2012-11-15 9:31 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 2a53be5..919b243 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -541,26 +541,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 5981912..07a8ca1 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] 25+ messages in thread
* [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property
2012-11-15 9:31 ` Sascha Hauer
@ 2012-11-15 9:31 ` Sascha Hauer
-1 siblings, 0 replies; 25+ 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] 25+ 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; 25+ 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] 25+ messages in thread
* Re: [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
2012-11-15 9:31 ` Sascha Hauer
@ 2012-11-19 9:52 ` Jean-Christophe PLAGNIOL-VILLARD
-1 siblings, 0 replies; 25+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-19 9:52 UTC (permalink / raw)
To: Sascha Hauer
Cc: linux-serial, Greg Kroah-Hartman, devicetree-discuss,
linux-kernel, kernel, linux-arm-kernel, Alan Cox
On 10:31 Thu 15 Nov , 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.
I like it but I've an issue with it I cannot specify the option for
as example I need to set the uart at 38400n8 or 115200n8 regarless of wath the
booloader did
Best Regards,
J.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/of/base.c | 28 ++++++++++++++++++++++++++++
> include/linux/of.h | 7 +++++++
> 2 files changed, 35 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index af3b22a..737feb8 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1358,3 +1358,31 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
> return curv;
> }
> EXPORT_SYMBOL_GPL(of_prop_next_string);
> +
> +/**
> + * of_device_is_stdout_path - check if a device node matches the
> + * linux,stdout-path property
> + *
> + * Check if this device node matches the linux,stdout-path property
> + * in the chosen node. return true if yes, false otherwise.
> + */
> +int of_device_is_stdout_path(struct device_node *dn)
> +{
> + const char *name;
> + struct device_node *dn_stdout;
> + int is_stdout = 0;
> +
> + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> + if (name == NULL)
> + return 0;
> +
> + dn_stdout = of_find_node_by_path(name);
> +
> + if (dn_stdout && dn_stdout == dn)
> + is_stdout = 1;
> +
> + of_node_put(dn_stdout);
> +
> + return is_stdout;
> +}
> +EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
> diff --git a/include/linux/of.h b/include/linux/of.h
> index b4e50d5..5f857b5 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -310,6 +310,8 @@ const char *of_prop_next_string(struct property *prop, const char *cur);
> s; \
> s = of_prop_next_string(prop, s))
>
> +int of_device_is_stdout_path(struct device_node *dn);
> +
> #else /* CONFIG_OF */
>
> static inline const char* of_node_full_name(struct device_node *np)
> @@ -437,6 +439,11 @@ static inline int of_machine_is_compatible(const char *compat)
> return 0;
> }
>
> +static inline int of_device_is_stdout_path(struct device_node *dn)
> +{
> + return 0;
> +}
> +
> #define of_match_ptr(_ptr) NULL
> #define of_match_node(_matches, _node) NULL
> #define of_property_for_each_u32(np, propname, prop, p, u) \
> --
> 1.7.10.4
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
@ 2012-11-19 9:52 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 0 replies; 25+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-19 9:52 UTC (permalink / raw)
To: linux-arm-kernel
On 10:31 Thu 15 Nov , 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.
I like it but I've an issue with it I cannot specify the option for
as example I need to set the uart at 38400n8 or 115200n8 regarless of wath the
booloader did
Best Regards,
J.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/of/base.c | 28 ++++++++++++++++++++++++++++
> include/linux/of.h | 7 +++++++
> 2 files changed, 35 insertions(+)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index af3b22a..737feb8 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -1358,3 +1358,31 @@ const char *of_prop_next_string(struct property *prop, const char *cur)
> return curv;
> }
> EXPORT_SYMBOL_GPL(of_prop_next_string);
> +
> +/**
> + * of_device_is_stdout_path - check if a device node matches the
> + * linux,stdout-path property
> + *
> + * Check if this device node matches the linux,stdout-path property
> + * in the chosen node. return true if yes, false otherwise.
> + */
> +int of_device_is_stdout_path(struct device_node *dn)
> +{
> + const char *name;
> + struct device_node *dn_stdout;
> + int is_stdout = 0;
> +
> + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> + if (name == NULL)
> + return 0;
> +
> + dn_stdout = of_find_node_by_path(name);
> +
> + if (dn_stdout && dn_stdout == dn)
> + is_stdout = 1;
> +
> + of_node_put(dn_stdout);
> +
> + return is_stdout;
> +}
> +EXPORT_SYMBOL_GPL(of_device_is_stdout_path);
> diff --git a/include/linux/of.h b/include/linux/of.h
> index b4e50d5..5f857b5 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -310,6 +310,8 @@ const char *of_prop_next_string(struct property *prop, const char *cur);
> s; \
> s = of_prop_next_string(prop, s))
>
> +int of_device_is_stdout_path(struct device_node *dn);
> +
> #else /* CONFIG_OF */
>
> static inline const char* of_node_full_name(struct device_node *np)
> @@ -437,6 +439,11 @@ static inline int of_machine_is_compatible(const char *compat)
> return 0;
> }
>
> +static inline int of_device_is_stdout_path(struct device_node *dn)
> +{
> + return 0;
> +}
> +
> #define of_match_ptr(_ptr) NULL
> #define of_match_node(_matches, _node) NULL
> #define of_property_for_each_u32(np, propname, prop, p, u) \
> --
> 1.7.10.4
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
2012-11-19 9:52 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-20 16:51 ` Grant Likely
-1 siblings, 0 replies; 25+ messages in thread
From: Grant Likely @ 2012-11-20 16:51 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD, Sascha Hauer
Cc: linux-serial, Greg Kroah-Hartman, devicetree-discuss,
linux-kernel, kernel, linux-arm-kernel, Alan Cox
On Mon, 19 Nov 2012 10:52:02 +0100, Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> wrote:
> On 10:31 Thu 15 Nov , 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.
>
> I like it but I've an issue with it I cannot specify the option for
>
> as example I need to set the uart at 38400n8 or 115200n8 regarless of wath the
> booloader did
Right. stdout-path can have a set of arguments appended for things like
serial speed. ePAPR says this about stdout-path:
A string that specifies the full path to the node representing the
device to be used for boot console output. If the character ":" is
present in the value it terminates the path. The value may be an alias.
If the stdin-path property is not specified, stdout-path should be
assumed to define the input device.
So, this function needs to do three more things:
- also look for 'stdout-path' (in addition to 'linux,stdout-path')
- Parse for a ':' in the path and trim that off so it can be used for
arguments. (Bonus: return the arguments to the caller)
- make sure that it can handle the path containing an alias (I've just
not checked if the current code will handle this)
g.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux, stdout-path
@ 2012-11-20 16:51 ` Grant Likely
0 siblings, 0 replies; 25+ messages in thread
From: Grant Likely @ 2012-11-20 16:51 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 19 Nov 2012 10:52:02 +0100, Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> wrote:
> On 10:31 Thu 15 Nov , 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.
>
> I like it but I've an issue with it I cannot specify the option for
>
> as example I need to set the uart at 38400n8 or 115200n8 regarless of wath the
> booloader did
Right. stdout-path can have a set of arguments appended for things like
serial speed. ePAPR says this about stdout-path:
A string that specifies the full path to the node representing the
device to be used for boot console output. If the character ":" is
present in the value it terminates the path. The value may be an alias.
If the stdin-path property is not specified, stdout-path should be
assumed to define the input device.
So, this function needs to do three more things:
- also look for 'stdout-path' (in addition to 'linux,stdout-path')
- Parse for a ':' in the path and trim that off so it can be used for
arguments. (Bonus: return the arguments to the caller)
- make sure that it can handle the path containing an alias (I've just
not checked if the current code will handle this)
g.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
2012-11-15 8:49 ` [PATCH 1/3] OF: Add helper for matching against linux, stdout-path Sascha Hauer
@ 2012-11-15 9:10 ` Grant Likely
-1 siblings, 0 replies; 25+ messages in thread
From: Grant Likely @ 2012-11-15 9:10 UTC (permalink / raw)
To: Sascha Hauer
Cc: linux-serial, Alan Cox, Greg Kroah-Hartman, linux-kernel,
devicetree-discuss, linux-arm-kernel, kernel
On Thu, Nov 15, 2012 at 8:49 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Wed, Nov 14, 2012 at 08:49:54PM +0000, Grant Likely wrote:
>> On Fri, Nov 2, 2012 at 9:48 AM, Sascha Hauer <s.hauer@pengutronix.de> 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.
>> >
>> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>> > ---
>> > drivers/of/Kconfig | 3 +++
>> > drivers/of/Makefile | 1 +
>> > drivers/of/of_stdout.c | 27 +++++++++++++++++++++++++++
>> > include/linux/of_stdout.h | 24 ++++++++++++++++++++++++
>> > 4 files changed, 55 insertions(+)
>> > create mode 100644 drivers/of/of_stdout.c
>> > create mode 100644 include/linux/of_stdout.h
>> >
>> > diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
>> > index dfba3e6..8574ebb 100644
>> > --- a/drivers/of/Kconfig
>> > +++ b/drivers/of/Kconfig
>> > @@ -67,6 +67,9 @@ config OF_MDIO
>> > help
>> > OpenFirmware MDIO bus (Ethernet PHY) accessors
>> >
>> > +config OF_STDOUT
>> > + def_bool y
>> > +
>> > config OF_PCI
>> > def_tristate PCI
>> > depends on PCI
>> > diff --git a/drivers/of/Makefile b/drivers/of/Makefile
>> > index e027f44..c9f3f2f 100644
>> > --- a/drivers/of/Makefile
>> > +++ b/drivers/of/Makefile
>> > @@ -8,6 +8,7 @@ obj-$(CONFIG_OF_I2C) += of_i2c.o
>> > obj-$(CONFIG_OF_NET) += of_net.o
>> > obj-$(CONFIG_OF_SELFTEST) += selftest.o
>> > obj-$(CONFIG_OF_MDIO) += of_mdio.o
>> > +obj-$(CONFIG_OF_STDOUT) += of_stdout.o
>> > obj-$(CONFIG_OF_PCI) += of_pci.o
>> > obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o
>> > obj-$(CONFIG_OF_MTD) += of_mtd.o
>> > diff --git a/drivers/of/of_stdout.c b/drivers/of/of_stdout.c
>> > new file mode 100644
>> > index 0000000..c9e370e
>> > --- /dev/null
>> > +++ b/drivers/of/of_stdout.c
>> > @@ -0,0 +1,27 @@
>> > +/*
>> > + * OF helper for linux,stdoutpath property.
>> > + *
>> > + * This file is released under the GPLv2
>> > + */
>> > +#include <linux/of_stdout.h>
>> > +
>> > +/**
>> > + * of_device_is_stdout_path - check if a device node matches the
>> > + * linux,stdout-path property
>> > + *
>> > + * Check if this device node matches the linux,stdout-path property
>> > + * in the chosen node. return true if yes, false otherwise.
>> > + */
>> > +int of_device_is_stdout_path(struct device_node *dn)
>> > +{
>> > + const char *name;
>> > +
>> > + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
>> > + if (name == NULL)
>> > + return 0;
>> > +
>> > + if (dn == of_find_node_by_path(name))
>>
>> need to of_node_put() the return value of of_find_node_by_path()
>>
>> > + return 1;
>> > +
>> > + return 0;
>> > +}
>>
>> Hi Sascha,
>>
>> I'm fine with the helper, but there really is no need for a completely
>> separate .c file. Just put it in drivers/of/base.c.
>
> I guess the same applies to include/linux/of_stdout.h.
>
> Should I drop the CONFIG_OF_STDOUT aswell?
Yup.
g.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux, stdout-path
@ 2012-11-15 9:10 ` Grant Likely
0 siblings, 0 replies; 25+ messages in thread
From: Grant Likely @ 2012-11-15 9:10 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Nov 15, 2012 at 8:49 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Wed, Nov 14, 2012 at 08:49:54PM +0000, Grant Likely wrote:
>> On Fri, Nov 2, 2012 at 9:48 AM, Sascha Hauer <s.hauer@pengutronix.de> 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.
>> >
>> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>> > ---
>> > drivers/of/Kconfig | 3 +++
>> > drivers/of/Makefile | 1 +
>> > drivers/of/of_stdout.c | 27 +++++++++++++++++++++++++++
>> > include/linux/of_stdout.h | 24 ++++++++++++++++++++++++
>> > 4 files changed, 55 insertions(+)
>> > create mode 100644 drivers/of/of_stdout.c
>> > create mode 100644 include/linux/of_stdout.h
>> >
>> > diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
>> > index dfba3e6..8574ebb 100644
>> > --- a/drivers/of/Kconfig
>> > +++ b/drivers/of/Kconfig
>> > @@ -67,6 +67,9 @@ config OF_MDIO
>> > help
>> > OpenFirmware MDIO bus (Ethernet PHY) accessors
>> >
>> > +config OF_STDOUT
>> > + def_bool y
>> > +
>> > config OF_PCI
>> > def_tristate PCI
>> > depends on PCI
>> > diff --git a/drivers/of/Makefile b/drivers/of/Makefile
>> > index e027f44..c9f3f2f 100644
>> > --- a/drivers/of/Makefile
>> > +++ b/drivers/of/Makefile
>> > @@ -8,6 +8,7 @@ obj-$(CONFIG_OF_I2C) += of_i2c.o
>> > obj-$(CONFIG_OF_NET) += of_net.o
>> > obj-$(CONFIG_OF_SELFTEST) += selftest.o
>> > obj-$(CONFIG_OF_MDIO) += of_mdio.o
>> > +obj-$(CONFIG_OF_STDOUT) += of_stdout.o
>> > obj-$(CONFIG_OF_PCI) += of_pci.o
>> > obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o
>> > obj-$(CONFIG_OF_MTD) += of_mtd.o
>> > diff --git a/drivers/of/of_stdout.c b/drivers/of/of_stdout.c
>> > new file mode 100644
>> > index 0000000..c9e370e
>> > --- /dev/null
>> > +++ b/drivers/of/of_stdout.c
>> > @@ -0,0 +1,27 @@
>> > +/*
>> > + * OF helper for linux,stdoutpath property.
>> > + *
>> > + * This file is released under the GPLv2
>> > + */
>> > +#include <linux/of_stdout.h>
>> > +
>> > +/**
>> > + * of_device_is_stdout_path - check if a device node matches the
>> > + * linux,stdout-path property
>> > + *
>> > + * Check if this device node matches the linux,stdout-path property
>> > + * in the chosen node. return true if yes, false otherwise.
>> > + */
>> > +int of_device_is_stdout_path(struct device_node *dn)
>> > +{
>> > + const char *name;
>> > +
>> > + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
>> > + if (name == NULL)
>> > + return 0;
>> > +
>> > + if (dn == of_find_node_by_path(name))
>>
>> need to of_node_put() the return value of of_find_node_by_path()
>>
>> > + return 1;
>> > +
>> > + return 0;
>> > +}
>>
>> Hi Sascha,
>>
>> I'm fine with the helper, but there really is no need for a completely
>> separate .c file. Just put it in drivers/of/base.c.
>
> I guess the same applies to include/linux/of_stdout.h.
>
> Should I drop the CONFIG_OF_STDOUT aswell?
Yup.
g.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
2012-11-14 20:49 ` [PATCH 1/3] OF: Add helper for matching against linux, stdout-path Grant Likely
@ 2012-11-15 8:49 ` Sascha Hauer
-1 siblings, 0 replies; 25+ messages in thread
From: Sascha Hauer @ 2012-11-15 8:49 UTC (permalink / raw)
To: Grant Likely
Cc: linux-serial, Alan Cox, Greg Kroah-Hartman, linux-kernel,
devicetree-discuss, linux-arm-kernel, kernel
On Wed, Nov 14, 2012 at 08:49:54PM +0000, Grant Likely wrote:
> On Fri, Nov 2, 2012 at 9:48 AM, Sascha Hauer <s.hauer@pengutronix.de> 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.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > drivers/of/Kconfig | 3 +++
> > drivers/of/Makefile | 1 +
> > drivers/of/of_stdout.c | 27 +++++++++++++++++++++++++++
> > include/linux/of_stdout.h | 24 ++++++++++++++++++++++++
> > 4 files changed, 55 insertions(+)
> > create mode 100644 drivers/of/of_stdout.c
> > create mode 100644 include/linux/of_stdout.h
> >
> > diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> > index dfba3e6..8574ebb 100644
> > --- a/drivers/of/Kconfig
> > +++ b/drivers/of/Kconfig
> > @@ -67,6 +67,9 @@ config OF_MDIO
> > help
> > OpenFirmware MDIO bus (Ethernet PHY) accessors
> >
> > +config OF_STDOUT
> > + def_bool y
> > +
> > config OF_PCI
> > def_tristate PCI
> > depends on PCI
> > diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> > index e027f44..c9f3f2f 100644
> > --- a/drivers/of/Makefile
> > +++ b/drivers/of/Makefile
> > @@ -8,6 +8,7 @@ obj-$(CONFIG_OF_I2C) += of_i2c.o
> > obj-$(CONFIG_OF_NET) += of_net.o
> > obj-$(CONFIG_OF_SELFTEST) += selftest.o
> > obj-$(CONFIG_OF_MDIO) += of_mdio.o
> > +obj-$(CONFIG_OF_STDOUT) += of_stdout.o
> > obj-$(CONFIG_OF_PCI) += of_pci.o
> > obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o
> > obj-$(CONFIG_OF_MTD) += of_mtd.o
> > diff --git a/drivers/of/of_stdout.c b/drivers/of/of_stdout.c
> > new file mode 100644
> > index 0000000..c9e370e
> > --- /dev/null
> > +++ b/drivers/of/of_stdout.c
> > @@ -0,0 +1,27 @@
> > +/*
> > + * OF helper for linux,stdoutpath property.
> > + *
> > + * This file is released under the GPLv2
> > + */
> > +#include <linux/of_stdout.h>
> > +
> > +/**
> > + * of_device_is_stdout_path - check if a device node matches the
> > + * linux,stdout-path property
> > + *
> > + * Check if this device node matches the linux,stdout-path property
> > + * in the chosen node. return true if yes, false otherwise.
> > + */
> > +int of_device_is_stdout_path(struct device_node *dn)
> > +{
> > + const char *name;
> > +
> > + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> > + if (name == NULL)
> > + return 0;
> > +
> > + if (dn == of_find_node_by_path(name))
>
> need to of_node_put() the return value of of_find_node_by_path()
>
> > + return 1;
> > +
> > + return 0;
> > +}
>
> Hi Sascha,
>
> I'm fine with the helper, but there really is no need for a completely
> separate .c file. Just put it in drivers/of/base.c.
I guess the same applies to include/linux/of_stdout.h.
Should I drop the CONFIG_OF_STDOUT aswell?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux, stdout-path
@ 2012-11-15 8:49 ` Sascha Hauer
0 siblings, 0 replies; 25+ messages in thread
From: Sascha Hauer @ 2012-11-15 8:49 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Nov 14, 2012 at 08:49:54PM +0000, Grant Likely wrote:
> On Fri, Nov 2, 2012 at 9:48 AM, Sascha Hauer <s.hauer@pengutronix.de> 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.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > drivers/of/Kconfig | 3 +++
> > drivers/of/Makefile | 1 +
> > drivers/of/of_stdout.c | 27 +++++++++++++++++++++++++++
> > include/linux/of_stdout.h | 24 ++++++++++++++++++++++++
> > 4 files changed, 55 insertions(+)
> > create mode 100644 drivers/of/of_stdout.c
> > create mode 100644 include/linux/of_stdout.h
> >
> > diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> > index dfba3e6..8574ebb 100644
> > --- a/drivers/of/Kconfig
> > +++ b/drivers/of/Kconfig
> > @@ -67,6 +67,9 @@ config OF_MDIO
> > help
> > OpenFirmware MDIO bus (Ethernet PHY) accessors
> >
> > +config OF_STDOUT
> > + def_bool y
> > +
> > config OF_PCI
> > def_tristate PCI
> > depends on PCI
> > diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> > index e027f44..c9f3f2f 100644
> > --- a/drivers/of/Makefile
> > +++ b/drivers/of/Makefile
> > @@ -8,6 +8,7 @@ obj-$(CONFIG_OF_I2C) += of_i2c.o
> > obj-$(CONFIG_OF_NET) += of_net.o
> > obj-$(CONFIG_OF_SELFTEST) += selftest.o
> > obj-$(CONFIG_OF_MDIO) += of_mdio.o
> > +obj-$(CONFIG_OF_STDOUT) += of_stdout.o
> > obj-$(CONFIG_OF_PCI) += of_pci.o
> > obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o
> > obj-$(CONFIG_OF_MTD) += of_mtd.o
> > diff --git a/drivers/of/of_stdout.c b/drivers/of/of_stdout.c
> > new file mode 100644
> > index 0000000..c9e370e
> > --- /dev/null
> > +++ b/drivers/of/of_stdout.c
> > @@ -0,0 +1,27 @@
> > +/*
> > + * OF helper for linux,stdoutpath property.
> > + *
> > + * This file is released under the GPLv2
> > + */
> > +#include <linux/of_stdout.h>
> > +
> > +/**
> > + * of_device_is_stdout_path - check if a device node matches the
> > + * linux,stdout-path property
> > + *
> > + * Check if this device node matches the linux,stdout-path property
> > + * in the chosen node. return true if yes, false otherwise.
> > + */
> > +int of_device_is_stdout_path(struct device_node *dn)
> > +{
> > + const char *name;
> > +
> > + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> > + if (name == NULL)
> > + return 0;
> > +
> > + if (dn == of_find_node_by_path(name))
>
> need to of_node_put() the return value of of_find_node_by_path()
>
> > + return 1;
> > +
> > + return 0;
> > +}
>
> Hi Sascha,
>
> I'm fine with the helper, but there really is no need for a completely
> separate .c file. Just put it in drivers/of/base.c.
I guess the same applies to include/linux/of_stdout.h.
Should I drop the CONFIG_OF_STDOUT aswell?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
2012-11-14 20:49 ` [PATCH 1/3] OF: Add helper for matching against linux, stdout-path Grant Likely
@ 2012-11-15 8:04 ` Sascha Hauer
-1 siblings, 0 replies; 25+ messages in thread
From: Sascha Hauer @ 2012-11-15 8:04 UTC (permalink / raw)
To: Grant Likely
Cc: linux-serial, Alan Cox, Greg Kroah-Hartman, linux-kernel,
devicetree-discuss, linux-arm-kernel, kernel
On Wed, Nov 14, 2012 at 08:49:54PM +0000, Grant Likely wrote:
> > +int of_device_is_stdout_path(struct device_node *dn)
> > +{
> > + const char *name;
> > +
> > + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> > + if (name == NULL)
> > + return 0;
> > +
> > + if (dn == of_find_node_by_path(name))
>
> need to of_node_put() the return value of of_find_node_by_path()
>
> > + return 1;
> > +
> > + return 0;
> > +}
>
> Hi Sascha,
>
> I'm fine with the helper, but there really is no need for a completely
> separate .c file. Just put it in drivers/of/base.c.
Agreed.
Thanks,
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux, stdout-path
@ 2012-11-15 8:04 ` Sascha Hauer
0 siblings, 0 replies; 25+ messages in thread
From: Sascha Hauer @ 2012-11-15 8:04 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Nov 14, 2012 at 08:49:54PM +0000, Grant Likely wrote:
> > +int of_device_is_stdout_path(struct device_node *dn)
> > +{
> > + const char *name;
> > +
> > + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> > + if (name == NULL)
> > + return 0;
> > +
> > + if (dn == of_find_node_by_path(name))
>
> need to of_node_put() the return value of of_find_node_by_path()
>
> > + return 1;
> > +
> > + return 0;
> > +}
>
> Hi Sascha,
>
> I'm fine with the helper, but there really is no need for a completely
> separate .c file. Just put it in drivers/of/base.c.
Agreed.
Thanks,
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
2012-11-02 9:48 ` Sascha Hauer
@ 2012-11-14 20:49 ` Grant Likely
-1 siblings, 0 replies; 25+ messages in thread
From: Grant Likely @ 2012-11-14 20:49 UTC (permalink / raw)
To: Sascha Hauer
Cc: linux-serial, Alan Cox, Greg Kroah-Hartman, linux-kernel,
devicetree-discuss, linux-arm-kernel, kernel
On Fri, Nov 2, 2012 at 9:48 AM, Sascha Hauer <s.hauer@pengutronix.de> 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.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/of/Kconfig | 3 +++
> drivers/of/Makefile | 1 +
> drivers/of/of_stdout.c | 27 +++++++++++++++++++++++++++
> include/linux/of_stdout.h | 24 ++++++++++++++++++++++++
> 4 files changed, 55 insertions(+)
> create mode 100644 drivers/of/of_stdout.c
> create mode 100644 include/linux/of_stdout.h
>
> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> index dfba3e6..8574ebb 100644
> --- a/drivers/of/Kconfig
> +++ b/drivers/of/Kconfig
> @@ -67,6 +67,9 @@ config OF_MDIO
> help
> OpenFirmware MDIO bus (Ethernet PHY) accessors
>
> +config OF_STDOUT
> + def_bool y
> +
> config OF_PCI
> def_tristate PCI
> depends on PCI
> diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> index e027f44..c9f3f2f 100644
> --- a/drivers/of/Makefile
> +++ b/drivers/of/Makefile
> @@ -8,6 +8,7 @@ obj-$(CONFIG_OF_I2C) += of_i2c.o
> obj-$(CONFIG_OF_NET) += of_net.o
> obj-$(CONFIG_OF_SELFTEST) += selftest.o
> obj-$(CONFIG_OF_MDIO) += of_mdio.o
> +obj-$(CONFIG_OF_STDOUT) += of_stdout.o
> obj-$(CONFIG_OF_PCI) += of_pci.o
> obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o
> obj-$(CONFIG_OF_MTD) += of_mtd.o
> diff --git a/drivers/of/of_stdout.c b/drivers/of/of_stdout.c
> new file mode 100644
> index 0000000..c9e370e
> --- /dev/null
> +++ b/drivers/of/of_stdout.c
> @@ -0,0 +1,27 @@
> +/*
> + * OF helper for linux,stdoutpath property.
> + *
> + * This file is released under the GPLv2
> + */
> +#include <linux/of_stdout.h>
> +
> +/**
> + * of_device_is_stdout_path - check if a device node matches the
> + * linux,stdout-path property
> + *
> + * Check if this device node matches the linux,stdout-path property
> + * in the chosen node. return true if yes, false otherwise.
> + */
> +int of_device_is_stdout_path(struct device_node *dn)
> +{
> + const char *name;
> +
> + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> + if (name == NULL)
> + return 0;
> +
> + if (dn == of_find_node_by_path(name))
need to of_node_put() the return value of of_find_node_by_path()
> + return 1;
> +
> + return 0;
> +}
Hi Sascha,
I'm fine with the helper, but there really is no need for a completely
separate .c file. Just put it in drivers/of/base.c.
g.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux, stdout-path
@ 2012-11-14 20:49 ` Grant Likely
0 siblings, 0 replies; 25+ messages in thread
From: Grant Likely @ 2012-11-14 20:49 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 2, 2012 at 9:48 AM, Sascha Hauer <s.hauer@pengutronix.de> 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.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/of/Kconfig | 3 +++
> drivers/of/Makefile | 1 +
> drivers/of/of_stdout.c | 27 +++++++++++++++++++++++++++
> include/linux/of_stdout.h | 24 ++++++++++++++++++++++++
> 4 files changed, 55 insertions(+)
> create mode 100644 drivers/of/of_stdout.c
> create mode 100644 include/linux/of_stdout.h
>
> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> index dfba3e6..8574ebb 100644
> --- a/drivers/of/Kconfig
> +++ b/drivers/of/Kconfig
> @@ -67,6 +67,9 @@ config OF_MDIO
> help
> OpenFirmware MDIO bus (Ethernet PHY) accessors
>
> +config OF_STDOUT
> + def_bool y
> +
> config OF_PCI
> def_tristate PCI
> depends on PCI
> diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> index e027f44..c9f3f2f 100644
> --- a/drivers/of/Makefile
> +++ b/drivers/of/Makefile
> @@ -8,6 +8,7 @@ obj-$(CONFIG_OF_I2C) += of_i2c.o
> obj-$(CONFIG_OF_NET) += of_net.o
> obj-$(CONFIG_OF_SELFTEST) += selftest.o
> obj-$(CONFIG_OF_MDIO) += of_mdio.o
> +obj-$(CONFIG_OF_STDOUT) += of_stdout.o
> obj-$(CONFIG_OF_PCI) += of_pci.o
> obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o
> obj-$(CONFIG_OF_MTD) += of_mtd.o
> diff --git a/drivers/of/of_stdout.c b/drivers/of/of_stdout.c
> new file mode 100644
> index 0000000..c9e370e
> --- /dev/null
> +++ b/drivers/of/of_stdout.c
> @@ -0,0 +1,27 @@
> +/*
> + * OF helper for linux,stdoutpath property.
> + *
> + * This file is released under the GPLv2
> + */
> +#include <linux/of_stdout.h>
> +
> +/**
> + * of_device_is_stdout_path - check if a device node matches the
> + * linux,stdout-path property
> + *
> + * Check if this device node matches the linux,stdout-path property
> + * in the chosen node. return true if yes, false otherwise.
> + */
> +int of_device_is_stdout_path(struct device_node *dn)
> +{
> + const char *name;
> +
> + name = of_get_property(of_chosen, "linux,stdout-path", NULL);
> + if (name == NULL)
> + return 0;
> +
> + if (dn == of_find_node_by_path(name))
need to of_node_put() the return value of of_find_node_by_path()
> + return 1;
> +
> + return 0;
> +}
Hi Sascha,
I'm fine with the helper, but there really is no need for a completely
separate .c file. Just put it in drivers/of/base.c.
g.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
2012-11-02 9:48 ` Sascha Hauer
@ 2012-11-14 20:43 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 25+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-14 20:43 UTC (permalink / raw)
To: Sascha Hauer
Cc: linux-serial, Alan Cox, Grant Likely, linux-kernel,
devicetree-discuss, linux-arm-kernel, kernel
On Fri, Nov 02, 2012 at 10:48:52AM +0100, 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.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/of/Kconfig | 3 +++
> drivers/of/Makefile | 1 +
> drivers/of/of_stdout.c | 27 +++++++++++++++++++++++++++
> include/linux/of_stdout.h | 24 ++++++++++++++++++++++++
> 4 files changed, 55 insertions(+)
> create mode 100644 drivers/of/of_stdout.c
> create mode 100644 include/linux/of_stdout.h
I need an ACK from the OF maintainers before I can take this through the
tty tree.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux, stdout-path
@ 2012-11-14 20:43 ` Greg Kroah-Hartman
0 siblings, 0 replies; 25+ messages in thread
From: Greg Kroah-Hartman @ 2012-11-14 20:43 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 02, 2012 at 10:48:52AM +0100, 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.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/of/Kconfig | 3 +++
> drivers/of/Makefile | 1 +
> drivers/of/of_stdout.c | 27 +++++++++++++++++++++++++++
> include/linux/of_stdout.h | 24 ++++++++++++++++++++++++
> 4 files changed, 55 insertions(+)
> create mode 100644 drivers/of/of_stdout.c
> create mode 100644 include/linux/of_stdout.h
I need an ACK from the OF maintainers before I can take this through the
tty tree.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
2012-11-02 9:48 [PATCH v3] linux,stdout-path helper Sascha Hauer
@ 2012-11-02 9:48 ` Sascha Hauer
0 siblings, 0 replies; 25+ 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 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/of/Kconfig | 3 +++
drivers/of/Makefile | 1 +
drivers/of/of_stdout.c | 27 +++++++++++++++++++++++++++
include/linux/of_stdout.h | 24 ++++++++++++++++++++++++
4 files changed, 55 insertions(+)
create mode 100644 drivers/of/of_stdout.c
create mode 100644 include/linux/of_stdout.h
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index dfba3e6..8574ebb 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -67,6 +67,9 @@ config OF_MDIO
help
OpenFirmware MDIO bus (Ethernet PHY) accessors
+config OF_STDOUT
+ def_bool y
+
config OF_PCI
def_tristate PCI
depends on PCI
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index e027f44..c9f3f2f 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_OF_I2C) += of_i2c.o
obj-$(CONFIG_OF_NET) += of_net.o
obj-$(CONFIG_OF_SELFTEST) += selftest.o
obj-$(CONFIG_OF_MDIO) += of_mdio.o
+obj-$(CONFIG_OF_STDOUT) += of_stdout.o
obj-$(CONFIG_OF_PCI) += of_pci.o
obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o
obj-$(CONFIG_OF_MTD) += of_mtd.o
diff --git a/drivers/of/of_stdout.c b/drivers/of/of_stdout.c
new file mode 100644
index 0000000..c9e370e
--- /dev/null
+++ b/drivers/of/of_stdout.c
@@ -0,0 +1,27 @@
+/*
+ * OF helper for linux,stdoutpath property.
+ *
+ * This file is released under the GPLv2
+ */
+#include <linux/of_stdout.h>
+
+/**
+ * of_device_is_stdout_path - check if a device node matches the
+ * linux,stdout-path property
+ *
+ * Check if this device node matches the linux,stdout-path property
+ * in the chosen node. return true if yes, false otherwise.
+ */
+int of_device_is_stdout_path(struct device_node *dn)
+{
+ const char *name;
+
+ name = of_get_property(of_chosen, "linux,stdout-path", NULL);
+ if (name == NULL)
+ return 0;
+
+ if (dn == of_find_node_by_path(name))
+ return 1;
+
+ return 0;
+}
diff --git a/include/linux/of_stdout.h b/include/linux/of_stdout.h
new file mode 100644
index 0000000..0d80674
--- /dev/null
+++ b/include/linux/of_stdout.h
@@ -0,0 +1,24 @@
+/*
+ * OF helper for linux,stdoutpath property.
+ *
+ * This file is released under the GPLv2
+ */
+
+#ifndef __LINUX_OF_STDOUT_H
+#define __LINUX_OF_STDOUT_H
+
+#ifdef CONFIG_OF_STDOUT
+
+#include <linux/of.h>
+int of_device_is_stdout_path(struct device_node *dn);
+
+#else
+
+static inline int of_device_is_stdout_path(struct device_node *dn)
+{
+ return 0;
+}
+
+#endif
+
+#endif /* __LINUX_OF_STDOUT_H */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
@ 2012-11-02 9:48 ` Sascha Hauer
0 siblings, 0 replies; 25+ messages in thread
From: Sascha Hauer @ 2012-11-02 9:48 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/of/Kconfig | 3 +++
drivers/of/Makefile | 1 +
drivers/of/of_stdout.c | 27 +++++++++++++++++++++++++++
include/linux/of_stdout.h | 24 ++++++++++++++++++++++++
4 files changed, 55 insertions(+)
create mode 100644 drivers/of/of_stdout.c
create mode 100644 include/linux/of_stdout.h
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index dfba3e6..8574ebb 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -67,6 +67,9 @@ config OF_MDIO
help
OpenFirmware MDIO bus (Ethernet PHY) accessors
+config OF_STDOUT
+ def_bool y
+
config OF_PCI
def_tristate PCI
depends on PCI
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index e027f44..c9f3f2f 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_OF_I2C) += of_i2c.o
obj-$(CONFIG_OF_NET) += of_net.o
obj-$(CONFIG_OF_SELFTEST) += selftest.o
obj-$(CONFIG_OF_MDIO) += of_mdio.o
+obj-$(CONFIG_OF_STDOUT) += of_stdout.o
obj-$(CONFIG_OF_PCI) += of_pci.o
obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o
obj-$(CONFIG_OF_MTD) += of_mtd.o
diff --git a/drivers/of/of_stdout.c b/drivers/of/of_stdout.c
new file mode 100644
index 0000000..c9e370e
--- /dev/null
+++ b/drivers/of/of_stdout.c
@@ -0,0 +1,27 @@
+/*
+ * OF helper for linux,stdoutpath property.
+ *
+ * This file is released under the GPLv2
+ */
+#include <linux/of_stdout.h>
+
+/**
+ * of_device_is_stdout_path - check if a device node matches the
+ * linux,stdout-path property
+ *
+ * Check if this device node matches the linux,stdout-path property
+ * in the chosen node. return true if yes, false otherwise.
+ */
+int of_device_is_stdout_path(struct device_node *dn)
+{
+ const char *name;
+
+ name = of_get_property(of_chosen, "linux,stdout-path", NULL);
+ if (name == NULL)
+ return 0;
+
+ if (dn == of_find_node_by_path(name))
+ return 1;
+
+ return 0;
+}
diff --git a/include/linux/of_stdout.h b/include/linux/of_stdout.h
new file mode 100644
index 0000000..0d80674
--- /dev/null
+++ b/include/linux/of_stdout.h
@@ -0,0 +1,24 @@
+/*
+ * OF helper for linux,stdoutpath property.
+ *
+ * This file is released under the GPLv2
+ */
+
+#ifndef __LINUX_OF_STDOUT_H
+#define __LINUX_OF_STDOUT_H
+
+#ifdef CONFIG_OF_STDOUT
+
+#include <linux/of.h>
+int of_device_is_stdout_path(struct device_node *dn);
+
+#else
+
+static inline int of_device_is_stdout_path(struct device_node *dn)
+{
+ return 0;
+}
+
+#endif
+
+#endif /* __LINUX_OF_STDOUT_H */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 25+ messages in thread
end of thread, other threads:[~2012-11-20 16:52 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 9:31 [PATCH v4] linux,stdout-path helper Sascha Hauer
2012-11-15 9:31 ` Sascha Hauer
2012-11-15 9:31 ` [PATCH 1/3] OF: Add helper for matching against linux,stdout-path Sascha Hauer
2012-11-15 9:31 ` Sascha Hauer
2012-11-19 9:52 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-19 9:52 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-20 16:51 ` Grant Likely
2012-11-20 16:51 ` [PATCH 1/3] OF: Add helper for matching against linux, stdout-path Grant Likely
2012-11-15 9:31 ` [PATCH 2/3] serial: i.MX: Make console support non optional Sascha Hauer
2012-11-15 9:31 ` Sascha Hauer
2012-11-15 9:31 ` 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
-- strict thread matches above, loose matches on Subject: below --
2012-11-02 9:48 [PATCH v3] linux,stdout-path helper Sascha Hauer
2012-11-02 9:48 ` [PATCH 1/3] OF: Add helper for matching against linux,stdout-path Sascha Hauer
2012-11-02 9:48 ` Sascha Hauer
2012-11-14 20:43 ` Greg Kroah-Hartman
2012-11-14 20:43 ` [PATCH 1/3] OF: Add helper for matching against linux, stdout-path Greg Kroah-Hartman
2012-11-14 20:49 ` [PATCH 1/3] OF: Add helper for matching against linux,stdout-path Grant Likely
2012-11-14 20:49 ` [PATCH 1/3] OF: Add helper for matching against linux, stdout-path Grant Likely
2012-11-15 8:04 ` [PATCH 1/3] OF: Add helper for matching against linux,stdout-path Sascha Hauer
2012-11-15 8:04 ` [PATCH 1/3] OF: Add helper for matching against linux, stdout-path Sascha Hauer
2012-11-15 8:49 ` [PATCH 1/3] OF: Add helper for matching against linux,stdout-path Sascha Hauer
2012-11-15 8:49 ` [PATCH 1/3] OF: Add helper for matching against linux, stdout-path Sascha Hauer
2012-11-15 9:10 ` [PATCH 1/3] OF: Add helper for matching against linux,stdout-path Grant Likely
2012-11-15 9:10 ` [PATCH 1/3] OF: Add helper for matching against linux, stdout-path Grant Likely
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.