-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
realtek: Refactor rtl930x leds #11898
base: main
Are you sure you want to change the base?
Changes from all commits
91e9d4b
ea3eb0c
725d6a4
2325341
f92c01e
8d05caa
cfac8b4
82cc7b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
#include <dt-bindings/input/input.h> | ||
#include <dt-bindings/gpio/gpio.h> | ||
#include <dt-bindings/leds/common.h> | ||
#include <dt-bindings/leds/leds-realtek.h> | ||
|
||
/ { | ||
compatible = "zyxel,xgs1250-12", "realtek,rtl838x-soc"; | ||
|
@@ -62,14 +63,78 @@ | |
tx-disable-gpio = <&gpio0 15 GPIO_ACTIVE_HIGH>; | ||
}; | ||
|
||
led_set: led_set@0 { | ||
compatible = "realtek,rtl9300-leds"; | ||
active-low; | ||
led_sets { | ||
compatible = "realtek,rtl9302-leds", "realtek,rtl930x-leds"; | ||
|
||
led_set0 = <0x0000 0xffff 0x0a20 0x0b80>; // LED set 0: 1000Mbps, 10/100Mbps | ||
led_set1 = <0x0a0b 0x0a28 0x0a82 0x0a0b>; // LED set 1: (10G, 5G, 2.5G) (2.5G, 1G) | ||
// (5G, 10/100) (10G, 5G, 2.5G) | ||
led_set2 = <0x0000 0xffff 0x0a20 0x0a01>; // LED set 2: 1000MBit, 10GBit | ||
led_set0 = /bits/ 16 < | ||
/* LED0 */ | ||
( | ||
RTL93XX_LED_SET_LINK_ACTIVITY | | ||
RTL93XX_LED_SET_LINK_UP_SOLID | | ||
RTL93XX_LED_SET_100M_LINK | | ||
RTL93XX_LED_SET_10M_LINK | ||
) | ||
/* LED1 */ | ||
( | ||
RTL93XX_LED_SET_LINK_ACTIVITY | | ||
RTL93XX_LED_SET_LINK_UP_SOLID | | ||
RTL93XX_LED_SET_1000M_LINK | ||
) | ||
/* LED2 */ | ||
RTL93XX_LED_SET_NONE | ||
/* LED3 */ | ||
RTL93XX_LED_SET_NONE | ||
>; | ||
led_set2 = /bits/ 16 < | ||
/* LED0 */ | ||
( | ||
RTL93XX_LED_SET_LINK_ACTIVITY | | ||
RTL93XX_LED_SET_LINK_UP_SOLID | | ||
RTL93XX_LED_SET_10G_LINK | | ||
RTL93XX_LED_SET_5G_LINK | | ||
RTL93XX_LED_SET_2G5_LINK | ||
) | ||
/* LED1 */ | ||
( | ||
RTL93XX_LED_SET_LINK_ACTIVITY | | ||
RTL93XX_LED_SET_LINK_UP_SOLID | | ||
RTL93XX_LED_SET_5G_LINK | | ||
RTL93XX_LED_SET_100M_LINK | ||
) | ||
/* LED2 */ | ||
( | ||
RTL93XX_LED_SET_LINK_ACTIVITY | | ||
RTL93XX_LED_SET_LINK_UP_SOLID | | ||
RTL93XX_LED_SET_2G5_LINK | | ||
RTL93XX_LED_SET_1000M_LINK | ||
) | ||
/* LED3 */ | ||
( | ||
RTL93XX_LED_SET_LINK_ACTIVITY | | ||
RTL93XX_LED_SET_LINK_UP_SOLID | | ||
RTL93XX_LED_SET_10G_LINK | | ||
RTL93XX_LED_SET_5G_LINK | | ||
RTL93XX_LED_SET_2G5_LINK | ||
) | ||
>; | ||
led_set3 = /bits/ 16 < | ||
/* LED0 */ | ||
( | ||
RTL93XX_LED_SET_LINK_ACTIVITY | | ||
RTL93XX_LED_SET_LINK_UP_SOLID | | ||
RTL93XX_LED_SET_10G_LINK | ||
) | ||
/* LED1 */ | ||
( | ||
RTL93XX_LED_SET_LINK_ACTIVITY | | ||
RTL93XX_LED_SET_LINK_UP_SOLID | | ||
RTL93XX_LED_SET_1000M_LINK | ||
) | ||
/* LED2 */ | ||
RTL93XX_LED_SET_NONE | ||
/* LED3 */ | ||
RTL93XX_LED_SET_NONE | ||
>; | ||
}; | ||
}; | ||
|
||
|
@@ -224,77 +289,127 @@ | |
phy-handle = <&phy0>; | ||
phy-mode = "xgmii"; | ||
led-set = <0>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Amber */ | ||
RTL93XX_LED_NUM1 /* Lime */ | ||
)>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
My proposed led controller driver handled this by requiring every used LED to be defined individually. The driver would then determine how to configure the hardware in the most appropriate way. So in a sense what you're adding here is similar. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Well we already had led-set, there's nothing new here, I only added led-num. And yes, they would have to be 'realtek,rtl93xx-led-set' at the least :p but I also do not intend to upstream either of those (hopefully). These are temporary, until we can go to a better driver. And then, it'll need to cover all our cases obviously.
Yeah, I saw that, but then, I don't like that either. While this is certainly the wrong place to discuss future design :p why I didn't like it, is because that allows you to have an arbitrary led setup, which sounds perfect, except you are restricted to the 4 (for rtl93xx), 3 afaik for rtl839x? So now you have some very deep complexity in figuring this out. Ideally, you'd refer a led here via a phandle and which 'mode', but the mode bit doesn't exist yet (which you struggled with too). But again, wrong time/place. And something we should deff. have a brainstorming session over. |
||
}; | ||
port@1 { | ||
reg = <1>; | ||
label = "lan2"; | ||
phy-handle = <&phy1>; | ||
phy-mode = "xgmii"; | ||
led-set = <0>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Amber */ | ||
RTL93XX_LED_NUM1 /* Lime */ | ||
)>; | ||
}; | ||
port@2 { | ||
reg = <2>; | ||
label = "lan3"; | ||
phy-handle = <&phy2>; | ||
phy-mode = "xgmii"; | ||
led-set = <0>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Amber */ | ||
RTL93XX_LED_NUM1 /* Lime */ | ||
)>; | ||
}; | ||
port@3 { | ||
reg = <3>; | ||
label = "lan4"; | ||
phy-handle = <&phy3>; | ||
phy-mode = "xgmii"; | ||
led-set = <0>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Amber */ | ||
RTL93XX_LED_NUM1 /* Lime */ | ||
)>; | ||
}; | ||
port@4 { | ||
reg = <4>; | ||
label = "lan5"; | ||
phy-handle = <&phy4>; | ||
phy-mode = "xgmii"; | ||
led-set = <0>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Amber */ | ||
RTL93XX_LED_NUM1 /* Lime */ | ||
)>; | ||
}; | ||
port@5 { | ||
reg = <5>; | ||
label = "lan6"; | ||
phy-handle = <&phy5>; | ||
phy-mode = "xgmii"; | ||
led-set = <0>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Amber */ | ||
RTL93XX_LED_NUM1 /* Lime */ | ||
)>; | ||
}; | ||
port@6 { | ||
reg = <6>; | ||
label = "lan7"; | ||
phy-handle = <&phy6>; | ||
phy-mode = "xgmii"; | ||
led-set = <0>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Amber */ | ||
RTL93XX_LED_NUM1 /* Lime */ | ||
)>; | ||
}; | ||
port@7 { | ||
reg = <7>; | ||
label = "lan8"; | ||
phy-handle = <&phy7>; | ||
phy-mode = "xgmii"; | ||
led-set = <0>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Amber */ | ||
RTL93XX_LED_NUM1 /* Lime */ | ||
)>; | ||
}; | ||
|
||
port@24 { | ||
reg = <24>; | ||
label = "lan9"; | ||
phy-mode = "usxgmii"; | ||
phy-handle = <&phy24>; | ||
led-set = <1>; | ||
led-set = <2>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Amber/Lime | RGB */ | ||
RTL93XX_LED_NUM1 | /* Amber | Red */ | ||
RTL93XX_LED_NUM2 | /* Lime | Green */ | ||
RTL93XX_LED_NUM3 /* off | Blue */ | ||
)>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still can't believe they wired the LEDs this way... I think it makes it pretty much impossible to allow all five LED components to be configured to userspace control (because one pin is essentially a mux now). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. five? thought it was 4? anyway, yeah, and that's exactly my point above, it's not so black/white trivial. So (ignoring the warts and uglyness what this patch propses) it is atleast 'somewhat' logical, but even that falls on its ass (when you look at the led configuration, 1G_ACTIVE etc) where you have to keep in mind that it's a mux you are setting up ... It's just very nasty, not just how they hooked up the leds, more how this is what the hardware allows (an in documentation encourages to a point). |
||
}; | ||
port@25 { | ||
reg = <25>; | ||
label = "lan10"; | ||
phy-mode = "usxgmii"; | ||
phy-handle = <&phy25>; | ||
led-set = <1>; | ||
led-set = <2>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Amber/Lime | RGB */ | ||
RTL93XX_LED_NUM1 | /* Amber | Red */ | ||
RTL93XX_LED_NUM2 | /* Lime | Green */ | ||
RTL93XX_LED_NUM3 /* off | Blue */ | ||
)>; | ||
}; | ||
port@26 { | ||
reg = <26>; | ||
label = "lan11"; | ||
phy-mode = "usxgmii"; | ||
phy-handle = <&phy26>; | ||
led-set = <1>; | ||
led-set = <2>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Amber/Lime | RGB */ | ||
RTL93XX_LED_NUM1 | /* Amber | Red */ | ||
RTL93XX_LED_NUM2 | /* Lime | Green */ | ||
RTL93XX_LED_NUM3 /* off | Blue */ | ||
)>; | ||
}; | ||
|
||
port@27 { | ||
|
@@ -303,7 +418,11 @@ | |
phy-mode = "10gbase-r"; | ||
phy-handle = <&phy27>; | ||
sfp = <&sfp0>; | ||
led-set = <2>; | ||
led-set = <3>; | ||
led-num = <( | ||
RTL93XX_LED_NUM0 | /* Blue */ | ||
RTL93XX_LED_NUM1 /* Lime */ | ||
)>; | ||
|
||
fixed-link { | ||
speed = <10000>; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, I'd recommend also adding the 10M here, by default, we get no light all, and officially 10M isn't supported, but of course it works just fine, and amber is 100/10 on GE ports ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Officially not supported by Zyxel? Because the LED controller hardware does appear to support it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10M? it works fine on my RTL8226 ports, but you have your aquantica MAC's there, so they may not support it.
I thus only recommended it, if you can confirm (with
ethtool -s 10M
on the host) if the port actually works. It does for me, and the leds indicate it all properly. Btw, the 10/100M support on those ports I added later in my patch series only, though I don't think it affects the aquantia? I can't test that, but if you start testing this stuff, take my WIP or DEV branches's tip to get all those patches and fixes.zyxel ignores 10M, but having a 'black' led, when 10M is connected is super weird too, even if it works. And disabling it in openwrt/software feels wrong too. If the hardware fully works with it, why not?