* [PATCH net-next 0/2] net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3
@ 2024-12-09 17:58 Fedor Ross
2024-12-09 17:58 ` [PATCH net-next 1/2] " Fedor Ross
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Fedor Ross @ 2024-12-09 17:58 UTC (permalink / raw)
To: Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Marek Vasut
Cc: netdev, linux-kernel, Woojung Huh, devicetree, Tristram Ha,
Fedor Ross
Add support for the led-mode property for the following PHYs which have
a single LED mode configuration value.
KSZ8765, KSZ8794 and KSZ8795 use register 0x0b bits 5,4 to control the
LED configuration.
KSZ8863 and KSZ8873 use register 0xc3 bits 5,4 to control the LED
configuration.
Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
---
Fedor Ross (2):
net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3
dt-bindings: net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3
.../devicetree/bindings/net/dsa/microchip,ksz.yaml | 89 +++++++++++++---------
drivers/net/dsa/microchip/ksz8.c | 9 +++
drivers/net/dsa/microchip/ksz8_reg.h | 1 +
drivers/net/dsa/microchip/ksz_common.c | 2 +
drivers/net/dsa/microchip/ksz_common.h | 1 +
5 files changed, 68 insertions(+), 34 deletions(-)
---
base-commit: 6145fefc1e42c1895c0c1c2c8593de2c085d8c56
change-id: 20241209-netdev-net-next-ksz8_led-mode-31b63f87963a
Best regards,
--
Fedor Ross <fedor.ross@ifm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 1/2] net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3
2024-12-09 17:58 [PATCH net-next 0/2] net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3 Fedor Ross
@ 2024-12-09 17:58 ` Fedor Ross
2024-12-09 17:58 ` [PATCH net-next 2/2] dt-bindings: " Fedor Ross
2024-12-09 18:22 ` [PATCH net-next 0/2] " Andrew Lunn
2 siblings, 0 replies; 7+ messages in thread
From: Fedor Ross @ 2024-12-09 17:58 UTC (permalink / raw)
To: Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Marek Vasut
Cc: netdev, linux-kernel, Woojung Huh, devicetree, Tristram Ha,
Fedor Ross
Add support for the led-mode property for the following PHYs which have
a single LED mode configuration value.
KSZ8765, KSZ8794 and KSZ8795 use register 0x0b bits 5,4 to control the
LED configuration.
KSZ8863 and KSZ8873 use register 0xc3 bits 5,4 to control the LED
configuration.
Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
---
drivers/net/dsa/microchip/ksz8.c | 9 +++++++++
drivers/net/dsa/microchip/ksz8_reg.h | 1 +
drivers/net/dsa/microchip/ksz_common.c | 2 ++
drivers/net/dsa/microchip/ksz_common.h | 1 +
4 files changed, 13 insertions(+)
diff --git a/drivers/net/dsa/microchip/ksz8.c b/drivers/net/dsa/microchip/ksz8.c
index da7110d675583dfb7c9be876d5ec5d12cddcf9b4..6bac134b1ccd9cadf6f878d0e0e73f17ed23b45a 100644
--- a/drivers/net/dsa/microchip/ksz8.c
+++ b/drivers/net/dsa/microchip/ksz8.c
@@ -1898,6 +1898,15 @@ int ksz8_setup(struct dsa_switch *ds)
regmap_update_bits(ksz_regmap_8(dev), REG_SW_CTRL_1,
SW_AGGR_BACKOFF, SW_AGGR_BACKOFF);
+ /* Configure LED mode */
+ if (dev->led_mode > 3)
+ dev_warn(dev->dev, "Invalid LED mode %d, supported modes 0..3.\n",
+ dev->led_mode);
+ else if (!ksz_is_8895_family(dev))
+ ksz_cfg(dev,
+ ksz_is_ksz88x3(dev) ? REG_SW_PWR_MGMT_LED_MODE : REG_SW_CTRL_9,
+ dev->led_mode << 4, true);
+
/*
* Make sure unicast VLAN boundary is set as default and
* enable no excessive collision drop.
diff --git a/drivers/net/dsa/microchip/ksz8_reg.h b/drivers/net/dsa/microchip/ksz8_reg.h
index 329688603a582b7f9dddc774327036edb54435f7..d04ae01c29b398414739e425d2c401ccbcfdac32 100644
--- a/drivers/net/dsa/microchip/ksz8_reg.h
+++ b/drivers/net/dsa/microchip/ksz8_reg.h
@@ -589,6 +589,7 @@
/* 88x3 specific */
#define REG_SW_INSERT_SRC_PVID 0xC2
+#define REG_SW_PWR_MGMT_LED_MODE 0xC3
/* PME */
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 920443ee8ffd02380da64cd9e14e867d6210e890..22eb882c7335001aa545c1abe65f25f4586e2d7f 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -5090,6 +5090,8 @@ int ksz_switch_register(struct ksz_device *dev)
}
of_node_put(ports);
}
+ of_property_read_u32(dev->dev->of_node, "microchip,led-mode", &dev->led_mode);
+
dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
"microchip,synclko-125");
dev->synclko_disable = of_property_read_bool(dev->dev->of_node,
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index b3bb75ca0796d208f232455677d338209bdaa97d..906f62b9cdb3677c3f8ece468d6ae93a3031db6d 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -175,6 +175,7 @@ struct ksz_device {
u32 chip_id;
u8 chip_rev;
int cpu_port; /* port connected to CPU */
+ unsigned int led_mode;
int phy_port_cnt;
phy_interface_t compat_interface;
bool synclko_125;
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 2/2] dt-bindings: net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3
2024-12-09 17:58 [PATCH net-next 0/2] net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3 Fedor Ross
2024-12-09 17:58 ` [PATCH net-next 1/2] " Fedor Ross
@ 2024-12-09 17:58 ` Fedor Ross
2024-12-09 18:22 ` [PATCH net-next 0/2] " Andrew Lunn
2 siblings, 0 replies; 7+ messages in thread
From: Fedor Ross @ 2024-12-09 17:58 UTC (permalink / raw)
To: Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Marek Vasut
Cc: netdev, linux-kernel, Woojung Huh, devicetree, Tristram Ha,
Fedor Ross
Add support for the led-mode property for the following PHYs which have
a single LED mode configuration value.
KSZ8765, KSZ8794 and KSZ8795 use register 0x0b bits 5,4 to control the
LED configuration.
KSZ8863 and KSZ8873 use register 0xc3 bits 5,4 to control the LED
configuration.
Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
---
.../devicetree/bindings/net/dsa/microchip,ksz.yaml | 89 +++++++++++++---------
1 file changed, 55 insertions(+), 34 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
index 62ca63e8a26fda0615cc254acca620f14f47cd10..2420e63d80249e533a34f992a0d3d12d926a3aa6 100644
--- a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
@@ -10,9 +10,6 @@ maintainers:
- Marek Vasut <marex@denx.de>
- Woojung Huh <Woojung.Huh@microchip.com>
-allOf:
- - $ref: /schemas/spi/spi-peripheral-props.yaml#
-
properties:
# See Documentation/devicetree/bindings/net/dsa/dsa.yaml for a list of additional
# required and optional properties.
@@ -106,38 +103,62 @@ required:
- compatible
- reg
-if:
- not:
- properties:
- compatible:
- enum:
- - microchip,ksz8863
- - microchip,ksz8873
-then:
- $ref: dsa.yaml#/$defs/ethernet-ports
-else:
- patternProperties:
- "^(ethernet-)?ports$":
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+ - if:
+ not:
+ properties:
+ compatible:
+ enum:
+ - microchip,ksz8863
+ - microchip,ksz8873
+ then:
+ $ref: dsa.yaml#/$defs/ethernet-ports
+ else:
patternProperties:
- "^(ethernet-)?port@[0-2]$":
- $ref: dsa-port.yaml#
- unevaluatedProperties: false
- properties:
- microchip,rmii-clk-internal:
- $ref: /schemas/types.yaml#/definitions/flag
- description:
- When ksz88x3 is acting as clock provier (via REFCLKO) it
- can select between internal and external RMII reference
- clock. Internal reference clock means that the clock for
- the RMII of ksz88x3 is provided by the ksz88x3 internally
- and the REFCLKI pin is unconnected. For the external
- reference clock, the clock needs to be fed back to ksz88x3
- via REFCLKI.
- If microchip,rmii-clk-internal is set, ksz88x3 will provide
- rmii reference clock internally, otherwise reference clock
- should be provided externally.
- dependencies:
- microchip,rmii-clk-internal: [ethernet]
+ "^(ethernet-)?ports$":
+ patternProperties:
+ "^(ethernet-)?port@[0-2]$":
+ $ref: dsa-port.yaml#
+ unevaluatedProperties: false
+ properties:
+ microchip,rmii-clk-internal:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description:
+ When ksz88x3 is acting as clock provier (via REFCLKO) it
+ can select between internal and external RMII reference
+ clock. Internal reference clock means that the clock for
+ the RMII of ksz88x3 is provided by the ksz88x3 internally
+ and the REFCLKI pin is unconnected. For the external
+ reference clock, the clock needs to be fed back to ksz88x3
+ via REFCLKI.
+ If microchip,rmii-clk-internal is set, ksz88x3 will provide
+ rmii reference clock internally, otherwise reference clock
+ should be provided externally.
+ dependencies:
+ microchip,rmii-clk-internal: [ethernet]
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - microchip,ksz8765
+ - microchip,ksz8794
+ - microchip,ksz8795
+ - microchip,ksz8863
+ - microchip,ksz8873
+ then:
+ properties:
+ microchip,led-mode:
+ description:
+ Set LED mode for ksz8765, ksz8794 or ksz8795 (Register 0x0B, bits 5..4)
+ and ksz8863 or ksz8873 (Register 0xC3, bits 5..4).
+ items:
+ enum:
+ - 0 # LED0: Link/ACT, LED1: Speed
+ - 1 # LED0: Link, LED1: ACT
+ - 2 # LED0: Link/ACT, LED1: Duplex
+ - 3 # LED0: Link, LED1: Duplex
unevaluatedProperties: false
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/2] net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3
2024-12-09 17:58 [PATCH net-next 0/2] net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3 Fedor Ross
2024-12-09 17:58 ` [PATCH net-next 1/2] " Fedor Ross
2024-12-09 17:58 ` [PATCH net-next 2/2] dt-bindings: " Fedor Ross
@ 2024-12-09 18:22 ` Andrew Lunn
2024-12-09 20:26 ` Marek Vasut
2024-12-17 18:57 ` fedor.ross
2 siblings, 2 replies; 7+ messages in thread
From: Andrew Lunn @ 2024-12-09 18:22 UTC (permalink / raw)
To: Fedor Ross
Cc: Woojung Huh, UNGLinuxDriver, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Marek Vasut, netdev,
linux-kernel, devicetree, Tristram Ha
On Mon, Dec 09, 2024 at 06:58:50PM +0100, Fedor Ross wrote:
> Add support for the led-mode property for the following PHYs which have
> a single LED mode configuration value.
>
> KSZ8765, KSZ8794 and KSZ8795 use register 0x0b bits 5,4 to control the
> LED configuration.
>
> KSZ8863 and KSZ8873 use register 0xc3 bits 5,4 to control the LED
> configuration.
PHY and MAC LEDs should be configured via /sys/class/leds. Please take
a look at how the Marvell PHY and DSA driver, qca8k driver etc do
LEDs.
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/2] net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3
2024-12-09 18:22 ` [PATCH net-next 0/2] " Andrew Lunn
@ 2024-12-09 20:26 ` Marek Vasut
2024-12-17 13:34 ` Rob Herring
2024-12-17 18:57 ` fedor.ross
1 sibling, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2024-12-09 20:26 UTC (permalink / raw)
To: Andrew Lunn, Fedor Ross
Cc: Woojung Huh, UNGLinuxDriver, Vladimir Oltean, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, netdev, linux-kernel,
devicetree, Tristram Ha
On 12/9/24 7:22 PM, Andrew Lunn wrote:
> On Mon, Dec 09, 2024 at 06:58:50PM +0100, Fedor Ross wrote:
>> Add support for the led-mode property for the following PHYs which have
>> a single LED mode configuration value.
>>
>> KSZ8765, KSZ8794 and KSZ8795 use register 0x0b bits 5,4 to control the
>> LED configuration.
>>
>> KSZ8863 and KSZ8873 use register 0xc3 bits 5,4 to control the LED
>> configuration.
>
> PHY and MAC LEDs should be configured via /sys/class/leds. Please take
> a look at how the Marvell PHY and DSA driver, qca8k driver etc do
> LEDs.
According to KSZ8794 datasheet, this register 0xb is Global Control:
Register 11 (0x0B): Global Control 9
So this does not seems like per-port LED control, but rather some global
control for all LEDs on all ports on the chip ?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/2] net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3
2024-12-09 20:26 ` Marek Vasut
@ 2024-12-17 13:34 ` Rob Herring
0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2024-12-17 13:34 UTC (permalink / raw)
To: Marek Vasut
Cc: Andrew Lunn, Fedor Ross, Woojung Huh, UNGLinuxDriver,
Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Krzysztof Kozlowski, Conor Dooley, netdev,
linux-kernel, devicetree, Tristram Ha
On Mon, Dec 09, 2024 at 09:26:33PM +0100, Marek Vasut wrote:
> On 12/9/24 7:22 PM, Andrew Lunn wrote:
> > On Mon, Dec 09, 2024 at 06:58:50PM +0100, Fedor Ross wrote:
> > > Add support for the led-mode property for the following PHYs which have
> > > a single LED mode configuration value.
> > >
> > > KSZ8765, KSZ8794 and KSZ8795 use register 0x0b bits 5,4 to control the
> > > LED configuration.
> > >
> > > KSZ8863 and KSZ8873 use register 0xc3 bits 5,4 to control the LED
> > > configuration.
> >
> > PHY and MAC LEDs should be configured via /sys/class/leds. Please take
> > a look at how the Marvell PHY and DSA driver, qca8k driver etc do
> > LEDs.
> According to KSZ8794 datasheet, this register 0xb is Global Control:
>
> Register 11 (0x0B): Global Control 9
>
> So this does not seems like per-port LED control, but rather some global
> control for all LEDs on all ports on the chip ?
Still should be able to use the standard binding and sysfs controls. The
driver just has to reject invalid combinations.
Rob
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next 0/2] net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3
2024-12-09 18:22 ` [PATCH net-next 0/2] " Andrew Lunn
2024-12-09 20:26 ` Marek Vasut
@ 2024-12-17 18:57 ` fedor.ross
1 sibling, 0 replies; 7+ messages in thread
From: fedor.ross @ 2024-12-17 18:57 UTC (permalink / raw)
To: andrew
Cc: UNGLinuxDriver, conor+dt, davem, devicetree, edumazet, fedor.ross,
krzk+dt, kuba, linux-kernel, marex, netdev, olteanv, pabeni, robh,
tristram.ha, woojung.huh
On 12/9/24 7:22 PM, Andrew Lunn wrote:
> On Mon, Dec 09, 2024 at 06:58:50PM +0100, Fedor Ross wrote:
> > Add support for the led-mode property for the following PHYs which have
> > a single LED mode configuration value.
> >
> > KSZ8765, KSZ8794 and KSZ8795 use register 0x0b bits 5,4 to control the
> > LED configuration.
> >
> > KSZ8863 and KSZ8873 use register 0xc3 bits 5,4 to control the LED
> > configuration.
>
> PHY and MAC LEDs should be configured via /sys/class/leds. Please take
> a look at how the Marvell PHY and DSA driver, qca8k driver etc do
> LEDs.
I'll take a look at it. Thanks for your input.
Best regards,
Fedor
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-17 19:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-09 17:58 [PATCH net-next 0/2] net: dsa: microchip: Add of config for LED mode for ksz87xx and ksz88x3 Fedor Ross
2024-12-09 17:58 ` [PATCH net-next 1/2] " Fedor Ross
2024-12-09 17:58 ` [PATCH net-next 2/2] dt-bindings: " Fedor Ross
2024-12-09 18:22 ` [PATCH net-next 0/2] " Andrew Lunn
2024-12-09 20:26 ` Marek Vasut
2024-12-17 13:34 ` Rob Herring
2024-12-17 18:57 ` fedor.ross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).