Skip to contentSkip to conversation

net: ethernet: ti: Introduce am654 gigabit eth switch subsystem driver

PATCH Superseded Keerthy 2 participants 11 messages Jan 31, 2019 – Feb 1, 2019

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Keerthy

author
#0 lore raw

cover net: ethernet: ti: Introduce am654 gigabit eth switch subsystem driver

Add new driver for the TI AM65x SoC Gigabit Ethernet Switch subsystem (CPSW NUSS). It has two ports and provides Ethernet packet communication for the device and can be configured as an Ethernet switch. CPSW NUSS features: the Reduced Gigabit Media Independent Interface (RGMII), Reduced Media Independent Interface (RMII), and the Management Data Input/Output (MDIO) interface for physical layer device (PHY) management. The TI AM65x SoC has integrated two-port Gigabit Ethernet Switch subsystem into device MCU domain named MCU_CPSW0. One Ethernet port (port 1) with selectable RGMII and RMII interfaces and an internal Communications Port Programming Interface (CPPI) port (Host port 0).

Host Port 0 CPPI Packet Streaming Interface interface supports 8 TX channels and on RX channels operating by TI am654 NAVSS Unified DMA Peripheral Root Complex (UDMA-P) controller.

The series is based on top of Vignesh's v3:

https://patchwork.ozlabs.org/patch/1032504/

Tested for tftp and booting to kernel on am654-evm.

Grygorii Strashko (5):
driver: net: ti: cpsw-mdio: use phys_addr_t for mdio_base addr
net: ethernet: ti: Introduce am654 gigabit eth switch subsystem driver
arm64: dts: ti: k3-am65: add mcu cpsw node
arm64: dts: k3-am654-base-board: add mcu cpsw nuss pinmux and phy defs
configs: am65x_evm_a53: enable networking

 arch/arm/dts/k3-am65.dtsi                    |   2 +
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 170 ++++
 configs/am65x_evm_a53_defconfig              |   7 +
 drivers/net/ti/Kconfig                       |   8 +
 drivers/net/ti/Makefile                      |   1 +
 drivers/net/ti/am65-cpsw-nuss.c              | 834 +++++++++++++++++++
 drivers/net/ti/cpsw_mdio.c                   |   2 +-
 drivers/net/ti/cpsw_mdio.h                   |   2 +-
 8 files changed, 1024 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ti/am65-cpsw-nuss.c
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/5 driver: net: ti: cpsw-mdio: use phys_addr_t for mdio_base addr

From: Grygorii Strashko <[email protected]>

Use phys_addr_t for mdio_base address to avoid build warnings on arm64.

---
 drivers/net/ti/cpsw_mdio.c | 2 +-
 drivers/net/ti/cpsw_mdio.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ti/cpsw_mdio.c +1 -1
index 70f547e6d7..86980612dd 100644
@@ -125,7 +125,7 @@ u32 cpsw_mdio_get_alive(struct mii_dev *bus)
 	return val & GENMASK(15, 0);
 }
 
