devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-serial@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devicetree-discuss@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de,
	linux-arm-kernel@lists.infradead.org,
	Alan Cox <alan@linux.intel.com>
Subject: Re: [PATCH 1/3] OF: Add helper for matching against linux,stdout-path
Date: Mon, 19 Nov 2012 10:52:02 +0100	[thread overview]
Message-ID: <20121119095202.GL4398@game.jcrosoft.org> (raw)
In-Reply-To: <1352971866-540-2-git-send-email-s.hauer@pengutronix.de>

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

  reply	other threads:[~2012-11-19  9:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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
  -- 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-14 20:43   ` Greg Kroah-Hartman
2012-11-14 20:49   ` Grant Likely
2012-11-15  8:04     ` Sascha Hauer
2012-11-15  8:49     ` Sascha Hauer
2012-11-15  9:10       ` Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121119095202.GL4398@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=alan@linux.intel.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).