diff mbox series

[v3:,net-next,4/4] net: dsa: microchip: add regmap_range for KSZ9896 chip

Message ID 20220902101610.109646-4-romain.naour@smile.fr (mailing list archive)
State Accepted
Commit 6674e7fd3beaf745b2e9d281a66f925a13de8ea7
Delegated to: Netdev Maintainers
Headers show
Series [v3:,net-next,1/4] net: dsa: microchip: add KSZ9896 switch support | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter warning Series does not have a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
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: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 227 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Romain Naour Sept. 2, 2022, 10:16 a.m. UTC
From: Romain Naour <romain.naour@skf.com>

Add register validation for KSZ9896.

Signed-off-by: Romain Naour <romain.naour@skf.com>
---
 drivers/net/dsa/microchip/ksz_common.c | 215 +++++++++++++++++++++++++
 1 file changed, 215 insertions(+)

Comments

Arun Ramadoss Sept. 2, 2022, 1:33 p.m. UTC | #1
On Fri, 2022-09-02 at 12:16 +0200, Romain Naour wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> From: Romain Naour <romain.naour@skf.com>
> 
> Add register validation for KSZ9896.
> 

Hi Oleksij,
Do we have any support for regular expression support for the
regmap_reg_range, since all the ports have same register configuration
except the port number in the msb. Becaue If I need to add regmap
validation for lan937x which has 5 variant with port count from 4 to 8
it will increase the file size. Do we need to move the register map to
other file or adding in ksz_common.c itself is fine.

