Skip to content

Commit

Permalink
ramips: mt7621: D-Link Dxx-1xx0 device tree updates
Browse files Browse the repository at this point in the history
* Use `fixed-layout` and `mac-base` for nvmem nodes;
* Fixed `dmesg` warning `OF: Bad cell count for
  /palmbus@1e000000/spi@b00/flash@0/partitions` (thanks @neheb).
* Assign `lan` MAC address from nvmem node.
* Assign `phy0` and `phy1` MAC addresses from nvmem node, and drop
  devices from `/etc/hotplug.d/ieee80211/10_fix_wifi_mac`.
  Note: recently committed mt76/commit/65cc3daf2 allows specifying
  multiple MAC addresses for DBDC ICs such as MT7615DN.
* GPIO LED nodes:
  * Rename (`led-status-red`, `led-signal-top`, ...);
  * Sort by GPIO number;
  * Remove `label` property;
  * Add `color`, `function`, `function-enumerator` properties;
* Update LED alias assignments.

Signed-off-by: Rani Hod <[email protected]>
  • Loading branch information
raenye committed Oct 28, 2024
1 parent 851ac7e commit d29bb5f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 38 deletions.
74 changes: 49 additions & 25 deletions target/linux/ramips/dts/mt7621_dlink_dxx-1xx0-x1.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
aliases {
label-mac-device = &gmac0;

led-boot = &led_status_red;
led-failsafe = &led_status_green;
led-boot = &led_status_green;
led-failsafe = &led_status_red;
led-running = &led_status_green;
led-upgrade = &led_status_red;
};

keys {
compatible = "gpio-keys";

reset {
button-reset {
label = "reset";
gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
debounce-interval = <60>;
};

wps {
button-wps {
label = "wps";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
Expand All @@ -36,36 +36,44 @@
leds {
compatible = "gpio-leds";

led_status_red: status_red {
led_status_green: led-status-green {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
};

led_status_red: led-status-red {
color = <LED_COLOR_ID_RED>;
function = LED_FUNCTION_STATUS;
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};

led_status_green: status_green {
function = LED_FUNCTION_STATUS;
led-rssi-top {
color = <LED_COLOR_ID_GREEN>;
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
function = "signal"; //LED_FUNCTION_SIGNAL;
function-enumerator = <3>;
gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
};

rssi_low_red {
label = "red:rssilow";
gpios = <&gpio 25 GPIO_ACTIVE_LOW>;
led-rssi-middle {
color = <LED_COLOR_ID_GREEN>;
function = "signal"; //LED_FUNCTION_SIGNAL;
function-enumerator = <2>;
gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
};

rssi_low_green {
label = "green:rssilow";
led-rssi-bottom-green {
color = <LED_COLOR_ID_GREEN>;
function = "signal"; //LED_FUNCTION_SIGNAL;
function-enumerator = <1>;
gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
};

rssi_med_green {
label = "green:rssimed";
gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
};

rssi_high_green {
label = "green:rssihigh";
gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
led-rssi-bottom-red {
color = <LED_COLOR_ID_RED>;
function = "signal"; //LED_FUNCTION_SIGNAL;
function-enumerator = <1>;
gpios = <&gpio 25 GPIO_ACTIVE_LOW>;
};
};
};
Expand All @@ -77,11 +85,11 @@
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
#address-cells = <1>;
#size-cells = <1>;

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

partition@0 {
label = "u-boot";
Expand Down Expand Up @@ -110,7 +118,9 @@
};

macaddr_factory_e000: macaddr@e000 {
compatible = "mac-base";
reg = <0xe000 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
Expand All @@ -134,12 +144,26 @@
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&eeprom_factory_0>;
nvmem-cell-names = "eeprom";
/* The correct MAC addresses are set in 10_fix_wifi_mac. */

#address-cells = <1>;
#size-cells = <0>;

band@0 { /* 2.4 GHz */
reg = <0>;
nvmem-cells = <&macaddr_factory_e000 1>;
nvmem-cell-names = "mac-address";
};

band@1 { /* 5 GHz */
reg = <1>;
nvmem-cells = <&macaddr_factory_e000 2>;
nvmem-cell-names = "mac-address";
};
};
};

&gmac0 {
nvmem-cells = <&macaddr_factory_e000>;
nvmem-cells = <&macaddr_factory_e000 0>;
nvmem-cell-names = "mac-address";
};

Expand Down
8 changes: 4 additions & 4 deletions target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ xzwifi,creativebox-v1)
dlink,dap-1620-b1|\
dlink,dra-1360-a1)
ucidef_set_rssimon "wlan1" "200000" "1"
ucidef_set_led_rssi "rssilow" "RSSILOW" "red:rssilow" "wlan1" "1" "40"
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "green:rssilow" "wlan1" "21" "100"
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "green:rssimed" "wlan1" "61" "100"
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:rssihigh" "wlan1" "81" "100"
ucidef_set_led_rssi "rssilow" "RSSILOW" "red:signal-1" "wlan1" "1" "40"
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "green:signal-1" "wlan1" "21" "100"
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "green:signal-2" "wlan1" "61" "100"
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:signal-3" "wlan1" "81" "100"
;;
dlink,dap-x1860-a1)
ucidef_set_rssimon "wlan1" "200000" "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@ case "$board" in
[ "$PHYNBR" = "1" ] && \
macaddr_setbit_la "$(macaddr_add $hw_mac_addr 0x100000)" > /sys${DEVPATH}/macaddress
;;
dlink,dap-1620-b1|\
dlink,dir-853-a1|\
dlink,dra-1360-a1)
lan_mac_addr="$(mtd_get_mac_binary factory 0xe000)"
[ "$PHYNBR" = "0" ] && \
macaddr_add $lan_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && \
macaddr_add $lan_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
dlink,covr-x1860-a1)
label_mac=$(mtd_get_mac_ascii config2 factory_mac)
[ "$PHYNBR" = "0" ] && \
Expand All @@ -72,6 +63,13 @@ case "$board" in
[ "$PHYNBR" = "0" ] && \
macaddr_add $lan_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
dlink,dir-853-a1)
lan_mac_addr="$(mtd_get_mac_binary factory 0xe000)"
[ "$PHYNBR" = "0" ] && \
macaddr_add $lan_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && \
macaddr_add $lan_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
dlink,dir-853-a3)
[ "$PHYNBR" = "0" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary factory 0xe000)" \
Expand Down

0 comments on commit d29bb5f

Please sign in to comment.