[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZP7i7oSthp9YHeXh@smile.fi.intel.com>
Date: Mon, 11 Sep 2023 12:50:38 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Linhua Xu <Linhua.xu@...soc.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Chunyan Zhang <zhang.lyra@...il.com>,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
lh xu <xulh0829@...il.com>,
Zhirong Qiu <zhirong.qiu@...soc.com>,
Xiongpeng Wu <xiongpeng.wu@...soc.com>
Subject: Re: [PATCH V2 2/6] pinctrl: sprd: Fix the incorrect mask and shift
definition
On Fri, Sep 08, 2023 at 01:51:42PM +0800, Linhua Xu wrote:
> From: Linhua Xu <Linhua.Xu@...soc.com>
>
> Pull-up and pull-down are mutually exclusive. When setting one of them,
> the bit of the other needs to be clear. Now, there are cases where pull-up
> and pull-down are set at the same time in the code, thus fix them.
...
> #define SLEEP_PULL_DOWN BIT(2)
> -#define SLEEP_PULL_DOWN_MASK 0x1
> +#define SLEEP_PULL_DOWN_MASK GENMASK(1, 0)
> #define SLEEP_PULL_DOWN_SHIFT 2
>
> #define PULL_DOWN BIT(6)
> -#define PULL_DOWN_MASK 0x1
> +#define PULL_DOWN_MASK (GENMASK(1, 0) | BIT(6))
> #define PULL_DOWN_SHIFT 6
>
> #define SLEEP_PULL_UP BIT(3)
> -#define SLEEP_PULL_UP_MASK 0x1
> -#define SLEEP_PULL_UP_SHIFT 3
> +#define SLEEP_PULL_UP_MASK GENMASK(1, 0)
> +#define SLEEP_PULL_UP_SHIFT 2
>
> #define PULL_UP_4_7K (BIT(12) | BIT(7))
> #define PULL_UP_20K BIT(7)
> -#define PULL_UP_MASK 0x21
> -#define PULL_UP_SHIFT 7
> +#define PULL_UP_MASK (GENMASK(1, 0) | BIT(6))
> +#define PULL_UP_SHIFT 6
These look strange now.
So, SLEEP MASK doesn't cover bits 2 and 3.
I believe you should have
#define SLEEP_PULL_UP_DOWN_MASK GENMASK(3, 2)
The other even weirder with this BIT(6) there.
In the similar way:
#define PULL_UP_DOWN_MASK GENMASK(7, 6)
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists