Skip to contentSkip to conversation

net: dsa: mv88e6xxx: refine SMI support

PATCH In review Vivien Didelot 2 participants 2 messages May 3, 2019 – May 4, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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
index 50de304abe2f..e85755dde90b 100644
@@ -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
index 19c07dff0440..faa3fa889f19 100644
@@ -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
Reviewed-by on v2 1/1
#1 lore raw
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.

Signature · 1 line
Florian