Introduce DSA Ethernet switch class and Felix driver
Subsystems (4)
cover Introduce DSA Ethernet switch class and Felix driver
DSA stands for Distributed Switch Architecture and it is a subsystem introduced in the Linux kernel to support switches that:
- have an Ethernet link up to the CPU
- use some form of tagging to identify the source/destination port for Rx/Tx
- may be cascaded in tree-like structures.
DSA is described in depth here:
https://www.kernel.org/doc/Documentation/networking/dsa/dsa.txt
This patch set introduces a DSA class in U-Boot to support drivers of DSA switches. DSA drivers have to implement the following ops:
- enable/disable of switch ports,
- insert a tag in frames being transmitted, used by the switch to select the egress port,
- parse a tag in frames being received, used for Rx traffic.
DSA class code deals with presentation of switch ports as Ethernet interfaces, deals with the master Ethernet device for I/O and helps with parsing of the DT assuming the structure follows the DSA kernel binding.
Support for switch cascading is not included yet.
In the sandbox environment, the DSA sandbox driver, the switch ports and master eth interface look like this:
=> dm tree
Class Index Probed Driver Name
-----------------------------------------------------------
[...]
eth 4 [ + ] eth_sandbox |-- dsa-test-eth dsa 0 [ + ] dsa_sandbox |-- dsa-test eth 5 [ + ] dsa-port | |-- lan0 eth 6 [ + ] dsa-port | `-- lan1
=> setenv ethact lan1
=> ping 1.2.3.5
Using lan1 device
host 1.2.3.5 is alive
=>
This patch set also introduces a driver for the Ethernet switch integrated into NXP LS1028A, called Felix. The switch has 4 front panel ports, I/O to/from it is done though an ENETC Ethernet interface and meta-data is carried between the switch and the driver though an additional header pre-pended to the original frame.
Network commands like tftp can be used on these front panel ports. The ports are disabled unless used so they do not cause issues on network topologies that include loops.
Felix as seen on LS1028A RDB:
=> dm tree
Class Index Probed Driver Name
-----------------------------------------------------------
[...]
dsa 0 [ + ] felix-switch | |-- felix-switch eth 4 [ + ] dsa-port | | |-- swp0 eth 5 [ + ] dsa-port | | |-- swp1 eth 6 [ + ] dsa-port | | |-- swp2 eth 7 [ + ] dsa-port | | `-- swp3
=> mdio list
[...]
10 - Vitesse VSC8514 <--> swp0
11 - Vitesse VSC8514 <--> swp1
12 - Vitesse VSC8514 <--> swp2
13 - Vitesse VSC8514 <--> swp3
NOTE:
This patchset is a major rework of the dsa-class code since the last
submission from May 5th:
https://patchwork.ozlabs.org/project/uboot/cover/1588700588-8587-1-git-send-email-claudiu.manoil at nxp.com/ The basic concepts and data path operation (tagging) in the DSA class
code remain the same as in the initial patchset from Alex, however the
external API has been changed significantly (simplified), the driver
model integration has been improved to the point that the DSA class
code no longer needs to allocate extra memory internally (via malloc),
reduced memory footprint, internal state data moved from the external
API and internalized, cleaner external API, internal code reworked,
completly reworked DSA sandbox driver and unit tests for better coverage
and to integrate better with the eth sandbox driver and tests, etc.
The DSA class code is now ported on top of the latest u-boot master
branch (obviously), and I tested it thoroughly with the sandbox driver
and unit tests. The felix driver has been tested with an older uboot,
since there are some issues booting the latest upstream uboot on a
LS1028A RDB board. Note that the felix driver itself didn't change
since the last submission, except for the DSA API function calls.
Alex Marginean (3):
drivers: net: Add Felix DSA switch driver
arm: dts: ls1028a: Add Ethernet switch node and dependencies
configs: ls1028a: Enable the Ethernet switch driver in defconfig
Claudiu Manoil (2):
net: Introduce DSA class for Ethernet switches
sandbox: Add a DSA sandbox driver and unit test
arch/Kconfig | 1 + arch/arm/dts/fsl-ls1028a-rdb.dts | 36 ++ arch/arm/dts/fsl-ls1028a.dtsi | 55 +- arch/sandbox/dts/test.dts | 40 ++ configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 2 + configs/ls1028aqds_tfa_defconfig | 2 + configs/ls1028ardb_tfa_SECURE_BOOT_defconfig | 2 + configs/ls1028ardb_tfa_defconfig | 2 + drivers/net/Kconfig | 23 + drivers/net/Makefile | 1 + drivers/net/dsa_sandbox.c | 181 +++++++ drivers/net/fsl_enetc.h | 5 + drivers/net/mscc_eswitch/Kconfig | 8 + drivers/net/mscc_eswitch/Makefile | 1 + drivers/net/mscc_eswitch/felix_switch.c | 432 ++++++++++++++++ include/configs/sandbox.h | 2 + include/dm/uclass-id.h | 1 + include/net.h | 6 + include/net/dsa.h | 206 ++++++++ net/Makefile | 1 + net/dsa-uclass.c | 517 +++++++++++++++++++ test/dm/Makefile | 1 + test/dm/dsa.c | 91 ++++ test/dm/eth.c | 10 +- 24 files changed, 1620 insertions(+), 6 deletions(-) create mode 100644 drivers/net/dsa_sandbox.c create mode 100644 drivers/net/mscc_eswitch/felix_switch.c create mode 100644 include/net/dsa.h create mode 100644 net/dsa-uclass.c create mode 100644 test/dm/dsa.c
Signature · 1 line
2.17.1
PATCH 1/5 net: Introduce DSA class for Ethernet switches
DSA stands for Distributed Switch Architecture and it covers switches that are connected to the CPU through an Ethernet link and generally use frame tags to pass information about the source/destination ports to/from CPU. Front panel ports are presented as regular ethernet devices in U-Boot and they are expected to support the typical networking commands. DSA switches may be cascaded, DSA class code does not currently support this.
--- drivers/net/Kconfig | 14 ++ include/dm/uclass-id.h | 1 + include/net.h | 6 + include/net/dsa.h | 206 ++++++++++++++++ net/Makefile | 1 + net/dsa-uclass.c | 517 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 745 insertions(+) create mode 100644 include/net/dsa.h create mode 100644 net/dsa-uclass.c
drivers/net/Kconfig +14 -0
@@ -37,6 +37,20 @@ config DM_MDIO_MUX This is currently implemented in net/mdio-mux-uclass.c Look in include/miiphy.h for details. +config DM_DSA + bool "Enable Driver Model for DSA switches" + depends on DM_ETH && DM_MDIO + help + Enable driver model for DSA switches + + Adds UCLASS_DSA class supporting switches that follow the Distributed + Switch Architecture (DSA). These switches rely on the presence of a + management switch port connected to an Ethernet controller capable of + receiving frames from the switch. This host Ethernet controller is + called the "master" Ethernet interface in DSA terminology. + This is currently implemented in net/dsa-uclass.c, refer to + include/net/dsa.h for API details. + config MDIO_SANDBOX depends on DM_MDIO && SANDBOX default y
include/dm/uclass-id.h +1 -0
@@ -46,6 +46,7 @@ enum uclass_id {UCLASS_DISPLAY ,/* Display (e.g. DisplayPort, HDMI) */ UCLASS_DSI_HOST ,/* Display Serial Interface host */ UCLASS_DMA ,/* Direct Memory Access */ +UCLASS_DSA ,/* Distributed (Ethernet) Switch Architecture */ UCLASS_EFI ,/* EFI managed devices */ UCLASS_ETH ,/* Ethernet device */ UCLASS_ETH_PHY, /* Ethernet PHY device */
include/net.h +6 -0
@@ -499,7 +499,13 @@ struct icmp_hdr {* maximum packet size and multiple of 32 bytes = 1536 */ #define PKTSIZE 1522 +#ifndef CONFIG_DM_DSA #define PKTSIZE_ALIGN 1536 +#else +/* Maximum DSA tagging overhead (headroom and/or tailroom) */ +#define DSA_MAX_OVR 256 +#define PKTSIZE_ALIGN (1536 + DSA_MAX_OVR) +#endif /* * Maximum receive ring size; that is, the number of packets
include/net/dsa.h new file +206 -0
206 lines not on this page · raw message
net/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_NET) += arp.o obj-$(CONFIG_CMD_BOOTP) += bootp.o obj-$(CONFIG_CMD_CDP) += cdp.o obj-$(CONFIG_CMD_DNS) += dns.o +obj-$(CONFIG_DM_DSA) += dsa-uclass.o ifdef CONFIG_DM_ETH obj-$(CONFIG_NET) += eth-uclass.o else
net/dsa-uclass.c new file +517 -0
517 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 1/5 net: Introduce DSA class for Ethernet switches
Hi Claudiu,
Quoted 11 lines · Claudiu Manoil
DSA stands for Distributed Switch Architecture and it covers switches that are connected to the CPU through an Ethernet link and generally use frame tags to pass information about the source/destination ports to/from CPU. Front panel ports are presented as regular ethernet devices in U-Boot and they are expected to support the typical networking commands. DSA switches may be cascaded, DSA class code does not currently support this.
Signed-off-by Alex Marginean <[email protected]>Signed-off-by Claudiu Manoil <[email protected]>
Quoted 10 lines
--- drivers/net/Kconfig | 14 ++ include/dm/uclass-id.h | 1 + include/net.h | 6 + include/net/dsa.h | 206 ++++++++++++++++ net/Makefile | 1 + net/dsa-uclass.c | 517 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 745 insertions(+) create mode 100644 include/net/dsa.h create mode 100644 net/dsa-uclass.c
I don't think it is necessary to have the 'if (!pdev)' checks around the place. We need a way in U-Boot to have checks like that to catch programming errors but to be able to turn them off in production code to reduce size.
I suppose a Kconfig would do it, with:
if (CONFIG_IS_ENABLED(SAFETY) && !pdev)
return log_,msg_ref("safety", -ENODEV)
Also note that -ENODEV is used by drive rmodel so it generally isn't safe to return it as a logic error. I think in this case because it never happens, it should be OK.
Regards,
Simon
PATCH 1/5 net: Introduce DSA class for Ethernet switches
Quoted 10 lines
-----Original Message-----
From: Simon Glass <[email protected]>
Sent: Thursday, January 14, 2021 5:42 PM
To: Claudiu Manoil <[email protected]>
Cc: Joe Hershberger <[email protected]>; Bin Meng <[email protected]>; Michael Walle <[email protected]>; U-Boot Mailing List <[email protected]>; Vladimir Oltean <[email protected]>; Alexandru Marginean <[email protected]>
Subject: Re: [PATCH 1/5] net: Introduce DSA class for Ethernet switches
[...]
Quoted 8 lines
Reviewed-by Simon Glass <[email protected]>I don't think it is necessary to have the 'if (!pdev)' checks around the place. We need a way in U-Boot to have checks like that to catch programming errors but to be able to turn them off in production code to reduce size.
Quoted 9 lines
I suppose a
Kconfigwould do it, with:if (
CONFIG_IS_ENABLED(SAFETY)&& !pdev)
return log_,msg_ref("safety",-ENODEV)Also note that
-ENODEVis used by drive rmodel so it generally isn't safe to return it as a logic error. I think in this case because it never happens, it should be OK.
Thanks for the review, Simon.
I thought about using assert(pdev) checks, but during development the simple "if (!pdev)..." proved more friendly. I like your idea about enabling the checks at compile time and disabling them in production.
For now, since this SAFETY flag is not implemented, my understanding is that you?re ok with leaving the pdev checks in the code as they are right now and sometime in the future these will be converted to the "SAFETY" construct you mention.
PATCH 1/5 net: Introduce DSA class for Ethernet switches
Hi Claudiu,
Quoted 30 lines · Claudiu Manoil
Quoted 11 lines
-----Original Message-----
From: Simon Glass <[email protected]>
Sent: Thursday, January 14, 2021 5:42 PM
To: Claudiu Manoil <[email protected]>
Cc: Joe Hershberger <[email protected]>; Bin Meng <[email protected]>; Michael Walle <[email protected]>; U-Boot Mailing List <[email protected]>; Vladimir Oltean <[email protected]>; Alexandru Marginean <[email protected]>
Subject: Re: [PATCH 1/5] net: Introduce DSA class for Ethernet switches[...]
Quoted 8 lines
Reviewed-by Simon Glass <[email protected]>I don't think it is necessary to have the 'if (!pdev)' checks around the place. We need a way in U-Boot to have checks like that to catch programming errors but to be able to turn them off in production code to reduce size.
Quoted 9 lines
I suppose a
Kconfigwould do it, with:if (
CONFIG_IS_ENABLED(SAFETY)&& !pdev)
return log_,msg_ref("safety",-ENODEV)Also note that
-ENODEVis used by drive rmodel so it generally isn't safe to return it as a logic error. I think in this case because it never happens, it should be OK.
Quoted 9 lines
Thanks for the review, Simon.
I thought about using assert(pdev) checks, but during development the simple "if (!pdev)..." proved more friendly. I like your idea about enabling the checks at compile time and disabling them in production.
For now, since this SAFETY flag is not implemented, my understanding is that you?re ok with leaving the pdev checks in the code as they are right now and sometime in the future these will be converted to the "SAFETY" construct you mention.
Yes that's fine, you have my review tag.
+Tom Rini what do you think about CONFIG_SAFETY or similar to allow these bug checks to be disabled for code-size reasons?
Regards,
Simon
PATCH 1/5 net: Introduce DSA class for Ethernet switches
Quoted 43 lines · Simon Glass
Hi Claudiu,
Quoted 30 lines · Claudiu Manoil
Quoted 11 lines
-----Original Message-----
From: Simon Glass <[email protected]>
Sent: Thursday, January 14, 2021 5:42 PM
To: Claudiu Manoil <[email protected]>
Cc: Joe Hershberger <[email protected]>; Bin Meng <[email protected]>; Michael Walle <[email protected]>; U-Boot Mailing List <[email protected]>; Vladimir Oltean <[email protected]>; Alexandru Marginean <[email protected]>
Subject: Re: [PATCH 1/5] net: Introduce DSA class for Ethernet switches[...]
Quoted 8 lines
Reviewed-by Simon Glass <[email protected]>I don't think it is necessary to have the 'if (!pdev)' checks around the place. We need a way in U-Boot to have checks like that to catch programming errors but to be able to turn them off in production code to reduce size.
Quoted 9 lines
I suppose a
Kconfigwould do it, with:if (
CONFIG_IS_ENABLED(SAFETY)&& !pdev)
return log_,msg_ref("safety",-ENODEV)Also note that
-ENODEVis used by drive rmodel so it generally isn't safe to return it as a logic error. I think in this case because it never happens, it should be OK.Quoted 9 lines
Thanks for the review, Simon.
I thought about using assert(pdev) checks, but during development the simple "if (!pdev)..." proved more friendly. I like your idea about enabling the checks at compile time and disabling them in production.
For now, since this SAFETY flag is not implemented, my understanding is that you?re ok with leaving the pdev checks in the code as they are right now and sometime in the future these will be converted to the "SAFETY" construct you mention.
Quoted 4 lines
Yes that's fine, you have my review tag.
+Tom Rini what do you think about
CONFIG_SAFETYor similar to allow these bug checks to be disabled for code-size reasons?
I don't know. Setting aside the name, my first concern is "so we disable certain forms of sanity checks, now assuming a malicious entity somewhere, what's now able to be exploited?"
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210119/cda6599c/attachment.sig>
PATCH 1/5 net: Introduce DSA class for Ethernet switches
Hi Tom,
Quoted 45 lines · Tom Rini
Quoted 43 lines · Simon Glass
Hi Claudiu,
Quoted 39 lines · Claudiu Manoil
Quoted 11 lines
-----Original Message-----
From: Simon Glass <[email protected]>
Sent: Thursday, January 14, 2021 5:42 PM
To: Claudiu Manoil <[email protected]>
Cc: Joe Hershberger <[email protected]>; Bin Meng <[email protected]>; Michael Walle <[email protected]>; U-Boot Mailing List <[email protected]>; Vladimir Oltean <[email protected]>; Alexandru Marginean <[email protected]>
Subject: Re: [PATCH 1/5] net: Introduce DSA class for Ethernet switches[...]
Quoted 8 lines
Reviewed-by Simon Glass <[email protected]>I don't think it is necessary to have the 'if (!pdev)' checks around the place. We need a way in U-Boot to have checks like that to catch programming errors but to be able to turn them off in production code to reduce size.
Quoted 9 lines
I suppose a
Kconfigwould do it, with:if (
CONFIG_IS_ENABLED(SAFETY)&& !pdev)
return log_,msg_ref("safety",-ENODEV)Also note that
-ENODEVis used by drive rmodel so it generally isn't safe to return it as a logic error. I think in this case because it never happens, it should be OK.Thanks for the review, Simon.
I thought about using assert(pdev) checks, but during development the simple "if (!pdev)..." proved more friendly. I like your idea about enabling the checks at compile time and disabling them in production.
For now, since this SAFETY flag is not implemented, my understanding is that you?re ok with leaving the pdev checks in the code as they are right now and sometime in the future these will be converted to the "SAFETY" construct you mention.
Quoted 8 lines
Quoted 4 lines
Yes that's fine, you have my review tag.
+Tom Rini what do you think about
CONFIG_SAFETYor similar to allow these bug checks to be disabled for code-size reasons?I don't know. Setting aside the name, my first concern is "so we disable certain forms of sanity checks, now assuming a malicious entity somewhere, what's now able to be exploited?"
Well if you are able to inject code then I suppose you can do anything. You don't need to worry about existing parameter checking.
The difference in my mind is whether there is user/input data involved. If so, then we need lots of checks. If it is just telling the clock to go a 2GHz, then the checks are probably just bloating the code. So rather than leave this to individual preference, I am wondering whether a Kconfig option might be best.
Regards,
Simon
PATCH 1/5 net: Introduce DSA class for Ethernet switches
Quoted 57 lines · Simon Glass
Hi Tom,
Quoted 45 lines · Tom Rini
Quoted 43 lines · Simon Glass
Hi Claudiu,
Quoted 39 lines · Claudiu Manoil
Quoted 11 lines
-----Original Message-----
From: Simon Glass <[email protected]>
Sent: Thursday, January 14, 2021 5:42 PM
To: Claudiu Manoil <[email protected]>
Cc: Joe Hershberger <[email protected]>; Bin Meng <[email protected]>; Michael Walle <[email protected]>; U-Boot Mailing List <[email protected]>; Vladimir Oltean <[email protected]>; Alexandru Marginean <[email protected]>
Subject: Re: [PATCH 1/5] net: Introduce DSA class for Ethernet switches[...]
Quoted 8 lines
Reviewed-by Simon Glass <[email protected]>I don't think it is necessary to have the 'if (!pdev)' checks around the place. We need a way in U-Boot to have checks like that to catch programming errors but to be able to turn them off in production code to reduce size.
Quoted 9 lines
I suppose a
Kconfigwould do it, with:if (
CONFIG_IS_ENABLED(SAFETY)&& !pdev)
return log_,msg_ref("safety",-ENODEV)Also note that
-ENODEVis used by drive rmodel so it generally isn't safe to return it as a logic error. I think in this case because it never happens, it should be OK.Thanks for the review, Simon.
I thought about using assert(pdev) checks, but during development the simple "if (!pdev)..." proved more friendly. I like your idea about enabling the checks at compile time and disabling them in production.
For now, since this SAFETY flag is not implemented, my understanding is that you?re ok with leaving the pdev checks in the code as they are right now and sometime in the future these will be converted to the "SAFETY" construct you mention.Quoted 8 lines
Quoted 4 lines
Yes that's fine, you have my review tag.
+Tom Rini what do you think about
CONFIG_SAFETYor similar to allow these bug checks to be disabled for code-size reasons?I don't know. Setting aside the name, my first concern is "so we disable certain forms of sanity checks, now assuming a malicious entity somewhere, what's now able to be exploited?"
Quoted 8 lines
Well if you are able to inject code then I suppose you can do anything. You don't need to worry about existing parameter checking.
The difference in my mind is whether there is user/input data involved. If so, then we need lots of checks. If it is just telling the clock to go a 2GHz, then the checks are probably just bloating the code. So rather than leave this to individual preference, I am wondering whether a
Kconfigoption might be best.
Thinking about this more, yes, if we can macro the check, then we can hide it (and potential other checks) under some SANITY_CHECKS option.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210125/269becb6/attachment.sig>
PATCH 2/5 sandbox: Add a DSA sandbox driver and unit test
In reply to Claudiu ManoilThe DSA sandbox driver is used for unit testing the DSA class code. It implements a simple 2 port switch plus 1 CPU port, and uses a very simple tag to identify the ports.
The DSA sandbox device is connected via CPU port to a regular Ethernet sandbox device, called 'dsa-test-eth, managed by the existing eth sandbox driver. The 'dsa-test-eth' is not intended for testing the eth class code however, but it is used to emulate traffic through the 'lan0' and 'lan1' front pannel switch ports. To achieve this the dsa sandbox driver registers a tx handler for the 'dsa-test-eth' device. The switch ports, labeled as 'lan0' and 'lan1', are also registered as eth devices by the dsa class code this time. So pinging through these switch ports is as easy as:
=> setenv ethact lan0
=> ping 1.2.3.5
Unit tests for the dsa class code were also added. The 'dsa_probe' test exercises most API functions from dsa.h. The 'dsa' unit test simply exercises ARP/ICMP traffic through the two switch ports, including tag injection and extraction, with the help of the dsa sandbox driver.
I took care to minimize the impact on the existing eth unit tests, though some adjustments needed to be made with the addition of extra eth interfaces used by the dsa unit tests. The additional eth interfaces also require MAC addresses, these have been added to the sandbox default environment.
--- arch/Kconfig | 1 + arch/sandbox/dts/test.dts | 40 +++++++++ drivers/net/Kconfig | 9 ++ drivers/net/Makefile | 1 + drivers/net/dsa_sandbox.c | 181 ++++++++++++++++++++++++++++++++++++++ include/configs/sandbox.h | 2 + test/dm/Makefile | 1 + test/dm/dsa.c | 91 +++++++++++++++++++ test/dm/eth.c | 10 +-- 9 files changed, 331 insertions(+), 5 deletions(-) create mode 100644 drivers/net/dsa_sandbox.c create mode 100644 test/dm/dsa.c
arch/Kconfig +1 -0
@@ -160,6 +160,7 @@ config SANDBOX imply CMD_CLONE imply SILENT_CONSOLE imply BOOTARGS_SUBST + imply DM_DSA config SH bool "SuperH architecture"
arch/sandbox/dts/test.dts +40 -0
@@ -14,7 +14,9 @@ aliases { console = &uart0; eth0 = "/eth at 10002000"; + eth2 = &swp_0; eth3 = ð_3; + eth4 = &dsa_eth0; eth5 = ð_5; gpio1 = &gpio_a; gpio2 = &gpio_b;
@@ -375,6 +377,44 @@ fake-host-hwaddr = [00 00 66 44 22 22]; }; + dsa_eth0: dsa-test-eth { + compatible = "sandbox,eth"; + reg = <0x10006000 0x1000>; + fake-host-hwaddr = [00 00 66 44 22 66]; + }; + + dsa-test { + compatible = "sandbox,dsa"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + swp_0: port at 0 { + reg = <0>; + label = "lan0"; + }; + + swp_1: port at 1 { + reg = <1>; + label = "lan1"; + phy-mode = "rgmii-txid"; + fixed-link { + speed = <100>; + full-duplex; + }; + }; + + port at 2 { + reg = <2>; + ethernet = <&dsa_eth0>; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; + firmware { sandbox_firmware: sandbox-firmware { compatible = "sandbox,firmware";
drivers/net/Kconfig +9 -0
@@ -77,6 +77,15 @@ config DM_ETH_PHY help Enable driver model for Ethernet Generic PHY . +config DSA_SANDBOX + depends on DM_DSA && SANDBOX + default y + bool "Sandbox: Mocked DSA driver" + help + This driver implements a dummy DSA switch connected to a dummy sandbox + Ethernet device used as DSA master, to test DSA class code, including + exported DSA API and datapath processing of Ethernet traffic. + menuconfig NETDEVICES bool "Network device support" depends on NET
drivers/net/Makefile +1 -0
@@ -21,6 +21,7 @@ obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac_socfpga.o obj-$(CONFIG_ETH_DESIGNWARE_S700) += dwmac_s700.o obj-$(CONFIG_DRIVER_DM9000) += dm9000x.o obj-$(CONFIG_DNET) += dnet.o +obj-$(CONFIG_DSA_SANDBOX) += dsa_sandbox.o obj-$(CONFIG_DM_ETH_PHY) += eth-phy-uclass.o obj-$(CONFIG_E1000) += e1000.o obj-$(CONFIG_E1000_SPI) += e1000_spi.o
drivers/net/dsa_sandbox.c new file +181 -0
181 lines not on this page · raw message
include/configs/sandbox.h +2 -0
@@ -93,7 +93,9 @@#endif #define SANDBOX_ETH_SETTINGS "ethaddr=00:00:11:22:33:44\0" \ + "eth2addr=00:00:11:22:33:48\0" \ "eth3addr=00:00:11:22:33:45\0" \ + "eth4addr=00:00:11:22:33:48\0" \ "eth5addr=00:00:11:22:33:46\0" \ "eth6addr=00:00:11:22:33:47\0" \ "ipaddr=1.2.3.4\0"
test/dm/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_DM_BOOTCOUNT) += bootcount.o obj-$(CONFIG_CLK) += clk.o clk_ccf.o obj-$(CONFIG_DEVRES) += devres.o obj-$(CONFIG_VIDEO_MIPI_DSI) += dsi_host.o +obj-$(CONFIG_DM_DSA) += dsa.o obj-$(CONFIG_DM_ETH) += eth.o obj-$(CONFIG_FIRMWARE) += firmware.o obj-$(CONFIG_DM_GPIO) += gpio.o
test/dm/dsa.c new file +91 -0
91 lines not on this page · raw message
test/dm/eth.c +5 -5
@@ -53,8 +53,8 @@ static int dm_test_eth_alias(struct unit_test_state *uts)ut_assertok (net_loop (PING ));ut_asserteq_str ("eth at 10004000" ,env_get ("ethact" )); -/* Expected to fail since eth2 is not defined in the device tree */ -env_set ("ethact" ,"eth2" ); +/* Expected to fail since eth1 is not defined in the device tree */ +env_set ("ethact" ,"eth1" );ut_assertok (net_loop (PING ));ut_asserteq_str ("eth at 10002000" ,env_get ("ethact" ));
@@ -227,7 +227,7 @@ static int _dm_test_net_retry(struct unit_test_state *uts)* the active device should be eth0 */ sandbox_eth_disable_response (1 , true); -env_set ("ethact" ,"eth at 10004000" ); +env_set ("ethact" ,"lan1" );env_set ("netretry" ,"yes" );sandbox_eth_skip_timeout ();ut_assertok (net_loop (PING ));
@@ -237,11 +237,11 @@ static int _dm_test_net_retry(struct unit_test_state *uts)* eth1 is disabled and netretry is no, so the ping should fail and the * active device should be eth1 */ -env_set ("ethact" ,"eth at 10004000" ); +env_set ("ethact" ,"lan1" );env_set ("netretry" ,"no" );sandbox_eth_skip_timeout ();ut_asserteq (-ENONET ,net_loop (PING )); -ut_asserteq_str ("eth at 10004000" ,env_get ("ethact" )); +ut_asserteq_str ("lan1" ,env_get ("ethact" ));return 0 ; }
Signature · 1 line
2.17.1
PATCH 2/5 sandbox: Add a DSA sandbox driver and unit test
Quoted 29 lines · Claudiu Manoil
The DSA sandbox driver is used for unit testing the DSA class code. It implements a simple 2 port switch plus 1 CPU port, and uses a very simple tag to identify the ports.
The DSA sandbox device is connected via CPU port to a regular Ethernet sandbox device, called 'dsa-test-eth, managed by the existing eth sandbox driver. The 'dsa-test-eth' is not intended for testing the eth class code however, but it is used to emulate traffic through the 'lan0' and 'lan1' front pannel switch ports. To achieve this the dsa sandbox driver registers a tx handler for the 'dsa-test-eth' device. The switch ports, labeled as 'lan0' and 'lan1', are also registered as eth devices by the dsa class code this time. So pinging through these switch ports is as easy as:
=> setenv ethact lan0
=> ping 1.2.3.5Unit tests for the dsa class code were also added. The '
dsa_probe' test exercises most API functions fromdsa.h. The 'dsa' unit test simply exercises ARP/ICMP traffic through the two switch ports, including tag injection and extraction, with the help of the dsa sandbox driver.
I took care to minimize the impact on the existing eth unit tests, though some adjustments needed to be made with the addition of extra eth interfaces used by the dsa unit tests. The additional eth interfaces also require MAC addresses, these have been added to the sandbox default environment.Signed-off-by Alex Marginean <[email protected]>Signed-off-by Claudiu Manoil <[email protected]>
Quoted 14 lines
--- arch/Kconfig | 1 + arch/sandbox/dts/test.dts | 40 +++++++++ drivers/net/Kconfig | 9 ++ drivers/net/Makefile | 1 + drivers/net/dsa_sandbox.c | 181 ++++++++++++++++++++++++++++++++++++++ include/configs/sandbox.h | 2 + test/dm/Makefile | 1 + test/dm/dsa.c | 91 +++++++++++++++++++ test/dm/eth.c | 10 +-- 9 files changed, 331 insertions(+), 5 deletions(-) create mode 100644 drivers/net/dsa_sandbox.c create mode 100644 test/dm/dsa.c
PATCH 3/5 drivers: net: Add Felix DSA switch driver
In reply to Claudiu ManoilFrom: Alex Marginean <[email protected]>
This driver is used for the Ethernet switch integrated into LS1028A NXP. Felix on LS1028A has 4 front panel ports and two internal ports, I/O to/from the switch is done through an ENETC Ethernet interface. The 4 front panel ports are available as Ethernet interfaces and can be used with the typical network commands like tftp.
--- drivers/net/fsl_enetc.h | 5 + drivers/net/mscc_eswitch/Kconfig | 8 + drivers/net/mscc_eswitch/Makefile | 1 + drivers/net/mscc_eswitch/felix_switch.c | 432 ++++++++++++++++++++++++ 4 files changed, 446 insertions(+) create mode 100644 drivers/net/mscc_eswitch/felix_switch.c
drivers/net/fsl_enetc.h +5 -0
@@ -201,6 +201,11 @@ struct enetc_priv {/* PCS replicator block for USXGMII */ #define ENETC_PCS_DEVAD_REPL 0x1f +#define ENETC_PCS_REPL_LINK_TIMER_1 0x12 +#define ENETC_PCS_REPL_LINK_TIMER_1_DEF 0x0003 +#define ENETC_PCS_REPL_LINK_TIMER_2 0x13 +#define ENETC_PCS_REPL_LINK_TIMER_2_DEF 0x06a0 +/* ENETC external MDIO registers */ #define ENETC_MDIO_BASE 0x1c00#define ENETC_MDIO_CFG 0x00
drivers/net/mscc_eswitch/Kconfig +8 -0
@@ -36,3 +36,11 @@ config MSCC_SERVAL_SWITCH select PHYLIB help This driver supports the Serval network switch device. + +config MSCC_FELIX_SWITCH + bool "Felix switch driver" + depends on DM_DSA && DM_PCI + select FSL_ENETC + help + This driver supports the Ethernet switch integrated in LS1028A NXP + SoC.
drivers/net/mscc_eswitch/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-$(CONFIG_MSCC_LUTON_SWITCH) += luton_switch.o mscc_xfer.o mscc_mac_table.o m obj-$(CONFIG_MSCC_JR2_SWITCH) += jr2_switch.o mscc_xfer.o mscc_miim.o obj-$(CONFIG_MSCC_SERVALT_SWITCH) += servalt_switch.o mscc_xfer.o mscc_miim.o obj-$(CONFIG_MSCC_SERVAL_SWITCH) += serval_switch.o mscc_xfer.o mscc_mac_table.o mscc_miim.o +obj-$(CONFIG_MSCC_FELIX_SWITCH) += felix_switch.o
drivers/net/mscc_eswitch/felix_switch.c new file +432 -0
432 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 4/5 arm: dts: ls1028a: Add Ethernet switch node and dependencies
In reply to Claudiu ManoilFrom: Alex Marginean <[email protected]>
The definition follows the DSA binding in kernel and describes the switch, its ports and PHYs.
ENETC PF6 is the 2nd Eth controller linked to the switch on LS1028A, it is not used in U-Boot and was disabled. Ethernet port aliases were also added to better manage the multitude of ports available now, and to enforce the order in which master and slave ports are probed.
--- arch/arm/dts/fsl-ls1028a-rdb.dts | 36 +++++++++++++++++++++ arch/arm/dts/fsl-ls1028a.dtsi | 55 +++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 1 deletion(-)
arch/arm/dts/fsl-ls1028a-rdb.dts +36 -0
@@ -131,9 +131,45 @@ phy-handle = <&rdb_phy0>; }; +ðsw_ports { + port at 0 { + status = "okay"; + phy-mode = "qsgmii"; + phy-handle = <&sw_phy0>; + }; + port at 1 { + status = "okay"; + phy-mode = "qsgmii"; + phy-handle = <&sw_phy1>; + }; + port at 2 { + status = "okay"; + phy-mode = "qsgmii"; + phy-handle = <&sw_phy2>; + }; + port at 3 { + status = "okay"; + phy-mode = "qsgmii"; + phy-handle = <&sw_phy3>; + }; +}; + &mdio0 { status = "okay"; rdb_phy0: phy at 2 { reg = <2>; }; + + sw_phy0: phy at 10 { + reg = <0x10>; + }; + sw_phy1: phy at 11 { + reg = <0x11>; + }; + sw_phy2: phy at 12 { + reg = <0x12>; + }; + sw_phy3: phy at 13 { + reg = <0x13>; + }; };
arch/arm/dts/fsl-ls1028a.dtsi +54 -1
69 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 4/5 arm: dts: ls1028a: Add Ethernet switch node and dependencies
Am 2021-01-13 19:05, schrieb Claudiu Manoil:
Quoted 78 lines
From: Alex Marginean <[email protected]>
The definition follows the DSA binding in kernel and describes the switch,
its ports and PHYs.
ENETC PF6 is the 2nd Eth controller linked to the switch on LS1028A, it is
not used in U-Boot and was disabled. Ethernet port aliases were also added to better manage the multitude of ports available now, and to enforce the order in which master and slave ports are probed.Signed-off-by Alex Marginean <[email protected]>Signed-off-by Claudiu Manoil <[email protected]>--- arch/arm/dts/fsl-ls1028a-rdb.dts | 36 +++++++++++++++++++++ arch/arm/dts/fsl-ls1028a.dtsi | 55 +++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 1 deletion(-)arch/arm/dts/fsl-ls1028a-rdb.dts +36
-0@@ -131,9 +131,45 @@ phy-handle = <&rdb_phy0>; }; +ðsw_ports { + port at 0 { + status = "okay"; + phy-mode = "qsgmii"; + phy-handle = <&sw_phy0>; + }; + port at 1 { + status = "okay"; + phy-mode = "qsgmii"; + phy-handle = <&sw_phy1>; + }; + port at 2 { + status = "okay"; + phy-mode = "qsgmii"; + phy-handle = <&sw_phy2>; + }; + port at 3 { + status = "okay"; + phy-mode = "qsgmii"; + phy-handle = <&sw_phy3>; + }; +}; + &mdio0 { status = "okay"; rdb_phy0: phy at 2 { reg = <2>; }; + + sw_phy0: phy at 10 { + reg = <0x10>; + }; + sw_phy1: phy at 11 { + reg = <0x11>; + }; + sw_phy2: phy at 12 { + reg = <0x12>; + }; + sw_phy3: phy at 13 { + reg = <0x13>; + }; };arch/arm/dts/fsl-ls1028a.dtsi +0
-0@@ -14,6 +14,17 @@ #address-cells = <2>; #size-cells = <2>;
arch/arm/dts/fsl-ls1028a.dtsi line 26
Quoted 10 lines
arch/arm/dts/fsl-ls1028a.dtsi +10
-0+ aliases { + eth0 = &enetc0; + eth1 = &enetc1; + eth2 = &enetc2; + eth3 = &enetc6; + eth4 = &felix0; + eth5 = &felix1; + eth6 = &felix2; + eth7 = &felix3; + };
Don't include the aliases in the common dtsi. There are serveral reasons for that:
(1) it is really board dependent. not every board has all these ports.
(2) it will mess up the device numbering for boards which use this dtsi. And with this it will also mess up the ethNaddr environment variable logic.
Please move them into the corresponding boards.
Quoted 33 lines
arch/arm/dts/fsl-ls1028a.dtsi +26
-0+ sysclk: sysclk { compatible = "fixed-clock"; #clock-cells = <0>;@@ -151,9 +162,51 @@ reg = <0x000300 0 0 0 0>; status = "disabled"; }; + ethsw: pci at 0,5 { + #address-cells=<0>; + #size-cells=<1>; + reg = <0x000500 0 0 0 0>; + + ethsw_ports: ports { + #address-cells = <1>; + #size-cells = <0>; + + felix0: port at 0 { + reg = <0>; + status = "disabled"; + label = "swp0"; + }; + felix1: port at 1 { + reg = <1>; + status = "disabled"; + label = "swp1"; + }; + felix2: port at 2 { + reg = <2>; + status = "disabled"; + label = "swp2"; + }; + felix3: port at 3 {
arch/arm/dts/fsl-ls1028a.dtsi line 199
Quoted 10 lines
arch/arm/dts/fsl-ls1028a.dtsi +10
-0+ reg = <3>; + status = "disabled"; + label = "swp3"; + }; + port at 4 { + reg = <4>; + phy-mode = "internal"; + status = "okay"; + ethernet = <&enetc2>; + };
status = "disabled".
Why would you enable just this port if all the switch ports are disabled.
Quoted 4 lines
arch/arm/dts/fsl-ls1028a.dtsi +4
-0+ port at 5 { + reg = <5>; + phy-mode = "internal"; + status = "disabled";
arch/arm/dts/fsl-ls1028a.dtsi line 212
Quoted 10 lines
arch/arm/dts/fsl-ls1028a.dtsi +4
-1+ }; + }; + }; enetc6: pci at 0,6 { reg = <0x000600 0 0 0 0>; - status = "okay"; + status = "disabled"; phy-mode = "internal"; }; };
-michael
PATCH 4/5 arm: dts: ls1028a: Add Ethernet switch node and dependencies
Quoted 4 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Wednesday, January 13, 2021 10:11 PM
[...]
Quoted 25 lines
Quoted 6 lines
arch/arm/dts/fsl-ls1028a.dtsi +0
-0@@ -14,6 +14,17 @@ #address-cells = <2>; #size-cells = <2>;arch/arm/dts/fsl-ls1028a.dtsi line 26
Quoted 10 lines
arch/arm/dts/fsl-ls1028a.dtsi +10
-0+ aliases { + eth0 = &enetc0; + eth1 = &enetc1; + eth2 = &enetc2; + eth3 = &enetc6; + eth4 = &felix0; + eth5 = &felix1; + eth6 = &felix2; + eth7 = &felix3; + };Don't include the aliases in the common dtsi. There are serveral reasons for that:
(1) it is really board dependent. not every board has all these ports.
(2) it will mess up the device numbering for boards which use this dtsi. And with this it will also mess up the ethNaddr environment variable logic.
Quoted 2 lines
Please move them into the corresponding boards.
Hi Michael,
I think the point of this patch was to enable the felix switch for the LS1028A RDB only for now, for simplicity, to make the patch set smaller. Follow-up patches would enable it for the remaining boards.
But I understand that keeping the aliases in the fsl-ls1028a.dtsi can mess up other boards that include it, including the Kontron boards. Would you agree to update only the ls1028 RDB board DT for now?
Alternatively you could test these patches on your boards and maybe provide the DT updates for the Kontron boards as part of this patch set.
Quoted 46 lines
Quoted 33 lines
arch/arm/dts/fsl-ls1028a.dtsi +26
-0+ sysclk: sysclk { compatible = "fixed-clock"; #clock-cells = <0>;@@ -151,9 +162,51 @@ reg = <0x000300 0 0 0 0>; status = "disabled"; }; + ethsw: pci at 0,5 { + #address-cells=<0>; + #size-cells=<1>; + reg = <0x000500 0 0 0 0>; + + ethsw_ports: ports { + #address-cells = <1>; + #size-cells = <0>; + + felix0: port at 0 { + reg = <0>; + status = "disabled"; + label = "swp0"; + }; + felix1: port at 1 { + reg = <1>; + status = "disabled"; + label = "swp1"; + }; + felix2: port at 2 { + reg = <2>; + status = "disabled"; + label = "swp2"; + }; + felix3: port at 3 {arch/arm/dts/fsl-ls1028a.dtsi line 199
Quoted 10 lines
arch/arm/dts/fsl-ls1028a.dtsi +10
-0+ reg = <3>; + status = "disabled"; + label = "swp3"; + }; + port at 4 { + reg = <4>; + phy-mode = "internal"; + status = "okay"; + ethernet = <&enetc2>; + };status = "disabled".
Quoted 3 lines
Why would you enable just this port if all the switch ports are disabled.
The number of active front panel ports may vary from board to board. These ports are supposed to be enabled in each board DT, depending on setup. But a DSA switch always needs a CPU port regardless of how many front side ports are active in each particular setup, and port at 4 is the CPU port.
Thanks,
Claudiu
PATCH 4/5 arm: dts: ls1028a: Add Ethernet switch node and dependencies
Hi Claudiu,
Am 2021-01-14 16:20, schrieb Claudiu Manoil:
Quoted 31 lines
Quoted 3 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Wednesday, January 13, 2021 10:11 PM[...]
Quoted 25 lines
Quoted 6 lines
arch/arm/dts/fsl-ls1028a.dtsi +0
-0@@ -14,6 +14,17 @@ #address-cells = <2>; #size-cells = <2>;arch/arm/dts/fsl-ls1028a.dtsi line 26
Quoted 10 lines
arch/arm/dts/fsl-ls1028a.dtsi +10
-0+ aliases { + eth0 = &enetc0; + eth1 = &enetc1; + eth2 = &enetc2; + eth3 = &enetc6; + eth4 = &felix0; + eth5 = &felix1; + eth6 = &felix2; + eth7 = &felix3; + };Don't include the aliases in the common dtsi. There are serveral reasons for that:
(1) it is really board dependent. not every board has all these ports.
(2) it will mess up the device numbering for boards which use this dtsi. And with this it will also mess up the ethNaddr environment variable logic.Quoted 2 lines
Please move them into the corresponding boards.
Quoted 10 lines
I think the point of this patch was to enable the felix switch for the LS1028A RDB only for now,
for simplicity, to make the patch set smaller. Follow-up patches would enable it for the remaining
boards.
But I understand that keeping the aliases in thefsl-ls1028a.dtsican mess up other boards
that include it, including the Kontron boards. Would you agree to update only the ls1028 RDB
board DT for now?
Sure, once accepted, I'll post a follow-up for our board.
Quoted 3 lines
Alternatively you could test these patches on your boards and maybe provide the DT updates for
the Kontron boards as part of this patch set.
I'm going to test this anyways and add a Tested-by to this set, once it tested successfully.
At the moment the only board variant which this would apply to is not upstream yet. Patches are pending. But sure, if it will be in upstream you could pick it up for this set.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/dts/fsl-ls1028a.dtsi +1
-0+ sysclk: sysclk { compatible = "fixed-clock"; #clock-cells = <0>;
Quoted 8 lines
Quoted 8 lines
arch/arm/dts/fsl-ls1028a.dtsi line 168
Quoted 8 lines
arch/arm/dts/fsl-ls1028a.dtsi +4
-0@@ -151,9 +162,51 @@ reg = <0x000300 0 0 0 0>; status = "disabled"; }; + ethsw: pci at 0,5 { + #address-cells=<0>; + #size-cells=<1>; + reg = <0x000500 0 0 0 0>;
This should also have
status = "disabled"
Quoted 38 lines
Quoted 34 lines
Quoted 21 lines
arch/arm/dts/fsl-ls1028a.dtsi +21
-0+ + ethsw_ports: ports { + #address-cells = <1>; + #size-cells = <0>; + + felix0: port at 0 { + reg = <0>; + status = "disabled"; + label = "swp0"; + }; + felix1: port at 1 { + reg = <1>; + status = "disabled"; + label = "swp1"; + }; + felix2: port at 2 { + reg = <2>; + status = "disabled"; + label = "swp2"; + }; + felix3: port at 3 {arch/arm/dts/fsl-ls1028a.dtsi line 199
Quoted 10 lines
arch/arm/dts/fsl-ls1028a.dtsi +10
-0+ reg = <3>; + status = "disabled"; + label = "swp3"; + }; + port at 4 { + reg = <4>; + phy-mode = "internal"; + status = "okay"; + ethernet = <&enetc2>; + };status = "disabled".
Quoted 3 lines
Why would you enable just this port if all the switch ports are disabled.
Quoted 6 lines
The number of active front panel ports may vary from board to board. These ports are supposed to be enabled in each board DT, depending on setup. But a DSA switch always needs a CPU port regardless of how many front side ports are active in each particular setup, and port at 4 is
the CPU port.
Sure, but my point was that the default should be disabled - as it should
be for any peripheral in the dtsi - and it should be enabled per board. What
if I'd rather use the other internal port? The linux dtsi also has all ports disabled by default. Speaking of the linux device tree. The u-boot one and the linux one are out-of-sync. Is there a reason why you couldn't
take the "ethernet-switch at 0,5" fragment from the linux tree?
-michael
PATCH 4/5 arm: dts: ls1028a: Add Ethernet switch node and dependencies
Quoted 130 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Thursday, January 14, 2021 5:40 PM
To: Claudiu Manoil <[email protected]>
Cc: Joe Hershberger <[email protected]>; Simon Glass <[email protected]>; Bin Meng <[email protected]>; u-
boot at lists.denx.de; Vladimir Oltean <[email protected]>; Alexandru Marginean <[email protected]>
Subject: Re: [PATCH 4/5] arm: dts: ls1028a: Add Ethernet switch node and dependenciesHi Claudiu,
Am 2021-01-14 16:20, schrieb Claudiu Manoil:
Quoted 31 lines
Quoted 3 lines
-----Original Message-----
From: Michael Walle <[email protected]>
Sent: Wednesday, January 13, 2021 10:11 PM[...]
Quoted 25 lines
Quoted 6 lines
arch/arm/dts/fsl-ls1028a.dtsi +0
-0@@ -14,6 +14,17 @@ #address-cells = <2>; #size-cells = <2>;arch/arm/dts/fsl-ls1028a.dtsi line 26
Quoted 10 lines
arch/arm/dts/fsl-ls1028a.dtsi +10
-0+ aliases { + eth0 = &enetc0; + eth1 = &enetc1; + eth2 = &enetc2; + eth3 = &enetc6; + eth4 = &felix0; + eth5 = &felix1; + eth6 = &felix2; + eth7 = &felix3; + };Don't include the aliases in the common dtsi. There are serveral reasons for that:
(1) it is really board dependent. not every board has all these ports.
(2) it will mess up the device numbering for boards which use this dtsi. And with this it will also mess up the ethNaddr environment variable logic.Quoted 2 lines
Please move them into the corresponding boards.
Quoted 10 lines
I think the point of this patch was to enable the felix switch for the LS1028A RDB only for now,
for simplicity, to make the patch set smaller. Follow-up patches would enable it for the remaining
boards.
But I understand that keeping the aliases in thefsl-ls1028a.dtsican mess up other boards
that include it, including the Kontron boards. Would you agree to update only the ls1028 RDB
board DT for now?Sure, once accepted, I'll post a follow-up for our board.
Quoted 3 lines
Alternatively you could test these patches on your boards and maybe provide the DT updates for
the Kontron boards as part of this patch set.I'm going to test this anyways and add a Tested-by to this set, once it tested successfully.
At the moment the only board variant which this would apply to is not upstream yet. Patches are pending. But sure, if it will be in upstream you could pick it up for this set.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/dts/fsl-ls1028a.dtsi +1
-0+ sysclk: sysclk { compatible = "fixed-clock"; #clock-cells = <0>;Quoted 8 lines
Quoted 8 lines
arch/arm/dts/fsl-ls1028a.dtsi line 168
Quoted 8 lines
arch/arm/dts/fsl-ls1028a.dtsi +4
-0@@ -151,9 +162,51 @@ reg = <0x000300 0 0 0 0>; status = "disabled"; }; + ethsw: pci at 0,5 { + #address-cells=<0>; + #size-cells=<1>; + reg = <0x000500 0 0 0 0>;This should also have
status = "disabled"Quoted 38 lines
Quoted 34 lines
Quoted 21 lines
arch/arm/dts/fsl-ls1028a.dtsi +21
-0+ + ethsw_ports: ports { + #address-cells = <1>; + #size-cells = <0>; + + felix0: port at 0 { + reg = <0>; + status = "disabled"; + label = "swp0"; + }; + felix1: port at 1 { + reg = <1>; + status = "disabled"; + label = "swp1"; + }; + felix2: port at 2 { + reg = <2>; + status = "disabled"; + label = "swp2"; + }; + felix3: port at 3 {arch/arm/dts/fsl-ls1028a.dtsi line 199
Quoted 10 lines
arch/arm/dts/fsl-ls1028a.dtsi +10
-0+ reg = <3>; + status = "disabled"; + label = "swp3"; + }; + port at 4 { + reg = <4>; + phy-mode = "internal"; + status = "okay"; + ethernet = <&enetc2>; + };status = "disabled".
Quoted 3 lines
Why would you enable just this port if all the switch ports are disabled.
Quoted 6 lines
The number of active front panel ports may vary from board to board. These ports are supposed to be enabled in each board DT, depending on setup. But a DSA switch always needs a CPU port regardless of how many front side ports are active in each particular setup, and port at 4 is
the CPU port.
Quoted 8 lines
Sure, but my point was that the default should be disabled - as it should be for any peripheral in the dtsi - and it should be enabled per board.
What if I'd rather use the other internal port? The linux dtsi also has all ports disabled by default. Speaking of the linux device tree. The u-boot one and the linux one are out-of-sync. Is there a reason why you couldn't take the "ethernet-switch at 0,5" fragment from the linux tree?
Michel, I agree with keeping the device tree nodes between linux and uboot as consistent as possible, so port 5 can look like this in the dtsi :
mscc_felix_port5: port at 5 {
reg = <5>;
phy-mode = "internal";
status = "disabled";
fixed-link {
speed = <1000>;
full-duplex;
};
};as it is currently in the upstream kernel:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi?h=v5.11-rc3
I'd drop however properties that are not used, like managed = "in-band-status" for the external ports, since this is phylink specific, and I don't expect we'll have phylink in uboot anytime soon.
PATCH 5/5 configs: ls1028a: Enable the Ethernet switch driver in defconfig
In reply to Claudiu ManoilFrom: Alex Marginean <[email protected]>
The switch driver for LS1028A Ethernet switch is now compiled in for both LS1028A boards.
--- configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 2 ++ configs/ls1028aqds_tfa_defconfig | 2 ++ configs/ls1028ardb_tfa_SECURE_BOOT_defconfig | 2 ++ configs/ls1028ardb_tfa_defconfig | 2 ++ 4 files changed, 8 insertions(+)
configs/ls1028aqds_tfa_SECURE_BOOT_defconfig +2 -0
@@ -61,6 +61,8 @@ CONFIG_DM_MDIO_MUX=y CONFIG_E1000=y CONFIG_FSL_ENETC=y CONFIG_MDIO_MUX_I2CREG=y +CONFIG_DM_DSA=y +CONFIG_MSCC_FELIX_SWITCH=y CONFIG_NVME=y CONFIG_PCI=y CONFIG_DM_PCI=y
configs/ls1028aqds_tfa_defconfig +2 -0
@@ -67,6 +67,8 @@ CONFIG_DM_MDIO_MUX=y CONFIG_E1000=y CONFIG_FSL_ENETC=y CONFIG_MDIO_MUX_I2CREG=y +CONFIG_DM_DSA=y +CONFIG_MSCC_FELIX_SWITCH=y CONFIG_NVME=y CONFIG_PCI=y CONFIG_DM_PCI=y
configs/ls1028ardb_tfa_SECURE_BOOT_defconfig +2 -0
@@ -58,6 +58,8 @@ CONFIG_DM_MDIO=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_FSL_ENETC=y +CONFIG_DM_DSA=y +CONFIG_MSCC_FELIX_SWITCH=y CONFIG_NVME=y CONFIG_PCI=y CONFIG_DM_PCI=y
configs/ls1028ardb_tfa_defconfig +2 -0
@@ -64,6 +64,8 @@ CONFIG_DM_MDIO=y CONFIG_PHY_GIGE=y CONFIG_E1000=y CONFIG_FSL_ENETC=y +CONFIG_DM_DSA=y +CONFIG_MSCC_FELIX_SWITCH=y CONFIG_NVME=y CONFIG_PCI=y CONFIG_DM_PCI=y
Signature · 1 line
2.17.1