-struct mii_dev *cpsw_mdio_init(const char *name, u32 mdio_base,
+struct mii_dev *cpsw_mdio_init(const char *name, phys_addr_t mdio_base,
 			       u32 bus_freq, int fck_freq)
 {
 	struct cpsw_mdio *cpsw_mdio;
drivers/net/ti/cpsw_mdio.h +1 -1
index 4a76d4e5c5..dbf4a2dcac 100644
@@ -10,7 +10,7 @@
 
 struct cpsw_mdio;
 
-struct mii_dev *cpsw_mdio_init(const char *name, u32 mdio_base,
+struct mii_dev *cpsw_mdio_init(const char *name, phys_addr_t mdio_base,
 			       u32 bus_freq, int fck_freq);
 void cpsw_mdio_free(struct mii_dev *bus);
 u32 cpsw_mdio_get_alive(struct mii_dev *bus);
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/5 driver: net: ti: cpsw-mdio: use phys_addr_t for mdio_base addr

Quoted 6 lines · Keerthy

From: Grygorii Strashko <[email protected]>

Use phys_addr_t for mdio_base address to avoid build warnings on arm64.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190201/679ac60c/attachment.sig>
author
#3 lore raw

PATCH 2/5 net: ethernet: ti: Introduce am654 gigabit eth switch subsystem driver

In reply to Keerthy

From: Grygorii Strashko <[email protected]>

Add new driver for the TI AM65x SoC Gigabit Ethernet Switch subsystem (CPSW NUSS). It has two ports and provides Ethernet packet communication for the device and can be configured as an Ethernet switch. CPSW NUSS features: the Reduced Gigabit Media Independent Interface (RGMII), Reduced Media Independent Interface (RMII), and the Management Data Input/Output (MDIO) interface for physical layer device (PHY) management. The TI AM65x SoC has integrated two-port Gigabit Ethernet Switch subsystem into device MCU domain named MCU_CPSW0. One Ethernet port (port 1) with selectable RGMII and RMII interfaces and an internal Communications Port Programming Interface (CPPI) port (Host port 0).

Host Port 0 CPPI Packet Streaming Interface interface supports 8 TX channels and on RX channels operating by TI am654 NAVSS Unified DMA Peripheral Root Complex (UDMA-P) controller.

---
 drivers/net/ti/Kconfig          |   8 +
 drivers/net/ti/Makefile         |   1 +
 drivers/net/ti/am65-cpsw-nuss.c | 834 ++++++++++++++++++++++++++++++++
 3 files changed, 843 insertions(+)
 create mode 100644 drivers/net/ti/am65-cpsw-nuss.c
drivers/net/ti/Kconfig +8 -0
index 82bc9f5d03..ecf642de10 100644
@@ -18,3 +18,11 @@ config DRIVER_TI_KEYSTONE_NET
 	bool "TI Keystone 2 Ethernet"
 	help
 	   This driver supports the TI Keystone 2 Ethernet subsystem
+
+config TI_AM65_CPSW_NUSS
+	bool "TI K3 AM65x MCU CPSW Nuss Ethernet controller driver"
+	depends on ARCH_K3
+	select PHYLIB
+	help
+	  This driver supports TI K3 MCU CPSW Nuss Ethernet controller
+	  in Texas Instruments K3 AM65x SoCs.
drivers/net/ti/Makefile +1 -0
index ee3e4eb5d6..8d3808bb4b 100644
@@ -5,3 +5,4 @@
 obj-$(CONFIG_DRIVER_TI_CPSW) += cpsw.o cpsw-common.o cpsw_mdio.o
 obj-$(CONFIG_DRIVER_TI_EMAC) += davinci_emac.o
 obj-$(CONFIG_DRIVER_TI_KEYSTONE_NET) += keystone_net.o cpsw_mdio.o
+obj-$(CONFIG_TI_AM65_CPSW_NUSS) += am65-cpsw-nuss.o cpsw_mdio.o
drivers/net/ti/am65-cpsw-nuss.c new file +834 -0

834 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

PATCH 2/5 net: ethernet: ti: Introduce am654 gigabit eth switch subsystem driver

Quoted 19 lines · Keerthy

From: Grygorii Strashko <[email protected]>

Add new driver for the TI AM65x SoC Gigabit Ethernet Switch subsystem (CPSW NUSS). It has two ports and provides Ethernet packet communication for the device and can be configured as an Ethernet switch. CPSW NUSS features: the Reduced Gigabit Media Independent Interface (RGMII), Reduced Media Independent Interface (RMII), and the Management Data Input/Output (MDIO) interface for physical layer device (PHY) management. The TI AM65x SoC has integrated two-port Gigabit Ethernet Switch subsystem into device MCU domain named MCU_CPSW0. One Ethernet port (port 1) with selectable RGMII and RMII interfaces and an internal Communications Port Programming Interface (CPPI) port (Host port 0).

Host Port 0 CPPI Packet Streaming Interface interface supports 8 TX channels and on RX channels operating by TI am654 NAVSS Unified DMA Peripheral Root Complex (UDMA-P) controller.

[snip]

drivers/net/ti/am65-cpsw-nuss.c line 139

Quoted 3 lines
drivers/net/ti/am65-cpsw-nuss.c new file +3 -0
+#ifdef AM65_CPSW_DEBUG
+#define	am65_cpsw_dbg(arg...) pr_err(arg)
+#define	am65_cpsw_dev_dbg(dev, arg...) dev_err(dev, arg)

No new debug macros, use pr_err/etc directly and tweak CONFIG_LOGLEVEL / CONFIG_SPL_LOGLEVEL or the macro being used if things are now too spammy in real usage.

drivers/net/ti/am65-cpsw-nuss.c line 144

Quoted 5 lines
drivers/net/ti/am65-cpsw-nuss.c new file +5 -0
+static void am65_cpsw_print_buf(ulong addr, const void *data, uint width,
+				uint count, uint linelen)
+{
+	print_buffer(addr, data, width, count, linelen);
+}

One usage of this function was clearly a bring-up debug print and for the other, we either call print_buffer on DMA failure or we don't care enough to. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190201/958d30a6/attachment.sig>
author
#5 lore raw

PATCH 3/5 arm64: dts: ti: k3-am65: add mcu cpsw node

In reply to Keerthy

From: Grygorii Strashko <[email protected]>

Add mcu cpsw and its components along with scm_conf node to have ethernet functional.

---
 arch/arm/dts/k3-am65.dtsi                    |   2 +
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 111 +++++++++++++++++++
 2 files changed, 113 insertions(+)
arch/arm/dts/k3-am65.dtsi +2 -0
index 3d4bf369d0..9d1ed49753 100644
@@ -64,6 +64,7 @@
 			 /* MCUSS Range */
 			 <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>,
 			 <0x00 0x40200000 0x00 0x40200000 0x00 0x00900100>,
+			 <0x00 0x40f00000 0x00 0x40f00000 0x00 0x00020000>,
 			 <0x00 0x42040000 0x00 0x42040000 0x00 0x03ac2400>,
 			 <0x00 0x45100000 0x00 0x45100000 0x00 0x00c24000>,
 			 <0x00 0x46000000 0x00 0x46000000 0x00 0x00200000>,
@@ -75,6 +76,7 @@
 			#size-cells = <2>;
 			ranges = <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>, /* MCU NAVSS*/
 				 <0x00 0x40200000 0x00 0x40200000 0x00 0x00900100>, /* First peripheral window */
+				 <0x00 0x40f00000 0x00 0x40f00000 0x00 0x00020000>, /* CTRL_MMR0 */
 				 <0x00 0x42040000 0x00 0x42040000 0x00 0x03ac2400>, /* WKUP */
 				 <0x00 0x45100000 0x00 0x45100000 0x00 0x00c24000>, /* MMRs, remaining NAVSS */
 				 <0x00 0x46000000 0x00 0x46000000 0x00 0x00200000>, /* CPSW */
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +111 -0

123 lines not on this page · raw message

Signature · 1 line
2.17.1
#6 lore raw

PATCH 3/5 arm64: dts: ti: k3-am65: add mcu cpsw node

Quoted 7 lines · Keerthy

From: Grygorii Strashko <[email protected]>

Add mcu cpsw and its components along with scm_conf node to have ethernet functional.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190201/32325074/attachment.sig>
author
#7 lore raw

PATCH 4/5 arm64: dts: k3-am654-base-board: add mcu cpsw nuss pinmux and phy defs

In reply to Keerthy

From: Grygorii Strashko <[email protected]>

Add mcu cpsw nuss pinmux and phy defs required by cpsw.

---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 59 ++++++++++++++++++++
 1 file changed, 59 insertions(+)
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +59 -0
index 27685c5a22..404df4ed36 100644
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/pinctrl/k3-am65.h>
 #include <dt-bindings/dma/k3-udma.h>
+#include <dt-bindings/net/ti-dp83867.h>
 
 / {
 	chosen {
@@ -299,6 +300,32 @@
 	u-boot,dm-spl;
 };
 
+&wkup_pmx0 {
+	mcu_cpsw_pins_default: mcu_cpsw_pins_default {
+		pinctrl-single,pins = <
+			AM65X_WKUP_IOPAD(0x0058, PIN_OUTPUT | MUX_MODE0) /* (N4) MCU_RGMII1_TX_CTL */
+			AM65X_WKUP_IOPAD(0x005c, PIN_INPUT | MUX_MODE0) /* (N5) MCU_RGMII1_RX_CTL */
+			AM65X_WKUP_IOPAD(0x0060, PIN_OUTPUT | MUX_MODE0) /* (M2) MCU_RGMII1_TD3 */
+			AM65X_WKUP_IOPAD(0x0064, PIN_OUTPUT | MUX_MODE0) /* (M3) MCU_RGMII1_TD2 */
+			AM65X_WKUP_IOPAD(0x0068, PIN_OUTPUT | MUX_MODE0) /* (M4) MCU_RGMII1_TD1 */
+			AM65X_WKUP_IOPAD(0x006c, PIN_OUTPUT | MUX_MODE0) /* (M5) MCU_RGMII1_TD0 */
+			AM65X_WKUP_IOPAD(0x0078, PIN_INPUT | MUX_MODE0) /* (L2) MCU_RGMII1_RD3 */
+			AM65X_WKUP_IOPAD(0x007c, PIN_INPUT | MUX_MODE0) /* (L5) MCU_RGMII1_RD2 */
+			AM65X_WKUP_IOPAD(0x0080, PIN_INPUT | MUX_MODE0) /* (M6) MCU_RGMII1_RD1 */
+			AM65X_WKUP_IOPAD(0x0084, PIN_INPUT | MUX_MODE0) /* (L6) MCU_RGMII1_RD0 */
+			AM65X_WKUP_IOPAD(0x0070, PIN_INPUT | MUX_MODE0) /* (N1) MCU_RGMII1_TXC */
+			AM65X_WKUP_IOPAD(0x0074, PIN_INPUT | MUX_MODE0) /* (M1) MCU_RGMII1_RXC */
+		>;
+	};
+
+	mcu_mdio_pins_default: mcu_mdio1_pins_default {
+		pinctrl-single,pins = <
+			AM65X_WKUP_IOPAD(0x008c, PIN_OUTPUT | MUX_MODE0) /* (L1) MCU_MDIO0_MDC */
+			AM65X_WKUP_IOPAD(0x0088, PIN_INPUT | MUX_MODE0) /* (L4) MCU_MDIO0_MDIO */
+		>;
+	};
+};
+
 &main_uart0 {
 	u-boot,dm-spl;
 	pinctrl-names = "default";
@@ -322,3 +349,35 @@
 	pinctrl-0 = <&main_mmc1_pins_default>;
 	sdhci-caps-mask = <0x7 0x0>;
 };
+
+&mcu_cpsw {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;
+};
+
+&davinci_mdio {
+	phy0: ethernet-phy at 0 {
+		reg = <0>;
+		/* TODO: phy reset: TCA9555RTWR(i2c:0x21)[p04].GPIO_MCU_RGMII_RSTN */
+		ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
+		ti,tx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
+		ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
+	};
+};
+
+&cpsw_port1 {
+	phy-mode = "rgmii-id";
+	phy-handle = <&phy0>;
+};
+
+&mcu_cpsw {
+	reg = <0x0 0x46000000 0x0 0x200000>,
+	      <0x0 0x40f00200 0x0 0x2>;
+	reg-names = "cpsw_nuss", "mac_efuse";
+
+	cpsw-phy-sel at 40f04040 {
+		compatible = "ti,am654-cpsw-phy-sel";
+		reg= <0x0 0x40f04040 0x0 0x4>;
+		reg-names = "gmii-sel";
+	};
+};
Signature · 1 line
2.17.1
#8 lore raw

PATCH 4/5 arm64: dts: k3-am654-base-board: add mcu cpsw nuss pinmux and phy defs

Quoted 6 lines · Keerthy

From: Grygorii Strashko <[email protected]>

Add mcu cpsw nuss pinmux and phy defs required by cpsw.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190201/6f385e74/attachment.sig>
author
#9 lore raw

PATCH 5/5 configs: am65x_evm_a53: enable networking

In reply to Keerthy

From: Grygorii Strashko <[email protected]>

Enable TI K3 AM65x CPSW NUSS driver.

---
 configs/am65x_evm_a53_defconfig | 7 +++++++
 1 file changed, 7 insertions(+)
configs/am65x_evm_a53_defconfig +7 -0
index 9ce22157c9..bf26fb4838 100644
@@ -42,6 +42,7 @@ CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
 CONFIG_ENV_IS_IN_FAT=y
 CONFIG_ENV_FAT_INTERFACE="mmc"
 CONFIG_ENV_FAT_DEVICE_AND_PART="1:1"
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
@@ -56,6 +57,11 @@ CONFIG_K3_SEC_PROXY=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_K3_ARASAN=y
+CONFIG_PHY_TI=y
+CONFIG_PHY_FIXED=y
+CONFIG_DM_ETH=y
+CONFIG_TI_AM65_CPSW_NUSS=y
+CONFIG_PHY=y
 CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_GENERIC is not set
 CONFIG_SPL_PINCTRL=y
@@ -71,3 +77,4 @@ CONFIG_DM_SERIAL=y
 CONFIG_SOC_TI=y
 CONFIG_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
+CONFIG_HEXDUMP=y
Signature · 1 line
2.17.1
#10 lore raw

PATCH 5/5 configs: am65x_evm_a53: enable networking

Quoted 6 lines · Keerthy

From: Grygorii Strashko <[email protected]>

Enable TI K3 AM65x CPSW NUSS driver.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190201/eb9270d6/attachment.sig>