> Signed-off-by: Romain Naour <romain.naour@skf.com>
> ---
>  drivers/net/dsa/microchip/ksz_common.c | 215
> +++++++++++++++++++++++++
>  1 file changed, 215 insertions(+)
> 
> diff --git a/drivers/net/dsa/microchip/ksz_common.c
> b/drivers/net/dsa/microchip/ksz_common.c
> index a700631130e0..7389837ddd84 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -802,6 +802,219 @@ static const struct regmap_access_table
> ksz9477_register_set = {
>         .n_yes_ranges = ARRAY_SIZE(ksz9477_valid_regs),
>  };
> 
> +static const struct regmap_range ksz9896_valid_regs[] = {
> +       regmap_reg_range(0x0000, 0x0003),
> +       regmap_reg_range(0x0006, 0x0006),
> +       regmap_reg_range(0x0010, 0x001f),
> +       regmap_reg_range(0x0100, 0x0100),
> +       regmap_reg_range(0x0103, 0x0107),
> +       regmap_reg_range(0x010d, 0x010d),
> +       regmap_reg_range(0x0110, 0x0113),
> +       regmap_reg_range(0x0120, 0x0127),
> +       regmap_reg_range(0x0201, 0x0201),
> +       regmap_reg_range(0x0210, 0x0213),
> +       regmap_reg_range(0x0300, 0x0300),
> +       regmap_reg_range(0x0302, 0x030b),
> +       regmap_reg_range(0x0310, 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),
> +
> +       /* port 1 */
> +       regmap_reg_range(0x1000, 0x1001),
> +       regmap_reg_range(0x1013, 0x1013),
> +       regmap_reg_range(0x1017, 0x1017),
> +       regmap_reg_range(0x101b, 0x101b),
> +       regmap_reg_range(0x101f, 0x1020),
> +       regmap_reg_range(0x1030, 0x1030),
> +       regmap_reg_range(0x1100, 0x1115),
> +       regmap_reg_range(0x111a, 0x111f),
> +       regmap_reg_range(0x1122, 0x1127),
> +       regmap_reg_range(0x112a, 0x112b),
> +       regmap_reg_range(0x1136, 0x1139),
> +       regmap_reg_range(0x113e, 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(0x1820, 0x1827),
> +       regmap_reg_range(0x1830, 0x1837),
> +       regmap_reg_range(0x1840, 0x184b),
> +       regmap_reg_range(0x1900, 0x1907),
> +       regmap_reg_range(0x1914, 0x1915),
> +       regmap_reg_range(0x1a00, 0x1a03),
> +       regmap_reg_range(0x1a04, 0x1a07),
> +       regmap_reg_range(0x1b00, 0x1b01),
> +       regmap_reg_range(0x1b04, 0x1b04),
> +
> +       /* port 2 */
> +       regmap_reg_range(0x2000, 0x2001),
> +       regmap_reg_range(0x2013, 0x2013),
> +       regmap_reg_range(0x2017, 0x2017),
> +       regmap_reg_range(0x201b, 0x201b),
> +       regmap_reg_range(0x201f, 0x2020),
> +       regmap_reg_range(0x2030, 0x2030),
> +       regmap_reg_range(0x2100, 0x2115),
> +       regmap_reg_range(0x211a, 0x211f),
> +       regmap_reg_range(0x2122, 0x2127),
> +       regmap_reg_range(0x212a, 0x212b),
> +       regmap_reg_range(0x2136, 0x2139),
> +       regmap_reg_range(0x213e, 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(0x2820, 0x2827),
> +       regmap_reg_range(0x2830, 0x2837),
> +       regmap_reg_range(0x2840, 0x284b),
> +       regmap_reg_range(0x2900, 0x2907),
> +       regmap_reg_range(0x2914, 0x2915),
> +       regmap_reg_range(0x2a00, 0x2a03),
> +       regmap_reg_range(0x2a04, 0x2a07),
> +       regmap_reg_range(0x2b00, 0x2b01),
> +       regmap_reg_range(0x2b04, 0x2b04),
> +
> +       /* 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(0x3100, 0x3115),
> +       regmap_reg_range(0x311a, 0x311f),
> +       regmap_reg_range(0x3122, 0x3127),
> +       regmap_reg_range(0x312a, 0x312b),
> +       regmap_reg_range(0x3136, 0x3139),
> +       regmap_reg_range(0x313e, 0x313f),
> +       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(0x3820, 0x3827),
> +       regmap_reg_range(0x3830, 0x3837),
> +       regmap_reg_range(0x3840, 0x384b),
> +       regmap_reg_range(0x3900, 0x3907),
> +       regmap_reg_range(0x3914, 0x3915),
> +       regmap_reg_range(0x3a00, 0x3a03),
> +       regmap_reg_range(0x3a04, 0x3a07),
> +       regmap_reg_range(0x3b00, 0x3b01),
> +       regmap_reg_range(0x3b04, 0x3b04),
> +
> +       /* port 4 */
> +       regmap_reg_range(0x4000, 0x4001),
> +       regmap_reg_range(0x4013, 0x4013),
> +       regmap_reg_range(0x4017, 0x4017),
> +       regmap_reg_range(0x401b, 0x401b),
> +       regmap_reg_range(0x401f, 0x4020),
> +       regmap_reg_range(0x4030, 0x4030),
> +       regmap_reg_range(0x4100, 0x4115),
> +       regmap_reg_range(0x411a, 0x411f),
> +       regmap_reg_range(0x4122, 0x4127),
> +       regmap_reg_range(0x412a, 0x412b),
> +       regmap_reg_range(0x4136, 0x4139),
> +       regmap_reg_range(0x413e, 0x413f),
> +       regmap_reg_range(0x4400, 0x4401),
> +       regmap_reg_range(0x4403, 0x4403),
> +       regmap_reg_range(0x4410, 0x4417),
> +       regmap_reg_range(0x4420, 0x4423),
> +       regmap_reg_range(0x4500, 0x4507),
> +       regmap_reg_range(0x4600, 0x4612),
> +       regmap_reg_range(0x4800, 0x480f),
> +       regmap_reg_range(0x4820, 0x4827),
> +       regmap_reg_range(0x4830, 0x4837),
> +       regmap_reg_range(0x4840, 0x484b),
> +       regmap_reg_range(0x4900, 0x4907),
> +       regmap_reg_range(0x4914, 0x4915),
> +       regmap_reg_range(0x4a00, 0x4a03),
> +       regmap_reg_range(0x4a04, 0x4a07),
> +       regmap_reg_range(0x4b00, 0x4b01),
> +       regmap_reg_range(0x4b04, 0x4b04),
> +
> +       /* port 5 */
> +       regmap_reg_range(0x5000, 0x5001),
> +       regmap_reg_range(0x5013, 0x5013),
> +       regmap_reg_range(0x5017, 0x5017),
> +       regmap_reg_range(0x501b, 0x501b),
> +       regmap_reg_range(0x501f, 0x5020),
> +       regmap_reg_range(0x5030, 0x5030),
> +       regmap_reg_range(0x5100, 0x5115),
> +       regmap_reg_range(0x511a, 0x511f),
> +       regmap_reg_range(0x5122, 0x5127),
> +       regmap_reg_range(0x512a, 0x512b),
> +       regmap_reg_range(0x5136, 0x5139),
> +       regmap_reg_range(0x513e, 0x513f),
> +       regmap_reg_range(0x5400, 0x5401),
> +       regmap_reg_range(0x5403, 0x5403),
> +       regmap_reg_range(0x5410, 0x5417),
> +       regmap_reg_range(0x5420, 0x5423),
> +       regmap_reg_range(0x5500, 0x5507),
> +       regmap_reg_range(0x5600, 0x5612),
> +       regmap_reg_range(0x5800, 0x580f),
> +       regmap_reg_range(0x5820, 0x5827),
> +       regmap_reg_range(0x5830, 0x5837),
> +       regmap_reg_range(0x5840, 0x584b),
> +       regmap_reg_range(0x5900, 0x5907),
> +       regmap_reg_range(0x5914, 0x5915),
> +       regmap_reg_range(0x5a00, 0x5a03),
> +       regmap_reg_range(0x5a04, 0x5a07),
> +       regmap_reg_range(0x5b00, 0x5b01),
> +       regmap_reg_range(0x5b04, 0x5b04),
> +
> +       /* port 6 */
> +       regmap_reg_range(0x6000, 0x6001),
> +       regmap_reg_range(0x6013, 0x6013),
> +       regmap_reg_range(0x6017, 0x6017),
> +       regmap_reg_range(0x601b, 0x601b),
> +       regmap_reg_range(0x601f, 0x6020),
> +       regmap_reg_range(0x6030, 0x6030),
> +       regmap_reg_range(0x6100, 0x6115),
> +       regmap_reg_range(0x611a, 0x611f),
> +       regmap_reg_range(0x6122, 0x6127),
> +       regmap_reg_range(0x612a, 0x612b),
> +       regmap_reg_range(0x6136, 0x6139),
> +       regmap_reg_range(0x613e, 0x613f),
> +       regmap_reg_range(0x6300, 0x6301),
> +       regmap_reg_range(0x6400, 0x6401),
> +       regmap_reg_range(0x6403, 0x6403),
> +       regmap_reg_range(0x6410, 0x6417),
> +       regmap_reg_range(0x6420, 0x6423),
> +       regmap_reg_range(0x6500, 0x6507),
> +       regmap_reg_range(0x6600, 0x6612),
> +       regmap_reg_range(0x6800, 0x680f),
> +       regmap_reg_range(0x6820, 0x6827),
> +       regmap_reg_range(0x6830, 0x6837),
> +       regmap_reg_range(0x6840, 0x684b),
> +       regmap_reg_range(0x6900, 0x6907),
> +       regmap_reg_range(0x6914, 0x6915),
> +       regmap_reg_range(0x6a00, 0x6a03),
> +       regmap_reg_range(0x6a04, 0x6a07),
> +       regmap_reg_range(0x6b00, 0x6b01),
> +       regmap_reg_range(0x6b04, 0x6b04),
> +};
> +
> +static const struct regmap_access_table ksz9896_register_set = {
> +       .yes_ranges = ksz9896_valid_regs,
> +       .n_yes_ranges = ARRAY_SIZE(ksz9896_valid_regs),
> +};
> +
>  const struct ksz_chip_data ksz_switch_chips[] = {
>         [KSZ8563] = {
>                 .chip_id = KSZ8563_CHIP_ID,
> @@ -993,6 +1206,8 @@ const struct ksz_chip_data ksz_switch_chips[] =
> {
>                 .internal_phy   = {true, true, true, true,
>                                    true, false},
>                 .gbit_capable   = {true, true, true, true, true,
> true},
> +               .wr_table = &ksz9896_register_set,
> +               .rd_table = &ksz9896_register_set,
>         },
> 
>         [KSZ9897] = {
> --
> 2.34.3
>
Romain Naour Sept. 2, 2022, 5:20 p.m. UTC | #2
Hi Arun,

Le 02/09/2022 à 15:33, Arun.Ramadoss@microchip.com a écrit :
> On Fri, 2022-09-02 at 12:16 +0200, Romain Naour wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you
>> know the content is safe
>>
>> From: Romain Naour <romain.naour@skf.com>
>>
>> Add register validation for KSZ9896.
>>
> 
> Hi Oleksij,
> Do we have any support for regular expression support for the
> regmap_reg_range, since all the ports have same register configuration
> except the port number in the msb. Becaue If I need to add regmap
> validation for lan937x which has 5 variant with port count from 4 to 8
> it will increase the file size. Do we need to move the register map to
> other file or adding in ksz_common.c itself is fine.
> 

Notice that the cpu port is special, it has two extra registers (XMII Port Control)

regmap_reg_range(0x6300, 0x6301)

Best regards,
Romain


>> +
>> +       /* port 5 */
>> +       regmap_reg_range(0x5000, 0x5001),
>> +       regmap_reg_range(0x5013, 0x5013),
>> +       regmap_reg_range(0x5017, 0x5017),
>> +       regmap_reg_range(0x501b, 0x501b),
>> +       regmap_reg_range(0x501f, 0x5020),
>> +       regmap_reg_range(0x5030, 0x5030),
>> +       regmap_reg_range(0x5100, 0x5115),
>> +       regmap_reg_range(0x511a, 0x511f),
>> +       regmap_reg_range(0x5122, 0x5127),
>> +       regmap_reg_range(0x512a, 0x512b),
>> +       regmap_reg_range(0x5136, 0x5139),
>> +       regmap_reg_range(0x513e, 0x513f),
>> +       regmap_reg_range(0x5400, 0x5401),
>> +       regmap_reg_range(0x5403, 0x5403),
>> +       regmap_reg_range(0x5410, 0x5417),
>> +       regmap_reg_range(0x5420, 0x5423),
>> +       regmap_reg_range(0x5500, 0x5507),
>> +       regmap_reg_range(0x5600, 0x5612),
>> +       regmap_reg_range(0x5800, 0x580f),
>> +       regmap_reg_range(0x5820, 0x5827),
>> +       regmap_reg_range(0x5830, 0x5837),
>> +       regmap_reg_range(0x5840, 0x584b),
>> +       regmap_reg_range(0x5900, 0x5907),
>> +       regmap_reg_range(0x5914, 0x5915),
>> +       regmap_reg_range(0x5a00, 0x5a03),
>> +       regmap_reg_range(0x5a04, 0x5a07),
>> +       regmap_reg_range(0x5b00, 0x5b01),
>> +       regmap_reg_range(0x5b04, 0x5b04),
>> +
>> +       /* port 6 */
>> +       regmap_reg_range(0x6000, 0x6001),
>> +       regmap_reg_range(0x6013, 0x6013),
>> +       regmap_reg_range(0x6017, 0x6017),
>> +       regmap_reg_range(0x601b, 0x601b),
>> +       regmap_reg_range(0x601f, 0x6020),
>> +       regmap_reg_range(0x6030, 0x6030),
>> +       regmap_reg_range(0x6100, 0x6115),
>> +       regmap_reg_range(0x611a, 0x611f),
>> +       regmap_reg_range(0x6122, 0x6127),
>> +       regmap_reg_range(0x612a, 0x612b),
>> +       regmap_reg_range(0x6136, 0x6139),
>> +       regmap_reg_range(0x613e, 0x613f),
>> +       regmap_reg_range(0x6300, 0x6301),
>> +       regmap_reg_range(0x6400, 0x6401),
>> +       regmap_reg_range(0x6403, 0x6403),
>> +       regmap_reg_range(0x6410, 0x6417),
>> +       regmap_reg_range(0x6420, 0x6423),
>> +       regmap_reg_range(0x6500, 0x6507),
>> +       regmap_reg_range(0x6600, 0x6612),
>> +       regmap_reg_range(0x6800, 0x680f),
>> +       regmap_reg_range(0x6820, 0x6827),
>> +       regmap_reg_range(0x6830, 0x6837),
>> +       regmap_reg_range(0x6840, 0x684b),
>> +       regmap_reg_range(0x6900, 0x6907),
>> +       regmap_reg_range(0x6914, 0x6915),
>> +       regmap_reg_range(0x6a00, 0x6a03),
>> +       regmap_reg_range(0x6a04, 0x6a07),
>> +       regmap_reg_range(0x6b00, 0x6b01),
>> +       regmap_reg_range(0x6b04, 0x6b04),
>> +};
>> +
diff mbox series

Patch

diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index a700631130e0..7389837ddd84 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -802,6 +802,219 @@  static const struct regmap_access_table ksz9477_register_set = {
 	.n_yes_ranges = ARRAY_SIZE(ksz9477_valid_regs),
 };
 
+static const struct regmap_range ksz9896_valid_regs[] = {
+	regmap_reg_range(0x0000, 0x0003),
+	regmap_reg_range(0x0006, 0x0006),
+	regmap_reg_range(0x0010, 0x001f),
+	regmap_reg_range(0x0100, 0x0100),
+	regmap_reg_range(0x0103, 0x0107),
+	regmap_reg_range(0x010d, 0x010d),
+	regmap_reg_range(0x0110, 0x0113),
+	regmap_reg_range(0x0120, 0x0127),
+	regmap_reg_range(0x0201, 0x0201),
+	regmap_reg_range(0x0210, 0x0213),
+	regmap_reg_range(0x0300, 0x0300),
+	regmap_reg_range(0x0302, 0x030b),
+	regmap_reg_range(0x0310, 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),
+
+	/* port 1 */
+	regmap_reg_range(0x1000, 0x1001),
+	regmap_reg_range(0x1013, 0x1013),
+	regmap_reg_range(0x1017, 0x1017),
+	regmap_reg_range(0x101b, 0x101b),
+	regmap_reg_range(0x101f, 0x1020),
+	regmap_reg_range(0x1030, 0x1030),
+	regmap_reg_range(0x1100, 0x1115),
+	regmap_reg_range(0x111a, 0x111f),
+	regmap_reg_range(0x1122, 0x1127),
+	regmap_reg_range(0x112a, 0x112b),
+	regmap_reg_range(0x1136, 0x1139),
+	regmap_reg_range(0x113e, 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(0x1820, 0x1827),
+	regmap_reg_range(0x1830, 0x1837),
+	regmap_reg_range(0x1840, 0x184b),
+	regmap_reg_range(0x1900, 0x1907),
+	regmap_reg_range(0x1914, 0x1915),
+	regmap_reg_range(0x1a00, 0x1a03),
+	regmap_reg_range(0x1a04, 0x1a07),
+	regmap_reg_range(0x1b00, 0x1b01),
+	regmap_reg_range(0x1b04, 0x1b04),
+
+	/* port 2 */
+	regmap_reg_range(0x2000, 0x2001),
+	regmap_reg_range(0x2013, 0x2013),
+	regmap_reg_range(0x2017, 0x2017),
+	regmap_reg_range(0x201b, 0x201b),
+	regmap_reg_range(0x201f, 0x2020),
+	regmap_reg_range(0x2030, 0x2030),
+	regmap_reg_range(0x2100, 0x2115),
+	regmap_reg_range(0x211a, 0x211f),
+	regmap_reg_range(0x2122, 0x2127),
+	regmap_reg_range(0x212a, 0x212b),
+	regmap_reg_range(0x2136, 0x2139),
+	regmap_reg_range(0x213e, 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(0x2820, 0x2827),
+	regmap_reg_range(0x2830, 0x2837),
+	regmap_reg_range(0x2840, 0x284b),
+	regmap_reg_range(0x2900, 0x2907),
+	regmap_reg_range(0x2914, 0x2915),
+	regmap_reg_range(0x2a00, 0x2a03),
+	regmap_reg_range(0x2a04, 0x2a07),
+	regmap_reg_range(0x2b00, 0x2b01),
+	regmap_reg_range(0x2b04, 0x2b04),
+
+	/* 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(0x3100, 0x3115),
+	regmap_reg_range(0x311a, 0x311f),
+	regmap_reg_range(0x3122, 0x3127),
+	regmap_reg_range(0x312a, 0x312b),
+	regmap_reg_range(0x3136, 0x3139),
+	regmap_reg_range(0x313e, 0x313f),
+	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(0x3820, 0x3827),
+	regmap_reg_range(0x3830, 0x3837),
+	regmap_reg_range(0x3840, 0x384b),
+	regmap_reg_range(0x3900, 0x3907),
+	regmap_reg_range(0x3914, 0x3915),
+	regmap_reg_range(0x3a00, 0x3a03),
+	regmap_reg_range(0x3a04, 0x3a07),
+	regmap_reg_range(0x3b00, 0x3b01),
+	regmap_reg_range(0x3b04, 0x3b04),
+
+	/* port 4 */
+	regmap_reg_range(0x4000, 0x4001),
+	regmap_reg_range(0x4013, 0x4013),
+	regmap_reg_range(0x4017, 0x4017),
+	regmap_reg_range(0x401b, 0x401b),
+	regmap_reg_range(0x401f, 0x4020),
+	regmap_reg_range(0x4030, 0x4030),
+	regmap_reg_range(0x4100, 0x4115),
+	regmap_reg_range(0x411a, 0x411f),
+	regmap_reg_range(0x4122, 0x4127),
+	regmap_reg_range(0x412a, 0x412b),
+	regmap_reg_range(0x4136, 0x4139),
+	regmap_reg_range(0x413e, 0x413f),
+	regmap_reg_range(0x4400, 0x4401),
+	regmap_reg_range(0x4403, 0x4403),
+	regmap_reg_range(0x4410, 0x4417),
+	regmap_reg_range(0x4420, 0x4423),
+	regmap_reg_range(0x4500, 0x4507),
+	regmap_reg_range(0x4600, 0x4612),
+	regmap_reg_range(0x4800, 0x480f),
+	regmap_reg_range(0x4820, 0x4827),
+	regmap_reg_range(0x4830, 0x4837),
+	regmap_reg_range(0x4840, 0x484b),
+	regmap_reg_range(0x4900, 0x4907),
+	regmap_reg_range(0x4914, 0x4915),
+	regmap_reg_range(0x4a00, 0x4a03),
+	regmap_reg_range(0x4a04, 0x4a07),
+	regmap_reg_range(0x4b00, 0x4b01),
+	regmap_reg_range(0x4b04, 0x4b04),
+
+	/* port 5 */
+	regmap_reg_range(0x5000, 0x5001),
+	regmap_reg_range(0x5013, 0x5013),
+	regmap_reg_range(0x5017, 0x5017),
+	regmap_reg_range(0x501b, 0x501b),
+	regmap_reg_range(0x501f, 0x5020),
+	regmap_reg_range(0x5030, 0x5030),
+	regmap_reg_range(0x5100, 0x5115),
+	regmap_reg_range(0x511a, 0x511f),
+	regmap_reg_range(0x5122, 0x5127),
+	regmap_reg_range(0x512a, 0x512b),
+	regmap_reg_range(0x5136, 0x5139),
+	regmap_reg_range(0x513e, 0x513f),
+	regmap_reg_range(0x5400, 0x5401),
+	regmap_reg_range(0x5403, 0x5403),
+	regmap_reg_range(0x5410, 0x5417),
+	regmap_reg_range(0x5420, 0x5423),
+	regmap_reg_range(0x5500, 0x5507),
+	regmap_reg_range(0x5600, 0x5612),
+	regmap_reg_range(0x5800, 0x580f),
+	regmap_reg_range(0x5820, 0x5827),
+	regmap_reg_range(0x5830, 0x5837),
+	regmap_reg_range(0x5840, 0x584b),
+	regmap_reg_range(0x5900, 0x5907),
+	regmap_reg_range(0x5914, 0x5915),
+	regmap_reg_range(0x5a00, 0x5a03),
+	regmap_reg_range(0x5a04, 0x5a07),
+	regmap_reg_range(0x5b00, 0x5b01),
+	regmap_reg_range(0x5b04, 0x5b04),
+
+	/* port 6 */
+	regmap_reg_range(0x6000, 0x6001),
+	regmap_reg_range(0x6013, 0x6013),
+	regmap_reg_range(0x6017, 0x6017),
+	regmap_reg_range(0x601b, 0x601b),
+	regmap_reg_range(0x601f, 0x6020),
+	regmap_reg_range(0x6030, 0x6030),
+	regmap_reg_range(0x6100, 0x6115),
+	regmap_reg_range(0x611a, 0x611f),
+	regmap_reg_range(0x6122, 0x6127),
+	regmap_reg_range(0x612a, 0x612b),
+	regmap_reg_range(0x6136, 0x6139),
+	regmap_reg_range(0x613e, 0x613f),
+	regmap_reg_range(0x6300, 0x6301),
+	regmap_reg_range(0x6400, 0x6401),
+	regmap_reg_range(0x6403, 0x6403),
+	regmap_reg_range(0x6410, 0x6417),
+	regmap_reg_range(0x6420, 0x6423),
+	regmap_reg_range(0x6500, 0x6507),
+	regmap_reg_range(0x6600, 0x6612),
+	regmap_reg_range(0x6800, 0x680f),
+	regmap_reg_range(0x6820, 0x6827),
+	regmap_reg_range(0x6830, 0x6837),
+	regmap_reg_range(0x6840, 0x684b),
+	regmap_reg_range(0x6900, 0x6907),
+	regmap_reg_range(0x6914, 0x6915),
+	regmap_reg_range(0x6a00, 0x6a03),
+	regmap_reg_range(0x6a04, 0x6a07),
+	regmap_reg_range(0x6b00, 0x6b01),
+	regmap_reg_range(0x6b04, 0x6b04),
+};
+
+static const struct regmap_access_table ksz9896_register_set = {
+	.yes_ranges = ksz9896_valid_regs,
+	.n_yes_ranges = ARRAY_SIZE(ksz9896_valid_regs),
+};
+
 const struct ksz_chip_data ksz_switch_chips[] = {
 	[KSZ8563] = {
 		.chip_id = KSZ8563_CHIP_ID,
@@ -993,6 +1206,8 @@  const struct ksz_chip_data ksz_switch_chips[] = {
 		.internal_phy	= {true, true, true, true,
 				   true, false},
 		.gbit_capable	= {true, true, true, true, true, true},
+		.wr_table = &ksz9896_register_set,
+		.rd_table = &ksz9896_register_set,
 	},
 
 	[KSZ9897] = {