diff mbox series

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

Message ID 20240308105021.2552975-1-o.rempel@pengutronix.de (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v1,1/1] net: dsa: microchip: add regmap_range for KSZ9563 chip | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 940 this patch: 940
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 956 this patch: 956
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 956 this patch: 956
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 133 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-03-10--00-00 (tests: 888)

Commit Message

Oleksij Rempel March 8, 2024, 10:50 a.m. UTC
Add register validation for KSZ9563.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/dsa/microchip/ksz_common.c | 121 +++++++++++++++++++++++++
 1 file changed, 121 insertions(+)

Comments

Simon Horman March 11, 2024, 9:21 a.m. UTC | #1
On Fri, Mar 08, 2024 at 11:50:21AM +0100, Oleksij Rempel wrote:
> Add register validation for KSZ9563.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

Reviewed-by: Simon Horman <horms@kernel.org>

...
Florian Fainelli March 11, 2024, 4:36 p.m. UTC | #2
On 3/8/24 02:50, Oleksij Rempel wrote:
> Add register validation for KSZ9563.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>   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!
diff mbox series

Patch

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[] = {
+	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),
+	regmap_reg_range(0x1004, 0x100b),
+	regmap_reg_range(0x1013, 0x1013),
+	regmap_reg_range(0x1017, 0x1017),
+	regmap_reg_range(0x101b, 0x101b),
+	regmap_reg_range(0x101f, 0x1021),
+	regmap_reg_range(0x1030, 0x1030),
+	regmap_reg_range(0x1100, 0x1115),
+	regmap_reg_range(0x111a, 0x111f),
+	regmap_reg_range(0x1120, 0x112b),
+	regmap_reg_range(0x1134, 0x113b),
+	regmap_reg_range(0x113c, 0x113f),
+	regmap_reg_range(0x1400, 0x1401),
+	regmap_reg_range(0x1403, 0x1403),
+	regmap_reg_range(0x1410, 0x1417),
+	regmap_reg_range(0x1420, 0x1423),
+	regmap_reg_range(0x1500, 0x1507),
+	regmap_reg_range(0x1600, 0x1612),
+	regmap_reg_range(0x1800, 0x180f),
+	regmap_reg_range(0x1900, 0x1907),
+	regmap_reg_range(0x1914, 0x191b),
+	regmap_reg_range(0x1a00, 0x1a03),
+	regmap_reg_range(0x1a04, 0x1a07),
+	regmap_reg_range(0x1b00, 0x1b01),
+	regmap_reg_range(0x1b04, 0x1b04),
+	regmap_reg_range(0x1c00, 0x1c05),
+	regmap_reg_range(0x1c08, 0x1c1b),
+
+	/* port 2 */
+	regmap_reg_range(0x2000, 0x2001),
+	regmap_reg_range(0x2004, 0x200b),
+	regmap_reg_range(0x2013, 0x2013),
+	regmap_reg_range(0x2017, 0x2017),
+	regmap_reg_range(0x201b, 0x201b),
+	regmap_reg_range(0x201f, 0x2021),
+	regmap_reg_range(0x2030, 0x2030),
+	regmap_reg_range(0x2100, 0x2115),
+	regmap_reg_range(0x211a, 0x211f),
+	regmap_reg_range(0x2120, 0x212b),
+	regmap_reg_range(0x2134, 0x213b),
+	regmap_reg_range(0x213c, 0x213f),
+	regmap_reg_range(0x2400, 0x2401),
+	regmap_reg_range(0x2403, 0x2403),
+	regmap_reg_range(0x2410, 0x2417),
+	regmap_reg_range(0x2420, 0x2423),
+	regmap_reg_range(0x2500, 0x2507),
+	regmap_reg_range(0x2600, 0x2612),
+	regmap_reg_range(0x2800, 0x280f),
+	regmap_reg_range(0x2900, 0x2907),
+	regmap_reg_range(0x2914, 0x291b),
+	regmap_reg_range(0x2a00, 0x2a03),
+	regmap_reg_range(0x2a04, 0x2a07),
+	regmap_reg_range(0x2b00, 0x2b01),
+	regmap_reg_range(0x2b04, 0x2b04),
+	regmap_reg_range(0x2c00, 0x2c05),
+	regmap_reg_range(0x2c08, 0x2c1b),
+
+	/* port 3 */
+	regmap_reg_range(0x3000, 0x3001),
+	regmap_reg_range(0x3013, 0x3013),
+	regmap_reg_range(0x3017, 0x3017),
+	regmap_reg_range(0x301b, 0x301b),
+	regmap_reg_range(0x301f, 0x3020),
+	regmap_reg_range(0x3030, 0x3030),
+	regmap_reg_range(0x3300, 0x3301),
+	regmap_reg_range(0x3303, 0x3303),
+	regmap_reg_range(0x3400, 0x3401),
+	regmap_reg_range(0x3403, 0x3403),
+	regmap_reg_range(0x3410, 0x3417),
+	regmap_reg_range(0x3420, 0x3423),
+	regmap_reg_range(0x3500, 0x3507),
+	regmap_reg_range(0x3600, 0x3612),
+	regmap_reg_range(0x3800, 0x380f),
+	regmap_reg_range(0x3900, 0x3907),
+	regmap_reg_range(0x3914, 0x391b),
+	regmap_reg_range(0x3a00, 0x3a03),
+	regmap_reg_range(0x3a04, 0x3a07),
+	regmap_reg_range(0x3b00, 0x3b01),
+	regmap_reg_range(0x3b04, 0x3b04),
+	regmap_reg_range(0x3c00, 0x3c05),
+	regmap_reg_range(0x3c08, 0x3c1b),
+};
+
+static const struct regmap_access_table ksz9563_register_set = {
+	.yes_ranges = ksz9563_valid_regs,
+	.n_yes_ranges = ARRAY_SIZE(ksz9563_valid_regs),
+};
+
 static const struct regmap_range ksz9477_valid_regs[] = {
 	regmap_reg_range(0x0000, 0x0003),
 	regmap_reg_range(0x0006, 0x0006),
@@ -1475,6 +1594,8 @@  const struct ksz_chip_data ksz_switch_chips[] = {
 		.supports_rgmii = {false, false, true},
 		.internal_phy = {true, true, false},
 		.gbit_capable = {true, true, true},
+		.wr_table = &ksz9563_register_set,
+		.rd_table = &ksz9563_register_set,
 	},
 
 	[KSZ8567] = {