arm64: dts: k3: Sync sdhci0 node from kernel and change driver name
authorFaiz Abbas <faiz_abbas@ti.com>
Mon, 10 Jun 2019 19:13:31 +0000 (00:43 +0530)
committerTom Rini <trini@konsulko.com>
Wed, 17 Jul 2019 15:12:08 +0000 (11:12 -0400)
Sync the sdhci0 node from kernel. This changes the compatible that is
required to be there in the driver. Change the same for the SD card node
which is not yet supported in kernel. This also syncs the main_pmx0 node
as a side effect.

Also change the name of the driver to match the compatible in kernel.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
arch/arm/dts/k3-am65-main.dtsi
arch/arm/dts/k3-am654-base-board-u-boot.dtsi
arch/arm/dts/k3-am654-base-board.dts
arch/arm/dts/k3-am654-r5-base-board.dts
configs/am65x_evm_a53_defconfig
configs/am65x_evm_r5_defconfig
drivers/mmc/Kconfig
drivers/mmc/Makefile
drivers/mmc/am654_sdhci.c [new file with mode: 0644]
drivers/mmc/k3_arsan_sdhci.c [deleted file]

index adcd6341e40c02aabef992516a075eb2a14245a8..84fed12fbdd83107319c2eaf11def1ae12b83b94 100644 (file)
                clock-frequency = <48000000>;
                current-speed = <115200>;
        };
+
+       main_pmx0: pinmux@11c000 {
+               compatible = "pinctrl-single";
+               reg = <0x0 0x11c000 0x0 0x2e4>;
+               #pinctrl-cells = <1>;
+               pinctrl-single,register-width = <32>;
+               pinctrl-single,function-mask = <0xffffffff>;
+       };
+
+       sdhci0: sdhci@4f80000 {
+               compatible = "ti,am654-sdhci-5.1";
+               reg = <0x0 0x4f80000 0x0 0x260>, <0x0 0x4f90000 0x0 0x134>;
+               power-domains = <&k3_pds 47>;
+               clocks = <&k3_clks 47 0>, <&k3_clks 47 1>;
+               clock-names = "clk_ahb", "clk_xin";
+               interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
+               mmc-ddr-1_8v;
+               mmc-hs200-1_8v;
+               ti,otap-del-sel = <0x2>;
+               ti,trm-icp = <0x8>;
+               dma-coherent;
+       };
 };
index 844a5cd96ad4c1655c07c08a736caea8196cad49..e135cfbf682a70348607a02b78ec68725cafc926 100644 (file)
 &cbass_main{
        u-boot,dm-spl;
 
-       main_pmx0: pinmux@11c000 {
-               compatible = "pinctrl-single";
-               reg = <0x0 0x11c000 0x0 0x2e4>;
-               #pinctrl-cells = <1>;
-               pinctrl-single,register-width = <32>;
-               pinctrl-single,function-mask = <0xffffffff>;
-       };
-
        main_pmx1: pinmux@11c2e8 {
                compatible = "pinctrl-single";
                reg = <0x0 0x11c2e8 0x0 0x24>;
                pinctrl-single,function-mask = <0xffffffff>;
        };
 
-       sdhci0: sdhci@04F80000 {
-               compatible = "arasan,sdhci-5.1";
-               reg = <0x0 0x4F80000 0x0 0x1000>,
-                     <0x0 0x4F90000 0x0 0x400>;
-               clocks = <&k3_clks 47 1>;
-               power-domains = <&k3_pds 47>;
-               max-frequency = <25000000>;
-       };
-
        sdhci1: sdhci@04FA0000 {
-               compatible = "arasan,sdhci-5.1";
+               compatible = "ti,am654-sdhci-5.1";
                reg = <0x0 0x4FA0000 0x0 0x1000>,
                      <0x0 0x4FB0000 0x0 0x400>;
                clocks = <&k3_clks 48 1>;
                        AM65X_IOPAD(0x0190, PIN_INPUT_PULLUP, 0)        /* (A24) MMC0_DAT5 */
                        AM65X_IOPAD(0x018c, PIN_INPUT_PULLUP, 0)        /* (B26) MMC0_DAT6 */
                        AM65X_IOPAD(0x0188, PIN_INPUT_PULLUP, 0)        /* (D25) MMC0_DAT7 */
-                       AM65X_IOPAD(0x01b0, PIN_INPUT, 0)                       /* (C25) MMC0_DS */
+                       AM65X_IOPAD(0x01b4, PIN_INPUT_PULLUP, 0)        /* (A23) MMC0_SDCD */
+                       AM65X_IOPAD(0x01b0, PIN_INPUT, 0)               /* (C25) MMC0_DS */
                >;
                u-boot,dm-spl;
        };
 
 &sdhci0 {
        u-boot,dm-spl;
-       status = "okay";
-       non-removable;
-       bus-width = <8>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&main_mmc0_pins_default>;
 };
 
 &sdhci1 {
index af6956fdc13f49662c47e2750b4296b843851a2e..ab233916c60f2193b33c4227e6813b81ee0e2042 100644 (file)
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include "k3-am654.dtsi"
+#include <dt-bindings/pinctrl/k3.h>
 
 / {
        compatible =  "ti,am654-evm", "ti,am654";
                };
        };
 };
+
+&main_pmx0 {
+       main_mmc0_pins_default: main_mmc0_pins_default {
+               pinctrl-single,pins = <
+                       AM65X_IOPAD(0x01a8, PIN_INPUT_PULLDOWN, 0)      /* (B25) MMC0_CLK */
+                       AM65X_IOPAD(0x01aC, PIN_INPUT_PULLUP, 0)        /* (B27) MMC0_CMD */
+                       AM65X_IOPAD(0x01a4, PIN_INPUT_PULLUP, 0)        /* (A26) MMC0_DAT0 */
+                       AM65X_IOPAD(0x01a0, PIN_INPUT_PULLUP, 0)        /* (E25) MMC0_DAT1 */
+                       AM65X_IOPAD(0x019c, PIN_INPUT_PULLUP, 0)        /* (C26) MMC0_DAT2 */
+                       AM65X_IOPAD(0x0198, PIN_INPUT_PULLUP, 0)        /* (A25) MMC0_DAT3 */
+                       AM65X_IOPAD(0x0194, PIN_INPUT_PULLUP, 0)        /* (E24) MMC0_DAT4 */
+                       AM65X_IOPAD(0x0190, PIN_INPUT_PULLUP, 0)        /* (A24) MMC0_DAT5 */
+                       AM65X_IOPAD(0x018c, PIN_INPUT_PULLUP, 0)        /* (B26) MMC0_DAT6 */
+                       AM65X_IOPAD(0x0188, PIN_INPUT_PULLUP, 0)        /* (D25) MMC0_DAT7 */
+                       AM65X_IOPAD(0x01b4, PIN_INPUT_PULLUP, 0)        /* (A23) MMC0_SDCD */
+                       AM65X_IOPAD(0x01b0, PIN_INPUT, 0)               /* (C25) MMC0_DS */
+               >;
+       };
+};
+
+&sdhci0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&main_mmc0_pins_default>;
+       bus-width = <8>;
+       non-removable;
+       ti,driver-strength-ohm = <50>;
+};
index a07038be70912b490eb65769da10818944f6995e..1ca4757ca5eaf304660b11549201c32d9f401e39 100644 (file)
                u-boot,dm-spl;
        };
 
+       clk_200mhz: dummy_clock {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <200000000>;
+               u-boot,dm-spl;
+       };
 };
 
 &dmsc {
        };
 };
 
