mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: xu lh <xulh0829@gmail.com>
Cc: Linhua Xu <Linhua.xu@unisoc.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Orson Zhai <orsonzhai@gmail.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Zhirong Qiu <zhirong.qiu@unisoc.com>,
	Xiongpeng Wu <xiongpeng.wu@unisoc.com>
Subject: Re: [PATCH V2 5/6] pinctrl: sprd: Increase the range of register values
Date: Thu, 26 Oct 2023 10:57:30 +0800	[thread overview]
Message-ID: <e8833e78-8678-e2fc-9de1-0b2531e179e1@linux.alibaba.com> (raw)
In-Reply-To: <CAPjKKSrs9X2msnDg=9rC8H57Dq8FPd7SWyBsr2MCwL0FMNkHPA@mail.gmail.com>



On 10/25/2023 7:29 PM, xu lh wrote:
> On Tue, Sep 12, 2023 at 4:37 PM Baolin Wang <baolin.wang@linux.alibaba.com>
> wrote:
> 
>>
>>
>> On 9/8/2023 1:51 PM, Linhua Xu wrote:
>>> From: Linhua Xu <Linhua.Xu@unisoc.com>
>>>
>>> As the UNISOC pin controller version iterates, more registers are
>> required
>>> to meet new functional requirements. Thus modify them.
>>>
>>> Signed-off-by: Linhua Xu <Linhua.Xu@unisoc.com>
>>> ---
>>>    drivers/pinctrl/sprd/pinctrl-sprd.h | 30 +++++++++++++++--------------
>>>    1 file changed, 16 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.h
>> b/drivers/pinctrl/sprd/pinctrl-sprd.h
>>> index a696f81ce663..5357874186fd 100644
>>> --- a/drivers/pinctrl/sprd/pinctrl-sprd.h
>>> +++ b/drivers/pinctrl/sprd/pinctrl-sprd.h
>>> @@ -7,30 +7,32 @@
>>>    #ifndef __PINCTRL_SPRD_H__
>>>    #define __PINCTRL_SPRD_H__
>>>
>>> +#include <linux/bits.h>
>>> +
>>>    struct platform_device;
>>>
>>> -#define NUM_OFFSET   (20)
>>> -#define TYPE_OFFSET  (16)
>>> -#define BIT_OFFSET   (8)
>>> -#define WIDTH_OFFSET (4)
>>> +#define NUM_OFFSET   22
>>> +#define TYPE_OFFSET  18
>>> +#define BIT_OFFSET   10
>>> +#define WIDTH_OFFSET 6
>>>
>>>    #define SPRD_PIN_INFO(num, type, offset, width, reg)        \
>>> -             (((num) & 0xFFF) << NUM_OFFSET |        \
>>> -              ((type) & 0xF) << TYPE_OFFSET |        \
>>> -              ((offset) & 0xFF) << BIT_OFFSET |      \
>>> -              ((width) & 0xF) << WIDTH_OFFSET |      \
>>> -              ((reg) & 0xF))
>>> +             (((num) & GENMASK(10, 0)) << NUM_OFFSET |       \
>>> +              ((type) & GENMASK(3, 0)) << TYPE_OFFSET |      \
>>> +              ((offset) & GENMASK(7, 0)) << BIT_OFFSET |     \
>>> +              ((width) & GENMASK(3, 0)) << WIDTH_OFFSET |    \
>>> +              ((reg) & GENMASK(5, 0)))
>>
>> Can you define some readable macro for the mask bits?
> 
> 
>>> okay. Do you think the following modification is okay?
> +#define PIN_ID         GENMASK(10, 0)
> +#define PIN_TYPE       GENMASK(3, 0)
> +#define FIELD_OFFSET   GENMASK(7, 0)
> +#define FIELD_WIDTH    GENMASK(3, 0)
> +#define PIN_REG                GENMASK(5, 0)

Looks better. To keep consistent, I perfer to something as below:
#define NUM_MASK xxx
#define TYPE_MASK xxx
#define BIT_MASK xxx
#define WIDTH_MASK xxx
#define REG_MASK xxx

  parent reply	other threads:[~2023-10-26  2:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08  5:51 [PATCH V2 0/6] pinctrl: sprd: Modification of UNIOC Platform pinctrl Driver Linhua Xu
2023-09-08  5:51 ` [PATCH V2 1/6] pinctrl: sprd: Modify the probe function parameters Linhua Xu
2023-09-11  9:46   ` Andy Shevchenko
2023-09-12  8:13   ` Baolin Wang
2023-09-08  5:51 ` [PATCH V2 2/6] pinctrl: sprd: Fix the incorrect mask and shift definition Linhua Xu
2023-09-11  9:50   ` Andy Shevchenko
2023-09-12  8:28   ` Baolin Wang
2023-11-13 13:50   ` Linus Walleij
2023-09-08  5:51 ` [PATCH V2 3/6] pinctrl: sprd: Modify pull-up parameters Linhua Xu
2023-09-11  9:51   ` Andy Shevchenko
2023-09-12  8:22   ` Baolin Wang
2023-09-08  5:51 ` [PATCH V2 4/6] pinctrl: sprd: Add pinctrl support for UMS512 Linhua Xu
2023-09-09  1:56   ` kernel test robot
2023-09-11  9:53   ` Andy Shevchenko
2023-09-08  5:51 ` [PATCH V2 5/6] pinctrl: sprd: Increase the range of register values Linhua Xu
2023-09-11  9:55   ` Andy Shevchenko
2023-09-12  8:37   ` Baolin Wang
     [not found]     ` <CAPjKKSrs9X2msnDg=9rC8H57Dq8FPd7SWyBsr2MCwL0FMNkHPA@mail.gmail.com>
2023-10-26  2:57       ` Baolin Wang [this message]
2023-09-08  5:51 ` [PATCH V2 6/6] pinctrl: sprd: Add pinctrl support for UMS9621 Linhua Xu
2023-09-11  9:56   ` Andy Shevchenko
2023-09-11 13:41 ` [PATCH V2 0/6] pinctrl: sprd: Modification of UNIOC Platform pinctrl Driver Linus Walleij
2023-09-12  8:40   ` Baolin Wang

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=e8833e78-8678-e2fc-9de1-0b2531e179e1@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=Linhua.xu@unisoc.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=xiongpeng.wu@unisoc.com \
    --cc=xulh0829@gmail.com \
    --cc=zhang.lyra@gmail.com \
    --cc=zhirong.qiu@unisoc.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

all inboxes | Powered by JetHome®