lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <071614c0-0f84-6087-47c6-385541c5733d@baylibre.com>
Date:   Mon, 22 May 2023 14:26:48 +0200
From:   jerome Neanne <jneanne@...libre.com>
To:     Tony Lindgren <tony@...mide.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <brgl@...ev.pl>,
        Lee Jones <lee@...nel.org>, linux-kernel@...r.kernel.org,
        linux-gpio@...r.kernel.org, linux-omap@...r.kernel.org,
        Jonathan Cormier <jcormier@...ticallink.com>
Subject: Re: [PATCH v2 1/2] gpio: tps65219: add GPIO support for TPS65219 PMIC



On 17/05/2023 08:33, Tony Lindgren wrote:
> * jerome Neanne <jneanne@...libre.com> [230512 07:13]:
>>
>>
>> On 11/05/2023 22:57, Linus Walleij wrote:
>>>> +       /* Documentation is stating that GPIO0 direction must not be changed in Linux:
>>>> +        * Table 8-34. MFP_1_CONFIG(3): MULTI_DEVICE_ENABLE,
>>>> +        * Should only be changed in INITIALIZE state (prior to ON Request).
>>>> +        * Set statically by NVM, changing direction in application can cause a hang.
>>>> +        * Below can be used for test purpose only:
>>>> +        */
>>>> +
>>>> +#if 0
>>>> +       int ret = regmap_update_bits(gpio->tps->regmap, TPS65219_REG_MFP_1_CONFIG,
>>>> +                                TPS65219_GPIO0_DIR_MASK, direction);
>>>> +       if (ret)
>>>> +               return ret;
>>>> +#endif
>>>> +       dev_err(gpio->tps->dev,
>>>> +               "GPIO%d direction set by NVM, change to %u failed, not allowed by specification\n",
>>>> +                offset, direction);
>>>> +       return -EOPNOTSUPP;
>>>> +}
>>>
>>> Normally people would complain about #if 0 code.
>>>
>>> But this is a special case!
>>>
>>> I definitely want the code to be in there somehow.
>>>
>>> What about:
>>>
>>> if (IS_ENABLED(DEBUG))?
>>>
>>> If someone enables debug with an explicit -DDEBUG to the compiler
>>> this could be allowed.
>> I'm fine with your proposal. Will wait few days just in case anyone wants to
>> add any comment then go for this.
> 
> Just wondering.. Would it help for the driver probe to set gpio0 as a gpio
> hog after reading the configured value?
> 
> Maybe the multi device enable just means the pin may be shared with no
> specific hardware reason to not change it during the runtime?

Your point looks valid. But I think we can't simply add a regular 
"gpio-hog" as a property in the device tree because we don't have a one 
to one mapping for GPIO consumer (theoretically we can have more than 2 
PMICs).

I think your suggestion is to read the multi-device value through regmap 
then "kind of" hog gpio with devm_gpio_request_one
So that gpio0 is preserved from being requested by other user.
Is this correct understanding?

Practically the board I'm using for test currently only have one PMIC.
I'm reluctant to implement additional logic that does not look so 
"conventional" that I can't test.

If maintainers agree, I'll postpone the implementation of your proposal 
until a platform compatible with this implementation is available for 
testing. So that we can check what is most accurate in real life.

Side Note: wo this implementation use of the driver is less optimal in 
multi-device configuration but still usable.

Regards,
Jerome.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