diff --git a/target/linux/ipq40xx/config-5.4 b/target/linux/ipq40xx/config-5.4 index 1cbba03dd9..4f7d61d121 100644 --- a/target/linux/ipq40xx/config-5.4 +++ b/target/linux/ipq40xx/config-5.4 @@ -322,6 +322,14 @@ CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y CONFIG_MIGHT_HAVE_CACHE_L2X0=y CONFIG_MIGRATION=y +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_IO_ACCESSORS=y +CONFIG_MMC_SDHCI_MSM=y +# CONFIG_MMC_SDHCI_PCI is not set +CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_TIFM_SD is not set CONFIG_MODULES_USE_ELF_REL=y # CONFIG_MSM_GCC_8660 is not set # CONFIG_MSM_GCC_8916 is not set @@ -470,6 +478,7 @@ CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y # CONFIG_REGULATOR_QCOM_SPMI is not set CONFIG_REGULATOR_VCTRL=y +CONFIG_REGULATOR_VQMMC_IPQ4019=y CONFIG_RESET_CONTROLLER=y # CONFIG_RESET_QCOM_AOSS is not set # CONFIG_RESET_QCOM_PDC is not set diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts b/target/linux/ipq40xx/files-5.4/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts similarity index 85% rename from target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts rename to target/linux/ipq40xx/files-5.4/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts index 14176a2c16..fb1d17829e 100644 --- a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts +++ b/target/linux/ipq40xx/files-5.4/arch/arm/boot/dts/qcom-ipq4019-r619ac-128m.dts @@ -15,4 +15,4 @@ reg = <0x0 0x8000000>; }; -/delete-node/ &rootfs_part2; \ No newline at end of file +/delete-node/ &rootfs_part2; diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-r619ac.dts b/target/linux/ipq40xx/files-5.4/arch/arm/boot/dts/qcom-ipq4019-r619ac.dts similarity index 93% rename from target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-r619ac.dts rename to target/linux/ipq40xx/files-5.4/arch/arm/boot/dts/qcom-ipq4019-r619ac.dts index e2adfc3552..0e37633e0c 100644 --- a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-r619ac.dts +++ b/target/linux/ipq40xx/files-5.4/arch/arm/boot/dts/qcom-ipq4019-r619ac.dts @@ -9,4 +9,4 @@ chosen { bootargs-append = " root=/dev/ubiblock0_1 rootfstype=squashfs"; }; -}; \ No newline at end of file +}; diff --git a/target/linux/ipq40xx/files-5.4/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi b/target/linux/ipq40xx/files-5.4/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi new file mode 100644 index 0000000000..3b9b2f08ca --- /dev/null +++ b/target/linux/ipq40xx/files-5.4/arch/arm/boot/dts/qcom-ipq4019-r619ac.dtsi @@ -0,0 +1,292 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019.dtsi" +#include +#include +#include + +/ { + aliases { + led-boot = &led_sys; + led-failsafe = &led_sys; + led-running = &led_sys; + led-upgrade = &led_sys; + label-mac-device = &gmac0; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + mdio@90000 { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + }; + + ess-psgmii@98000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + usb2@60f8800 { + status = "okay"; + }; + + usb3@8af8800 { + status = "okay"; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; + + led_sys: sys { + label = "r619ac:blue:sys"; + gpios = <&tlmm 39 GPIO_ACTIVE_HIGH>; + }; + + wlan2g { + label = "r619ac:blue:wlan2g"; + gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; + + wlan5g { + label = "r619ac:blue:wlan5g"; + gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_spi1 { + status = "okay"; + + flash@0 { + reg = <0>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@1 { + label = "Bootloader"; + reg = <0x0 0x170000>; + }; + + partition@170000 { + label = "ART"; + reg = <0x170000 0x10000>; + }; + + partition@180000 { + label = "unused"; + reg = <0x180000 0xe80000>; + }; + }; + }; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_0_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&nand { + status = "okay"; + + nand@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + rootfs_part1: partition@0 { + label = "rootfs"; + reg = <0x0 0x4000000>; + }; + + rootfs_part2: partition@4000000 { + label = "unused1"; + reg = <0x4000000 0x4000000>; + }; + }; + }; +}; + +&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"; +}; + +&sdhci { + pinctrl-0 = <&sd_0_pins>; + pinctrl-names = "default"; + vqmmc-supply = <&vqmmc>; + status = "okay"; +}; + +&tlmm { + mdio_pins: mdio_pinmux { + mux_1 { + pins = "gpio6"; + function = "mdio"; + bias-pull-up; + }; + + mux_2 { + pins = "gpio7"; + function = "mdc"; + bias-pull-up; + }; + }; + + sd_0_pins: sd_0_pinmux { + mux_1 { + pins = "gpio23", "gpio24", "gpio25", "gpio26", "gpio28"; + function = "sdio"; + drive-strength = <10>; + }; + + mux_2 { + pins = "gpio27"; + function = "sdio"; + drive-strength = <16>; + }; + }; + + serial_0_pins: serial0-pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + 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 { + status = "okay"; +}; + +&usb3_hs_phy { + status = "okay"; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&vqmmc { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + qcom,ath10k-calibration-variant = "R619AC"; +}; + +&wifi1 { + status = "okay"; + qcom,ath10k-calibration-variant = "R619AC"; +}; diff --git a/target/linux/ipq40xx/files-5.4/drivers/regulator/ipq4019-vqmmc-regulator.c b/target/linux/ipq40xx/files-5.4/drivers/regulator/ipq4019-vqmmc-regulator.c new file mode 100644 index 0000000000..faf1a73403 --- /dev/null +++ b/target/linux/ipq40xx/files-5.4/drivers/regulator/ipq4019-vqmmc-regulator.c @@ -0,0 +1,111 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright (c) 2019 Mantas Pucka +// Copyright (c) 2019 Robert Marko +// +// Driver for IPQ4019 SD/MMC controller's I/O LDO voltage regulator + +#include +#include +#include +#include +#include +#include +#include +#include + +static const unsigned int ipq4019_vmmc_voltages[] = { + 1500000, 1800000, 2500000, 3000000, +}; + +static struct regulator_ops ipq4019_regulator_voltage_ops = { + .list_voltage = regulator_list_voltage_table, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = regulator_set_voltage_sel_regmap, +}; + +static struct regulator_desc vmmc_regulator = { + .name = "vmmcq", + .ops = &ipq4019_regulator_voltage_ops, + .type = REGULATOR_VOLTAGE, + .owner = THIS_MODULE, + .volt_table = ipq4019_vmmc_voltages, + .n_voltages = ARRAY_SIZE(ipq4019_vmmc_voltages), + .vsel_reg = 0, + .vsel_mask = 0x3, +}; + +const struct regmap_config ipq4019_vmmcq_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, +}; + +static int ipq4019_regulator_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct regulator_init_data *init_data; + struct regulator_config cfg = {}; + struct regulator_dev *rdev; + struct resource *res; + struct regmap *rmap; + void __iomem *base; + + init_data = of_get_regulator_init_data(dev, dev->of_node, + &vmmc_regulator); + if (!init_data) + return -EINVAL; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + + rmap = devm_regmap_init_mmio(dev, base, &ipq4019_vmmcq_regmap_config); + if (IS_ERR(rmap)) + return PTR_ERR(rmap); + + cfg.dev = dev; + cfg.init_data = init_data; + cfg.of_node = dev->of_node; + cfg.regmap = rmap; + + rdev = devm_regulator_register(dev, &vmmc_regulator, &cfg); + if (IS_ERR(rdev)) { + dev_err(dev, "Failed to register regulator: %ld\n", + PTR_ERR(rdev)); + return PTR_ERR(rdev); + } + platform_set_drvdata(pdev, rdev); + + return 0; +} + +static int ipq4019_regulator_remove(struct platform_device *pdev) +{ + struct regulator_dev *rdev = platform_get_drvdata(pdev); + + regulator_unregister(rdev); + + return 0; +} + +static const struct of_device_id regulator_ipq4019_of_match[] = { + { .compatible = "qcom,ipq4019-vqmmc-regulator", }, + {}, +}; + +static struct platform_driver ipq4019_regulator_driver = { + .probe = ipq4019_regulator_probe, + .remove = ipq4019_regulator_remove, + .driver = { + .name = "regulator-vqmmc-ipq4019", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(regulator_ipq4019_of_match), + }, +}; +module_platform_driver(ipq4019_regulator_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mantas Pucka "); +MODULE_DESCRIPTION("IPQ4019 VQMMC voltage regulator"); \ No newline at end of file diff --git a/target/linux/ipq40xx/patches-5.4/400-sdhci-msm-fix-clock.patch b/target/linux/ipq40xx/patches-5.4/400-sdhci-msm-fix-clock.patch new file mode 100644 index 0000000000..e2b4bcfc03 --- /dev/null +++ b/target/linux/ipq40xx/patches-5.4/400-sdhci-msm-fix-clock.patch @@ -0,0 +1,11 @@ +--- a/drivers/mmc/host/sdhci-msm.c ++++ b/drivers/mmc/host/sdhci-msm.c +@@ -1681,7 +1681,7 @@ MODULE_DEVICE_TABLE(of, sdhci_msm_dt_mat + + static const struct sdhci_ops sdhci_msm_ops = { + .reset = sdhci_reset, +- .set_clock = sdhci_msm_set_clock, ++ .set_clock = sdhci_set_clock, + .get_min_clock = sdhci_msm_get_min_clock, + .get_max_clock = sdhci_msm_get_max_clock, + .set_bus_width = sdhci_set_bus_width, diff --git a/target/linux/ipq40xx/patches-5.4/851-add-ipq40xx-vqmmc-regulator-driver-to-KConfig.patch b/target/linux/ipq40xx/patches-5.4/851-add-ipq40xx-vqmmc-regulator-driver-to-KConfig.patch new file mode 100644 index 0000000000..3b8ac4944a --- /dev/null +++ b/target/linux/ipq40xx/patches-5.4/851-add-ipq40xx-vqmmc-regulator-driver-to-KConfig.patch @@ -0,0 +1,26 @@ +--- a/drivers/regulator/Kconfig ++++ b/drivers/regulator/Kconfig +@@ -334,6 +334,13 @@ config REGULATOR_HI655X + This driver provides support for the voltage regulators of the + Hisilicon Hi655x PMIC device. + ++config REGULATOR_VQMMC_IPQ4019 ++ tristate "IPQ4019 VQMMC SD LDO regulator support" ++ depends on ARCH_QCOM ++ help ++ This driver provides support for the VQMMC LDO I/0 ++ voltage regulator of the IPQ4019 SD/EMMC controller. ++ + config REGULATOR_ISL9305 + tristate "Intersil ISL9305 regulator" + depends on I2C +--- a/drivers/regulator/Makefile ++++ b/drivers/regulator/Makefile +@@ -43,6 +43,7 @@ obj-$(CONFIG_REGULATOR_GPIO) += gpio-reg + obj-$(CONFIG_REGULATOR_HI6421) += hi6421-regulator.o + obj-$(CONFIG_REGULATOR_HI6421V530) += hi6421v530-regulator.o + obj-$(CONFIG_REGULATOR_HI655X) += hi655x-regulator.o ++obj-$(CONFIG_REGULATOR_VQMMC_IPQ4019) += ipq4019-vqmmc-regulator.o + obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o + obj-$(CONFIG_REGULATOR_ISL9305) += isl9305.o + obj-$(CONFIG_REGULATOR_LM363X) += lm363x-regulator.o diff --git a/target/linux/ipq40xx/patches-5.4/852-ARM-dts-qcom-ipq4019-Add-SDHCI-VQMMC-LDO-regulator-n.patch b/target/linux/ipq40xx/patches-5.4/852-ARM-dts-qcom-ipq4019-Add-SDHCI-VQMMC-LDO-regulator-n.patch new file mode 100644 index 0000000000..fdb3f8bbcc --- /dev/null +++ b/target/linux/ipq40xx/patches-5.4/852-ARM-dts-qcom-ipq4019-Add-SDHCI-VQMMC-LDO-regulator-n.patch @@ -0,0 +1,33 @@ +From beae4078c07d3cdc90473a2b35eb0d2b4f3c922c Mon Sep 17 00:00:00 2001 +From: Robert Marko +Date: Sat, 14 Sep 2019 23:13:17 +0200 +Subject: [PATCH] ARM: dts: qcom: ipq4019: Add SDHCI VQMMC LDO regulator node + +IPQ4019 has a built in SD/eMMC controller which depends on +VQMMC LDO regulator working. +Since we have a driver for it lets add the appropriate node for it. + +Signed-off-by: Robert Marko +--- + arch/arm/boot/dts/qcom-ipq4019.dtsi | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/arch/arm/boot/dts/qcom-ipq4019.dtsi ++++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi +@@ -216,6 +216,16 @@ + interrupts = ; + }; + ++ vqmmc: regulator@1948000 { ++ compatible = "qcom,ipq4019-vqmmc-regulator"; ++ reg = <0x01948000 0x4>; ++ regulator-name = "vqmmc"; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-always-on; ++ status = "disabled"; ++ }; ++ + blsp_dma: dma@7884000 { + compatible = "qcom,bam-v1.7.0"; + reg = <0x07884000 0x23000>; diff --git a/target/linux/ipq40xx/patches-5.4/853-add-sdhci-msm-node-to-dts.patch b/target/linux/ipq40xx/patches-5.4/853-add-sdhci-msm-node-to-dts.patch new file mode 100644 index 0000000000..4450d48501 --- /dev/null +++ b/target/linux/ipq40xx/patches-5.4/853-add-sdhci-msm-node-to-dts.patch @@ -0,0 +1,41 @@ +Subject: [PATCH] ARM: dts: qcom: ipq4019: Add SDHCI controller node +Date: Thu, 15 Aug 2019 19:28:23 +0200 +Message-Id: <20190815172823.12028-1-robimarko@gmail.com> +X-Mailer: git-send-email 2.21.0 +MIME-Version: 1.0 +Sender: linux-arm-msm-owner@vger.kernel.org +Precedence: bulk +List-ID: +X-Mailing-List: linux-arm-msm@vger.kernel.org +X-Virus-Scanned: ClamAV using ClamSMTP + +IPQ4019 has a built in SD/eMMC controller which is supported by the +SDHCI MSM driver, by the "qcom,sdhci-msm-v4" binding. +So lets add the appropriate node for it. + +Signed-off-by: Robert Marko +--- + arch/arm/boot/dts/qcom-ipq4019.dtsi | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/arch/arm/boot/dts/qcom-ipq4019.dtsi ++++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi +@@ -226,6 +226,18 @@ + status = "disabled"; + }; + ++ sdhci: sdhci@7824900 { ++ compatible = "qcom,sdhci-msm-v4"; ++ reg = <0x7824900 0x11c>, <0x7824000 0x800>; ++ interrupts = , ; ++ interrupt-names = "hc_irq", "pwr_irq"; ++ bus-width = <8>; ++ clocks = <&gcc GCC_SDCC1_APPS_CLK>, <&gcc GCC_SDCC1_AHB_CLK>, ++ <&gcc GCC_DCD_XO_CLK>; ++ clock-names = "core", "iface", "xo"; ++ status = "disabled"; ++ }; ++ + blsp_dma: dma@7884000 { + compatible = "qcom,bam-v1.7.0"; + reg = <0x07884000 0x23000>; diff --git a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch index d49c03c1d0..47cd2a000b 100644 --- a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch +++ b/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -837,11 +837,43 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -837,11 +837,45 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ @@ -44,6 +44,8 @@ Signed-off-by: John Crispin + qcom-ipq4019-map-ac2200.dtb \ + qcom-ipq4019-e2600ac-c1.dtb \ + qcom-ipq4019-e2600ac-c2.dtb \ ++ qcom-ipq4019-r619ac.dtb \ ++ qcom-ipq4019-r619ac-128m.dtb \ + qcom-ipq4019-u4019-32m.dtb \ + qcom-ipq4019-wpj419.dtb \ + qcom-ipq4028-wpj428.dtb \