[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZOh9tUvqtdOEnl+e@smile.fi.intel.com>
Date: Fri, 25 Aug 2023 13:08:53 +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>,
Xiongpeng Wu <xiongpeng.wu@...soc.com>
Subject: Re: [PATCH 1/6] pinctrl: sprd: Modify the probe function parameters
On Fri, Aug 25, 2023 at 11:18:21AM +0800, Linhua Xu wrote:
> From: Linhua Xu <Linhua.Xu@...soc.com>
>
> For UNISOC pin controller, the offset values of the common register and
> misc register will be different. Thus put these in the probe function
> parameters.
...
> +#define PINCTRL_REG_OFFSET 0x20
0x0020
> +#define PINCTRL_REG_MISC_OFFSET 0x4020
...
> if (pin->type == GLOBAL_CTRL_PIN) {
> - pin->reg = (unsigned long)sprd_pctl->base +
> - PINCTRL_REG_LEN * reg;
> + pin->reg = (unsigned long)(sprd_pctl->base +
> + (unsigned long)(PINCTRL_REG_LEN * reg));
Please, make sure you get rid of castings completely. They are weird
for the start and may lead to bugs.
> pin->bit_offset = sprd_soc_pin_info[i].bit_offset;
> pin->bit_width = sprd_soc_pin_info[i].bit_width;
> ctrl_pin++;
> } else if (pin->type == COMMON_PIN) {
> pin->reg = (unsigned long)sprd_pctl->base +
> - PINCTRL_REG_OFFSET + PINCTRL_REG_LEN *
> + sprd_pctl->common_pin_offset + PINCTRL_REG_LEN *
> (i - ctrl_pin);
> com_pin++;
> } else if (pin->type == MISC_PIN) {
> pin->reg = (unsigned long)sprd_pctl->base +
> - PINCTRL_REG_MISC_OFFSET + PINCTRL_REG_LEN *
> + sprd_pctl->misc_pin_offset + PINCTRL_REG_LEN *
> (i - ctrl_pin - com_pin);
> }
Ditto.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists