Skip to content

Commit bf3b1d3

Browse files
committed
Merge branch 'net-dsa-ks8995-fix-up-bindings'
Linus Walleij says: ==================== net: dsa: ks8995: Fix up bindings After looking at the datasheets for KS8995 I realized this is a DSA switch and need to have DT bindings as such and be implemented as such. This series just fixes up the bindings and the offending device tree. The existing kernel driver which is in drivers/net/phy/spi_ks8995.c does not implement DSA. It can be forgiven for this because it was merged in 2011 and the DSA framework was not widely established back then. It continues to probe fine but needs to be rewritten to use the special DSA tag and moved to drivers/net/dsa as time permits. (I hope I can do this.) It's fine for the networking tree to merge both patches, I maintain ixp4xx as well. But I can also carry the second patch through the SoC tree if so desired. v1: https://lore.kernel.org/20250624-ks8995-dsa-bindings-v1-0-71a8b4f63315@linaro.org ==================== Link: https://patch.msgid.link/20250625-ks8995-dsa-bindings-v2-0-ce71dce9be0b@linaro.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 0a12c43 + c9cc6b6 commit bf3b1d3

File tree

3 files changed

+213
-34
lines changed

3 files changed

+213
-34
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/net/dsa/micrel,ks8995.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Micrel KS8995 Family DSA Switches
8+
9+
maintainers:
10+
- Linus Walleij <linus.walleij@linaro.org>
11+
12+
description:
13+
The Micrel KS8995 DSA Switches are 100 Mbit switches that were produced in
14+
the early-to-mid 2000s. The chip features a CPU port and four outgoing ports,
15+
each with an internal PHY. The chip itself is managed over SPI, but all the
16+
PHYs need to be accessed from an external MDIO channel.
17+
18+
Further, a fifth PHY is available and can be used separately from the switch
19+
fabric, connected to an external MII interface name MII-P5. This is
20+
unrelated from the CPU-facing port 5 which is used for DSA MII traffic.
21+
22+
properties:
23+
compatible:
24+
enum:
25+
- micrel,ks8995
26+
- micrel,ksz8795
27+
- micrel,ksz8864
28+
29+
reg:
30+
maxItems: 1
31+
32+
reset-gpios:
33+
description: GPIO to be used to reset the whole device
34+
maxItems: 1
35+
36+
allOf:
37+
- $ref: dsa.yaml#/$defs/ethernet-ports
38+
- $ref: /schemas/spi/spi-peripheral-props.yaml#
39+
40+
required:
41+
- compatible
42+
- reg
43+
44+
unevaluatedProperties: false
45+
46+
examples:
47+
- |
48+
#include <dt-bindings/gpio/gpio.h>
49+
50+
spi {
51+
#address-cells = <1>;
52+
#size-cells = <0>;
53+
54+
ethernet-switch@0 {
55+
compatible = "micrel,ks8995";
56+
reg = <0>;
57+
spi-max-frequency = <25000000>;
58+
59+
ethernet-ports {
60+
#address-cells = <1>;
61+
#size-cells = <0>;
62+
63+
ethernet-port@0 {
64+
reg = <0>;
65+
label = "lan1";
66+
};
67+
ethernet-port@1 {
68+
reg = <1>;
69+
label = "lan2";
70+
};
71+
ethernet-port@2 {
72+
reg = <2>;
73+
label = "lan3";
74+
};
75+
ethernet-port@3 {
76+
reg = <3>;
77+
label = "lan4";
78+
};
79+
ethernet-port@4 {
80+
reg = <4>;
81+
ethernet = <&mac2>;
82+
phy-mode = "mii";
83+
fixed-link {
84+
speed = <100>;
85+
full-duplex;
86+
};
87+
};
88+
};
89+
};
90+
};
91+
92+
soc {
93+
#address-cells = <1>;
94+
#size-cells = <1>;
95+
96+
/* The WAN port connected on MII-P5 */
97+
ethernet-port@1000 {
98+
reg = <0x00001000 0x1000>;
99+
label = "wan";
100+
phy-mode = "mii";
101+
phy-handle = <&phy5>;
102+
};
103+
104+
mac2: ethernet-port@2000 {
105+
reg = <0x00002000 0x1000>;
106+
phy-mode = "mii";
107+
fixed-link {
108+
speed = <100>;
109+
full-duplex;
110+
};
111+
};
112+
};
113+
114+
mdio {
115+
#address-cells = <1>;
116+
#size-cells = <0>;
117+
118+
/* LAN PHYs 1-4 accessible over external MDIO */
119+
phy1: ethernet-phy@1 {
120+
reg = <1>;
121+
};
122+
phy2: ethernet-phy@2 {
123+
reg = <2>;
124+
};
125+
phy3: ethernet-phy@3 {
126+
reg = <3>;
127+
};
128+
phy4: ethernet-phy@4 {
129+
reg = <4>;
130+
};
131+
/* WAN PHY accessible over external MDIO */
132+
phy5: ethernet-phy@5 {
133+
reg = <5>;
134+
};
135+
};

