* [PATCH v4] linux,stdout-path helper @ 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 ` (2 more replies) 0 siblings, 3 replies; 6+ 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] 6+ messages in thread
* [PATCH 1/3] OF: Add helper for matching against linux,stdout-path 2012-11-15 9:31 [PATCH v4] linux,stdout-path helper Sascha Hauer @ 2012-11-15 9:31 ` Sascha Hauer 2012-11-19 9:52 ` Jean-Christophe PLAGNIOL-VILLARD [not found] ` <1352971866-540-1-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2012-11-15 9:31 ` [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property Sascha Hauer 2 siblings, 1 reply; 6+ 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] 6+ messages in thread
* Re: [PATCH 1/3] OF: Add helper for matching against linux,stdout-path 2012-11-15 9:31 ` [PATCH 1/3] OF: Add helper for matching against linux,stdout-path Sascha Hauer @ 2012-11-19 9:52 ` Jean-Christophe PLAGNIOL-VILLARD 2012-11-20 16:51 ` Grant Likely 0 siblings, 1 reply; 6+ 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] 6+ 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 0 siblings, 0 replies; 6+ 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] 6+ messages in thread
[parent not found: <1352971866-540-1-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* [PATCH 2/3] serial: i.MX: Make console support non optional [not found] ` <1352971866-540-1-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2012-11-15 9:31 ` Sascha Hauer 0 siblings, 0 replies; 6+ 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] 6+ 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 ` [PATCH 1/3] OF: Add helper for matching against linux,stdout-path Sascha Hauer [not found] ` <1352971866-540-1-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2012-11-15 9:31 ` Sascha Hauer 2 siblings, 0 replies; 6+ 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] 6+ messages in thread
end of thread, other threads:[~2012-11-20 16:51 UTC | newest] Thread overview: 6+ 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 ` [PATCH 1/3] OF: Add helper for matching against linux,stdout-path Sascha Hauer 2012-11-19 9:52 ` Jean-Christophe PLAGNIOL-VILLARD 2012-11-20 16:51 ` Grant Likely [not found] ` <1352971866-540-1-git-send-email-s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2012-11-15 9:31 ` [PATCH 2/3] serial: i.MX: Make console support non optional Sascha Hauer 2012-11-15 9:31 ` [PATCH 3/3] serial: i.MX: evaluate linux,stdout-path property Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).