net: dsa: mv88e6xxx: refine SMI support
Subsystems (4)
PATCH v2 1/1 net: dsa: mv88e6xxx: refine SMI support
The Marvell SOHO switches have several ways to access the internal registers. One of them being the System Management Interface (SMI), using the MDC and MDIO pins, with direct and indirect variants.
In preparation for adding support for other register accesses, move the SMI code into its own files. At the same time, refine the code to make it clear that the indirect variant is implemented using the direct variant accessing only two registers for command and data.
--- drivers/net/dsa/mv88e6xxx/Makefile | 1 + drivers/net/dsa/mv88e6xxx/chip.c | 160 +---------------------------- drivers/net/dsa/mv88e6xxx/chip.h | 11 -- drivers/net/dsa/mv88e6xxx/smi.c | 158 ++++++++++++++++++++++++++++ drivers/net/dsa/mv88e6xxx/smi.h | 59 +++++++++++ 5 files changed, 219 insertions(+), 170 deletions(-) create mode 100644 drivers/net/dsa/mv88e6xxx/smi.c create mode 100644 drivers/net/dsa/mv88e6xxx/smi.h
drivers/net/dsa/mv88e6xxx/Makefile +1 -0
@@ -12,3 +12,4 @@ mv88e6xxx-objs += phy.o mv88e6xxx-objs += port.o mv88e6xxx-$(CONFIG_NET_DSA_MV88E6XXX_PTP) += ptp.o mv88e6xxx-objs += serdes.o +mv88e6xxx-objs += smi.o
drivers/net/dsa/mv88e6xxx/chip.c +1 -159
178 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx/chip.h +0 -11
@@ -21,17 +21,6 @@#include <linux/timecounter.h> #include <net/dsa.h> -#define SMI_CMD 0x00 -#define SMI_CMD_BUSY BIT(15) -#define SMI_CMD_CLAUSE_22 BIT(12) -#define SMI_CMD_OP_22_WRITE ((1 << 10) | SMI_CMD_BUSY | SMI_CMD_CLAUSE_22) -#define SMI_CMD_OP_22_READ ((2 << 10) | SMI_CMD_BUSY | SMI_CMD_CLAUSE_22) -#define SMI_CMD_OP_45_WRITE_ADDR ((0 << 10) | SMI_CMD_BUSY) -#define SMI_CMD_OP_45_WRITE_DATA ((1 << 10) | SMI_CMD_BUSY) -#define SMI_CMD_OP_45_READ_DATA ((2 << 10) | SMI_CMD_BUSY) -#define SMI_CMD_OP_45_READ_DATA_INC ((3 << 10) | SMI_CMD_BUSY) -#define SMI_DATA 0x01 -#define MV88E6XXX_N_FID 4096/* PVT limits for 4-bit port and 5-bit switch */
drivers/net/dsa/mv88e6xxx/smi.c new file +158 -0
158 lines not on this page · raw message
drivers/net/dsa/mv88e6xxx/smi.h new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
2.21.0
Quoted 10 lines · Vivien Didelot
The Marvell SOHO switches have several ways to access the internal registers. One of them being the System Management Interface (SMI), using the MDC and MDIO pins, with direct and indirect variants.
In preparation for adding support for other register accesses, move the SMI code into its own files. At the same time, refine the code to make it clear that the indirect variant is implemented using the direct variant accessing only two registers for command and data.
Signed-off-by Vivien Didelot <[email protected]>
Signature · 1 line
Florian