From: Nishanth Menon <nm@ti.com>
To: Roger Quadros <rogerq@ti.com>
Cc: tony@atomide.com, balbi@ti.com, linux-omap@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2] pinctrl: dra: dt-bindings: Fix output pull up/down
Date: Mon, 3 Nov 2014 08:59:36 -0600 [thread overview]
Message-ID: <54579858.4030605@ti.com> (raw)
In-Reply-To: <545794CB.5030802@ti.com>
On 11/03/2014 08:44 AM, Roger Quadros wrote:
> On 11/03/2014 04:30 PM, Nishanth Menon wrote:
>> On 12:09-20141103, Roger Quadros wrote:
>>> For PIN_OUTPUT_PULLUP and PIN_OUTPUT_PULLDOWN we must not set the
>>> PULL_DIS bit which disables the PULLs.
>>>
>>> PULL_ENA is a 0 and using it in an OR operation is a NOP, so don't
>>> use it in the PIN_OUTPUT_PULLUP/DOWN macros.
>>>
>>> Fixes: 23d9cec07c58 ("pinctrl: dra: dt-bindings: Fix pull enable/disable")
>>>
>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>> ---
>>> include/dt-bindings/pinctrl/dra.h | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/include/dt-bindings/pinctrl/dra.h b/include/dt-bindings/pinctrl/dra.h
>>> index 3d33794..7448edf 100644
>>> --- a/include/dt-bindings/pinctrl/dra.h
>>> +++ b/include/dt-bindings/pinctrl/dra.h
>>> @@ -40,8 +40,8 @@
>>>
>>> /* Active pin states */
>>> #define PIN_OUTPUT (0 | PULL_DIS)
>>> -#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP)
>>> -#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA)
>>> +#define PIN_OUTPUT_PULLUP (PULL_UP)
>>> +#define PIN_OUTPUT_PULLDOWN (0)
>>> #define PIN_INPUT (INPUT_EN | PULL_DIS)
>>> #define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL)
>>> #define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP)
>>
>> You are right, we do have an issue with using PIN_OUTPUT along with
>> remaining setting.
>>
>> For a moment, I wondered why input was not impacted - then I realized
>> that INPUT_EN was being used instead of PIN_INPUT - following that
>> convention. With the intent being explicitly using macros that
>> clearly indicate what each setting combination is is, how about the
>> following?
>>
>>
>> diff --git a/include/dt-bindings/pinctrl/dra.h b/include/dt-bindings/pinctrl/dra.h
>> index 3d33794..d4037e7 100644
>> --- a/include/dt-bindings/pinctrl/dra.h
>> +++ b/include/dt-bindings/pinctrl/dra.h
>> @@ -34,14 +34,15 @@
>> #define PULL_DIS (1 << 16)
>> #define PULL_UP (1 << 17)
>> #define INPUT_EN (1 << 18)
>> +#define OUTPUT_EN (0 << 18)
>> #define SLEWCONTROL (1 << 19)
>> #define WAKEUP_EN (1 << 24)
>> #define WAKEUP_EVENT (1 << 25)
>>
>> /* Active pin states */
>> -#define PIN_OUTPUT (0 | PULL_DIS)
>> -#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP)
>> -#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA)
>> +#define PIN_OUTPUT (OUTPUT_EN | PULL_DIS)
>> +#define PIN_OUTPUT_PULLUP (OUTPUT_EN | PULL_ENA | PULL_UP)
>> +#define PIN_OUTPUT_PULLDOWN (OUTPUT_EN | PULL_ENA)
>
> To me it adds more confusion and this change is a NOP as we're ORing 0 here
> with OUTPUT_EN.
look at this this way:
PIN_OUTPUT_PULLDOWN (OUTPUT_EN | PULL_ENA)
should probably trigger in mind (what about PULLDOWN?)
PIN_OUTPUT_PULLDOWN (OUTPUT_EN | PULL_ENA | PULL_DOWN)
then verify values of each OUTPUT_EN -> 0 in bit 18, ok, etc.
if we ensure that PIN_XX macros use just the basic primitives, it is
easier to prevent the mistake like the one I made. the other option of
not defining macros whose values are 0 implies that the reviewer has
to recheck against trm to ensure all the right "1" bits are set.
just my view here.
>
>> #define PIN_INPUT (INPUT_EN | PULL_DIS)
>> #define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL)
>> #define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP)
>>
>
> cheers,
> -roger
>
--
Regards,
Nishanth Menon
next prev parent reply other threads:[~2014-11-03 14:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-31 10:52 [PATCH] pinctrl: dra: dt-bindings: Fix output pull up/down Roger Quadros
2014-10-31 13:50 ` Nishanth Menon
2014-11-03 9:28 ` Roger Quadros
2014-11-03 10:09 ` [PATCH v2] " Roger Quadros
2014-11-03 14:30 ` Nishanth Menon
2014-11-03 14:44 ` Roger Quadros
2014-11-03 14:59 ` Nishanth Menon [this message]
2014-11-03 15:07 ` Roger Quadros
2014-11-03 17:56 ` Nishanth Menon
2014-11-05 17:10 ` Nishanth Menon
2014-11-10 22:29 ` 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=54579858.4030605@ti.com \
--to=nm@ti.com \
--cc=balbi@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=rogerq@ti.com \
--cc=tony@atomide.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).