mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
r8169: add LED configuration from OF
This commit is contained in:
parent
ae12d2f77b
commit
edcc283381
@ -400,7 +400,7 @@
|
|||||||
vpcie3v3-supply = <&vcc3v3_pcie>;
|
vpcie3v3-supply = <&vcc3v3_pcie>;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
|
|
||||||
pcie@10 {
|
pcie@0,0 {
|
||||||
reg = <0x00100000 0 0 0 0>;
|
reg = <0x00100000 0 0 0 0>;
|
||||||
#address-cells = <3>;
|
#address-cells = <3>;
|
||||||
#size-cells = <2>;
|
#size-cells = <2>;
|
||||||
@ -409,7 +409,7 @@
|
|||||||
compatible = "pci10ec,8125";
|
compatible = "pci10ec,8125";
|
||||||
reg = <0x000000 0 0 0 0>;
|
reg = <0x000000 0 0 0 0>;
|
||||||
|
|
||||||
realtek,led-data = <0x4078>;
|
realtek,led-data = <0x238>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -420,7 +420,7 @@
|
|||||||
vpcie3v3-supply = <&vcc3v3_pcie>;
|
vpcie3v3-supply = <&vcc3v3_pcie>;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
|
|
||||||
pcie@20 {
|
pcie@0,0 {
|
||||||
reg = <0x00200000 0 0 0 0>;
|
reg = <0x00200000 0 0 0 0>;
|
||||||
#address-cells = <3>;
|
#address-cells = <3>;
|
||||||
#size-cells = <2>;
|
#size-cells = <2>;
|
||||||
@ -429,7 +429,7 @@
|
|||||||
compatible = "pci10ec,8125";
|
compatible = "pci10ec,8125";
|
||||||
reg = <0x000000 0 0 0 0>;
|
reg = <0x000000 0 0 0 0>;
|
||||||
|
|
||||||
realtek,led-data = <0x4078>;
|
realtek,led-data = <0x238>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||||
|
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||||
|
@@ -17,6 +17,7 @@
|
||||||
|
#include <linux/delay.h>
|
||||||
|
#include <linux/ethtool.h>
|
||||||
|
#include <linux/phy.h>
|
||||||
|
+#include <linux/of.h>
|
||||||
|
#include <linux/if_vlan.h>
|
||||||
|
#include <linux/in.h>
|
||||||
|
#include <linux/io.h>
|
||||||
|
@@ -183,6 +184,7 @@ enum rtl_registers {
|
||||||
|
MAR0 = 8, /* Multicast filter. */
|
||||||
|
CounterAddrLow = 0x10,
|
||||||
|
CounterAddrHigh = 0x14,
|
||||||
|
+ CustomLED = 0x18,
|
||||||
|
TxDescStartAddrLow = 0x20,
|
||||||
|
TxDescStartAddrHigh = 0x24,
|
||||||
|
TxHDescStartAddrLow = 0x28,
|
||||||
|
@@ -5274,6 +5276,22 @@ done:
|
||||||
|
rtl_rar_set(tp, mac_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int rtl_led_configuration(struct rtl8169_private *tp)
|
||||||
|
+{
|
||||||
|
+ u32 led_data;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = of_property_read_u32(tp->pci_dev->dev.of_node,
|
||||||
|
+ "realtek,led-data", &led_data);
|
||||||
|
+
|
||||||
|
+ if (ret)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ RTL_W16(tp, CustomLED, led_data);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
|
{
|
||||||
|
struct rtl8169_private *tp;
|
||||||
|
@@ -5438,6 +5456,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct
|
||||||
|
if (!tp->counters)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
+ rtl_led_configuration(tp);
|
||||||
|
pci_set_drvdata(pdev, tp);
|
||||||
|
|
||||||
|
rc = r8169_mdio_register(tp);
|
@ -0,0 +1,49 @@
|
|||||||
|
--- a/drivers/net/ethernet/realtek/r8169_main.c
|
||||||
|
+++ b/drivers/net/ethernet/realtek/r8169_main.c
|
||||||
|
@@ -17,6 +17,7 @@
|
||||||
|
#include <linux/delay.h>
|
||||||
|
#include <linux/ethtool.h>
|
||||||
|
#include <linux/phy.h>
|
||||||
|
+#include <linux/of.h>
|
||||||
|
#include <linux/if_vlan.h>
|
||||||
|
#include <linux/in.h>
|
||||||
|
#include <linux/io.h>
|
||||||
|
@@ -183,6 +184,7 @@ enum rtl_registers {
|
||||||
|
MAR0 = 8, /* Multicast filter. */
|
||||||
|
CounterAddrLow = 0x10,
|
||||||
|
CounterAddrHigh = 0x14,
|
||||||
|
+ CustomLED = 0x18,
|
||||||
|
TxDescStartAddrLow = 0x20,
|
||||||
|
TxDescStartAddrHigh = 0x24,
|
||||||
|
TxHDescStartAddrLow = 0x28,
|
||||||
|
@@ -5274,6 +5276,22 @@ done:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int rtl_led_configuration(struct rtl8169_private *tp)
|
||||||
|
+{
|
||||||
|
+ u32 led_data;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = of_property_read_u32(tp->pci_dev->dev.of_node,
|
||||||
|
+ "realtek,led-data", &led_data);
|
||||||
|
+
|
||||||
|
+ if (ret)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ RTL_W16(tp, CustomLED, led_data);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
|
{
|
||||||
|
struct rtl8169_private *tp;
|
||||||
|
@@ -5438,6 +5456,7 @@ static int rtl_init_one(struct pci_dev *pdev, const struct
|
||||||
|
if (!tp->counters)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
+ rtl_led_configuration(tp);
|
||||||
|
pci_set_drvdata(pdev, tp);
|
||||||
|
|
||||||
|
rc = r8169_mdio_register(tp);
|
Loading…
Reference in New Issue
Block a user