Subject: Re: [PATCH net-next v1 1/1] net: dsa: microchip: add regmap_range for KSZ9563 chip

From: Florian Fainelli <[email-masked]>
Date: Mon, 11 Mar 2024 09:36:59 -0700

On 3/8/24 02:50, Oleksij Rempel wrote:
> Add register validation for KSZ9563.
> 
> Signed-off-by: Oleksij Rempel <[email-masked]>
> ---
>   drivers/net/dsa/microchip/ksz_common.c | 121 +++++++++++++++++++++++++
>   1 file changed, 121 insertions(+)
> 
> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
> index 030b167764b39..2308be3bdc9d8 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -666,6 +666,125 @@ static const struct regmap_access_table ksz8563_register_set = {
>   	.n_yes_ranges = ARRAY_SIZE(ksz8563_valid_regs),
>   };
>   
> +static const struct regmap_range ksz9563_valid_regs[] = {

Missing comment to describe those are global registers, and not per-port 
registers?

> +	regmap_reg_range(0x0000, 0x0003),
> +	regmap_reg_range(0x0006, 0x0006),
> +	regmap_reg_range(0x000f, 0x000f),
> +	regmap_reg_range(0x0010, 0x001f),
> +	regmap_reg_range(0x0100, 0x0100),
> +	regmap_reg_range(0x0104, 0x0107),
> +	regmap_reg_range(0x010d, 0x010d),
> +	regmap_reg_range(0x0110, 0x0113),
> +	regmap_reg_range(0x0120, 0x012b),
> +	regmap_reg_range(0x0201, 0x0201),
> +	regmap_reg_range(0x0210, 0x0213),
> +	regmap_reg_range(0x0300, 0x0300),
> +	regmap_reg_range(0x0302, 0x030b),
> +	regmap_reg_range(0x030e, 0x031b),
> +	regmap_reg_range(0x0320, 0x032b),
> +	regmap_reg_range(0x0330, 0x0336),
> +	regmap_reg_range(0x0338, 0x033b),
> +	regmap_reg_range(0x033e, 0x033e),
> +	regmap_reg_range(0x0340, 0x035f),
> +	regmap_reg_range(0x0370, 0x0370),
> +	regmap_reg_range(0x0378, 0x0378),
> +	regmap_reg_range(0x037c, 0x037d),
> +	regmap_reg_range(0x0390, 0x0393),
> +	regmap_reg_range(0x0400, 0x040e),
> +	regmap_reg_range(0x0410, 0x042f),
> +	regmap_reg_range(0x0500, 0x0519),
> +	regmap_reg_range(0x0520, 0x054b),
> +	regmap_reg_range(0x0550, 0x05b3),
> +
> +	/* port 1 */
> +	regmap_reg_range(0x1000, 0x1001),

Seems like adding a macro that encapsulates all per-port register ranges 
would help a bit?

Other than that, LGTM!
-- 
Florian