All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: meson: fix bit manipulation of pin bias configuration
@ 2020-12-14 18:48 Neil Armstrong
  2020-12-14 20:48 ` Anton Arapov
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Armstrong @ 2020-12-14 18:48 UTC (permalink / raw)
  To: u-boot

This fixes the wrong usage of clrsetbits_le32(), badly setting the set argument.

Fixes: c4c726c26b ("pinctrl: meson: add pinconf support")
Reported-by: Anton Arapov <arapov@gmail.com>
Reported-by: Otto Meier <gf435@gmx.net>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
Hi Anton, Otto,

This should fix eMMC booting on Odroid-C2, could you have a quick try to confirm ?

Thanks,
Neil

 drivers/pinctrl/meson/pinctrl-meson.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index d4539b02d8..5065b62436 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -216,13 +216,13 @@ static int meson_pinconf_bias_set(struct udevice *dev, unsigned int pin,
 	}
 
 	/* othewise, enable the bias and select level */
-	clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), 1);
+	clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), BIT(bit));
 	ret = meson_gpio_calc_reg_and_bit(dev, offset, REG_PULL, &reg, &bit);
 	if (ret)
 		return ret;
 
 	clrsetbits_le32(priv->reg_pull + reg, BIT(bit),
-			param == PIN_CONFIG_BIAS_PULL_UP);
+			(param == PIN_CONFIG_BIAS_PULL_UP ? BIT(bit) : 0));
 
 	return 0;
 }
-- 
2.25.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] pinctrl: meson: fix bit manipulation of pin bias configuration
  2020-12-14 18:48 [PATCH] pinctrl: meson: fix bit manipulation of pin bias configuration Neil Armstrong
@ 2020-12-14 20:48 ` Anton Arapov
  2020-12-15  7:52   ` Neil Armstrong
  0 siblings, 1 reply; 4+ messages in thread
From: Anton Arapov @ 2020-12-14 20:48 UTC (permalink / raw)
  To: u-boot

Hi Neil,

I tested it and it does fix the issue. I am able to boot from eMMC.

Thanks a lot!
Anton

On Mon, Dec 14, 2020 at 7:48 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> This fixes the wrong usage of clrsetbits_le32(), badly setting the set argument.
>
> Fixes: c4c726c26b ("pinctrl: meson: add pinconf support")
> Reported-by: Anton Arapov <arapov@gmail.com>
> Reported-by: Otto Meier <gf435@gmx.net>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
> Hi Anton, Otto,
>
> This should fix eMMC booting on Odroid-C2, could you have a quick try to confirm ?
>
> Thanks,
> Neil
>
>  drivers/pinctrl/meson/pinctrl-meson.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
> index d4539b02d8..5065b62436 100644
> --- a/drivers/pinctrl/meson/pinctrl-meson.c
> +++ b/drivers/pinctrl/meson/pinctrl-meson.c
> @@ -216,13 +216,13 @@ static int meson_pinconf_bias_set(struct udevice *dev, unsigned int pin,
>         }
>
>         /* othewise, enable the bias and select level */
> -       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), 1);
> +       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), BIT(bit));
>         ret = meson_gpio_calc_reg_and_bit(dev, offset, REG_PULL, &reg, &bit);
>         if (ret)
>                 return ret;
>
>         clrsetbits_le32(priv->reg_pull + reg, BIT(bit),
> -                       param == PIN_CONFIG_BIAS_PULL_UP);
> +                       (param == PIN_CONFIG_BIAS_PULL_UP ? BIT(bit) : 0));
>
>         return 0;
>  }
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] pinctrl: meson: fix bit manipulation of pin bias configuration
  2020-12-14 20:48 ` Anton Arapov
@ 2020-12-15  7:52   ` Neil Armstrong
  2020-12-15  9:51     ` Otto Meier
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Armstrong @ 2020-12-15  7:52 UTC (permalink / raw)
  To: u-boot

