mpc85xx: tl-wdr4900: move platform code to dts
authorRosen Penev <rosenp@gmail.com>
Mon, 19 Aug 2024 22:08:55 +0000 (15:08 -0700)
committerRobert Marko <robimarko@gmail.com>
Wed, 21 Aug 2024 19:39:24 +0000 (21:39 +0200)
No benefit in doing so in platform file. Code for dts has already been
written. Might as well use it.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16125
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts
target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/tl_wdr4900_v1.c

index d8162f0dff5503188b69a56bd1e179bc2a6de45a..91baba0cd7743c31fad45af7ed5d080b369e6b3e 100644 (file)
                                  0x1000000 0x0 0x0
                                  0x0 0x100000>;
 
-                       wifi@0,0 {
+                       ath9k: wifi@0,0 {
                                compatible = "pci168c,0033";
                                reg = <0x0000 0 0 0 0>;
+                               #gpio-cells = <2>;
+                               gpio-controller;
+                               qca,led-pin = /bits/ 8 <0>;
                                nvmem-cells = <&cal_caldata_1000>, <&macaddr_uboot_4fc00 0>;
                                nvmem-cell-names = "calibration", "mac-address";
                        };
                        wifi@0,0 {
                                compatible = "pci168c,0030";
                                reg = <0x0000 0 0 0 0>;
+                               /*
+                               * The PCI header of the AR9381 chip is not programmed
+                               * correctly by the bootloader and the device uses wrong
+                               * data due to that. Replace the broken values with the
+                               * correct ones.
+                               */
+                               device-id = <0x0030>;
+                               class-code = <0x028000>;
+                               qca,led-pin = /bits/ 8 <0>;
                                nvmem-cells = <&cal_caldata_5000>, <&macaddr_uboot_4fc00 (-1)>;
                                nvmem-cell-names = "calibration", "mac-address";
                        };
        leds {
                compatible = "gpio-leds";
 
+               wps {
+                       gpios = <&ath9k 1 GPIO_ACTIVE_LOW>;
+                       label = "tp-link:green:wps";
+               };
+
                system_green: system {
                        gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
                        label = "tp-link:blue:system";
index 095f1fb77d59612640f19e0a63954fe85da9a2cb..22c4ad3fc4c67542f2c8908aa5347e30a9e7fbb0 100644 (file)
@@ -47,58 +47,6 @@ void __init tl_wdr4900_v1_pic_init(void)
        mpic_init(mpic);
 }
 
-#ifdef CONFIG_PCI
-static struct gpio_led tl_wdr4900_v1_wmac_leds_gpio[] = {
-       {
-               .name           = "tp-link:blue:wps",
-               .gpio           = 1,
-               .active_low     = 1,
-       },
-};
-
-static struct ath9k_platform_data tl_wdr4900_v1_wmac0_data = {
-       .led_pin = 0,
-       .leds = tl_wdr4900_v1_wmac_leds_gpio,
-       .num_leds = ARRAY_SIZE(tl_wdr4900_v1_wmac_leds_gpio),
-};
-
-static struct ath9k_platform_data tl_wdr4900_v1_wmac1_data = {
-       .led_pin = 0,
-};
-
-static void tl_wdr4900_v1_pci_wmac_fixup(struct pci_dev *dev)
-{
-       if (!machine_is(tl_wdr4900_v1))
-               return;
-
-       if (dev->bus->number == 1 &&
-           PCI_SLOT(dev->devfn) == 0) {
-               dev->dev.platform_data = &tl_wdr4900_v1_wmac0_data;
-               return;
-       }
-
-       if (dev->bus->number == 3 &&
-           PCI_SLOT(dev->devfn) == 0 &&
-           dev->device == 0xabcd) {
-               dev->dev.platform_data = &tl_wdr4900_v1_wmac1_data;
-
-               /*
-                * The PCI header of the AR9381 chip is not programmed
-                * correctly by the bootloader and the device uses wrong
-                * data due to that. Replace the broken values with the
-                * correct ones.
-                */
-               dev->device = 0x30;
-               dev->class = 0x028000;
-
-               pr_info("pci %s: AR9381 fixup applied\n", pci_name(dev));
-       }
-}
-
-DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID,
-                       tl_wdr4900_v1_pci_wmac_fixup);
-#endif /* CONFIG_PCI */
-
 /*
  * Setup the architecture
  */