Skip to contentSkip to conversation

Add network support for Jaguar2 SoCs

PATCH New Horatiu Vultur 2 participants 6 messages Apr 3, 2019 – Apr 7, 2019

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

v4 cover Add network support for Jaguar2 SoCs

v4-changes:
- address Daniel comments.

v3-changes:
- move serdes setup in network driver and read serdes configuration from DT.

v2-changes:
- create serdes6g_setup and serdes1g_setup functions to be easier to extand for future boards.

Horatiu Vultur (4):
net: Add MSCC Jaguar2 network driver.
board: mscc: jr2: Update MSCC Jaguar2 boards
net: mscc: jaguar2: Add ethenet nodes for Jaguar2.
configs: mscc_jr2: Add network support

 arch/mips/dts/jr2_pcb110.dts          |   76 +++
 arch/mips/dts/jr2_pcb111.dts          |  400 ++++++++++++
 arch/mips/dts/mscc,jr2.dtsi           |  116 ++++
 arch/mips/dts/serval2_pcb112.dts      |   44 ++
 board/mscc/jr2/jr2.c                  |   23 +
 configs/mscc_jr2_defconfig            |    6 +-
 drivers/net/mscc_eswitch/Kconfig      |    7 +
 drivers/net/mscc_eswitch/Makefile     |    1 +
 drivers/net/mscc_eswitch/jr2_switch.c | 1075 +++++++++++++++++++++++++++++++++
 include/configs/vcoreiii.h            |    2 +-
 include/dt-bindings/mscc/jr2_data.h   |   19 +
 11 files changed, 1767 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/mscc_eswitch/jr2_switch.c
 create mode 100644 include/dt-bindings/mscc/jr2_data.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH v4 1/4 net: Add MSCC Jaguar2 network driver.

Add network driver for Microsemi Ethernet switch.
It is present on Jaguar2 SoCs.

---
 drivers/net/mscc_eswitch/Kconfig      |    7 +
 drivers/net/mscc_eswitch/Makefile     |    1 +
 drivers/net/mscc_eswitch/jr2_switch.c | 1075 +++++++++++++++++++++++++++++++++
 include/configs/vcoreiii.h            |    2 +-
 4 files changed, 1084 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/mscc_eswitch/jr2_switch.c
drivers/net/mscc_eswitch/Kconfig +7 -0
index 88e5a97..3f9d14b 100644
@@ -15,3 +15,10 @@ config MSCC_LUTON_SWITCH
 	select PHYLIB
 	help
 	  This driver supports the Luton network switch device.
+
+config MSCC_JR2_SWITCH
+	bool "Jaguar2 switch driver"
+	depends on DM_ETH && ARCH_MSCC
+	select PHYLIB
+	help
+	  This driver supports the Jaguar2 network switch device.
drivers/net/mscc_eswitch/Makefile +1 -0
index 751a839..0a1b863 100644
@@ -1,3 +1,4 @@
 
 obj-$(CONFIG_MSCC_OCELOT_SWITCH) += ocelot_switch.o mscc_miim.o mscc_xfer.o mscc_mac_table.o
 obj-$(CONFIG_MSCC_LUTON_SWITCH) += luton_switch.o mscc_miim.o mscc_xfer.o mscc_mac_table.o
+obj-$(CONFIG_MSCC_JR2_SWITCH) += jr2_switch.o mscc_xfer.o
drivers/net/mscc_eswitch/jr2_switch.c new file +1075 -0

1,075 lines not on this page · raw message

include/configs/vcoreiii.h +1 -1
index 2840c7b..aeef58d 100644
@@ -10,7 +10,7 @@
 
 /* Onboard devices */
 
-#define CONFIG_SYS_MALLOC_LEN		0x100000
+#define CONFIG_SYS_MALLOC_LEN		0x1F0000
 #define CONFIG_SYS_LOAD_ADDR		0x00100000
 #define CONFIG_SYS_INIT_SP_OFFSET       0x400000
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH v4 2/4 board: mscc: jr2: Update MSCC Jaguar2 boards

In reply to Horatiu Vultur

In Jaguar2 SoC family there are 3 different pcb. Each of this needs to configure the phys in different ways. Therefore implement the function board_phy_config and based on pcb configure them accordingly.

---
 board/mscc/jr2/jr2.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
