Skip to contentSkip to conversation

net: dsa: ksz9477: add I2C managed mode support

PATCH In review Sergio Paracuellos 1 participant 1 message Dec 17, 2018

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

PATCH v3 1/2 net: dsa: ksz9477: add I2C managed mode support

In this mode the switch device and the internal phys will be managed via I2C interface.

---
Changes v3:
- return -EINVAL if 'ksz_i2c_write' is called with len 0 to avoid a possible memory corruption.

Changes v2:
- Use dev->txbuf as transmition buffer which is allocated using kernel allocators avoiding some possible DMA issues using the stack.

 drivers/net/dsa/microchip/Kconfig       |   6 +
 drivers/net/dsa/microchip/Makefile      |   1 +
 drivers/net/dsa/microchip/ksz9477_i2c.c | 272 ++++++++++++++++++++++++
 3 files changed, 279 insertions(+)
 create mode 100644 drivers/net/dsa/microchip/ksz9477_i2c.c
drivers/net/dsa/microchip/Kconfig +6 -0
index a8caf9249d50..162fec43d204 100644
@@ -14,3 +14,9 @@ config NET_DSA_MICROCHIP_KSZ9477_SPI
 	depends on NET_DSA_MICROCHIP_KSZ9477 && SPI
 	help
 	  Select to enable support for registering switches configured through SPI.
+
+config NET_DSA_MICROCHIP_KSZ9477_I2C
+	tristate "KSZ series I2C connected switch driver"
+	depends on NET_DSA_MICROCHIP_KSZ9477 && I2C
+	help
+	  Select to enable support for registering switches configured through I2C.
drivers/net/dsa/microchip/Makefile +1 -0
index 3142c18b8f57..eb9b768face2 100644
@@ -1,3 +1,4 @@
 obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON)	+= ksz_common.o
 obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ9477)		+= ksz9477.o
 obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ9477_SPI)	+= ksz9477_spi.o
+obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ9477_I2C)	+= ksz9477_i2c.o
drivers/net/dsa/microchip/ksz9477_i2c.c new file +272 -0

272 lines not on this page · raw message

Signature · 1 line
2.19.1