Add network support for Ocelots SoCs
Subsystems (2)
v3 cover Add network support for Ocelots SoCs
Hello,
this the third version of a series allowing to use the switch component of the Ocelots SoC as a network interface.
The binding used is exactly the same of the one already used by Linux.
There is also a patch adding a workaround needed on the Ocelot based
boards: indeed the pin connected to the DDR reset is part of the switch subsystem. So we need ensure that the DDR is not reset during the switch reset.
Gregory
Changelog:
v2 -> v3:
- Use wait_for_bit_le32() whenever it is possible instead of timer_get_us() (Suggested by Daniel Schwierzeck)
- Remove ocelot_ofdata_to_platdata() and get the resources directly from the probe function (Suggested by Daniel Schwierzeck)
- Use dev_remap_addr_name() to simplify the address mapping (Suggested by Daniel Schwierzeck)
- Simplify the mdio initialization by only manage the internal PHY for now
v1 -> v2:
- Use wait_for_bit_le32() (suggested by Stefan Roese)
- Use debug() instead of printf() for the debug messages in mscc_switch_reset.
Gregory CLEMENT (4):
MIPS: mscc: ocelot: Add ethernet nodes for Ocelot
net: add MSCC Ocelot switch support
MIPS: mscc: ocelot: add switch reset support
configs: mscc_ocelot: add network support
MAINTAINERS | 1 + arch/mips/dts/mscc,ocelot.dtsi | 97 ++++ arch/mips/dts/ocelot_pcb123.dts | 20 + board/mscc/ocelot/ocelot.c | 24 + configs/mscc_ocelot_defconfig | 1 + drivers/net/Kconfig | 7 + drivers/net/Makefile | 1 + drivers/net/ocelot_switch.c | 765 ++++++++++++++++++++++++++++++++ 8 files changed, 916 insertions(+) create mode 100644 drivers/net/ocelot_switch.c
Signature · 1 line
2.20.1
PATCH v3 1/4 MIPS: mscc: ocelot: Add ethernet nodes for Ocelot
Import Ethernet related nodes from Linux
--- arch/mips/dts/mscc,ocelot.dtsi | 97 +++++++++++++++++++++++++++++++++ arch/mips/dts/ocelot_pcb123.dts | 20 +++++++ 2 files changed, 117 insertions(+)
arch/mips/dts/mscc,ocelot.dtsi +97 -0
@@ -112,6 +112,98 @@ status = "disabled"; }; + switch at 1010000 { + pinctrl-0 = <&miim1_pins>; + pinctrl-names = "default"; + + compatible = "mscc,vsc7514-switch"; + reg = <0x1010000 0x10000>, /* VTSS_TO_SYS */ + <0x1030000 0x10000>, /* VTSS_TO_REW */ + <0x1080000 0x100>, /* VTSS_TO_DEVCPU_QS */ + <0x10d0000 0x10000>, /* VTSS_TO_HSIO */ + <0x11e0000 0x100>, /* VTSS_TO_DEV_0 */ + <0x11f0000 0x100>, /* VTSS_TO_DEV_1 */ + <0x1200000 0x100>, /* VTSS_TO_DEV_2 */ + <0x1210000 0x100>, /* VTSS_TO_DEV_3 */ + <0x1220000 0x100>, /* VTSS_TO_DEV_4 */ + <0x1230000 0x100>, /* VTSS_TO_DEV_5 */ + <0x1240000 0x100>, /* VTSS_TO_DEV_6 */ + <0x1250000 0x100>, /* VTSS_TO_DEV_7 */ + <0x1260000 0x100>, /* VTSS_TO_DEV_8 */ + <0x1270000 0x100>, /* NA */ + <0x1280000 0x100>, /* NA */ + <0x1800000 0x80000>, /* VTSS_TO_QSYS */ + <0x1880000 0x10000>; /* VTSS_TO_ANA */ + reg-names = "sys", "rew", "qs", "hsio", "port0", + "port1", "port2", "port3", "port4", "port5", + "port6", "port7", "port8", "port9", + "port10", "qsys", "ana"; + interrupts = <21 22>; + interrupt-names = "xtr", "inj"; + status = "okay"; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port0: port at 0 { + reg = <0>; + }; + port1: port at 1 { + reg = <1>; + }; + port2: port at 2 { + reg = <2>; + }; + port3: port at 3 { + reg = <3>; + }; + port4: port at 4 { + reg = <4>; + }; + port5: port at 5 { + reg = <5>; + }; + port6: port at 6 { + reg = <6>; + }; + port7: port at 7 { + reg = <7>; + }; + port8: port at 8 { + reg = <8>; + }; + port9: port at 9 { + reg = <9>; + }; + port10: port at 10 { + reg = <10>; + }; + }; + }; + + mdio0: mdio at 107009c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "mscc,ocelot-miim"; + reg = <0x107009c 0x24>, <0x10700f0 0x8>; + interrupts = <14>; + status = "disabled"; + + 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>; + }; + }; + reset at 1070008 { compatible = "mscc,ocelot-chip-reset"; reg = <0x1070008 0x4>;
@@ -144,6 +236,11 @@ function = "si"; }; + miim1_pins: miim1-pins { + pins = "GPIO_14", "GPIO_15"; + function = "miim1"; + }; + spi_cs2_pin: spi-cs2-pin { pins = "GPIO_9"; function = "si";
arch/mips/dts/ocelot_pcb123.dts +20 -0
@@ -35,3 +35,23 @@ status = "okay"; mscc,sgpio-ports = <0x00FFFFFF>; }; + +&mdio0 { + status = "okay"; +}; + +&port0 { + phy-handle = <&phy0>; +}; + +&port1 { + phy-handle = <&phy1>; +}; + +&port2 { + phy-handle = <&phy2>; +}; + +&port3 { + phy-handle = <&phy3>; +};
Signature · 1 line
2.20.1
PATCH v3 2/4 net: add MSCC Ocelot switch support
In reply to Gregory CLEMENTThis patch adds support for the Microsemi Ethernet switch present on Ocelot SoCs.
--- MAINTAINERS | 1 + drivers/net/Kconfig | 7 + drivers/net/Makefile | 1 + drivers/net/ocelot_switch.c | 765 ++++++++++++++++++++++++++++++++++++ 4 files changed, 774 insertions(+) create mode 100644 drivers/net/ocelot_switch.c
MAINTAINERS +1 -0
@@ -529,6 +529,7 @@ F: drivers/gpio/mscc_sgpio.c F: drivers/spi/mscc_bb_spi.c F: include/configs/vcoreiii.h F: drivers/pinctrl/mscc/ +F: drivers/net/ocelot_switch.c MIPS JZ4780 M: Ezequiel Garcia <[email protected]>
drivers/net/Kconfig +7 -0
@@ -432,6 +432,13 @@ config SNI_AVE This driver implements support for the Socionext AVE Ethernet controller, as found on the Socionext UniPhier family. +config MSCC_OCELOT_SWITCH + bool "Ocelot switch driver" + depends on DM_ETH && ARCH_MSCC + select PHYLIB + help + This driver supports the Ocelot network switch device. + config ETHER_ON_FEC1 bool "FEC1" depends on MPC8XX_FEC
drivers/net/Makefile +1 -0
@@ -74,3 +74,4 @@ obj-$(CONFIG_DWC_ETH_QOS) += dwc_eth_qos.o obj-$(CONFIG_FSL_PFE) += pfe_eth/ obj-$(CONFIG_SNI_AVE) += sni_ave.o obj-y += ti/ +obj-$(CONFIG_MSCC_OCELOT_SWITCH) += ocelot_switch.o
drivers/net/ocelot_switch.c new file +765 -0
765 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v3 2/4 net: add MSCC Ocelot switch support
Am 17.01.19 um 17:07 schrieb Gregory CLEMENT:
Quoted 12 lines
This patch adds support for the Microsemi Ethernet switch present on Ocelot SoCs.
Signed-off-by Gregory CLEMENT <[email protected]>--- MAINTAINERS | 1 + drivers/net/Kconfig | 7 + drivers/net/Makefile | 1 + drivers/net/ocelot_switch.c | 765 ++++++++++++++++++++++++++++++++++++ 4 files changed, 774 insertions(+) create mode 100644 drivers/net/ocelot_switch.c
Signature · 1 line
- Daniel
PATCH v3 3/4 MIPS: mscc: ocelot: add switch reset support
In reply to Gregory CLEMENTOn some ocelots platform a workaround is needed in order to be able to reset the switch without resetting the DDR.
--- board/mscc/ocelot/ocelot.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
board/mscc/ocelot/ocelot.c +24 -0
@@ -10,6 +10,7 @@#include <environment.h> #include <spi.h> #include <led.h> +#include <wait_bit.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -18,6 +19,29 @@ enum { BOARD_TYPE_PCB123, }; +void mscc_switch_reset (bool enter) +{ +/* Nasty workaround to avoid GPIO19 (DDR!) being reset */ +mscc_gpio_set_alternate (19 ,2 ); + +debug ("applying SwC reset\n" ); + +writel (ICPU_RESET_CORE_RST_PROTECT ,BASE_CFG +ICPU_RESET ); +writel (PERF_SOFT_RST_SOFT_CHIP_RST ,BASE_DEVCPU_GCB +PERF_SOFT_RST ); + +if (wait_for_bit_le32 (BASE_DEVCPU_GCB +PERF_SOFT_RST , +PERF_SOFT_RST_SOFT_CHIP_RST , false,5000 , false)) +pr_err ("Tiemout while waiting for switch reset\n" ); + +/* +* Reset GPIO19 mode back as regular GPIO, output, high (DDR +* not reset) (Order is important) +*/ +setbits_le32 (BASE_DEVCPU_GCB +PERF_GPIO_OE ,BIT (19 )); +writel (BIT (19 ),BASE_DEVCPU_GCB +PERF_GPIO_OUT_SET ); +mscc_gpio_set_alternate (19 ,0 ); +} +void board_debug_uart_init (void ) {/* too early for the pinctrl driver, so configure the UART pins here */
Signature · 1 line
2.20.1
PATCH v3 4/4 configs: mscc_ocelot: add network support
In reply to Gregory CLEMENTNow that network support is added for the ocelot platform, let's add it in the default configuration.
--- configs/mscc_ocelot_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/mscc_ocelot_defconfig +1 -0
@@ -60,6 +60,7 @@ CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_SPI_FLASH_MTD=y CONFIG_DM_ETH=y +CONFIG_MSCC_OCELOT_SWITCH=y CONFIG_PINCTRL=y CONFIG_PINCONF=y CONFIG_DM_SERIAL=y
Signature · 1 line
2.20.1
v3 cover Add network support for Ocelots SoCs
In reply to Gregory CLEMENTAm 17.01.19 um 17:07 schrieb Gregory CLEMENT:
Quoted 37 lines
Hello,
this the third version of a series allowing to use the switch component of the Ocelots SoC as a network interface.
The binding used is exactly the same of the one already used by Linux.
There is also a patch adding a workaround needed on the Ocelot based
boards: indeed the pin connected to the DDR reset is part of the switch subsystem. So we need ensure that the DDR is not reset during the switch reset.Gregory
Changelog:
v2 -> v3:- Use
wait_for_bit_le32()whenever it is possible instead oftimer_get_us()(Suggested by Daniel Schwierzeck)
- Removeocelot_ofdata_to_platdata()and get the resources directly from the probe function (Suggested by Daniel Schwierzeck)
- Usedev_remap_addr_name()to simplify the address mapping (Suggested by Daniel Schwierzeck)
- Simplify the mdio initialization by only manage the internal PHY for nowv1 -> v2:
- Usewait_for_bit_le32()(suggested by Stefan Roese)
- Usedebug()instead ofprintf()for the debug messages inmscc_switch_reset.Gregory CLEMENT (4):
MIPS: mscc: ocelot: Add ethernet nodes for Ocelot
net: add MSCC Ocelot switch support
MIPS: mscc: ocelot: add switch reset support
configs:mscc_ocelot: add network support
Quoted 11 lines
MAINTAINERS | 1 + arch/mips/dts/mscc,ocelot.dtsi | 97 ++++ arch/mips/dts/ocelot_pcb123.dts | 20 + board/mscc/ocelot/ocelot.c | 24 + configs/mscc_ocelot_defconfig | 1 + drivers/net/Kconfig | 7 + drivers/net/Makefile | 1 + drivers/net/ocelot_switch.c | 765 ++++++++++++++++++++++++++++++++ 8 files changed, 916 insertions(+) create mode 100644 drivers/net/ocelot_switch.c
series applied to u-boot-mips, thanks.
Signature · 1 line
- Daniel