net: dsa: microchip: rename and clean ksz8 series files
v2 cover net: dsa: microchip: rename and clean ksz8 series files
From: Pieter Van Trappen <[email protected]>
The first KSZ8 series implementation was done for a KSZ8795 device but since several other KSZ8 devices have been added. Rename these files to adhere to the ksz8 naming convention as already used in most functions and the existing ksz8.h; add an explanatory note.
In addition, clean the files by removing macros that are defined at more than one place and remove confusion by renaming the KSZ8830 string which in fact is not an existing KSZ series switch.
---
v2:
- more finegrained description in Kconfig and ksz8.c header
- add KSZ8830 renaming
v1: https://lore.kernel.org/netdev/[email protected]/
Pieter Van Trappen (3):
net: dsa: microchip: rename ksz8 series files
net: dsa: microchip: clean up ksz8_reg definition macros
net: dsa: microchip: replace unclear KSZ8830 strings
drivers/net/dsa/microchip/Kconfig | 9 ++--
drivers/net/dsa/microchip/Makefile | 2 +-
.../net/dsa/microchip/{ksz8795.c => ksz8.c} | 13 +++--
drivers/net/dsa/microchip/ksz8863_smi.c | 4 +-
.../microchip/{ksz8795_reg.h => ksz8_reg.h} | 15 +++---
drivers/net/dsa/microchip/ksz_common.c | 48 +++++++++----------
drivers/net/dsa/microchip/ksz_common.h | 5 +-
drivers/net/dsa/microchip/ksz_spi.c | 6 +--
include/linux/platform_data/microchip-ksz.h | 2 +-
9 files changed, 58 insertions(+), 46 deletions(-)
rename drivers/net/dsa/microchip/{ksz8795.c => ksz8.c} (99%)
rename drivers/net/dsa/microchip/{ksz8795_reg.h => ksz8_reg.h} (98%)base-commit: e5899b60f52a7591cfc2a2dec3e83710975117d7
Signature · 1 line
2.43.0
PATCH v2 1/3 net: dsa: microchip: rename ksz8 series files
From: Pieter Van Trappen <[email protected]>
The first KSZ8 series implementation was done for a KSZ8795 device but since several other KSZ8 devices have been added. Rename these files to adhere to the ksz8 naming convention as already used in most functions and the existing ksz8.h; add an explanatory note.
---
drivers/net/dsa/microchip/Kconfig | 9 ++++++---
drivers/net/dsa/microchip/Makefile | 2 +-
drivers/net/dsa/microchip/{ksz8795.c => ksz8.c} | 11 +++++++++--
.../net/dsa/microchip/{ksz8795_reg.h => ksz8_reg.h} | 11 ++++++++---
4 files changed, 24 insertions(+), 9 deletions(-)
rename drivers/net/dsa/microchip/{ksz8795.c => ksz8.c} (99%)
rename drivers/net/dsa/microchip/{ksz8795_reg.h => ksz8_reg.h} (98%)drivers/net/dsa/microchip/Kconfig +6 -3
@@ -1,14 +1,17 @@ # SPDX-License-Identifier: GPL-2.0-only menuconfig NET_DSA_MICROCHIP_KSZ_COMMON - tristate "Microchip KSZ8795/KSZ9477/LAN937x series switch support" + tristate "Microchip KSZ8XXX/KSZ9477/LAN937X series switch support" depends on NET_DSA select NET_DSA_TAG_KSZ select NET_DSA_TAG_NONE select NET_IEEE8021Q_HELPERS select DCB help - This driver adds support for Microchip KSZ9477 series switch and - KSZ8795/KSZ88x3 switch chips. + This driver adds support for Microchip KSZ9477 series, + LAN937X series and KSZ8 series switch chips, being + KSZ9477/9896/9897/9893/9563/9567, + LAN9370/9371/9372/9373/9374, KSZ8863/8873, KSZ8895/8864 and + KSZ8794/8795/8765. config NET_DSA_MICROCHIP_KSZ9477_I2C tristate "KSZ series I2C connected switch driver"
drivers/net/dsa/microchip/Makefile +1 -1
@@ -2,7 +2,7 @@ obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON) += ksz_switch.o ksz_switch-objs := ksz_common.o ksz_dcb.o ksz_switch-objs += ksz9477.o ksz9477_acl.o ksz9477_tc_flower.o -ksz_switch-objs += ksz8795.o +ksz_switch-objs += ksz8.o ksz_switch-objs += lan937x_main.o ifdef CONFIG_NET_DSA_MICROCHIP_KSZ_PTP
drivers/net/dsa/microchip/ksz8.c renamed from drivers/net/dsa/microchip/ksz8795.c +9 -2
@@ -1,6 +1,13 @@// SPDX-License-Identifier: GPL-2.0 /* -* Microchip KSZ8795 switch driver +* Microchip KSZ8XXX series switch driver +* +* It supports the following switches: +* - KSZ8863, KSZ8873 aka KSZ88X3 +* - KSZ8895, KSZ8864 aka KSZ8895 family +* - KSZ8794, KSZ8795, KSZ8765 aka KSZ87XX +* Note that it does NOT support: +* - KSZ8563, KSZ8567 - see KSZ9477 driver * * Copyright (C) 2017 Microchip Technology Inc. * Tristram Ha <[email protected]>
@@ -23,7 +30,7 @@#include <linux/phylink.h> #include "ksz_common.h" -#include "ksz8795_reg.h" +#include "ksz8_reg.h" #include "ksz8.h" static void ksz_cfg (struct ksz_device *dev,u32 addr,u8 bits,bool set)
drivers/net/dsa/microchip/ksz8_reg.h renamed from drivers/net/dsa/microchip/ksz8795_reg.h +8 -3
@@ -1,13 +1,18 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ /* -* Microchip KSZ8795 register definitions +* Microchip KSZ8XXX series register definitions +* +* The base for these definitions is KSZ8795 but unless indicated +* differently by their prefix, they apply to all KSZ8 series +* devices. Registers and masks that do change are defined in +* dedicated structures in ksz_common.c. * * Copyright (c) 2017 Microchip Technology Inc. * Tristram Ha <[email protected]> */ -#ifndef __KSZ8795_REG_H -#define __KSZ8795_REG_H +#ifndef __KSZ8_REG_H +#define __KSZ8_REG_H#define KS_PORT_M 0x1F
Signature · 1 line
2.43.0
Re: [PATCH net-next v2 1/3] net: dsa: microchip: rename ksz8 series files
Hi Pieter,
Quoted 27 lines · On Fri, 2024-08-30 at 16:12 +0200, [email protected] wrote:
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
From: Pieter Van Trappen <[email protected]>
drivers/net/dsa/microchip/Kconfig +0
-1@@ -1,14 +1,17 @@ # SPDX-License-Identifier: GPL-2.0-only menuconfig NET_DSA_MICROCHIP_KSZ_COMMON - tristate "Microchip KSZ8795/KSZ9477/LAN937x series switchsupport"
+ tristate "Microchip KSZ8XXX/KSZ9477/LAN937X series switch
support"
depends onNET_DSA
selectNET_DSA_TAG_KSZ
selectNET_DSA_TAG_NONE
selectNET_IEEE8021Q_HELPERS
select DCB
help
- This driver adds support for Microchip KSZ9477 series
switch and
drivers/net/dsa/microchip/Kconfig line 12
Quoted 4 lines
drivers/net/dsa/microchip/Kconfig +3
-1- KSZ8795/KSZ88x3 switch chips. + This driver adds support for Microchip KSZ9477 series, + LAN937X series and KSZ8 series switch chips, being + KSZ9477/9896/9897/9893/9563/9567,
You missed KSZ8567 and KSZ8563. Also it could be in order as suggested by Tristram,
- KSZ8863/8873, KSZ8895/8864, KSZ8794/8795/8765 - KSZ9477/9897/9896/9567/8567 - KSZ9893/9563/8563 - LAN9370/9371/9372/9373/9374
drivers/net/dsa/microchip/Kconfig line 7
Quoted 13 lines
drivers/net/dsa/microchip/Kconfig +7
-1+ LAN9370/9371/9372/9373/9374, KSZ8863/8873, KSZ8895/8864 and + KSZ8794/8795/8765.@@ -1,6 +1,13 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Microchip KSZ8795 switch driver + * Microchip KSZ8XXX series switch driver + * + * It supports the following switches: + * - KSZ8863, KSZ8873 aka KSZ88X3 + * - KSZ8895, KSZ8864 aka KSZ8895 family
You can remove 'family' here, so as to be consistent.
Quoted 9 lines
drivers/net/dsa/microchip/Kconfig +3
-0+ * - KSZ8794, KSZ8795, KSZ8765 aka KSZ87XX + * Note that it does NOT support: + * - KSZ8563, KSZ8567 - see KSZ9477 driver * * Copyright (C) 2017 Microchip Technology Inc. * Tristram Ha <[email protected]>@@ -23,7 +30,7 @@ #include <linux/phylink.h>
Re: [PATCH net-next v2 1/3] net: dsa: microchip: rename ksz8 series files
Hi Arun,
Review
Quoted 13 lines
drivers/net/dsa/microchip/Kconfig line 12
Quoted 6 lines
- This driver adds support for Microchip KSZ9477 series
switch anddrivers/net/dsa/microchip/Kconfig +3
-1- KSZ8795/KSZ88x3 switch chips. + This driver adds support for Microchip KSZ9477 series, + LAN937X series and KSZ8 series switch chips, being + KSZ9477/9896/9897/9893/9563/9567,You missed KSZ8567 and KSZ8563. Also it could be in order as suggested by Tristram,
(quoted diff) +0
-4- KSZ8863/8873, KSZ8895/8864, KSZ8794/8795/8765 - KSZ9477/9897/9896/9567/8567 - KSZ9893/9563/8563 - LAN9370/9371/9372/9373/9374
OK will do.
Quoted 5 lines
Quoted 3 lines
+ * It supports the following switches:
+ * - KSZ8863, KSZ8873 aka KSZ88X3
+ * - KSZ8895, KSZ8864 aka KSZ8895 familyYou can remove 'family' here, so as to be consistent.
Well I'd rather keep it so it's consistent with the ksz_common.h ksz_is_8895_family(), do you agree?
Quoted 9 lines
drivers/net/dsa/microchip/ksz8.c line 31
Quoted 9 lines
+ * - KSZ8794, KSZ8795, KSZ8765 aka KSZ87XX
+ * Note that it does NOT support:
+ * - KSZ8563, KSZ8567 - see KSZ9477 driver
*
* Copyright (C) 2017 Microchip Technology Inc.
* Tristram Ha <[email protected]>drivers/net/dsa/microchip/ksz8.c renamed from drivers/net/dsa/microchip/ksz8795.c +0
-0@@ -23,7 +30,7 @@#include <linux/phylink.h>
Cheers, Pieter
Re: [PATCH net-next v2 1/3] net: dsa: microchip: rename ksz8 series files
Hi Pieter,
Quoted 22 lines · Pieter
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Hi Arun,
Quoted 10 lines
drivers/net/dsa/microchip/Kconfig line 12
Quoted 6 lines
- This driver adds support for Microchip KSZ9477 series
switch anddrivers/net/dsa/microchip/Kconfig +3
-1- KSZ8795/KSZ88x3 switch chips. + This driver adds support for Microchip KSZ9477 series, + LAN937X series and KSZ8 series switch chips, being + KSZ9477/9896/9897/9893/9563/9567,You missed KSZ8567 and KSZ8563. Also it could be in order as suggested
by Tristram,Review
Quoted 4 lines
(quoted diff) +0
-4- KSZ8863/8873, KSZ8895/8864, KSZ8794/8795/8765 - KSZ9477/9897/9896/9567/8567 - KSZ9893/9563/8563 - LAN9370/9371/9372/9373/9374OK will do.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
+ * It supports the following switches:
+ * - KSZ8863, KSZ8873 aka KSZ88X3
+ * - KSZ8895, KSZ8864 aka KSZ8895 familyYou can remove 'family' here, so as to be consistent.
Well I'd rather keep it so it's consistent with the
ksz_common.hksz_is_8895_family(), do you agree?
OK. LGTM.
PATCH v2 2/3 net: dsa: microchip: clean up ksz8_reg definition macros
In reply to [email protected]From: Pieter Van Trappen <[email protected]>
Remove macros that are already defined at more appropriate places.
--- drivers/net/dsa/microchip/ksz8_reg.h | 4 ---- 1 file changed, 4 deletions(-)
drivers/net/dsa/microchip/ksz8_reg.h +0 -4
@@ -364,8 +364,6 @@#define REG_IND_DATA_1 0x77#define REG_IND_DATA_0 0x78 -#define REG_IND_DATA_PME_EEE_ACL 0xA0 -#define REG_INT_STATUS 0x7C#define REG_INT_ENABLE 0x7D
@@ -709,8 +707,6 @@#define KSZ8795_ID_LO 0x1550#define KSZ8863_ID_LO 0x1430 -#define KSZ8795_SW_ID 0x8795 -#define PHY_REG_LINK_MD 0x1D#define PHY_START_CABLE_DIAG BIT(15)
Signature · 1 line
2.43.0
Re: [PATCH net-next v2 2/3] net: dsa: microchip: clean up ksz8_reg definition macros
Quoted 8 lines · On Fri, 2024-08-30 at 16:12 +0200, [email protected] wrote:
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
From: Pieter Van Trappen <[email protected]>
Remove macros that are already defined at more appropriate places.
Signed-off-by Pieter Van Trappen <[email protected]>
PATCH v2 3/3 net: dsa: microchip: replace unclear KSZ8830 strings
In reply to [email protected]From: Pieter Van Trappen <[email protected]>
Replace uppercase KSZ8830 with KSZ8863 and lowercase ksz8830 with ksz88x3 strings. This because KSZ8830 is not an actual switch but it's the Chip ID shared among KSZ8863/KSZ8873 switches, impossible to differentiate from their Chip ID or Revision registers.
Now all KSZ*_CHIP_ID macros refer to actual, existing switches which removes confusion.
--- drivers/net/dsa/microchip/ksz8.c | 2 +- drivers/net/dsa/microchip/ksz8863_smi.c | 4 +- drivers/net/dsa/microchip/ksz_common.c | 48 ++++++++++----------- drivers/net/dsa/microchip/ksz_common.h | 5 ++- drivers/net/dsa/microchip/ksz_spi.c | 6 +-- include/linux/platform_data/microchip-ksz.h | 2 +- 6 files changed, 34 insertions(+), 33 deletions(-)
drivers/net/dsa/microchip/ksz8.c +1 -1
@@ -194,7 +194,7 @@ int ksz8_change_mtu(struct ksz_device *dev, int port, int mtu)case KSZ8794_CHIP_ID :case KSZ8765_CHIP_ID :return ksz8795_change_mtu (dev, frame_size); -case KSZ8830_CHIP_ID : +case KSZ8863_CHIP_ID :case KSZ8864_CHIP_ID :case KSZ8895_CHIP_ID :return ksz8863_change_mtu (dev, frame_size);
drivers/net/dsa/microchip/ksz8863_smi.c +2 -2
@@ -199,11 +199,11 @@ static void ksz8863_smi_shutdown(struct mdio_device *mdiodev)static const struct of_device_id ksz8863_dt_ids[] = { { .compatible ="microchip,ksz8863" , - .data = &ksz_switch_chips[KSZ8830 ] + .data = &ksz_switch_chips[KSZ8863 ] }, { .compatible ="microchip,ksz8873" , - .data = &ksz_switch_chips[KSZ8830 ] + .data = &ksz_switch_chips[KSZ8863 ] }, { }, };
drivers/net/dsa/microchip/ksz_common.c +24 -24
154 lines not on this page · raw message
drivers/net/dsa/microchip/ksz_common.h +3 -2
@@ -200,7 +200,8 @@ enum ksz_model {KSZ8795 ,KSZ8794 ,KSZ8765 , -KSZ8830 , +KSZ8863 , +KSZ8873 ,KSZ8864 ,KSZ8895 , KSZ9477,
@@ -628,7 +629,7 @@ static inline bool ksz_is_ksz87xx(struct ksz_device *dev)static inline bool ksz_is_ksz88x3 (struct ksz_device *dev) { -return dev->chip_id ==KSZ8830_CHIP_ID ; +return dev->chip_id ==KSZ8863_CHIP_ID ; }static inline bool ksz_is_8895_family (struct ksz_device *dev)
drivers/net/dsa/microchip/ksz_spi.c +3 -3
@@ -54,7 +54,7 @@ static int ksz_spi_probe(struct spi_device *spi)if (!chip)return -EINVAL ; -if (chip->chip_id ==KSZ8830_CHIP_ID ) +if (chip->chip_id ==KSZ8863_CHIP_ID ) regmap_config = ksz8863_regmap_config; else if (chip->chip_id == KSZ8795_CHIP_ID || chip->chip_id == KSZ8794_CHIP_ID ||
@@ -137,7 +137,7 @@ static const struct of_device_id ksz_dt_ids[] = { }, { .compatible = "microchip,ksz8863", - .data = &ksz_switch_chips[KSZ8830] + .data = &ksz_switch_chips[KSZ8863] }, { .compatible = "microchip,ksz8864",
@@ -145,7 +145,7 @@ static const struct of_device_id ksz_dt_ids[] = { }, { .compatible = "microchip,ksz8873", - .data = &ksz_switch_chips[KSZ8830] + .data = &ksz_switch_chips[KSZ8863] }, { .compatible = "microchip,ksz8895",
include/linux/platform_data/microchip-ksz.h +1 -1
@@ -27,7 +27,7 @@ enum ksz_chip_id {KSZ8795_CHIP_ID =0x8795 ,KSZ8794_CHIP_ID =0x8794 ,KSZ8765_CHIP_ID =0x8765 , -KSZ8830_CHIP_ID =0x8830 , +KSZ8863_CHIP_ID =0x8863 ,KSZ8864_CHIP_ID =0x8864 ,KSZ8895_CHIP_ID =0x8895 , KSZ9477_CHIP_ID = 0x00947700,
Signature · 1 line
2.43.0
Re: [PATCH net-next v2 3/3] net: dsa: microchip: replace unclear KSZ8830 strings
Hi Pieter,
Quoted 6 lines · On Fri, 2024-08-30 at 16:12 +0200, [email protected] wrote:
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
From: Pieter Van Trappen <[email protected]>
Replace uppercase KSZ8830 with KSZ8863
Since KSZ8863/73 sharing same chip id, replacing KSZ8830 with KSZ8863 is somewhat confusing. Can you elaborate here. I believe, it should KSZ88X3_CHIP_ID.
Re: [PATCH net-next v2 3/3] net: dsa: microchip: replace unclear KSZ8830 strings
Hi Arun,
Quoted 7 lines
Quoted 3 lines
From: Pieter Van Trappen <[email protected]>
Replace uppercase KSZ8830 with KSZ8863
Since KSZ8863/73 sharing same chip id, replacing KSZ8830 with KSZ8863 is somewhat confusing. Can you elaborate here. I believe, it should
KSZ88X3_CHIP_ID.
I'm afraid there's no perfect solution here, it's the only chip here that can't be differentiated by its chip id I believe.
The reason I didn't go for KSZ88X3_CHIP_ID is that the enum requires a constant as well so 0x88x3 won't work and I wanted to avoid the following because it would be the only definition where the name and constant would not match:
include/linux/platform_data/microchip-ksz.h +1 -1
@@ -27,7 +27,7 @@ enum ksz_chip_id {KSZ8795_CHIP_ID =0x8795 ,KSZ8794_CHIP_ID =0x8794 ,KSZ8765_CHIP_ID =0x8765 , -KSZ8830_CHIP_ID =0x8830 , +KSZ88X3_CHIP_ID =0x8863 ,KSZ8864_CHIP_ID =0x8864 ,KSZ8895_CHIP_ID =0x8895
Technically it's possible of course, which one has your preference?
Cheers, Pieter
Re: [PATCH net-next v2 3/3] net: dsa: microchip: replace unclear KSZ8830 strings
Hi Pieter,
Quoted 14 lines · Pieter
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Hi Arun,
Quoted 8 lines
Quoted 3 lines
From: Pieter Van Trappen <[email protected]>
Replace uppercase KSZ8830 with KSZ8863
Since KSZ8863/73 sharing same chip id, replacing KSZ8830 with KSZ8863
is somewhat confusing. Can you elaborate here. I believe, it shouldKSZ88X3_CHIP_ID.
Quoted 8 lines
I'm afraid there's no perfect solution here, it's the only chip here that can't be differentiated by its chip id I believe.
The reason I didn't go for
KSZ88X3_CHIP_IDis that the enum requires a
constant as well so0x88x3won't work and I wanted to avoid the following because it would be the only definition where the name and constant would not match:
IMO: It is understood that KSZ88x3 has chip id 0x8830, So the name and constant does not match each other.
Quoted 12 lines
include/linux/platform_data/microchip-ksz.h +1
-1@@ -27,7 +27,7 @@ enum ksz_chip_id {KSZ8795_CHIP_ID =0x8795 ,KSZ8794_CHIP_ID =0x8794 ,KSZ8765_CHIP_ID =0x8765 , -KSZ8830_CHIP_ID =0x8830 , +KSZ88X3_CHIP_ID =0x8863 ,KSZ8864_CHIP_ID =0x8864 ,KSZ8895_CHIP_ID =0x8895
Quoted 1 line
Technically it's possible of course, which one has your preference?
It is confusing like for upper case replacing with KSZ8863 and lowercase with KSZ88x3. IMO it should be same for both. Have things consistent.
Quoted 2 lines
Cheers, Pieter