From 503fab647379ca8bf2c228a567109c3f822bdef0 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Tue, 24 Dec 2019 13:04:24 +0800 Subject: [PATCH] ipq40xx: update r619ac source code (#2441) * ipq40xx: revise r619ac dts * add r619ac pcie network card support on art * ipq40xx: fixed sdhci reset info bug --- .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 ++ .../arm/boot/dts/qcom-ipq4019-r619ac.dtsi | 35 +++++++++--- .../arm/boot/dts/qcom-ipq4019-r619ac.dtsi | 15 ++++- .../854-add-sdhci-reset-implementation.patch | 57 +++++++++++++++++++ .../854-add-sdhci-reset-implementation.patch | 57 +++++++++++++++++++ 5 files changed, 158 insertions(+), 10 deletions(-) create mode 100644 target/linux/ipq40xx/patches-4.14/854-add-sdhci-reset-implementation.patch create mode 100644 target/linux/ipq40xx/patches-4.19/854-add-sdhci-reset-implementation.patch diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 3c4f9aa71..64b5a1477 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -118,6 +118,10 @@ case "$FIRMWARE" in openmesh,a62) ath10kcal_extract "0:ART" 36864 12064 ;; + p2w,r619ac |\ + p2w,r619ac-128m) + ath10kcal_extract "ART" 36864 12064 + ;; esac ;; "ath10k/pre-cal-ahb-a000000.wifi.bin") diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi index 54b7dc83b..d03b17df9 100644 --- a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi +++ b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi @@ -6,7 +6,6 @@ #include / { - aliases { led-boot = &led_sys; led-failsafe = &led_sys; @@ -81,6 +80,8 @@ leds { compatible = "gpio-leds"; + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; led_sys: sys { label = "r619ac:blue:sys"; @@ -199,7 +200,6 @@ &sdhci { pinctrl-0 = <&sd_0_pins>; pinctrl-names = "default"; - cd-gpios = <&tlmm 22 GPIO_ACTIVE_LOW>; vqmmc-supply = <&vqmmc>; status = "okay"; }; @@ -231,12 +231,6 @@ function = "sdio"; drive-strength = <16>; }; - - mux_3 { - pins = "gpio32"; - function = "gpio"; - output-low; - }; }; serial_0_pins: serial0-pinmux { @@ -246,6 +240,29 @@ bias-disable; }; }; + + led_pins: led_pinmux { + mux { + pins = "gpio32", "gpio39", "gpio50"; + function = "gpio"; + bias-pull-up; + output-low; + }; + + mux_1 { + pins = "gpio52"; + function = "gpio"; + bias-pull-up; + output-high; + }; + + mux_2 { + pins = "gpio61"; + function = "gpio"; + bias-pull-down; + output-high; + }; + }; }; &usb3_ss_phy { @@ -272,4 +289,4 @@ &wifi1 { status = "okay"; qcom,ath10k-calibration-variant = "R619AC"; -}; \ No newline at end of file +}; diff --git a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi index 30b9e7307..3b9b2f08c 100644 --- a/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi +++ b/target/linux/ipq40xx/files-4.19/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi @@ -179,6 +179,20 @@ }; }; +&pcie0 { + status = "okay"; + perst-gpio = <&tlmm 4 GPIO_ACTIVE_LOW>; + wake-gpio = <&tlmm 40 GPIO_ACTIVE_HIGH>; + + /* Free slot for use */ + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + }; +}; + &qpic_bam { status = "okay"; }; @@ -186,7 +200,6 @@ &sdhci { pinctrl-0 = <&sd_0_pins>; pinctrl-names = "default"; - cd-gpios = <&tlmm 22 GPIO_ACTIVE_LOW>; vqmmc-supply = <&vqmmc>; status = "okay"; }; diff --git a/target/linux/ipq40xx/patches-4.14/854-add-sdhci-reset-implementation.patch b/target/linux/ipq40xx/patches-4.14/854-add-sdhci-reset-implementation.patch new file mode 100644 index 000000000..636b0cef8 --- /dev/null +++ b/target/linux/ipq40xx/patches-4.14/854-add-sdhci-reset-implementation.patch @@ -0,0 +1,57 @@ +From: Georgi Djakov +Date: Mon, 28 Nov 2016 19:39:20 +0200 +Subject: [PATCH v2] mmc: sdhci-msm: Add sdhci_reset() implementation + +Signed-off-by: Georgi Djakov +--- + +drivers/mmc/host/sdhci-msm.c | 29 ++++++++++++++++++++++++++++- +1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c +index 32879b845b75..157ae07f9309 100644 +--- a/drivers/mmc/host/sdhci-msm.c ++++ b/drivers/mmc/host/sdhci-msm.c +@@ -1117,6 +1117,33 @@ static void sdhci_msm_set_clock(struct sdhci_host *host, unsigned int clock) + __sdhci_msm_set_clock(host, clock); + } + ++void sdhci_msm_reset(struct sdhci_host *host, u8 mask) ++{ ++ unsigned long timeout = 100; ++ ++ sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET); ++ ++ if (mask & SDHCI_RESET_ALL) { ++ host->clock = 0; ++ ++ /* ++ * SDHCI_RESET_ALL triggers the PWR IRQ ++ * and we need to handle it here. ++ */ ++ sdhci_msm_voltage_switch(host); ++ } ++ ++ while (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) { ++ if (timeout == 0) { ++ pr_err("%s: Reset 0x%x never completed.\n", ++ mmc_hostname(host->mmc), (int)mask); ++ return; ++ } ++ timeout--; ++ mdelay(1); ++ } ++} ++ + static void sdhci_msm_write_w(struct sdhci_host *host, u16 val, int reg) + { + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); +@@ -1148,7 +1174,7 @@ static const struct of_device_id sdhci_msm_dt_match[] = { + MODULE_DEVICE_TABLE(of, sdhci_msm_dt_match); + + static const struct sdhci_ops sdhci_msm_ops = { +- .reset = sdhci_reset, ++ .reset = sdhci_msm_reset, + .set_clock = sdhci_set_clock, + .get_min_clock = sdhci_msm_get_min_clock, + .get_max_clock = sdhci_msm_get_max_clock, diff --git a/target/linux/ipq40xx/patches-4.19/854-add-sdhci-reset-implementation.patch b/target/linux/ipq40xx/patches-4.19/854-add-sdhci-reset-implementation.patch new file mode 100644 index 000000000..636b0cef8 --- /dev/null +++ b/target/linux/ipq40xx/patches-4.19/854-add-sdhci-reset-implementation.patch @@ -0,0 +1,57 @@ +From: Georgi Djakov +Date: Mon, 28 Nov 2016 19:39:20 +0200 +Subject: [PATCH v2] mmc: sdhci-msm: Add sdhci_reset() implementation + +Signed-off-by: Georgi Djakov +--- + +drivers/mmc/host/sdhci-msm.c | 29 ++++++++++++++++++++++++++++- +1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c +index 32879b845b75..157ae07f9309 100644 +--- a/drivers/mmc/host/sdhci-msm.c ++++ b/drivers/mmc/host/sdhci-msm.c +@@ -1117,6 +1117,33 @@ static void sdhci_msm_set_clock(struct sdhci_host *host, unsigned int clock) + __sdhci_msm_set_clock(host, clock); + } + ++void sdhci_msm_reset(struct sdhci_host *host, u8 mask) ++{ ++ unsigned long timeout = 100; ++ ++ sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET); ++ ++ if (mask & SDHCI_RESET_ALL) { ++ host->clock = 0; ++ ++ /* ++ * SDHCI_RESET_ALL triggers the PWR IRQ ++ * and we need to handle it here. ++ */ ++ sdhci_msm_voltage_switch(host); ++ } ++ ++ while (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) { ++ if (timeout == 0) { ++ pr_err("%s: Reset 0x%x never completed.\n", ++ mmc_hostname(host->mmc), (int)mask); ++ return; ++ } ++ timeout--; ++ mdelay(1); ++ } ++} ++ + static void sdhci_msm_write_w(struct sdhci_host *host, u16 val, int reg) + { + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); +@@ -1148,7 +1174,7 @@ static const struct of_device_id sdhci_msm_dt_match[] = { + MODULE_DEVICE_TABLE(of, sdhci_msm_dt_match); + + static const struct sdhci_ops sdhci_msm_ops = { +- .reset = sdhci_reset, ++ .reset = sdhci_msm_reset, + .set_clock = sdhci_set_clock, + .get_min_clock = sdhci_msm_get_min_clock, + .get_max_clock = sdhci_msm_get_max_clock,