+&main_pmx0 {
+       u-boot,dm-spl;
+       main_mmc0_pins_default: main_mmc0_pins_default {
+               pinctrl-single,pins = <
+                       AM65X_IOPAD(0x01a8, PIN_INPUT_PULLDOWN, 0)      /* (B25) MMC0_CLK */
+                       AM65X_IOPAD(0x01aC, PIN_INPUT_PULLUP, 0)        /* (B27) MMC0_CMD */
+                       AM65X_IOPAD(0x01a4, PIN_INPUT_PULLUP, 0)        /* (A26) MMC0_DAT0 */
+                       AM65X_IOPAD(0x01a0, PIN_INPUT_PULLUP, 0)        /* (E25) MMC0_DAT1 */
+                       AM65X_IOPAD(0x019c, PIN_INPUT_PULLUP, 0)        /* (C26) MMC0_DAT2 */
+                       AM65X_IOPAD(0x0198, PIN_INPUT_PULLUP, 0)        /* (A25) MMC0_DAT3 */
+                       AM65X_IOPAD(0x0194, PIN_INPUT_PULLUP, 0)        /* (E24) MMC0_DAT4 */
+                       AM65X_IOPAD(0x0190, PIN_INPUT_PULLUP, 0)        /* (A24) MMC0_DAT5 */
+                       AM65X_IOPAD(0x018c, PIN_INPUT_PULLUP, 0)        /* (B26) MMC0_DAT6 */
+                       AM65X_IOPAD(0x0188, PIN_INPUT_PULLUP, 0)        /* (D25) MMC0_DAT7 */
+                       AM65X_IOPAD(0x01b0, PIN_INPUT, 0)               /* (C25) MMC0_DS */
+               >;
+       };
+};
+
 &memorycontroller {
        vtt-supply = <&vtt_supply>;
        pinctrl-names = "default";
        pinctrl-0 = <&wkup_vtt_pins_default>;
 };
+
+&sdhci0 {
+       clock-names = "clk_xin";
+       clocks = <&clk_200mhz>;
+       /delete-property/ power-domains;
+       ti,driver-strength-ohm = <50>;
+};
+
+&sdhci1 {
+       clock-names = "clk_xin";
+       clocks = <&clk_200mhz>;
+       /delete-property/ power-domains;
+};
index b940af3f56164b372b2784118b4a204a7dc39351..0b778c76e432a41ff6e3a4e1873f828f29e3c315 100644 (file)
@@ -58,7 +58,7 @@ CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
-CONFIG_MMC_SDHCI_K3_ARASAN=y
+CONFIG_MMC_SDHCI_AM654=y
 CONFIG_PHY_TI=y
 CONFIG_PHY_FIXED=y
 CONFIG_DM_ETH=y
index 3814872ec7a18b9e6366ff33d152f426a5229915..6d7ba4d77cf3c7f90e9e847f2879a235679ea5eb 100644 (file)
@@ -63,7 +63,7 @@ CONFIG_K3_SEC_PROXY=y
 CONFIG_MISC=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
-CONFIG_MMC_SDHCI_K3_ARASAN=y
+CONFIG_MMC_SDHCI_AM654=y
 CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_GENERIC is not set
 CONFIG_SPL_PINCTRL=y
index 890ef358a004aa56c93f7abe26e195a17dbe2a10..98d3f7a1501afe454c04ca8b2b5446dff2d8884c 100644 (file)
@@ -468,14 +468,14 @@ config MMC_SDHCI_CADENCE
 
          If unsure, say N.
 
-config MMC_SDHCI_K3_ARASAN
-       bool "Arasan SDHCI controller for TI's K3 based SoCs"
+config MMC_SDHCI_AM654
+       bool "SDHCI Controller on TI's Am654 devices"
        depends on ARCH_K3
        depends on MMC_SDHCI
        depends on DM_MMC && OF_CONTROL && BLK
        help
-         Support for Arasan SDHCI host controller on Texas Instruments'
-         K3 family based SoC platforms
+         Support for Secure Digital Host Controller Interface (SDHCI)
+         controllers present on TI's AM654 SOCs.
 
 config MMC_SDHCI_KONA
        bool "SDHCI support on Broadcom KONA platform"
