From: Tony Lindgren <tony@atomide.com>
To: Jun Nie <jun.nie@linaro.org>
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
linux-gpio@vger.kernel.org, Shawn Guo <shawn.guo@linaro.org>,
"wan.zhijun" <wan.zhijun@zte.com.cn>,
Jason Liu <jason.liu@linaro.org>
Subject: Re: [PATCH] pinctrl: single: support GPIO for bits pinctrl
Date: Mon, 6 Jul 2015 03:40:00 -0700 [thread overview]
Message-ID: <20150706103959.GD10644@atomide.com> (raw)
In-Reply-To: <CABymUCPJFcdhvy__yGV_sjJQ+Ts9s9mAORaQet9htaqUXAseVQ@mail.gmail.com>
* Jun Nie <jun.nie@linaro.org> [150706 02:21]:
> 2015-07-06 17:03 GMT+08:00 Tony Lindgren <tony@atomide.com>:
> > * Jun Nie <jun.nie@linaro.org> [150706 01:43]:
> >> 2015-06-23 18:18 GMT+08:00 Jun Nie <jun.nie@linaro.org>:
> >> > 2015-06-23 18:14 GMT+08:00 Tony Lindgren <tony@atomide.com>:
> >> >> * Jun Nie <jun.nie@linaro.org> [150623 02:56]:
> >> >>> 2015-06-17 15:17 GMT+08:00 Tony Lindgren <tony@atomide.com>:
> >> >>> > * Jun Nie <jun.nie@linaro.org> [150616 18:58]:
> >> >>> >> + if (pcs->bits_per_mux) {
> >> >>> >> + int pin_pos, byte_num, num_pins_in_register;
> >> >>> >> +
> >> >>> >> + num_pins_in_register = pcs->width / pcs->bits_per_pin;
> >> >>> >> + byte_num = (pcs->bits_per_pin * pin) / BITS_PER_BYTE;
> >> >>> >> + offset = (byte_num / mux_bytes) * mux_bytes;
> >> >>> >> + pin_pos = pin % num_pins_in_register;
> >> >>> >> + pin_pos *= pcs->bits_per_pin;
> >> >>> >> + data = pcs->read(pcs->base + offset) &
> >> >>> >> + ~(pcs->fmask << pin_pos);
> >> >>> >
> >> >>> > Should you check the pcs->fmask here too in case some bits are reserved?
> >> >>> >
> >> >>> Did not catch your idea? Those bits set in fmask are dedicated for one
> >> >>> pin mux control and should be clear before set as desired value per my
> >> >>> understanding. Do you mean some bits may be reserved and not for any
> >> >>> function?
> >> >>
> >> >> Right, can you please check that we don't try to write to reserved
> >> >> bits in the hardawre if the mask is set?
> >>
> >> > Then I have question that how can I know what bits is for function
> >> > mask, what bits are for reserved? Do we have any other value to
> >> > indicate it? I did not find it in one register for one pin mux case.
> >>
> >> Could you help elaborate this? Thanks!
> >
> > We can only write to the bits specified in pinctrl-single,function-mask.
> >
> I see, you want below mask to make sure gpiofunc value does not exceed
> expected bits though it should be safe if dts data is correct. Right?
> + data = pcs->read(pcs->base + offset) &
> + ~(pcs->fmask << pin_pos);
> + data |= (pcs->fmask & frange->gpiofunc) << pin_pos;
Yes please :)
Tony
next prev parent reply other threads:[~2015-07-06 10:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-17 1:56 [PATCH] pinctrl: single: support GPIO for bits pinctrl Jun Nie
2015-06-17 7:17 ` Tony Lindgren
2015-06-19 14:55 ` Haojian Zhuang
2015-06-23 9:54 ` Jun Nie
2015-06-23 10:14 ` Tony Lindgren
2015-06-23 10:18 ` Jun Nie
2015-07-06 8:40 ` Jun Nie
2015-07-06 9:03 ` Tony Lindgren
2015-07-06 9:19 ` Jun Nie
2015-07-06 10:40 ` Tony Lindgren [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-06-12 8:19 Jun Nie
2015-06-16 9:17 ` Linus Walleij
2015-06-16 11:28 ` 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=20150706103959.GD10644@atomide.com \
--to=tony@atomide.com \
--cc=haojian.zhuang@linaro.org \
--cc=jason.liu@linaro.org \
--cc=jun.nie@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=shawn.guo@linaro.org \
--cc=wan.zhijun@zte.com.cn \
/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).