On 14/12/2020 21:48, Anton Arapov wrote:
> Hi Neil,
> 
> I tested it and it does fix the issue. I am able to boot from eMMC.
> 
> Thanks a lot!
> Anton
> 
> On Mon, Dec 14, 2020 at 7:48 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
>>
>> This fixes the wrong usage of clrsetbits_le32(), badly setting the set argument.
>>
>> Fixes: c4c726c26b ("pinctrl: meson: add pinconf support")
>> Reported-by: Anton Arapov <arapov@gmail.com>
>> Reported-by: Otto Meier <gf435@gmx.net>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>> Hi Anton, Otto,
>>
>> This should fix eMMC booting on Odroid-C2, could you have a quick try to confirm ?
>>
>> Thanks,
>> Neil
>>
>>  drivers/pinctrl/meson/pinctrl-meson.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
>> index d4539b02d8..5065b62436 100644
>> --- a/drivers/pinctrl/meson/pinctrl-meson.c
>> +++ b/drivers/pinctrl/meson/pinctrl-meson.c
>> @@ -216,13 +216,13 @@ static int meson_pinconf_bias_set(struct udevice *dev, unsigned int pin,
>>         }
>>
>>         /* othewise, enable the bias and select level */
>> -       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), 1);
>> +       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), BIT(bit));
>>         ret = meson_gpio_calc_reg_and_bit(dev, offset, REG_PULL, &reg, &bit);
>>         if (ret)
>>                 return ret;
>>
>>         clrsetbits_le32(priv->reg_pull + reg, BIT(bit),
>> -                       param == PIN_CONFIG_BIAS_PULL_UP);
>> +                       (param == PIN_CONFIG_BIAS_PULL_UP ? BIT(bit) : 0));
>>
>>         return 0;
>>  }
>> --
>> 2.25.1
>>

Thanks for testing !

Applied to u-boot-amlogic

Neil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] pinctrl: meson: fix bit manipulation of pin bias configuration
  2020-12-15  7:52   ` Neil Armstrong
@ 2020-12-15  9:51     ` Otto Meier
  0 siblings, 0 replies; 4+ messages in thread
From: Otto Meier @ 2020-12-15  9:51 UTC (permalink / raw)
  To: u-boot

Hi,

I tested it also with newest U-boot DMI: Hardkernel Co., Ltd. 
ODROID-C2/ODROID-C2, BIOS 2021.01-rc3-00134-gf40825e18e-dirty 12/15/2020

and it definitly fixes the emmc boot issue.


Am 15.12.20 um 08:52 schrieb Neil Armstrong:
> On 14/12/2020 21:48, Anton Arapov wrote:
>> Hi Neil,
>>
>> I tested it and it does fix the issue. I am able to boot from eMMC.
>>
>> Thanks a lot!
>> Anton
>>
>> On Mon, Dec 14, 2020 at 7:48 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
>>> This fixes the wrong usage of clrsetbits_le32(), badly setting the set argument.
>>>
>>> Fixes: c4c726c26b ("pinctrl: meson: add pinconf support")
>>> Reported-by: Anton Arapov <arapov@gmail.com>
>>> Reported-by: Otto Meier <gf435@gmx.net>
>>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>>> ---
>>> Hi Anton, Otto,
>>>
>>> This should fix eMMC booting on Odroid-C2, could you have a quick try to confirm ?
>>>
>>> Thanks,
>>> Neil
>>>
>>>   drivers/pinctrl/meson/pinctrl-meson.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
>>> index d4539b02d8..5065b62436 100644
>>> --- a/drivers/pinctrl/meson/pinctrl-meson.c
>>> +++ b/drivers/pinctrl/meson/pinctrl-meson.c
>>> @@ -216,13 +216,13 @@ static int meson_pinconf_bias_set(struct udevice *dev, unsigned int pin,
>>>          }
>>>
>>>          /* othewise, enable the bias and select level */
>>> -       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), 1);
>>> +       clrsetbits_le32(priv->reg_pullen + reg, BIT(bit), BIT(bit));
>>>          ret = meson_gpio_calc_reg_and_bit(dev, offset, REG_PULL, &reg, &bit);
>>>          if (ret)
>>>                  return ret;
>>>
>>>          clrsetbits_le32(priv->reg_pull + reg, BIT(bit),
>>> -                       param == PIN_CONFIG_BIAS_PULL_UP);
>>> +                       (param == PIN_CONFIG_BIAS_PULL_UP ? BIT(bit) : 0));
>>>
>>>          return 0;
>>>   }
>>> --
>>> 2.25.1
>>>
> Thanks for testing !
>
> Applied to u-boot-amlogic
>
> Neil
>
Thank you very much for this correct fix.

Best regards
Otto

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-15  9:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 18:48 [PATCH] pinctrl: meson: fix bit manipulation of pin bias configuration Neil Armstrong
2020-12-14 20:48 ` Anton Arapov
2020-12-15  7:52   ` Neil Armstrong
2020-12-15  9:51     ` Otto Meier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.