Skip to content

Commit a47ab26

Browse files
committed
Merge branch 'net-ethernet-ti-add-networking-support-for-k3-am65x-j721e-soc'
Grygorii Strashko says: ==================== net: ethernet: ti: add networking support for k3 am65x/j721e soc This v6 series adds basic networking support support TI K3 AM654x/J721E SoC which have integrated Gigabit Ethernet MAC (Media Access Controller) into device MCU domain and named MCU_CPSW0 (CPSW2G NUSS). Formally TRMs refer CPSW2G NUSS as two-port Gigabit Ethernet Switch subsystem with port 0 being the CPPI DMA host port and port 1 being the external Ethernet port, but for 1 external port device it's just Port 0 <-> ALE <-> Port 1 and it's rather device with HW filtering capabilities then actually switching device. It's expected to have similar devices, but with more external ports. The new Host port 0 Communications Port Programming Interface (CPPI5) is operating by TI AM654x/J721E NAVSS Unified DMA Peripheral Root Complex (UDMA-P) controller [1]. The CPSW2G contains below modules for which existing code is re-used: - MAC SL: cpsw_sl.c - Address Lookup Engine (ALE): cpsw_ale.c, basically compatible with K2 66AK2E/G - Management Data Input/Output interface (MDIO): davinci_mdio.c, fully compatible with TI AM3/4/5 devices Basic features supported by CPSW2G NUSS driver: - VLAN support, 802.1Q compliant, Auto add port VLAN for untagged frames on ingress, Auto VLAN removal on egress and auto pad to minimum frame size. - multicast filtering - promisc mode - TX multiq support in Round Robin or Fixed priority modes - RX checksum offload for non-fragmented IPv4/IPv6 TCP/UDP packets - TX checksum offload support for IPv4/IPv6 TCP/UDP packets (J721E only). Features under development: - Support for IEEE 1588 Clock Synchronization. The CPSW2G NUSS includes new version of Common Platform Time Sync (CPTS) - tc-mqprio: priority level Quality Of Service (QOS) support (802.1p) - tc-cbs: Support for Audio/Video Bridging (P802.1Qav/D6.0) HW shapers - tc-taprio: IEEE 802.1Qbv/D2.2 Enhancements for Scheduled Traffic - frame preemption: IEEE P902.3br/D2.0 Interspersing Express Traffic, 802.1Qbu - extended ALE features: classifier/policers, auto-aging Patches 1-6 are intended for netdev, Patches 7-11 are intended for K3 Platform tree and provided here for testing purposes. Changes in v6: - fixed comments from Rob Herring <[email protected]> and added his Reviewed-by. - added Tested-by: Peter Ujfalusi <[email protected]> Changes in v5: - renamed files k3-udma-desc-pool.* k3-udma-desc-pool to k3-cppi-desc-pool.*, and API to k3_cppi_desc_pool_* as requested by Peter Ujfalusi <[email protected]> - fixed copy-paste err in am65_cpsw_nuss_ndo_slave_set_rx_mode() which blocked recieving of mcast frames. - added Tested-by: Murali Karicheri <[email protected]> Changes in v4: - fixed minor comments from Jakub Kicinski <[email protected]> - dependencies resolved: required phy-rmii-sel changes [2] queued for merge except one [3] which is included in this series with Kishon's ask. Changes in v3: - add ARM64 defconfig changes for testing purposes - fixed DT yaml definition - fixed comments from Jakub Kicinski <[email protected]> Changes in v2: - fixed DT yaml definition - fixed comments from David Miller v5: https://patchwork.ozlabs.org/cover/1258295/ v4: https://patchwork.ozlabs.org/cover/1256092/ v3: https://patchwork.ozlabs.org/cover/1254568/ v2: https://patchwork.ozlabs.org/cover/1250674/ v1: https://lwn.net/Articles/813087/ TRMs: AM654: http://www.ti.com/lit/ug/spruid7e/spruid7e.pdf J721E: http://www.ti.com/lit/ug/spruil1a/spruil1a.pdf Preliminary documentation can be found at: http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Foundational_Components/Kernel/Kernel_Drivers/Network/K3_CPSW2g.html [1] https://lwn.net/Articles/808030/ [2] https://lkml.org/lkml/2020/2/22/100 [3] https://lkml.org/lkml/2020/3/3/724 ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 5bb7357 + cae21a4 commit a47ab26

18 files changed

