diff mbox series

[v3,09/24] mmc: omap_hsmmc: use mmc_of_parse to populate mmc_config

Message ID 1517324513-13875-10-git-send-email-jjhiblot@ti.com
State New
Headers show
Series None | expand

Commit Message

Jean-Jacques Hiblot Jan. 30, 2018, 3:01 p.m. UTC
From: Kishon Vijay Abraham I <kishon@ti.com>

Use the mmc_of_parse library function to populate mmc_config instead of
repeating the same code in host controller driver.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
---

Changes in v3: None

 drivers/mmc/omap_hsmmc.c | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

Comments

Adam Ford Feb. 22, 2018, 10:43 p.m. UTC | #1
On Tue, Jan 30, 2018 at 9:01 AM, Jean-Jacques Hiblot <jjhiblot@ti.com>
wrote:

> From: Kishon Vijay Abraham I <kishon@ti.com>
>
> Use the mmc_of_parse library function to populate mmc_config instead of
> repeating the same code in host controller driver.
>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
>

This patch appears to break the omap3_logic, a DM3730 with device tree
support.

U-Boot 2018.03-rc2-00082-g2d7482c (Feb 22 2018 - 16:41:12 -0600)



OMAP3630/3730-GP ES1.2, CPU-OPP2, L3-200MHz, Max CPU Clock 800 MHz

Model: LogicPD Zoom OMAP3 Development Kit

Logic DM37x/OMAP35x reference board + LPDDR/NAND

DRAM:  256 MiB

NAND:  512 MiB

MMC:   mmc@4809c000 - probe failed: -1

OMAP Logic # mmc info

No MMC device available

OMAP Logic #




---
>
> Changes in v3: None
>
>  drivers/mmc/omap_hsmmc.c | 24 +++++-------------------
>  1 file changed, 5 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
> index ab4a095..57548ee 100644
> --- a/drivers/mmc/omap_hsmmc.c
> +++ b/drivers/mmc/omap_hsmmc.c
> @@ -1297,32 +1297,18 @@ static int omap_hsmmc_ofdata_to_platdata(struct
> udevice *dev)
>         struct mmc_config *cfg = &plat->cfg;
>         const void *fdt = gd->fdt_blob;
>         int node = dev_of_offset(dev);
> -       int val;
> +       int ret;
>
>         plat->base_addr = map_physmem(devfdt_get_addr(dev),
>                                       sizeof(struct hsmmc *),
>                                       MAP_NOCACHE);
>
> -       cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
> -       val = fdtdec_get_int(fdt, node, "bus-width", -1);
> -       if (val < 0) {
> -               printf("error: bus-width property missing\n");
> -               return -ENOENT;
> -       }
> -
> -       switch (val) {
> -       case 0x8:
> -               cfg->host_caps |= MMC_MODE_8BIT;
> -       case 0x4:
> -               cfg->host_caps |= MMC_MODE_4BIT;
> -               break;
> -       default:
> -               printf("error: invalid bus-width property\n");
> -               return -ENOENT;
> -       }
> +       ret = mmc_of_parse(dev, cfg);
> +       if (ret < 0)
> +               return ret;
>
> +       cfg->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
>         cfg->f_min = 400000;
> -       cfg->f_max = fdtdec_get_int(fdt, node, "max-frequency", 52000000);
>         cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
>         cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
>         if (fdtdec_get_bool(fdt, node, "ti,dual-volt"))
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>
Adam Ford Feb. 22, 2018, 11:05 p.m. UTC | #2
On Thu, Feb 22, 2018 at 4:43 PM, Adam Ford <aford173@gmail.com> wrote:

>
>
> On Tue, Jan 30, 2018 at 9:01 AM, Jean-Jacques Hiblot <jjhiblot@ti.com>
> wrote:
>
>> From: Kishon Vijay Abraham I <kishon@ti.com>
>>
>> Use the mmc_of_parse library function to populate mmc_config instead of
>> repeating the same code in host controller driver.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
>>
>
> This patch appears to break the omap3_logic, a DM3730 with device tree
> support.
>
> U-Boot 2018.03-rc2-00082-g2d7482c (Feb 22 2018 - 16:41:12 -0600)
>
>
>
> OMAP3630/3730-GP ES1.2, CPU-OPP2, L3-200MHz, Max CPU Clock 800 MHz
>
> Model: LogicPD Zoom OMAP3 Development Kit
>
> Logic DM37x/OMAP35x reference board + LPDDR/NAND
>
> DRAM:  256 MiB
>
> NAND:  512 MiB
>
> MMC:   mmc@4809c000 - probe failed: -1
>
> OMAP Logic # mmc info
>
> No MMC device available
>
> OMAP Logic #
>
>
I appears as of this series fixes this issue:
https://patchwork.ozlabs.org/project/uboot/list/?series=29899

I'll reply to that series with 'tested-by'

Sorry for the noise.


adam

>
>
>
> ---
>>
>> Changes in v3: None
>>
>>  drivers/mmc/omap_hsmmc.c | 24 +++++-------------------
>>  1 file changed, 5 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
>> index ab4a095..57548ee 100644
>> --- a/drivers/mmc/omap_hsmmc.c
>> +++ b/drivers/mmc/omap_hsmmc.c
>> @@ -1297,32 +1297,18 @@ static int omap_hsmmc_ofdata_to_platdata(struct
>> udevice *dev)
>>         struct mmc_config *cfg = &plat->cfg;
>>         const void *fdt = gd->fdt_blob;
>>         int node = dev_of_offset(dev);
>> -       int val;
>> +       int ret;
>>
>>         plat->base_addr = map_physmem(devfdt_get_addr(dev),
>>                                       sizeof(struct hsmmc *),
>>                                       MAP_NOCACHE);
>>
>> -       cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
>> -       val = fdtdec_get_int(fdt, node, "bus-width", -1);
>> -       if (val < 0) {
>> -               printf("error: bus-width property missing\n");
>> -               return -ENOENT;
>> -       }
>> -
>> -       switch (val) {
>> -       case 0x8:
>> -               cfg->host_caps |= MMC_MODE_8BIT;
>> -       case 0x4:
>> -               cfg->host_caps |= MMC_MODE_4BIT;
>> -               break;
>> -       default:
>> -               printf("error: invalid bus-width property\n");
>> -               return -ENOENT;
>> -       }
>> +       ret = mmc_of_parse(dev, cfg);
>> +       if (ret < 0)
>> +               return ret;
>>
>> +       cfg->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
>>         cfg->f_min = 400000;
>> -       cfg->f_max = fdtdec_get_int(fdt, node, "max-frequency", 52000000);
>>         cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
>>         cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
>>         if (fdtdec_get_bool(fdt, node, "ti,dual-volt"))
>> --
>> 1.9.1
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
>>
>
>
Jaehoon Chung Feb. 23, 2018, 7:02 a.m. UTC | #3
On 02/23/2018 08:05 AM, Adam Ford wrote:
> On Thu, Feb 22, 2018 at 4:43 PM, Adam Ford <aford173@gmail.com> wrote:
> 
>>
>>
>> On Tue, Jan 30, 2018 at 9:01 AM, Jean-Jacques Hiblot <jjhiblot@ti.com>
>> wrote:
>>
>>> From: Kishon Vijay Abraham I <kishon@ti.com>
>>>
>>> Use the mmc_of_parse library function to populate mmc_config instead of
>>> repeating the same code in host controller driver.
>>>
>>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
>>>
>>
>> This patch appears to break the omap3_logic, a DM3730 with device tree
>> support.
>>
>> U-Boot 2018.03-rc2-00082-g2d7482c (Feb 22 2018 - 16:41:12 -0600)
>>
>>
>>
>> OMAP3630/3730-GP ES1.2, CPU-OPP2, L3-200MHz, Max CPU Clock 800 MHz
>>
>> Model: LogicPD Zoom OMAP3 Development Kit
>>
>> Logic DM37x/OMAP35x reference board + LPDDR/NAND
>>
>> DRAM:  256 MiB
>>
>> NAND:  512 MiB
>>
>> MMC:   mmc@4809c000 - probe failed: -1
>>
>> OMAP Logic # mmc info
>>
>> No MMC device available
>>
>> OMAP Logic #
>>
>>
> I appears as of this series fixes this issue:
> https://patchwork.ozlabs.org/project/uboot/list/?series=29899
> 
> I'll reply to that series with 'tested-by'

Thanks for testing.

Best Regards,
Jaehoon Chung

> 
> Sorry for the noise.
> 
> 
> adam
> 
>>
>>
>>
>> ---
>>>
>>> Changes in v3: None
>>>
>>>  drivers/mmc/omap_hsmmc.c | 24 +++++-------------------
>>>  1 file changed, 5 insertions(+), 19 deletions(-)
>>>
>>> diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
>>> index ab4a095..57548ee 100644
>>> --- a/drivers/mmc/omap_hsmmc.c
>>> +++ b/drivers/mmc/omap_hsmmc.c
>>> @@ -1297,32 +1297,18 @@ static int omap_hsmmc_ofdata_to_platdata(struct
>>> udevice *dev)
>>>         struct mmc_config *cfg = &plat->cfg;
>>>         const void *fdt = gd->fdt_blob;
>>>         int node = dev_of_offset(dev);
>>> -       int val;
>>> +       int ret;
>>>
>>>         plat->base_addr = map_physmem(devfdt_get_addr(dev),
>>>                                       sizeof(struct hsmmc *),
>>>                                       MAP_NOCACHE);
>>>
>>> -       cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
>>> -       val = fdtdec_get_int(fdt, node, "bus-width", -1);
>>> -       if (val < 0) {
>>> -               printf("error: bus-width property missing\n");
>>> -               return -ENOENT;
>>> -       }
>>> -
>>> -       switch (val) {
>>> -       case 0x8:
>>> -               cfg->host_caps |= MMC_MODE_8BIT;
>>> -       case 0x4:
>>> -               cfg->host_caps |= MMC_MODE_4BIT;
>>> -               break;
>>> -       default:
>>> -               printf("error: invalid bus-width property\n");
>>> -               return -ENOENT;
>>> -       }
>>> +       ret = mmc_of_parse(dev, cfg);
>>> +       if (ret < 0)
>>> +               return ret;
>>>
>>> +       cfg->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
>>>         cfg->f_min = 400000;
>>> -       cfg->f_max = fdtdec_get_int(fdt, node, "max-frequency", 52000000);
>>>         cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
>>>         cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
>>>         if (fdtdec_get_bool(fdt, node, "ti,dual-volt"))
>>> --
>>> 1.9.1
>>>
>>> _______________________________________________
>>> U-Boot mailing list
>>> U-Boot@lists.denx.de
>>> https://lists.denx.de/listinfo/u-boot
>>>
>>
>>
>
diff mbox series

Patch

diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index ab4a095..57548ee 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -1297,32 +1297,18 @@  static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)
 	struct mmc_config *cfg = &plat->cfg;
 	const void *fdt = gd->fdt_blob;
 	int node = dev_of_offset(dev);
-	int val;
+	int ret;
 
 	plat->base_addr = map_physmem(devfdt_get_addr(dev),
 				      sizeof(struct hsmmc *),
 				      MAP_NOCACHE);
 
-	cfg->host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
-	val = fdtdec_get_int(fdt, node, "bus-width", -1);
-	if (val < 0) {
-		printf("error: bus-width property missing\n");
-		return -ENOENT;
-	}
-
-	switch (val) {
-	case 0x8:
-		cfg->host_caps |= MMC_MODE_8BIT;
-	case 0x4:
-		cfg->host_caps |= MMC_MODE_4BIT;
-		break;
-	default:
-		printf("error: invalid bus-width property\n");
-		return -ENOENT;
-	}
+	ret = mmc_of_parse(dev, cfg);
+	if (ret < 0)
+		return ret;
 
+	cfg->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
 	cfg->f_min = 400000;
-	cfg->f_max = fdtdec_get_int(fdt, node, "max-frequency", 52000000);
 	cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
 	cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
 	if (fdtdec_get_bool(fdt, node, "ti,dual-volt"))