index 3c8c53a9e16121a0514fffe4c5f0ef3d52d334b5..6cc018bb6726cfef67d51444fa6a4ec8e2303cdf 100644 (file)
@@ -50,7 +50,7 @@ obj-$(CONFIG_MMC_SDHCI_ATMEL)         += atmel_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_BCM2835)                += bcm2835_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_BCMSTB)         += bcmstb_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_CADENCE)                += sdhci-cadence.o
-obj-$(CONFIG_MMC_SDHCI_K3_ARASAN)      += k3_arsan_sdhci.o
+obj-$(CONFIG_MMC_SDHCI_AM654)          += am654_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_KONA)           += kona_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_MSM)            += msm_sdhci.o
 obj-$(CONFIG_MMC_SDHCI_MV)             += mv_sdhci.o
diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c
new file mode 100644 (file)
index 0000000..2d08fe3
--- /dev/null
@@ -0,0 +1,109 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * Texas Instruments' K3 SD Host Controller Interface
+ */
+
+#include <clk.h>
+#include <common.h>
+#include <dm.h>
+#include <malloc.h>
+#include <power-domain.h>
+#include <sdhci.h>
+
+#define AM654_SDHCI_MIN_FREQ   400000
+
+struct am654_sdhci_plat {
+       struct mmc_config cfg;
+       struct mmc mmc;
+       unsigned int f_max;
+};
+
+static int am654_sdhci_probe(struct udevice *dev)
+{
+       struct am654_sdhci_plat *plat = dev_get_platdata(dev);
+       struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+       struct sdhci_host *host = dev_get_priv(dev);
+       struct power_domain sdhci_pwrdmn;
+       struct clk clk;
+       unsigned long clock;
+       int ret;
+
+       ret = power_domain_get_by_index(dev, &sdhci_pwrdmn, 0);
+       if (ret) {
+               dev_err(dev, "failed to get power domain\n");
+               return ret;
+       }
+
+       ret = power_domain_on(&sdhci_pwrdmn);
+       if (ret) {
+               dev_err(dev, "Power domain on failed\n");
+               return ret;
+       }
+
+       ret = clk_get_by_index(dev, 0, &clk);
+       if (ret) {
+               dev_err(dev, "failed to get clock\n");
+               return ret;
+       }
+
+       clock = clk_get_rate(&clk);
+       if (IS_ERR_VALUE(clock)) {
+               dev_err(dev, "failed to get rate\n");
+               return clock;
+       }
+
+       host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
+                      SDHCI_QUIRK_BROKEN_R1B;
+
+       host->max_clk = clock;
+
+       ret = sdhci_setup_cfg(&plat->cfg, host, plat->f_max,
+                             AM654_SDHCI_MIN_FREQ);
+       host->mmc = &plat->mmc;
+       if (ret)
+               return ret;
+       host->mmc->priv = host;
+       host->mmc->dev = dev;
+       upriv->mmc = host->mmc;
+
+       return sdhci_probe(dev);
+}
+
+static int am654_sdhci_ofdata_to_platdata(struct udevice *dev)
+{
+       struct am654_sdhci_plat *plat = dev_get_platdata(dev);
+       struct sdhci_host *host = dev_get_priv(dev);
+
+       host->name = dev->name;
+       host->ioaddr = (void *)dev_read_addr(dev);
+       host->bus_width = dev_read_u32_default(dev, "bus-width", 4);
+       plat->f_max = dev_read_u32_default(dev, "max-frequency", 0);
+
+       return 0;
+}
+
+static int am654_sdhci_bind(struct udevice *dev)
+{
+       struct am654_sdhci_plat *plat = dev_get_platdata(dev);
+
+       return sdhci_bind(dev, &plat->mmc, &plat->cfg);
+}
+
+static const struct udevice_id am654_sdhci_ids[] = {
+       { .compatible = "ti,am654-sdhci-5.1" },
+       { }
+};
+
+U_BOOT_DRIVER(am654_sdhci_drv) = {
+       .name           = "am654_sdhci",
+       .id             = UCLASS_MMC,
+       .of_match       = am654_sdhci_ids,
+       .ofdata_to_platdata = am654_sdhci_ofdata_to_platdata,
+       .ops            = &sdhci_ops,
+       .bind           = am654_sdhci_bind,
+       .probe          = am654_sdhci_probe,
+       .priv_auto_alloc_size = sizeof(struct sdhci_host),
+       .platdata_auto_alloc_size = sizeof(struct am654_sdhci_plat),
+};
diff --git a/drivers/mmc/k3_arsan_sdhci.c b/drivers/mmc/k3_arsan_sdhci.c
deleted file mode 100644 (file)
index d5f2857..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
- *
- * Texas Instruments' K3 SD Host Controller Interface
- */
-
-#include <clk.h>
-#include <common.h>
-#include <dm.h>
-#include <malloc.h>
-#include <power-domain.h>
-#include <sdhci.h>
-
-#define K3_ARASAN_SDHCI_MIN_FREQ       0
-
-struct k3_arasan_sdhci_plat {
-       struct mmc_config cfg;
-       struct mmc mmc;
-       unsigned int f_max;
-};
-
-static int k3_arasan_sdhci_probe(struct udevice *dev)
-{
-       struct k3_arasan_sdhci_plat *plat = dev_get_platdata(dev);
-       struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
-       struct sdhci_host *host = dev_get_priv(dev);
-       struct power_domain sdhci_pwrdmn;
-       struct clk clk;
-       unsigned long clock;
-       int ret;
-
-       ret = power_domain_get_by_index(dev, &sdhci_pwrdmn, 0);
-       if (ret) {
-               dev_err(dev, "failed to get power domain\n");
-               return ret;
-       }
-
-       ret = power_domain_on(&sdhci_pwrdmn);
-       if (ret) {
-               dev_err(dev, "Power domain on failed\n");
-               return ret;
-       }
-
-       ret = clk_get_by_index(dev, 0, &clk);
-       if (ret) {
-               dev_err(dev, "failed to get clock\n");
-               return ret;
-       }
-
-       clock = clk_get_rate(&clk);
-       if (IS_ERR_VALUE(clock)) {
-               dev_err(dev, "failed to get rate\n");
-               return clock;
-       }
-
-       host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD |
-                      SDHCI_QUIRK_BROKEN_R1B;
-
-       host->max_clk = clock;
-
-       ret = sdhci_setup_cfg(&plat->cfg, host, plat->f_max,
-                             K3_ARASAN_SDHCI_MIN_FREQ);
-       host->mmc = &plat->mmc;
-       if (ret)
-               return ret;
-       host->mmc->priv = host;
-       host->mmc->dev = dev;
-       upriv->mmc = host->mmc;
-
-       return sdhci_probe(dev);
-}
-
-static int k3_arasan_sdhci_ofdata_to_platdata(struct udevice *dev)
-{
-       struct k3_arasan_sdhci_plat *plat = dev_get_platdata(dev);
-       struct sdhci_host *host = dev_get_priv(dev);
-
-       host->name = dev->name;
-       host->ioaddr = (void *)dev_read_addr(dev);
-       host->bus_width = dev_read_u32_default(dev, "bus-width", 4);
-       plat->f_max = dev_read_u32_default(dev, "max-frequency", 0);
-
-       return 0;
-}
-
-static int k3_arasan_sdhci_bind(struct udevice *dev)
-{
-       struct k3_arasan_sdhci_plat *plat = dev_get_platdata(dev);
-
-       return sdhci_bind(dev, &plat->mmc, &plat->cfg);
-}
-
-static const struct udevice_id k3_arasan_sdhci_ids[] = {
-       { .compatible = "arasan,sdhci-5.1" },
-       { }
-};
-
-U_BOOT_DRIVER(k3_arasan_sdhci_drv) = {
-       .name           = "k3_arasan_sdhci",
-       .id             = UCLASS_MMC,
-       .of_match       = k3_arasan_sdhci_ids,
-       .ofdata_to_platdata = k3_arasan_sdhci_ofdata_to_platdata,
-       .ops            = &sdhci_ops,
-       .bind           = k3_arasan_sdhci_bind,
-       .probe          = k3_arasan_sdhci_probe,
-       .priv_auto_alloc_size = sizeof(struct sdhci_host),
-       .platdata_auto_alloc_size = sizeof(struct k3_arasan_sdhci_plat),
-};