From 8e8f283dbd843f3f7ead8e1e7ff5e73fb664ba03 Mon Sep 17 00:00:00 2001 From: Yue Wang Date: Tue, 4 Jul 2017 16:12:13 +0800 Subject: [PATCH] pcie: support broadcom wifi ap6356p. PD#146975: pcie: support broadcom wifi ap6356p. Change-Id: Iec6877c0b34dbc213711071427ccca786396b12b Signed-off-by: Yue Wang --- arch/arm64/boot/dts/amlogic/axg_a113d_skt.dts | 8 +++----- arch/arm64/boot/dts/amlogic/axg_s400.dts | 8 +++----- drivers/pci/quirks.c | 17 +++++++++++++++++ include/linux/pci_ids.h | 5 +++++ 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/axg_a113d_skt.dts b/arch/arm64/boot/dts/amlogic/axg_a113d_skt.dts index 1d05b03..7813e69 100644 --- a/arch/arm64/boot/dts/amlogic/axg_a113d_skt.dts +++ b/arch/arm64/boot/dts/amlogic/axg_a113d_skt.dts @@ -298,7 +298,7 @@ 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>; @@ -307,9 +307,7 @@ #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>; @@ -338,7 +336,7 @@ #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 */ diff --git a/arch/arm64/boot/dts/amlogic/axg_s400.dts b/arch/arm64/boot/dts/amlogic/axg_s400.dts index 92d3ff7..3858639 100644 --- a/arch/arm64/boot/dts/amlogic/axg_s400.dts +++ b/arch/arm64/boot/dts/amlogic/axg_s400.dts @@ -305,7 +305,7 @@ 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>; @@ -314,9 +314,7 @@ #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>; @@ -345,7 +343,7 @@ #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 */ diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 5d8151b..de20b29 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -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 */ diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 3e5dbbe..3471a71 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -3053,4 +3053,9 @@ #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 */ -- 2.7.4