[PATCH] mmc: Parse new binding for eMMC fixed driver type

Parse the new binding and store it in the mmc config struct after doing some sanity checks. The code is designed to support fixed mmc driver type if we ever need that.
Signed-off-by: Shunsuke Tokumoto s-tokumoto@fujitsu.com Signed-off-by: Yasushi Iida yasushi.iida@fujitsu.com --- drivers/mmc/mmc-uclass.c | 30 ++++++++++++++++++++++++++++++ drivers/mmc/mmc.c | 8 ++++++++ include/mmc.h | 3 +++ 3 files changed, 41 insertions(+)
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index c5b7872900..e67aae451f 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -162,6 +162,36 @@ int dm_mmc_deferred_probe(struct udevice *dev) if (ops->deferred_probe) return ops->deferred_probe(dev);
+ /* Check eMMC driver type selection */ + val = dev_read_u32_default(dev, "fixed-emmc-driver-type", 0); + if (val > 4) { + puts(""fixed-emmc-driver-type" is illegal. force to 0.\n"); + val = 0; + } + cfg->driver_type = val; + + val = dev_read_u32_default(dev, + "fixed-emmc-driver-type-hs200", + -ENOENT); + if (val != -ENOENT) { + if (val > 4) { + puts(""fixed-emmc-driver-type-hs200" is illegal.\n"); + val = 0; + } + } + cfg->driver_type_hs200 = val; + + val = dev_read_u32_default(dev, + "fixed-emmc-driver-type-hs400", + -ENOENT); + if (val != -ENOENT) { + if (val > 4) { + puts(""fixed-emmc-driver-type-hs400" is illegal.\n"); + val = 0; + } + } + cfg->driver_type_hs400 = val; + return 0; }
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 620bb93064..8241be9996 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -849,11 +849,19 @@ static int mmc_set_card_speed(struct mmc *mmc, enum bus_mode mode, #if CONFIG_IS_ENABLED(MMC_HS200_SUPPORT) case MMC_HS_200: speed_bits = EXT_CSD_TIMING_HS200; + if (mmc->cfg->driver_type_hs200 != -ENOENT) + speed_bits |= (mmc->cfg->driver_type_hs200 << 4); + else + speed_bits |= (mmc->cfg->driver_type << 4); break; #endif #if CONFIG_IS_ENABLED(MMC_HS400_SUPPORT) case MMC_HS_400: speed_bits = EXT_CSD_TIMING_HS400; + if (mmc->cfg->driver_type_hs400 != -ENOENT) + speed_bits |= (mmc->cfg->driver_type_hs400 << 4); + else + speed_bits |= (mmc->cfg->driver_type << 4); break; #endif #if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT) diff --git a/include/mmc.h b/include/mmc.h index 82562193cc..8d79ff5cbe 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -555,6 +555,9 @@ struct mmc_config { uint f_max; uint b_max; unsigned char part_type; + uint driver_type; + uint driver_type_hs200; + uint driver_type_hs400; };
struct sd_ssr {

Subject: [PATCH] mmc: Parse new binding for eMMC fixed driver type
Parse the new binding and store it in the mmc config struct after doing some sanity checks. The code is designed to support fixed mmc driver type if we ever need that.
Signed-off-by: Shunsuke Tokumoto s-tokumoto@fujitsu.com Signed-off-by: Yasushi Iida yasushi.iida@fujitsu.com
drivers/mmc/mmc-uclass.c | 30 ++++++++++++++++++++++++++++++ drivers/mmc/mmc.c | 8 ++++++++ include/mmc.h | 3 +++ 3 files changed, 41 insertions(+)
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index c5b7872900..e67aae451f 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -162,6 +162,36 @@ int dm_mmc_deferred_probe(struct udevice *dev) if (ops->deferred_probe) return ops->deferred_probe(dev);
- /* Check eMMC driver type selection */
- val = dev_read_u32_default(dev, "fixed-emmc-driver-type", 0);
Has the bindings been accepted by Linux Kernel?
Regards, Peng.

From: Peng Fan peng.fan@nxp.com Sent: Tuesday, July 14, 2020 4:52 PM To: Tokumoto, Shunsuke/徳本 俊介 s-tokumoto@fujitsu.com Cc: u-boot@lists.denx.de; Iida, Yasushi/飯田 康志 yasushi.iida@fujitsu.com Subject: RE: [PATCH] mmc: Parse new binding for eMMC fixed driver type
Subject: [PATCH] mmc: Parse new binding for eMMC fixed driver type
Parse the new binding and store it in the mmc config struct after doing some sanity checks. The code is designed to support fixed mmc driver type if we ever need that.
Signed-off-by: Shunsuke Tokumoto s-tokumoto@fujitsu.com Signed-off-by: Yasushi Iida yasushi.iida@fujitsu.com
drivers/mmc/mmc-uclass.c | 30
++++++++++++++++++++++++++++++
drivers/mmc/mmc.c | 8 ++++++++ include/mmc.h | 3 +++ 3 files changed, 41 insertions(+)
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index
c5b7872900..e67aae451f 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -162,6 +162,36 @@ int dm_mmc_deferred_probe(struct udevice *dev) if (ops->deferred_probe) return ops->deferred_probe(dev);
- /* Check eMMC driver type selection */
- val = dev_read_u32_default(dev, "fixed-emmc-driver-type", 0);
Has the bindings been accepted by Linux Kernel?
The bindings "fixed-emmc-driver-type" has already included in the Linux Kernel. The others, "fixed-emmc-driver-type-hs200" and "fixed-emmc-driver-type-hs400" are not included in the Linux Kernel.
Regards, Peng.
Best regards Shunsuke

Subject: RE: [PATCH] mmc: Parse new binding for eMMC fixed driver type
From: Peng Fan peng.fan@nxp.com Sent: Tuesday, July 14, 2020 4:52 PM To: Tokumoto, Shunsuke/�Ա� ���� s-tokumoto@fujitsu.com Cc: u-boot@lists.denx.de; Iida, Yasushi/��� ��־ yasushi.iida@fujitsu.com Subject: RE: [PATCH] mmc: Parse new binding for eMMC fixed driver type
Subject: [PATCH] mmc: Parse new binding for eMMC fixed driver type
Parse the new binding and store it in the mmc config struct after doing some sanity checks. The code is designed to support fixed mmc driver type if we ever need that.
Signed-off-by: Shunsuke Tokumoto s-tokumoto@fujitsu.com Signed-off-by: Yasushi Iida yasushi.iida@fujitsu.com
drivers/mmc/mmc-uclass.c | 30
++++++++++++++++++++++++++++++
drivers/mmc/mmc.c | 8 ++++++++ include/mmc.h | 3 +++ 3 files changed, 41 insertions(+)
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index
c5b7872900..e67aae451f 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -162,6 +162,36 @@ int dm_mmc_deferred_probe(struct udevice
*dev)
if (ops->deferred_probe) return ops->deferred_probe(dev);
- /* Check eMMC driver type selection */
- val = dev_read_u32_default(dev, "fixed-emmc-driver-type", 0);
Has the bindings been accepted by Linux Kernel?
The bindings "fixed-emmc-driver-type" has already included in the Linux Kernel. The others, "fixed-emmc-driver-type-hs200" and "fixed-emmc-driver-type-hs400" are not included in the Linux Kernel.
Then please mark u-boot,xxx for U-Boot specific properties and add some doc in U-Boot. If the bindings are under review by Linux Kernel, please share me the link and see how it goes.
Thanks, Peng.
Regards, Peng.
Best regards Shunsuke
participants (3)
-
Peng Fan
-
s-tokumoto@fujitsu.com
-
Shunsuke Tokumoto