[PATCH] mmc: arm_pl180_mmci: Rely on DM
Jaehoon Chung
jh80.chung at samsung.com
Wed Apr 3 02:45:39 CEST 2024
On 2/8/24 18:33, Linus Walleij wrote:
> The PL180/MMCI driver is implied to use CONFIG_DM and the ARM
> defconfigs such as configs/vexpress_ca9x4_defconfig will get it
> as well.
>
> With a simple oneline to default to not being the v2 variant,
> the original ARM MMCI variant works fine with the driver as well.
> The IP version actually needs to be read out from a register on
> the ARM versions, but we will simply assume we are running on the
> original hardware if arm,primecell-periphid is not explicitly
> specified in the device tree.
>
> Drop the !CONFIG_DM code and depend on DM_MMC.
>
> Tested on the Versatile Express CA9x4 board.
>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
Reviewed-by: Jaehoon Chung <jh80.chung at samsung.com>
Sorry for late. I will apply this patch to u-boot-mmc/master. Thanks.
Best Regards,
Jaehoon Chung
> ---
> drivers/mmc/Kconfig | 1 +
> drivers/mmc/arm_pl180_mmci.c | 66 ++------------------------------------------
> 2 files changed, 3 insertions(+), 64 deletions(-)
>
>
> ---
> base-commit: 0101a2ffe125911ebf89172b495f5ff14f2fd058
> change-id: 20240208-uboot-vexpress-ca9-127bd6b163df
>
> Best regards,
>
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index 17618c3bdcc1..59716c3966e5 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -79,6 +79,7 @@ config MMC_SPI_CRC_ON
>
> config ARM_PL180_MMCI
> bool "ARM AMBA Multimedia Card Interface and compatible support"
> + depends on DM_MMC
> help
> This selects the ARM(R) AMBA(R) PrimeCell Multimedia Card
> Interface (PL180, PL181 and compatible) support.
> diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
> index 5cf5502ed545..2666b65362bc 100644
> --- a/drivers/mmc/arm_pl180_mmci.c
> +++ b/drivers/mmc/arm_pl180_mmci.c
> @@ -18,6 +18,7 @@
> #include <malloc.h>
> #include <mmc.h>
> #include <dm/device_compat.h>
> +#include <dm.h>
>
> #include <asm/io.h>
> #include <asm-generic/gpio.h>
> @@ -25,8 +26,6 @@
> #include "arm_pl180_mmci.h"
> #include <linux/delay.h>
>
> -#ifdef CONFIG_DM_MMC
> -#include <dm.h>
> #define MMC_CLOCK_MAX 48000000
> #define MMC_CLOCK_MIN 400000
>
> @@ -34,7 +33,6 @@ struct arm_pl180_mmc_plat {
> struct mmc_config cfg;
> struct mmc mmc;
> };
> -#endif
>
> static int wait_for_command_end(struct mmc *dev, struct mmc_cmd *cmd)
> {
> @@ -358,65 +356,6 @@ static int host_set_ios(struct mmc *dev)
> return 0;
> }
>
> -#ifndef CONFIG_DM_MMC
> -/* MMC uses open drain drivers in the enumeration phase */
> -static int mmc_host_reset(struct mmc *dev)
> -{
> - struct pl180_mmc_host *host = dev->priv;
> -
> - writel(host->pwr_init, &host->base->power);
> -
> - return 0;
> -}
> -
> -static const struct mmc_ops arm_pl180_mmci_ops = {
> - .send_cmd = host_request,
> - .set_ios = host_set_ios,
> - .init = mmc_host_reset,
> -};
> -
> -/*
> - * mmc_host_init - initialize the mmc controller.
> - * Set initial clock and power for mmc slot.
> - * Initialize mmc struct and register with mmc framework.
> - */
> -
> -int arm_pl180_mmci_init(struct pl180_mmc_host *host, struct mmc **mmc)
> -{
> - u32 sdi_u32;
> -
> - writel(host->pwr_init, &host->base->power);
> - writel(host->clkdiv_init, &host->base->clock);
> - udelay(CLK_CHANGE_DELAY);
> -
> - /* Disable mmc interrupts */
> - sdi_u32 = readl(&host->base->mask0) & ~SDI_MASK0_MASK;
> - writel(sdi_u32, &host->base->mask0);
> -
> - host->cfg.name = host->name;
> - host->cfg.ops = &arm_pl180_mmci_ops;
> -
> - /* TODO remove the duplicates */
> - host->cfg.host_caps = host->caps;
> - host->cfg.voltages = host->voltages;
> - host->cfg.f_min = host->clock_min;
> - host->cfg.f_max = host->clock_max;
> - if (host->b_max != 0)
> - host->cfg.b_max = host->b_max;
> - else
> - host->cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
> -
> - *mmc = mmc_create(&host->cfg, host);
> - if (!*mmc)
> - return -1;
> - debug("registered mmc interface number is:%d\n",
> - (*mmc)->block_dev.devnum);
> -
> - return 0;
> -}
> -#endif
> -
> -#ifdef CONFIG_DM_MMC
> static void arm_pl180_mmc_init(struct pl180_mmc_host *host)
> {
> u32 sdi_u32;
> @@ -477,7 +416,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
> host->version2 = true;
> break;
> default:
> - host->version2 = true;
> + host->version2 = false; /* ARM variant */
> }
>
> gpio_request_by_name(dev, "cd-gpios", 0, &host->cd_gpio, GPIOD_IS_IN);
> @@ -561,4 +500,3 @@ U_BOOT_DRIVER(arm_pl180_mmc) = {
> .priv_auto = sizeof(struct pl180_mmc_host),
> .plat_auto = sizeof(struct arm_pl180_mmc_plat),
> };
> -#endif
More information about the U-Boot
mailing list