pcie: support broadcom wifi ap6356p.
authorYue Wang <yue.wang@amlogic.com>
Tue, 4 Jul 2017 08:12:13 +0000 (16:12 +0800)
committerYue Wang <yue.wang@amlogic.com>
Tue, 4 Jul 2017 08:18:47 +0000 (16:18 +0800)
PD#146975: pcie: support broadcom wifi ap6356p.

Change-Id: Iec6877c0b34dbc213711071427ccca786396b12b
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
arch/arm64/boot/dts/amlogic/axg_a113d_skt.dts
arch/arm64/boot/dts/amlogic/axg_s400.dts
drivers/pci/quirks.c
include/linux/pci_ids.h

index 1d05b03..7813e69 100644 (file)
                                0x0 0xff644000 0x0 0x2000
                                0x0 0xff646000 0x0 0x2000
                                0x0 0xffd01080 0x0 0x10
-                               0x0 0xf9c00000 0x0 0x100000>;
+                               0x0 0xf9f00000 0x0 0x100000>;
                reg-names = "elbi", "phy", "cfg", "reset", "config";
                reset-gpio = <&gpio GPIOX_19 GPIO_ACTIVE_HIGH>;
                interrupts = <0 177 0>, <0 179 0>;
                #address-cells = <3>;
                #size-cells = <2>;
                device_type = "pci";
-               ranges = <0x81000000 0 0          0 0xf9d00000  0x0 0x10000
-                       /*downstream I/O */
-                         0x82000000 0 0xf9d10000 0x0 0xf9d10000 0 0x002f0000>;
+               ranges = <0x82000000 0 0 0x0 0xf9c00000 0 0x00300000>;
                        /* non-prefetchable memory */
                num-lanes = <1>;
                pcie-num = <1>;
                #address-cells = <3>;
                #size-cells = <2>;
                device_type = "pci";
-               ranges = <0x81000000 0 0          0  0xfa500000 0x0 0x10000
+               ranges = <0x81000000 0 0 0 0xfa500000 0x0 0x10000
                        /* downstream I/O */
                        0x82000000 0 0xfa510000 0x0 0xfa510000 0 0x002f0000>;
                        /* non-prefetchable memory */
index 92d3ff7..3858639 100644 (file)
                                0x0 0xff644000 0x0 0x2000
                                0x0 0xff646000 0x0 0x2000
                                0x0 0xffd01080 0x0 0x10
-                               0x0 0xf9c00000 0x0 0x100000>;
+                               0x0 0xf9f00000 0x0 0x100000>;
                reg-names = "elbi", "phy", "cfg", "reset", "config";
                reset-gpio = <&gpio GPIOX_19 GPIO_ACTIVE_HIGH>;
                interrupts = <0 177 0>, <0 179 0>;
                #address-cells = <3>;
                #size-cells = <2>;
                device_type = "pci";
-               ranges = <0x81000000 0 0          0 0xf9d00000  0x0 0x10000
-                       /*downstream I/O */
-                         0x82000000 0 0xf9d10000 0x0 0xf9d10000 0 0x002f0000>;
+               ranges = <0x82000000 0 0 0x0 0xf9c00000 0 0x00300000>;
                        /* non-prefetchable memory */
                num-lanes = <1>;
                pcie-num = <1>;
                #address-cells = <3>;
                #size-cells = <2>;
                device_type = "pci";
-               ranges = <0x81000000 0 0          0  0xfa500000 0x0 0x10000
+               ranges = <0x81000000 0 0 0 0xfa500000 0x0 0x10000
                        /* downstream I/O */
                        0x82000000 0 0xfa510000 0x0 0xfa510000 0 0x002f0000>;
                        /* non-prefetchable memory */
index 5d8151b..de20b29 100644 (file)
@@ -1117,6 +1117,23 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x7900, quirk_amd_ide_mode);
 DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, 0x7900, quirk_amd_ide_mode);
 
+#ifdef CONFIG_AMLOGIC_PCIE
+/*
+ *     set broadcom wifi ap6356p bar2 to 2MB
+ */
+static void quirk_broadcom_ap6356p(struct pci_dev *pdev)
+{
+       unsigned short rbarctrl = 0;
+       unsigned short rbarctrln = 0;
+
+       pci_read_config_word(pdev, 0x228, &rbarctrl);
+       pci_write_config_word(pdev, 0x228, ((rbarctrl & 0xff) | 0x100));
+       pci_read_config_word(pdev, 0x228, &rbarctrln);
+       dev_printk(KERN_DEBUG, &pdev->dev, "change 0x228, rbarctrl=%x->%x\n", rbarctrl, rbarctrln);
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AP6356P, PCI_DEVICE_ID_AP6356P, quirk_broadcom_ap6356p);
+#endif
+
 /*
  *     Serverworks CSB5 IDE does not fully support native mode
  */
index 3e5dbbe..3471a71 100644 (file)
 
 #define PCI_VENDOR_ID_OCZ              0x1b85
 
+#ifdef CONFIG_AMLOGIC_PCIE
+#define PCI_VENDOR_ID_AP6356P          0x14e4
+#define PCI_DEVICE_ID_AP6356P          0x43ec
+#endif
+
 #endif /* _LINUX_PCI_IDS_H */