Re: [PATCH 5/6] pinctrl: sprd: Increase the range of register values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 25, 2023 at 11:18:25AM +0800, Linhua Xu wrote:
> From: Linhua Xu <Linhua.Xu@xxxxxxxxxx>
> 
> As the UNISOC pin controller version iterates, more registers are required
> to meet new functional requirements. Thus modify them.

...

+ bits.h and...

> +#define NUM_OFFSET	(22)
> +#define TYPE_OFFSET	(18)
> +#define BIT_OFFSET	(10)
> +#define WIDTH_OFFSET	(6)

Why do you need parentheses? Also what do these represent
(since they are decimal numbers)?

...

>  #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))
> +		 ((reg) & 0x1F))

...use GENMASK() everywhere above.

...

>  		.type = (((a) >> TYPE_OFFSET) & 0xf),		\
>  		.bit_offset = (((a) >> BIT_OFFSET) & 0xff),	\
>  		.bit_width = ((a) >> WIDTH_OFFSET & 0xf),	\
> -		.reg = ((a) & 0xf)				\
> +		.reg = ((a) & 0x1f)				\

Ditto.

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux