]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: msm_sdhci: program core_vendor_spec
authorCaleb Connolly <caleb.connolly@linaro.org>
Fri, 21 Jun 2024 01:53:09 +0000 (03:53 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 6 Sep 2024 01:08:14 +0000 (19:08 -0600)
After resetting the host controller, program in the POR val for this
register just like the Linux driver does.

This seems to help with initialization when running U-Boot as the primary
bootloader on some boards.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
drivers/mmc/msm_sdhci.c

index f5e9930c7997afb50ec7c193b655b33bedea36b7..4e5c932c071f6bcb9ab9918d0ab6916d89a2d14e 100644 (file)
@@ -32,6 +32,8 @@
 #define SDCC_MCI_STATUS2_MCI_ACT 0x1
 #define SDCC_MCI_HC_MODE 0x78
 
+#define CORE_VENDOR_SPEC_POR_VAL 0xa9c
+
 struct msm_sdhc_plat {
        struct mmc_config cfg;
        struct mmc mmc;
@@ -46,6 +48,7 @@ struct msm_sdhc {
 struct msm_sdhc_variant_info {
        bool mci_removed;
 
+       u32 core_vendor_spec;
        u32 core_vendor_spec_capabilities0;
 };
 
@@ -54,11 +57,14 @@ DECLARE_GLOBAL_DATA_PTR;
 static int msm_sdc_clk_init(struct udevice *dev)
 {
        struct msm_sdhc *prv = dev_get_priv(dev);
+       const struct msm_sdhc_variant_info *var_info;
        ofnode node = dev_ofnode(dev);
        ulong clk_rate;
        int ret, i = 0, n_clks;
        const char *clk_name;
 
+       var_info = (void *)dev_get_driver_data(dev);
+
        ret = ofnode_read_u32(node, "clock-frequency", (uint *)(&clk_rate));
        if (ret)
                clk_rate = 201500000;
@@ -105,6 +111,9 @@ static int msm_sdc_clk_init(struct udevice *dev)
                return -EINVAL;
        }
 
+       writel_relaxed(CORE_VENDOR_SPEC_POR_VAL,
+                      prv->host.ioaddr + var_info->core_vendor_spec);
+
        return 0;
 }
 
@@ -254,12 +263,14 @@ static int msm_sdc_bind(struct udevice *dev)
 static const struct msm_sdhc_variant_info msm_sdhc_mci_var = {
        .mci_removed = false,
 
+       .core_vendor_spec = 0x10c,
        .core_vendor_spec_capabilities0 = 0x11c,
 };
 
 static const struct msm_sdhc_variant_info msm_sdhc_v5_var = {
        .mci_removed = true,
 
+       .core_vendor_spec = 0x20c,
        .core_vendor_spec_capabilities0 = 0x21c,
 };