Documentation/devicetree/bindings/net/micrel-ks8995.txt

Lines changed: 0 additions & 20 deletions
This file was deleted.

arch/arm/boot/dts/intel/ixp/intel-ixp42x-linksys-wrv54g.dts

Lines changed: 78 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,55 @@
7272
cs-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
7373
num-chipselects = <1>;
7474

75-
switch@0 {
75+
ethernet-switch@0 {
7676
compatible = "micrel,ks8995";
7777
reg = <0>;
7878
spi-max-frequency = <50000000>;
79+
80+
/*
81+
* The PHYs are accessed over the external MDIO
82+
* bus and not internally through the switch control
83+
* registers.
84+
*/
85+
ethernet-ports {
86+
#address-cells = <1>;
87+
#size-cells = <0>;
88+
89+
ethernet-port@0 {
90+
reg = <0>;
91+
label = "1";
92+
phy-mode = "mii";
93+
phy-handle = <&phy1>;
94+
};
95+
ethernet-port@1 {
96+
reg = <1>;
97+
label = "2";
98+
phy-mode = "mii";
99+
phy-handle = <&phy2>;
100+
};
101+
ethernet-port@2 {
102+
reg = <2>;
103+
label = "3";
104+
phy-mode = "mii";
105+
phy-handle = <&phy3>;
106+
};
107+
ethernet-port@3 {
108+
reg = <3>;
109+
label = "4";
110+
phy-mode = "mii";
111+
phy-handle = <&phy4>;
112+
};
113+
ethernet-port@4 {
114+
reg = <4>;
115+
ethernet = <&ethb>;
116+
phy-mode = "mii";
117+
fixed-link {
118+
speed = <100>;
119+
full-duplex;
120+
};
121+
};
122+
123+
};
79124
};
80125
};
81126

@@ -135,40 +180,59 @@
135180
};
136181

137182
/*
138-
* EthB - connected to the KS8995 switch ports 1-4
139-
* FIXME: the boardfile defines .phy_mask = 0x1e for this port to enable output to
140-
* all four switch ports, also using an out of tree multiphy patch.
141-
* Do we need a new binding and property for this?
183+
* EthB connects to the KS8995 CPU port and faces ports 1-4
184+
* through the switch fabric.
185+
*
186+
* To complicate things, the MDIO channel is also only
187+
* accessible through EthB, but used independently for PHY
188+
* control.
142189
*/
143-
ethernet@c8009000 {
190+
ethb: ethernet@c8009000 {
144191
status = "okay";
145192
queue-rx = <&qmgr 3>;
146193
queue-txready = <&qmgr 20>;
147-
phy-mode = "rgmii";
148-
phy-handle = <&phy4>;
194+
phy-mode = "mii";
195+
fixed-link {
196+
speed = <100>;
197+
full-duplex;
198+
};
149199

150200
mdio {
151201
#address-cells = <1>;
152202
#size-cells = <0>;
153203

154-
/* Should be ports 1-4 on the KS8995 switch */
204+
/*
205+
* LAN ports 1-4 on the KS8995 switch
206+
* and PHY5 for WAN need to be accessed
207+
* through this external MDIO channel.
208+
*/
209+
phy1: ethernet-phy@1 {
210+
reg = <1>;
211+
};
212+
phy2: ethernet-phy@2 {
213+
reg = <2>;
214+
};
215+
phy3: ethernet-phy@3 {
216+
reg = <3>;
217+
};
155218
phy4: ethernet-phy@4 {
156219
reg = <4>;
157220
};
158-
159-
/* Should be port 5 on the KS8995 switch */
160221
phy5: ethernet-phy@5 {
161222
reg = <5>;
162223
};
163224
};
164225
};
165226

166-
/* EthC - connected to KS8995 switch port 5 */
167-
ethernet@c800a000 {
227+
/*
228+
* EthC connects to MII-P5 on the KS8995 bypassing
229+
* all of the switch logic and facing PHY5
230+
*/
231+
ethc: ethernet@c800a000 {
168232
status = "okay";
169233
queue-rx = <&qmgr 4>;
170234
queue-txready = <&qmgr 21>;
171-
phy-mode = "rgmii";
235+
phy-mode = "mii";
172236
phy-handle = <&phy5>;
173237
};
174238
};

0 commit comments

Comments
 (0)