* [PATCH v6] linux,stdout-path helper @ 2013-08-05 12:40 Sascha Hauer 2013-08-05 12:40 ` [PATCH 1/2] OF: Add helper for matching against linux,stdout-path Sascha Hauer ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Sascha Hauer @ 2013-08-05 12:40 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 This is a series originally created by me. It was hijacked and then abandoned by Jean-Christophe for v5. I reverted the changes by Jean-Christophe since they introduced changes to the devicetree binding. Instead I'd like to have the existing binding implemented first before changing it. Sascha changes since v5: - reverted changes from v4 - parse linux,stdoutpath property in of_alias_scan as suggested by Grant changes since v4: - add option support and check stdout-path too 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] 7+ messages in thread
* [PATCH 1/2] OF: Add helper for matching against linux,stdout-path 2013-08-05 12:40 [PATCH v6] linux,stdout-path helper Sascha Hauer @ 2013-08-05 12:40 ` Sascha Hauer 2013-08-05 12:59 ` [PATCH 1/2] OF: Add helper for matching against linux, stdout-path Rob Herring 2013-08-05 12:40 ` [PATCH 2/2] serial: i.MX: evaluate linux,stdout-path property Sascha Hauer 2013-08-12 6:04 ` [PATCH v6] linux,stdout-path helper Sascha Hauer 2 siblings, 1 reply; 7+ messages in thread From: Sascha Hauer @ 2013-08-05 12:40 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 | 26 ++++++++++++++++++++++++++ include/linux/of.h | 7 +++++++ 2 files changed, 33 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 5c54279..1c3c79c 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -32,6 +32,7 @@ struct device_node *of_allnodes; EXPORT_SYMBOL(of_allnodes); struct device_node *of_chosen; struct device_node *of_aliases; +static struct device_node *of_stdout; DEFINE_MUTEX(of_aliases_mutex); @@ -1595,6 +1596,15 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) of_chosen = of_find_node_by_path("/chosen"); if (of_chosen == NULL) of_chosen = of_find_node_by_path("/chosen at 0"); + + if (of_chosen) { + const char *name; + + name = of_get_property(of_chosen, "linux,stdout-path", NULL); + if (name) + of_stdout = of_find_node_by_path(name); + } + of_aliases = of_find_node_by_path("/aliases"); if (!of_aliases) return; @@ -1703,3 +1713,19 @@ 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) +{ + if (!of_stdout) + return false; + + return of_stdout == dn; +} +EXPORT_SYMBOL_GPL(of_device_is_stdout_path); diff --git a/include/linux/of.h b/include/linux/of.h index 1fd08ca..429e168 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -343,6 +343,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) @@ -505,6 +507,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.8.4.rc0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 1/2] OF: Add helper for matching against linux, stdout-path 2013-08-05 12:40 ` [PATCH 1/2] OF: Add helper for matching against linux,stdout-path Sascha Hauer @ 2013-08-05 12:59 ` Rob Herring 2013-08-05 13:16 ` [PATCH 1/2] OF: Add helper for matching against linux,stdout-path Sascha Hauer 0 siblings, 1 reply; 7+ messages in thread From: Rob Herring @ 2013-08-05 12:59 UTC (permalink / raw) To: linux-arm-kernel On 08/05/2013 07:40 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. > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Rob Herring <rob.herring@calxeda.com> There are no existing users that could take advantage of this? Rob > --- > drivers/of/base.c | 26 ++++++++++++++++++++++++++ > include/linux/of.h | 7 +++++++ > 2 files changed, 33 insertions(+) > > diff --git a/drivers/of/base.c b/drivers/of/base.c > index 5c54279..1c3c79c 100644 > --- a/drivers/of/base.c > +++ b/drivers/of/base.c > @@ -32,6 +32,7 @@ struct device_node *of_allnodes; > EXPORT_SYMBOL(of_allnodes); > struct device_node *of_chosen; > struct device_node *of_aliases; > +static struct device_node *of_stdout; > > DEFINE_MUTEX(of_aliases_mutex); > > @@ -1595,6 +1596,15 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) > of_chosen = of_find_node_by_path("/chosen"); > if (of_chosen == NULL) > of_chosen = of_find_node_by_path("/chosen at 0"); > + > + if (of_chosen) { > + const char *name; > + > + name = of_get_property(of_chosen, "linux,stdout-path", NULL); > + if (name) > + of_stdout = of_find_node_by_path(name); > + } > + > of_aliases = of_find_node_by_path("/aliases"); > if (!of_aliases) > return; > @@ -1703,3 +1713,19 @@ 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) > +{ > + if (!of_stdout) > + return false; > + > + return of_stdout == dn; > +} > +EXPORT_SYMBOL_GPL(of_device_is_stdout_path); > diff --git a/include/linux/of.h b/include/linux/of.h > index 1fd08ca..429e168 100644 > --- a/include/linux/of.h > +++ b/include/linux/of.h > @@ -343,6 +343,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) > @@ -505,6 +507,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) \ > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] OF: Add helper for matching against linux,stdout-path 2013-08-05 12:59 ` [PATCH 1/2] OF: Add helper for matching against linux, stdout-path Rob Herring @ 2013-08-05 13:16 ` Sascha Hauer 0 siblings, 0 replies; 7+ messages in thread From: Sascha Hauer @ 2013-08-05 13:16 UTC (permalink / raw) To: linux-arm-kernel On Mon, Aug 05, 2013 at 07:59:01AM -0500, Rob Herring wrote: > On 08/05/2013 07:40 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. > > > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > > Acked-by: Rob Herring <rob.herring@calxeda.com> > > There are no existing users that could take advantage of this? The existing users do not register the console in the drivers probe function but instead have initcalls which parse the linux,stdout-path property manually and register whatever they find there. The better implementations at least check whether the node they find actually is compatible to the driver. Sorry, no users to change here without having access to the hardware. 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] 7+ messages in thread
* [PATCH 2/2] serial: i.MX: evaluate linux,stdout-path property 2013-08-05 12:40 [PATCH v6] linux,stdout-path helper Sascha Hauer 2013-08-05 12:40 ` [PATCH 1/2] OF: Add helper for matching against linux,stdout-path Sascha Hauer @ 2013-08-05 12:40 ` Sascha Hauer 2013-08-12 6:04 ` [PATCH v6] linux,stdout-path helper Sascha Hauer 2 siblings, 0 replies; 7+ messages in thread From: Sascha Hauer @ 2013-08-05 12:40 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 415cec6..420ad02 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1472,6 +1472,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.8.4.rc0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v6] linux,stdout-path helper 2013-08-05 12:40 [PATCH v6] linux,stdout-path helper Sascha Hauer 2013-08-05 12:40 ` [PATCH 1/2] OF: Add helper for matching against linux,stdout-path Sascha Hauer 2013-08-05 12:40 ` [PATCH 2/2] serial: i.MX: evaluate linux,stdout-path property Sascha Hauer @ 2013-08-12 6:04 ` Sascha Hauer 2013-08-12 18:22 ` Greg Kroah-Hartman 2 siblings, 1 reply; 7+ messages in thread From: Sascha Hauer @ 2013-08-12 6:04 UTC (permalink / raw) To: linux-arm-kernel Greg, Given that we have Robs Ack, can you take this series? Sascha On Mon, Aug 05, 2013 at 02:40:43PM +0200, Sascha Hauer wrote: > 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 > > This is a series originally created by me. It was hijacked and then abandoned > by Jean-Christophe for v5. I reverted the changes by Jean-Christophe since > they introduced changes to the devicetree binding. Instead I'd like to have > the existing binding implemented first before changing it. > > Sascha > > changes since v5: > - reverted changes from v4 > - parse linux,stdoutpath property in of_alias_scan as suggested by Grant > changes since v4: > - add option support and check stdout-path too > 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. > > -- 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] 7+ messages in thread
* [PATCH v6] linux,stdout-path helper 2013-08-12 6:04 ` [PATCH v6] linux,stdout-path helper Sascha Hauer @ 2013-08-12 18:22 ` Greg Kroah-Hartman 0 siblings, 0 replies; 7+ messages in thread From: Greg Kroah-Hartman @ 2013-08-12 18:22 UTC (permalink / raw) To: linux-arm-kernel On Mon, Aug 12, 2013 at 08:04:44AM +0200, Sascha Hauer wrote: > Greg, > > Given that we have Robs Ack, can you take this series? Yes, will do. greg k-h ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-08-12 18:22 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-08-05 12:40 [PATCH v6] linux,stdout-path helper Sascha Hauer 2013-08-05 12:40 ` [PATCH 1/2] OF: Add helper for matching against linux,stdout-path Sascha Hauer 2013-08-05 12:59 ` [PATCH 1/2] OF: Add helper for matching against linux, stdout-path Rob Herring 2013-08-05 13:16 ` [PATCH 1/2] OF: Add helper for matching against linux,stdout-path Sascha Hauer 2013-08-05 12:40 ` [PATCH 2/2] serial: i.MX: evaluate linux,stdout-path property Sascha Hauer 2013-08-12 6:04 ` [PATCH v6] linux,stdout-path helper Sascha Hauer 2013-08-12 18:22 ` Greg Kroah-Hartman
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).