+3486
-5
lines changed
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/net/ti,k3-am654-cpsw-nuss.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: The TI AM654x/J721E SoC Gigabit Ethernet MAC (Media Access Controller) Device Tree Bindings
8+
9+
maintainers:
10+
- Grygorii Strashko <[email protected]>
11+
- Sekhar Nori <[email protected]>
12+
13+
description:
14+
The TI AM654x/J721E SoC Gigabit Ethernet MAC (CPSW2G NUSS) has two ports
15+
(one external) and provides Ethernet packet communication for the device.
16+
CPSW2G NUSS features - the Reduced Gigabit Media Independent Interface (RGMII),
17+
Reduced Media Independent Interface (RMII), the Management Data
18+
Input/Output (MDIO) interface for physical layer device (PHY) management,
19+
new version of Common Platform Time Sync (CPTS), updated Address Lookup
20+
Engine (ALE).
21+
One external Ethernet port (port 1) with selectable RGMII/RMII interfaces and
22+
an internal Communications Port Programming Interface (CPPI5) (Host port 0).
23+
Host Port 0 CPPI Packet Streaming Interface interface supports 8 TX channels
24+
and one RX channels and operating by TI AM654x/J721E NAVSS Unified DMA
25+
Peripheral Root Complex (UDMA-P) controller.
26+
The CPSW2G NUSS is integrated into device MCU domain named MCU_CPSW0.
27+
28+
Additional features
29+
priority level Quality Of Service (QOS) support (802.1p)
30+
Support for Audio/Video Bridging (P802.1Qav/D6.0)
31+
Support for IEEE 1588 Clock Synchronization (2008 Annex D, Annex E and Annex F)
32+
Flow Control (802.3x) Support
33+
Time Sensitive Network Support
34+
IEEE P902.3br/D2.0 Interspersing Express Traffic
35+
IEEE 802.1Qbv/D2.2 Enhancements for Scheduled Traffic
36+
Configurable number of addresses plus VLANs
37+
Configurable number of classifier/policers
38+
VLAN support, 802.1Q compliant, Auto add port VLAN for untagged frames on
39+
ingress, Auto VLAN removal on egress and auto pad to minimum frame size.
40+
RX/TX csum offload
41+
42+
Specifications can be found at
43+
http://www.ti.com/lit/ug/spruid7e/spruid7e.pdf
44+
http://www.ti.com/lit/ug/spruil1a/spruil1a.pdf
45+
46+
properties:
47+
"#address-cells": true
48+
"#size-cells": true
49+
50+
compatible:
51+
oneOf:
52+
- const: ti,am654-cpsw-nuss
53+
- const: ti,j721e-cpsw-nuss
54+
55+
reg:
56+
maxItems: 1
57+
description:
58+
The physical base address and size of full the CPSW2G NUSS IO range
59+
60+
reg-names:
61+
items:
62+
- const: cpsw_nuss
63+
64+
ranges: true
65+
66+
dma-coherent: true
67+
68+
clocks:
69+
description: CPSW2G NUSS functional clock
70+
71+
clock-names:
72+
items:
73+
- const: fck
74+
75+
power-domains:
76+
maxItems: 1
77+
78+
dmas:
79+
maxItems: 9
80+
81+
dma-names:
82+
items:
83+
- const: tx0
84+
- const: tx1
85+
- const: tx2
86+
- const: tx3
87+
- const: tx4
88+
- const: tx5
89+
- const: tx6
90+
- const: tx7
91+
- const: rx
92+
93+
ethernet-ports:
94+
type: object
95+
properties:
96+
'#address-cells':
97+
const: 1
98+
'#size-cells':
99+
const: 0
100+
101+
patternProperties:
102+
port@1:
103+
type: object
104+
description: CPSW2G NUSS external ports
105+
106+
allOf:
107+
- $ref: ethernet-controller.yaml#
108+
109+
properties:
110+
reg:
111+
items:
112+
- const: 1
113+
description: CPSW port number
114+
115+
phys:
116+
maxItems: 1
117+
description: phandle on phy-gmii-sel PHY
118+
119+
label:
120+
description: label associated with this port
121+
122+
ti,mac-only:
123+
$ref: /schemas/types.yaml#definitions/flag
124+
description:
125+
Specifies the port works in mac-only mode.
126+
127+
ti,syscon-efuse:
128+
$ref: /schemas/types.yaml#definitions/phandle-array
129+
description:
130+
Phandle to the system control device node which provides access
131+
to efuse IO range with MAC addresses
132+
133+
required:
134+
- reg
135+
- phys
136+
137+
additionalProperties: false
138+
139+
patternProperties:
140+
"^mdio@[0-9a-f]+$":
141+
type: object
142+
allOf:
143+
- $ref: "ti,davinci-mdio.yaml#"
144+
description:
145+
CPSW MDIO bus.
146+
147+
required:
148+
- compatible
149+
- reg
150+
- reg-names
151+
- ranges
152+
- clocks
153+
- clock-names
154+
- power-domains
155+
- dmas
156+
- dma-names
157+
- '#address-cells'
158+
- '#size-cells'
159+
160+
additionalProperties: false
161+
162+
examples:
163+
- |
164+
#include <dt-bindings/pinctrl/k3.h>
165+
#include <dt-bindings/soc/ti,sci_pm_domain.h>
166+
#include <dt-bindings/net/ti-dp83867.h>
167+
168+
mcu_cpsw: ethernet@46000000 {
169+
compatible = "ti,am654-cpsw-nuss";
170+
#address-cells = <2>;
171+
#size-cells = <2>;
172+
reg = <0x0 0x46000000 0x0 0x200000>;
173+
reg-names = "cpsw_nuss";
174+
ranges = <0x0 0x0 0x46000000 0x0 0x200000>;
175+
dma-coherent;
176+
clocks = <&k3_clks 5 10>;
177+
clock-names = "fck";
178+
power-domains = <&k3_pds 5 TI_SCI_PD_EXCLUSIVE>;
179+
pinctrl-names = "default";
180+
pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;
181+
182+
dmas = <&mcu_udmap 0xf000>,
183+
<&mcu_udmap 0xf001>,
184+
<&mcu_udmap 0xf002>,
185+
<&mcu_udmap 0xf003>,
186+
<&mcu_udmap 0xf004>,
187+
<&mcu_udmap 0xf005>,
188+
<&mcu_udmap 0xf006>,
189+
<&mcu_udmap 0xf007>,
190+
<&mcu_udmap 0x7000>;
191+
dma-names = "tx0", "tx1", "tx2", "tx3", "tx4", "tx5", "tx6", "tx7",
192+
"rx";
193+
194+
ethernet-ports {
195+
#address-cells = <1>;
196+
#size-cells = <0>;
197+
198+
cpsw_port1: port@1 {
199+
reg = <1>;
200+
ti,mac-only;
201+
label = "port1";
202+
ti,syscon-efuse = <&mcu_conf 0x200>;
203+
phys = <&phy_gmii_sel 1>;
204+
205+
phy-mode = "rgmii-rxid";
206+
phy-handle = <&phy0>;
207+
};
208+
};
209+
210+
davinci_mdio: mdio@f00 {
211+
compatible = "ti,cpsw-mdio","ti,davinci_mdio";
212+
reg = <0x0 0xf00 0x0 0x100>;
213+
#address-cells = <1>;
214+
#size-cells = <0>;
215+
clocks = <&k3_clks 5 10>;
216+
clock-names = "fck";
217+
bus_freq = <1000000>;
218+
219+
phy0: ethernet-phy@0 {
220+
reg = <0>;
221+
ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
222+
ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
223+
};
224+
};
225+
};

arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,4 +187,53 @@
187187
#size-cells = <0>;
188188
};
189189
};
190+
191+
mcu_cpsw: ethernet@46000000 {
192+
compatible = "ti,am654-cpsw-nuss";
193+
#address-cells = <2>;
194+
#size-cells = <2>;
195+
reg = <0x0 0x46000000 0x0 0x200000>;
196+
reg-names = "cpsw_nuss";
197+
ranges = <0x0 0x0 0x0 0x46000000 0x0 0x200000>;
198+
dma-coherent;
199+
clocks = <&k3_clks 5 10>;
200+
clock-names = "fck";
201+
power-domains = <&k3_pds 5 TI_SCI_PD_EXCLUSIVE>;
202+
203+
dmas = <&mcu_udmap 0xf000>,
204+
<&mcu_udmap 0xf001>,
205+
<&mcu_udmap 0xf002>,
206+
<&mcu_udmap 0xf003>,
207+
<&mcu_udmap 0xf004>,
208+
<&mcu_udmap 0xf005>,
209+
<&mcu_udmap 0xf006>,
210+
<&mcu_udmap 0xf007>,
211+
<&mcu_udmap 0x7000>;
212+
dma-names = "tx0", "tx1", "tx2", "tx3",
213+
"tx4", "tx5", "tx6", "tx7",
214+
"rx";
215+
216+
ethernet-ports {
217+
#address-cells = <1>;
218+
#size-cells = <0>;
219+
220+
cpsw_port1: port@1 {
221+
reg = <1>;
222+
ti,mac-only;
223+
label = "port1";
224+
ti,syscon-efuse = <&mcu_conf 0x200>;
225+
phys = <&phy_gmii_sel 1>;
226+
};
227+
};
228+
229+
davinci_mdio: mdio@f00 {
230+
compatible = "ti,cpsw-mdio","ti,davinci_mdio";
231+
reg = <0x0 0xf00 0x0 0x100>;
232+
#address-cells = <1>;
233+
#size-cells = <0>;
234+
clocks = <&k3_clks 5 10>;
235+
clock-names = "fck";
236+
bus_freq = <1000000>;
237+
};
238+
};
190239
};

