From: Tony Lindgren <tony@atomide.com>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/2] pinctrl: pinctrl-single: Add pinctrl-single,bits type of mux
Date: Thu, 6 Sep 2012 12:10:19 -0700 [thread overview]
Message-ID: <20120906191019.GZ1303@atomide.com> (raw)
In-Reply-To: <1346835718-21325-3-git-send-email-peter.ujfalusi@ti.com>
Hi Peter,
* Peter Ujfalusi <peter.ujfalusi@ti.com> [120905 02:02]:
> With pinctrl-single,bits it is possible to update just part of the register
> within the pinctrl-single,function-mask area.
> This is useful when one register configures mmore than one pin's mux.
You have a typo here: ^^^^^
> --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
> +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
> @@ -31,6 +31,15 @@ device pinctrl register, and 0x118 contains the desired value of the
> pinctrl register. See the device example and static board pins example
> below for more information.
>
> +In case when one register changes more than one pin's mux the
> +pinctrl-single,bits can be used which takes three parameters:
> +
> + pinctrl-single,bits = <0xdc 0x18, 0xff>;
> +
> +Where 0xdc is the offset from the pinctrl register base address for the
> +device pinctrl register, 0x18 is the desired value, and 0xff is the sub mask to
> +be used when applying this change to the register.
> +
Is it now safe to assume that we always have width of three if
pinctrl-single,bits is specified? The reason I'm asking is..
> @@ -657,18 +664,29 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
> {
> struct pcs_func_vals *vals;
> const __be32 *mux;
> - int size, rows, *pins, index = 0, found = 0, res = -ENOMEM;
> + int size, params, rows, *pins, index = 0, found = 0, res = -ENOMEM;
> struct pcs_function *function;
>
> - mux = of_get_property(np, PCS_MUX_NAME, &size);
> - if ((!mux) || (size < sizeof(*mux) * 2)) {
> - dev_err(pcs->dev, "bad data for mux %s\n",
> - np->name);
> + mux = of_get_property(np, PCS_MUX_PINS_NAME, &size);
> + if (mux) {
> + params = 2;
> + } else {
> + mux = of_get_property(np, PCS_MUX_BITS_NAME, &size);
> + if (!mux) {
> + dev_err(pcs->dev, "no valid property for %s\n",
> + np->name);
> + return -EINVAL;
> + }
> + params = 3;
> + }
..because here we could assume the default value for params is 2
if pinctrl-single,pins is specified, and otherwise params is 3
if pinctrl-single,bits is specified for the controller. That would
avoid querying a potentially non-exiting property for each entry.
> @@ -686,6 +704,10 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
> val = be32_to_cpup(mux + index++);
> vals[found].reg = pcs->base + offset;
> vals[found].val = val;
> + if (params == 3) {
> + val = be32_to_cpup(mux + index++);
> + vals[found].mask = val;
> + }
>
> pin = pcs_get_pin_by_offset(pcs, offset);
> if (pin < 0) {
Here params too would be then set during probe already.
Other than that, seems to still work for me for my test cases.
Regards,
Tony
next prev parent reply other threads:[~2012-09-06 19:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 9:01 [PATCH 0/2] pinctrl: pinctrl-single: new type: pinctrl-single,bits Peter Ujfalusi
2012-09-05 9:01 ` [PATCH 1/2] pinctrl: pinctrl-single: Make sure we do not change bits outside of mask Peter Ujfalusi
2012-09-06 18:59 ` Tony Lindgren
2012-09-07 21:13 ` Linus Walleij
2012-09-07 21:39 ` Tony Lindgren
2012-09-10 7:09 ` Linus Walleij
2012-09-05 9:01 ` [PATCH 2/2] pinctrl: pinctrl-single: Add pinctrl-single,bits type of mux Peter Ujfalusi
2012-09-06 19:10 ` Tony Lindgren [this message]
2012-09-07 15:13 ` Peter Ujfalusi
2012-09-07 16:55 ` Tony Lindgren
2012-09-10 11:55 ` Peter Ujfalusi
2012-09-10 17:10 ` Tony Lindgren
2012-09-10 7:10 ` Linus Walleij
2012-09-10 18:49 ` Tony Lindgren
2012-09-05 12:10 ` [PATCH 0/2] pinctrl: pinctrl-single: new type: pinctrl-single,bits Linus Walleij
2012-09-05 18:20 ` Tony Lindgren
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=20120906191019.GZ1303@atomide.com \
--to=tony@atomide.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=peter.ujfalusi@ti.com \
/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).