summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Eckelmann2025-08-20 03:19:31 +0000
committerRobert Marko2025-09-03 07:54:51 +0000
commitea5a749311a5c1a5dce85915e0039b1db93f703e (patch)
treee8f0d1662e63ebbec3b1a14e15c20e172d8cab9b
parent93113a745a24c114b9994b680ca290a00b0a7c1d (diff)
downloadopenwrt-ea5a749311a5c1a5dce85915e0039b1db93f703e.tar.gz
realtek: rtl931x: Add LED Sync configuration
The pinmux-related registers on the RTL931X SoC family are spread across various non-consecutive registers. It might be tempting to modify them directly in a specific driver (SPI, LED, etc.), but this would cause issues with parallel, non-locked read-modify-write operations, which are required to update individual portions of these registers. Instead, it is better to use the devicetree pinctrl properties to define the correct configurations for the various operation modes. One important setting here is the LED Sync bit. This allows the LED controller to generate an additional positive edge on the `STCP` ("STore Clock Pin", also known as `RCLK`) of the LED shift register after the actual content has already been shifted in using the normal shift clock. The LED shift register is then expected to copy the content from the shift register section into the storage registers, which act as the actual LED output control. This functionality is available in, and commonly used with, the SNx4HC595 family of shift registers. To activate it, simply register it in the default state of the "realtek,rtl83xx-switch" node: &switch0 { pinctrl-names = "default"; pinctrl-0 = <&pinmux_enable_led_sync>; .... }; It would be nicer when this can be directly added to the led subnode. But for this to work, `realtek,rtl9300-leds` must first be an actual driver (known to the driver core). [1] https://www.ti.com/lit/ds/symlink/sn74hc595.pdf Suggested-by: Bevan Weiss <bevan.weiss@gmail.com> Signed-off-by: Sven Eckelmann <sven@narfation.org> Link: https://github.com/openwrt/openwrt/pull/19815 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--target/linux/realtek/dts/rtl931x.dtsi9
1 files changed, 9 insertions, 0 deletions
diff --git a/target/linux/realtek/dts/rtl931x.dtsi b/target/linux/realtek/dts/rtl931x.dtsi
index 54a304019c..462c3ea9b0 100644
--- a/target/linux/realtek/dts/rtl931x.dtsi
+++ b/target/linux/realtek/dts/rtl931x.dtsi
@@ -231,6 +231,15 @@
pinctrl-single,function-mask = <0x1>;
#pinctrl-cells = <2>;
+ /* Enable GPIO 31 */
+ pinmux_disable_led_sync: disable-led-sync {
+ pinctrl-single,bits = <0x0 0x0 0x10000>;
+ };
+
+ pinmux_enable_led_sync: enable-led-sync {
+ pinctrl-single,bits = <0x0 0x10000 0x10000>;
+ };
+
/* Enable GPIO6 and GPIO7, possibly unknown others */
pinmux_disable_jtag: disable_jtag {
pinctrl-single,bits = <0x0 0x0 0x8000>;