arch/arm64/boot/dts/ti/k3-am65.dtsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
i2c3 = &main_i2c1;
3131
i2c4 = &main_i2c2;
3232
i2c5 = &main_i2c3;
33+
ethernet0 = &cpsw_port1;
3334
};
3435

3536
chosen { };

arch/arm64/boot/dts/ti/k3-am654-base-board.dts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "k3-am654.dtsi"
99
#include <dt-bindings/input/input.h>
10+
#include <dt-bindings/net/ti-dp83867.h>
1011

1112
/ {
1213
compatible = "ti,am654-evm", "ti,am654";
@@ -95,7 +96,30 @@
9596
wkup_pca554_default: wkup_pca554_default {
9697
pinctrl-single,pins = <
9798
AM65X_WKUP_IOPAD(0x0034, PIN_INPUT, 7) /* (T1) MCU_OSPI1_CLK.WKUP_GPIO0_25 */
99+
>;
100+
};
101+
102+
mcu_cpsw_pins_default: mcu_cpsw_pins_default {
103+
pinctrl-single,pins = <
104+
AM65X_WKUP_IOPAD(0x0058, PIN_OUTPUT, 0) /* (N4) MCU_RGMII1_TX_CTL */
105+
AM65X_WKUP_IOPAD(0x005c, PIN_INPUT, 0) /* (N5) MCU_RGMII1_RX_CTL */
106+
AM65X_WKUP_IOPAD(0x0060, PIN_OUTPUT, 0) /* (M2) MCU_RGMII1_TD3 */
107+
AM65X_WKUP_IOPAD(0x0064, PIN_OUTPUT, 0) /* (M3) MCU_RGMII1_TD2 */
108+
AM65X_WKUP_IOPAD(0x0068, PIN_OUTPUT, 0) /* (M4) MCU_RGMII1_TD1 */
109+
AM65X_WKUP_IOPAD(0x006c, PIN_OUTPUT, 0) /* (M5) MCU_RGMII1_TD0 */
110+
AM65X_WKUP_IOPAD(0x0078, PIN_INPUT, 0) /* (L2) MCU_RGMII1_RD3 */
111+
AM65X_WKUP_IOPAD(0x007c, PIN_INPUT, 0) /* (L5) MCU_RGMII1_RD2 */
112+
AM65X_WKUP_IOPAD(0x0080, PIN_INPUT, 0) /* (M6) MCU_RGMII1_RD1 */
113+
AM65X_WKUP_IOPAD(0x0084, PIN_INPUT, 0) /* (L6) MCU_RGMII1_RD0 */
114+
AM65X_WKUP_IOPAD(0x0070, PIN_INPUT, 0) /* (N1) MCU_RGMII1_TXC */
115+
AM65X_WKUP_IOPAD(0x0074, PIN_INPUT, 0) /* (M1) MCU_RGMII1_RXC */
116+
>;
117+
};
98118

119+
mcu_mdio_pins_default: mcu_mdio1_pins_default {
120+
pinctrl-single,pins = <
121+
AM65X_WKUP_IOPAD(0x008c, PIN_OUTPUT, 0) /* (L1) MCU_MDIO0_MDC */
122+
AM65X_WKUP_IOPAD(0x0088, PIN_INPUT, 0) /* (L4) MCU_MDIO0_MDIO */
99123
>;
100124
};
101125
};
@@ -419,3 +443,21 @@
419443
data-lanes = <1 2>;
420444
};
421445
};
446+
447+
&mcu_cpsw {
448+
pinctrl-names = "default";
449+
pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;
450+
};
451+
452+
&davinci_mdio {
453+
phy0: ethernet-phy@0 {
454+
reg = <0>;
455+
ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
456+
ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
457+
};
458+
};
459+
460+
&cpsw_port1 {
461+
phy-mode = "rgmii-rxid";
462+
phy-handle = <&phy0>;
463+
};

0 commit comments

Comments
 (0)