]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mmc: sdhci-esdhc-imx: add NXP S32G2 support
authorChester Lin <clin@suse.com>
Thu, 21 Oct 2021 07:13:32 +0000 (15:13 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 26 Oct 2021 15:37:33 +0000 (17:37 +0200)
Support the SDHCI controller found on NXP S32G2 platform. The new flag
ESDHC_FLAG_SKIP_ERR004536 is used because the hardware erratum bit is not
applicable for S32G2.

Signed-off-by: Chester Lin <clin@suse.com>
Link: https://lore.kernel.org/r/20211021071333.32485-3-clin@suse.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-esdhc-imx.c

index e658f0174242071752152783a18874be21efc9b8..afaf33707d46a926717cec6e7044134442a21c89 100644 (file)
  */
 #define ESDHC_FLAG_BROKEN_AUTO_CMD23   BIT(16)
 
+/* ERR004536 is not applicable for the IP  */
+#define ESDHC_FLAG_SKIP_ERR004536      BIT(17)
+
 enum wp_types {
        ESDHC_WP_NONE,          /* no WP, neither controller nor gpio */
        ESDHC_WP_CONTROLLER,    /* mmc controller internal WP */
@@ -289,6 +292,13 @@ static const struct esdhc_soc_data usdhc_imx7d_data = {
                        | ESDHC_FLAG_BROKEN_AUTO_CMD23,
 };
 
+static struct esdhc_soc_data usdhc_s32g2_data = {
+       .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_MAN_TUNING
+                       | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200
+                       | ESDHC_FLAG_HS400 | ESDHC_FLAG_HS400_ES
+                       | ESDHC_FLAG_SKIP_ERR004536,
+};
+
 static struct esdhc_soc_data usdhc_imx7ulp_data = {
        .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
                        | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200
@@ -347,6 +357,7 @@ static const struct of_device_id imx_esdhc_dt_ids[] = {
        { .compatible = "fsl,imx7ulp-usdhc", .data = &usdhc_imx7ulp_data, },
        { .compatible = "fsl,imx8qxp-usdhc", .data = &usdhc_imx8qxp_data, },
        { .compatible = "fsl,imx8mm-usdhc", .data = &usdhc_imx8mm_data, },
+       { .compatible = "nxp,s32g2-usdhc", .data = &usdhc_s32g2_data, },
        { /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, imx_esdhc_dt_ids);
@@ -1375,8 +1386,10 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
                 * erratum ESDHC_FLAG_ERR004536 fix for MX6Q TO1.2 and MX6DL
                 * TO1.1, it's harmless for MX6SL
                 */
-               writel(readl(host->ioaddr + 0x6c) & ~BIT(7),
-                       host->ioaddr + 0x6c);
+               if (!(imx_data->socdata->flags & ESDHC_FLAG_SKIP_ERR004536)) {
+                       writel(readl(host->ioaddr + 0x6c) & ~BIT(7),
+                               host->ioaddr + 0x6c);
+               }
 
                /* disable DLL_CTRL delay line settings */
                writel(0x0, host->ioaddr + ESDHC_DLL_CTRL);