board/mscc/jr2/jr2.c +23 -0
index 58a4a04..6e5ef4c 100644
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <led.h>
+#include <miiphy.h>
 
 enum {
 	BOARD_TYPE_PCB110 = 0xAABBCE00,
@@ -64,6 +65,28 @@ static void vcoreiii_gpio_set_alternate(int gpio, int mode)
 	}
 }
 
+int board_phy_config(struct phy_device *phydev)
+{
+	if (gd->board_type == BOARD_TYPE_PCB110 ||
+	    gd->board_type == BOARD_TYPE_PCB112) {
+		phy_write(phydev, 0, 31, 0x10);
+		phy_write(phydev, 0, 18, 0x80F0);
+		while (phy_read(phydev, 0, 18) & 0x8000)
+			;
+		phy_write(phydev, 0, 31, 0);
+	}
+	if (gd->board_type == BOARD_TYPE_PCB111) {
+		phy_write(phydev, 0, 31, 0x10);
+		phy_write(phydev, 0, 18, 0x80A0);
+		while (phy_read(phydev, 0, 18) & 0x8000)
+			;
+		phy_write(phydev, 0, 14, 0x800);
+		phy_write(phydev, 0, 31, 0);
+	}
+
+	return 0;
+}
+
 void board_debug_uart_init(void)
 {
 	/* too early for the pinctrl driver, so configure the UART pins here */
Signature · 1 line
2.7.4
#3 lore raw

PATCH v4 3/4 net: mscc: jaguar2: Add ethenet nodes for Jaguar2.

In reply to Horatiu Vultur

Add ethernet nodes for Jaguar2 SoCs family. There are 3 pcb in this
family: pcb110, pcb111 and pcb112.

---
 arch/mips/dts/jr2_pcb110.dts        |  76 +++++++
 arch/mips/dts/jr2_pcb111.dts        | 400 ++++++++++++++++++++++++++++++++++++
 arch/mips/dts/mscc,jr2.dtsi         | 116 +++++++++++
 arch/mips/dts/serval2_pcb112.dts    |  44 ++++
 include/dt-bindings/mscc/jr2_data.h |  19 ++
 5 files changed, 655 insertions(+)
 create mode 100644 include/dt-bindings/mscc/jr2_data.h
arch/mips/dts/jr2_pcb110.dts +76 -0
index ddc30ff..4a5a584 100644
@@ -5,6 +5,7 @@
 
 /dts-v1/;
 #include "mscc,jr2.dtsi"
+#include <dt-bindings/mscc/jr2_data.h>
 
 / {
 	model = "Jaguar2 Cu8-Sfp16 PCB110 Reference Board";
@@ -72,3 +73,78 @@
 	sgpio-ports = <0x3f00ffff>;
 	gpio-ranges = <&sgpio2 0 0 96>;
 };
+
+&mdio1 {
+	status = "okay";
+
+	phy0: ethernet-phy at 0 {
+		reg = <0>;
+	};
+	phy1: ethernet-phy at 1 {
+		reg = <1>;
+	};
+	phy2: ethernet-phy at 2 {
+		reg = <2>;
+	};
+	phy3: ethernet-phy at 3 {
+		reg = <3>;
+	};
+	phy4: ethernet-phy at 4 {
+		reg = <4>;
+	};
+	phy5: ethernet-phy at 5 {
+		reg = <5>;
+	};
+	phy6: ethernet-phy at 6 {
+		reg = <6>;
+	};
+	phy7: ethernet-phy at 7 {
+		reg = <7>;
+	};
+};
+
+&switch {
+	ethernet-ports {
+
+		port0: port at 0 {
+			reg = <0>;
+			phy-handle = <&phy0>;
+			phys = <&serdes_hsio 0 SERDES1G(1) PHY_MODE_SGMII>;
+		};
+		port1: port at 1 {
+			reg = <1>;
+			phy-handle = <&phy1>;
+			phys = <&serdes_hsio 1 SERDES1G(2) PHY_MODE_SGMII>;
+		};
+		port2: port at 2 {
+			reg = <2>;
+			phy-handle = <&phy2>;
+			phys = <&serdes_hsio 2 SERDES1G(3) PHY_MODE_SGMII>;
+		};
+		port3: port at 3 {
+			reg = <3>;
+			phy-handle = <&phy3>;
+			phys = <&serdes_hsio 3 SERDES1G(4) PHY_MODE_SGMII>;
+		};
+		port4: port at 4 {
+			reg = <4>;
+			phy-handle = <&phy4>;
+			phys = <&serdes_hsio 4 SERDES1G(5) PHY_MODE_SGMII>;
+		};
+		port5: port at 5 {
+			reg = <5>;
+			phy-handle = <&phy5>;
+			phys = <&serdes_hsio 5 SERDES1G(6) PHY_MODE_SGMII>;
+		};
+		port6: port at 6 {
+			reg = <6>;
+			phy-handle = <&phy6>;
+			phys = <&serdes_hsio 6 SERDES1G(7) PHY_MODE_SGMII>;
+		};
+		port7: port at 7 {
+			reg = <7>;
+			phy-handle = <&phy7>;
+			phys = <&serdes_hsio 7 SERDES1G(8) PHY_MODE_SGMII>;
+		};
+	};
+};
arch/mips/dts/jr2_pcb111.dts +400 -0

409 lines not on this page · raw message

arch/mips/dts/mscc,jr2.dtsi +116 -0

121 lines not on this page · raw message

arch/mips/dts/serval2_pcb112.dts +44 -0

53 lines not on this page · raw message

include/dt-bindings/mscc/jr2_data.h new file +19 -0
new file mode 100644
index 0000000..2f06fc5
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
+/*
+ * Copyright (c) 2018 Microsemi Corporation
+ */
+
+#ifndef _JR2_DATA_H_
+#define _JR2_DATA_H_
+
+#define SERDES1G(x)     (x)
+#define SERDES1G_MAX    SERDES1G(10)
+#define SERDES6G(x)     (SERDES1G_MAX + 1 + (x))
+#define SERDES6G_MAX    SERDES6G(17)
+#define SERDES_MAX      (SERDES6G_MAX + 1)
+
+/* similar with phy_interface_t */
+#define PHY_MODE_SGMII  2
+#define PHY_MODE_QSGMII 4
+
+#endif
Signature · 1 line
2.7.4
#4 lore raw

PATCH v4 4/4 configs: mscc_jr2: Add network support

In reply to Horatiu Vultur

Update default confing to use network driver for Jaguar2 SoCs.

---
 configs/mscc_jr2_defconfig | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configs/mscc_jr2_defconfig +5 -1
index 95562b7..92c22b8 100644
@@ -28,7 +28,10 @@ CONFIG_CMD_MEMTEST=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
-# CONFIG_CMD_NET is not set
+CONFIG_CMD_DHCP=y
+# CONFIG_NET_TFTP_VARS is not set
+# CONFIG_CMD_NFS is not set
+CONFIG_CMD_PING=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nor0=spi_flash"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=spi_flash:1m(UBoot),256k(Env),256k(Env.bk)"
@@ -66,3 +69,4 @@ CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_LZMA=y
+CONFIG_MSCC_JR2_SWITCH=y
Signature · 1 line
2.7.4
#5 lore raw

v4 cover Add network support for Jaguar2 SoCs

In reply to Horatiu Vultur

Am 03.04.19 um 19:54 schrieb Horatiu Vultur:

Quoted 17 lines

v4-changes:
- address Daniel comments.

v3-changes:
- move serdes setup in network driver and read serdes configuration from DT.

v2-changes:
- create serdes6g_setup and serdes1g_setup functions to be easier to extand for future boards.

Horatiu Vultur (4):
net: Add MSCC Jaguar2 network driver.
board: mscc: jr2: Update MSCC Jaguar2 boards
net: mscc: jaguar2: Add ethenet nodes for Jaguar2.
configs: mscc_jr2: Add network support

Quoted 15 lines
 arch/mips/dts/jr2_pcb110.dts          |   76 +++
 arch/mips/dts/jr2_pcb111.dts          |  400 ++++++++++++
 arch/mips/dts/mscc,jr2.dtsi           |  116 ++++
 arch/mips/dts/serval2_pcb112.dts      |   44 ++
 board/mscc/jr2/jr2.c                  |   23 +
 configs/mscc_jr2_defconfig            |    6 +-
 drivers/net/mscc_eswitch/Kconfig      |    7 +
 drivers/net/mscc_eswitch/Makefile     |    1 +
 drivers/net/mscc_eswitch/jr2_switch.c | 1075 +++++++++++++++++++++++++++++++++
 include/configs/vcoreiii.h            |    2 +-
 include/dt-bindings/mscc/jr2_data.h   |   19 +
 11 files changed, 1767 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/mscc_eswitch/jr2_switch.c
 create mode 100644 include/dt-bindings/mscc/jr2_data.h

series applied to u-boot-mips/next, thanks.

Signature · 1 line
- Daniel