All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc: pic32_sdhci: Complete the transition to driver model
@ 2017-06-21  3:23 ` Alan Ott
  2017-06-30  4:00   ` Jaehoon Chung
  2017-07-08 19:58   ` [U-Boot] [PATCH v2] " Alan Ott
  0 siblings, 2 replies; 8+ messages in thread
From: Alan Ott @ 2017-06-21  3:23 UTC (permalink / raw)
  To: u-boot

Previously this driver appeared to have been half-way converted to the new
driver model and did not work at all.

Complete the transition to the driver model, adding the necessary
connections.

Signed-off-by: Alan Ott <alan@softiron.com>
---
 configs/pic32mzdask_defconfig |  1 -
 drivers/mmc/Kconfig           |  2 +-
 drivers/mmc/pic32_sdhci.c     | 31 ++++++++++++++++++++++++++-----
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig
index 688b989..afb1bdb 100644
--- a/configs/pic32mzdask_defconfig
+++ b/configs/pic32mzdask_defconfig
@@ -25,7 +25,6 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_EFI_PARTITION is not set
 CONFIG_OF_EMBED=y
 CONFIG_NET_RANDOM_ETHADDR=y
-# CONFIG_BLK is not set
 CONFIG_CLK=y
 CONFIG_DM_GPIO=y
 CONFIG_MMC=y
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index 0dd4443..b70775d 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -274,7 +274,7 @@ config MMC_SDHCI_MV
 
 config MMC_SDHCI_PIC32
 	bool "Microchip PIC32 on-chip SDHCI support"
-	depends on DM_MMC && MACH_PIC32
+	depends on DM_MMC && BLK && DM_MMC_OPS && MACH_PIC32
 	depends on MMC_SDHCI
 	help
 	  Support for Microchip PIC32 SDHCI controller.
diff --git a/drivers/mmc/pic32_sdhci.c b/drivers/mmc/pic32_sdhci.c
index 212e22e..fc6d7f3 100644
--- a/drivers/mmc/pic32_sdhci.c
+++ b/drivers/mmc/pic32_sdhci.c
@@ -15,6 +15,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+struct pic32_sdhci_plat {
+	struct mmc_config cfg;
+	struct mmc mmc;
+};
+
 static int pic32_sdhci_get_cd(struct sdhci_host *host)
 {
 	/* PIC32 SDHCI CD errata:
@@ -31,6 +36,8 @@ static const struct sdhci_ops pic32_sdhci_ops = {
 
 static int pic32_sdhci_probe(struct udevice *dev)
 {
+	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
 	struct sdhci_host *host = dev_get_priv(dev);
 	const void *fdt = gd->fdt_blob;
 	u32 f_min_max[2];
@@ -56,14 +63,25 @@ static int pic32_sdhci_probe(struct udevice *dev)
 		return ret;
 	}
 
-	host->max_clk   = f_min_max[1];
-
-	ret = add_sdhci(host, 0, f_min_max[0]);
-	if (ret)
+	ret = sdhci_setup_cfg(&plat->cfg, host, /*max*/0, /*min*/f_min_max[0]);
+	if (ret) {
+		printf("pic32_sdhci: sdhci_setup_cfg() failed\n");
 		return ret;
+	}
+
+	host->mmc = &plat->mmc;
 	host->mmc->dev = dev;
+	host->mmc->priv = host;
+	upriv->mmc = host->mmc;
 
-	return 0;
+	return sdhci_probe(dev);
+}
+
+static int pic32_sdhci_bind(struct udevice *dev)
+{
+	struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
+
+	return sdhci_bind(dev, &plat->mmc, &plat->cfg);
 }
 
 static const struct udevice_id pic32_sdhci_ids[] = {
@@ -75,6 +93,9 @@ U_BOOT_DRIVER(pic32_sdhci_drv) = {
 	.name			= "pic32_sdhci",
 	.id			= UCLASS_MMC,
 	.of_match		= pic32_sdhci_ids,
+	.ops                    = &sdhci_ops,
+	.bind                   = pic32_sdhci_bind,
 	.probe			= pic32_sdhci_probe,
 	.priv_auto_alloc_size	= sizeof(struct sdhci_host),
+	.platdata_auto_alloc_size = sizeof(struct pic32_sdhci_plat),
 };
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] mmc: pic32_sdhci: Complete the transition to driver model
  2017-06-21  3:23 ` [U-Boot] [PATCH] mmc: pic32_sdhci: Complete the transition to driver model Alan Ott
@ 2017-06-30  4:00   ` Jaehoon Chung
  2017-06-30  5:51     ` Masahiro Yamada
  2017-06-30 21:30     ` Alan Ott
  2017-07-08 19:58   ` [U-Boot] [PATCH v2] " Alan Ott
  1 sibling, 2 replies; 8+ messages in thread
From: Jaehoon Chung @ 2017-06-30  4:00 UTC (permalink / raw)
  To: u-boot

On 06/21/2017 12:23 PM, Alan Ott wrote:
> Previously this driver appeared to have been half-way converted to the new
> driver model and did not work at all.
> 
> Complete the transition to the driver model, adding the necessary
> connections.
> 
> Signed-off-by: Alan Ott <alan@softiron.com>
> ---
>  configs/pic32mzdask_defconfig |  1 -
>  drivers/mmc/Kconfig           |  2 +-
>  drivers/mmc/pic32_sdhci.c     | 31 ++++++++++++++++++++++++++-----
>  3 files changed, 27 insertions(+), 7 deletions(-)
> 
> diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig
> index 688b989..afb1bdb 100644
> --- a/configs/pic32mzdask_defconfig
> +++ b/configs/pic32mzdask_defconfig
> @@ -25,7 +25,6 @@ CONFIG_CMD_EXT4_WRITE=y
>  # CONFIG_EFI_PARTITION is not set
>  CONFIG_OF_EMBED=y
>  CONFIG_NET_RANDOM_ETHADDR=y
> -# CONFIG_BLK is not set
>  CONFIG_CLK=y
>  CONFIG_DM_GPIO=y
>  CONFIG_MMC=y
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index 0dd4443..b70775d 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -274,7 +274,7 @@ config MMC_SDHCI_MV
>  
>  config MMC_SDHCI_PIC32
>  	bool "Microchip PIC32 on-chip SDHCI support"
> -	depends on DM_MMC && MACH_PIC32
> +	depends on DM_MMC && BLK && DM_MMC_OPS && MACH_PIC32

If DM_MMC is enabled,,then CONFIG_BLK and CONFIG_DM_MMC_OPS are "y" by default.
Why do you touch this?

>  	depends on MMC_SDHCI
>  	help
>  	  Support for Microchip PIC32 SDHCI controller.
> diff --git a/drivers/mmc/pic32_sdhci.c b/drivers/mmc/pic32_sdhci.c
> index 212e22e..fc6d7f3 100644
> --- a/drivers/mmc/pic32_sdhci.c
> +++ b/drivers/mmc/pic32_sdhci.c
> @@ -15,6 +15,11 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> +struct pic32_sdhci_plat {
> +	struct mmc_config cfg;
> +	struct mmc mmc;
> +};
> +
>  static int pic32_sdhci_get_cd(struct sdhci_host *host)
>  {
>  	/* PIC32 SDHCI CD errata:
> @@ -31,6 +36,8 @@ static const struct sdhci_ops pic32_sdhci_ops = {
>  
>  static int pic32_sdhci_probe(struct udevice *dev)
>  {
> +	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
> +	struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
>  	struct sdhci_host *host = dev_get_priv(dev);
>  	const void *fdt = gd->fdt_blob;
>  	u32 f_min_max[2];
> @@ -56,14 +63,25 @@ static int pic32_sdhci_probe(struct udevice *dev)
>  		return ret;
>  	}
>  
> -	host->max_clk   = f_min_max[1];
> -
> -	ret = add_sdhci(host, 0, f_min_max[0]);
> -	if (ret)
> +	ret = sdhci_setup_cfg(&plat->cfg, host, /*max*/0, /*min*/f_min_max[0]);

What are "/*max*, /*min*/" ?

> +	if (ret) {
> +		printf("pic32_sdhci: sdhci_setup_cfg() failed\n");
>  		return ret;
> +	}
> +
> +	host->mmc = &plat->mmc;
>  	host->mmc->dev = dev;
> +	host->mmc->priv = host;
> +	upriv->mmc = host->mmc;
>  
> -	return 0;
> +	return sdhci_probe(dev);
> +}
> +
> +static int pic32_sdhci_bind(struct udevice *dev)
> +{
> +	struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
> +
> +	return sdhci_bind(dev, &plat->mmc, &plat->cfg);
>  }
>  
>  static const struct udevice_id pic32_sdhci_ids[] = {
> @@ -75,6 +93,9 @@ U_BOOT_DRIVER(pic32_sdhci_drv) = {
>  	.name			= "pic32_sdhci",
>  	.id			= UCLASS_MMC,
>  	.of_match		= pic32_sdhci_ids,
> +	.ops                    = &sdhci_ops,
> +	.bind                   = pic32_sdhci_bind,
>  	.probe			= pic32_sdhci_probe,
>  	.priv_auto_alloc_size	= sizeof(struct sdhci_host),
> +	.platdata_auto_alloc_size = sizeof(struct pic32_sdhci_plat),
>  };
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] mmc: pic32_sdhci: Complete the transition to driver model
  2017-06-30  4:00   ` Jaehoon Chung
@ 2017-06-30  5:51     ` Masahiro Yamada
  2017-06-30 21:30     ` Alan Ott
  1 sibling, 0 replies; 8+ messages in thread
From: Masahiro Yamada @ 2017-06-30  5:51 UTC (permalink / raw)
  To: u-boot

2017-06-30 13:00 GMT+09:00 Jaehoon Chung <jh80.chung@samsung.com>:
> On 06/21/2017 12:23 PM, Alan Ott wrote:
>> Previously this driver appeared to have been half-way converted to the new
>> driver model and did not work at all.
>>
>> Complete the transition to the driver model, adding the necessary
>> connections.
>>
>> Signed-off-by: Alan Ott <alan@softiron.com>
>> ---
>>  configs/pic32mzdask_defconfig |  1 -
>>  drivers/mmc/Kconfig           |  2 +-
>>  drivers/mmc/pic32_sdhci.c     | 31 ++++++++++++++++++++++++++-----
>>  3 files changed, 27 insertions(+), 7 deletions(-)
>>
>> diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig
>> index 688b989..afb1bdb 100644
>> --- a/configs/pic32mzdask_defconfig
>> +++ b/configs/pic32mzdask_defconfig
>> @@ -25,7 +25,6 @@ CONFIG_CMD_EXT4_WRITE=y
>>  # CONFIG_EFI_PARTITION is not set
>>  CONFIG_OF_EMBED=y
>>  CONFIG_NET_RANDOM_ETHADDR=y
>> -# CONFIG_BLK is not set
>>  CONFIG_CLK=y
>>  CONFIG_DM_GPIO=y
>>  CONFIG_MMC=y
>> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
>> index 0dd4443..b70775d 100644
>> --- a/drivers/mmc/Kconfig
>> +++ b/drivers/mmc/Kconfig
>> @@ -274,7 +274,7 @@ config MMC_SDHCI_MV
>>
>>  config MMC_SDHCI_PIC32
>>       bool "Microchip PIC32 on-chip SDHCI support"
>> -     depends on DM_MMC && MACH_PIC32
>> +     depends on DM_MMC && BLK && DM_MMC_OPS && MACH_PIC32
>
> If DM_MMC is enabled,,then CONFIG_BLK and CONFIG_DM_MMC_OPS are "y" by default.
> Why do you touch this?
>

I think the point here is CONFIG_BLK and CONFIG_DM_MMC_OPS are configurable
via menuconfig or friends.


The MMC core code is #ifdef's by CONFIG_BLK and CONFIG_DM_MMC_OPS.

It means one single board can not enable two MMC drivers at the same time
if one of them expects BLK/DM_MMC_OPS but the other does not.

Some boards need to use two different MMC drivers for SD card and eMMC.
(Some of my UniPhier boards are the case.)


Without "depends on DM_MMC && BLK && DM_MMC_OPS",
we can cause build error by enabling two MMC drivers with different
support level.



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] mmc: pic32_sdhci: Complete the transition to driver model
  2017-06-30  4:00   ` Jaehoon Chung
  2017-06-30  5:51     ` Masahiro Yamada
@ 2017-06-30 21:30     ` Alan Ott
  2017-07-02 23:47       ` Jaehoon Chung
  1 sibling, 1 reply; 8+ messages in thread
From: Alan Ott @ 2017-06-30 21:30 UTC (permalink / raw)
  To: u-boot

On 06/30/2017 12:00 AM, Jaehoon Chung wrote:
> On 06/21/2017 12:23 PM, Alan Ott wrote:
>> Previously this driver appeared to have been half-way converted to the new
>> driver model and did not work at all.
>>
>> Complete the transition to the driver model, adding the necessary
>> connections.
>>
>> Signed-off-by: Alan Ott <alan@softiron.com>
>> ---
>>   configs/pic32mzdask_defconfig |  1 -
>>   drivers/mmc/Kconfig           |  2 +-
>>   drivers/mmc/pic32_sdhci.c     | 31 ++++++++++++++++++++++++++-----
>>   3 files changed, 27 insertions(+), 7 deletions(-)
>>
>> diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig
>> index 688b989..afb1bdb 100644
>> --- a/configs/pic32mzdask_defconfig
>> +++ b/configs/pic32mzdask_defconfig
>> @@ -25,7 +25,6 @@ CONFIG_CMD_EXT4_WRITE=y
>>   # CONFIG_EFI_PARTITION is not set
>>   CONFIG_OF_EMBED=y
>>   CONFIG_NET_RANDOM_ETHADDR=y
>> -# CONFIG_BLK is not set
>>   CONFIG_CLK=y
>>   CONFIG_DM_GPIO=y
>>   CONFIG_MMC=y
>> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
>> index 0dd4443..b70775d 100644
>> --- a/drivers/mmc/Kconfig
>> +++ b/drivers/mmc/Kconfig
>> @@ -274,7 +274,7 @@ config MMC_SDHCI_MV
>>   
>>   config MMC_SDHCI_PIC32
>>   	bool "Microchip PIC32 on-chip SDHCI support"
>> -	depends on DM_MMC && MACH_PIC32
>> +	depends on DM_MMC && BLK && DM_MMC_OPS && MACH_PIC32
> If DM_MMC is enabled,,then CONFIG_BLK and CONFIG_DM_MMC_OPS are "y" by default.
> Why do you touch this?

I made it look like other drivers which use BLK and DM_MMC_OPS.

At some point it seemed required because of build failures I was having, 
but maybe my .config was just out of date. I will remove this, but 
again, other examples in the same directory are the same, so they should 
probably be fixed too, separately.

>
>>   	depends on MMC_SDHCI
>>   	help
>>   	  Support for Microchip PIC32 SDHCI controller.
>> diff --git a/drivers/mmc/pic32_sdhci.c b/drivers/mmc/pic32_sdhci.c
>> index 212e22e..fc6d7f3 100644
>> --- a/drivers/mmc/pic32_sdhci.c
>> +++ b/drivers/mmc/pic32_sdhci.c
>> @@ -15,6 +15,11 @@
>>   
>>   DECLARE_GLOBAL_DATA_PTR;
>>   
>> +struct pic32_sdhci_plat {
>> +	struct mmc_config cfg;
>> +	struct mmc mmc;
>> +};
>> +
>>   static int pic32_sdhci_get_cd(struct sdhci_host *host)
>>   {
>>   	/* PIC32 SDHCI CD errata:
>> @@ -31,6 +36,8 @@ static const struct sdhci_ops pic32_sdhci_ops = {
>>   
>>   static int pic32_sdhci_probe(struct udevice *dev)
>>   {
>> +	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
>> +	struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
>>   	struct sdhci_host *host = dev_get_priv(dev);
>>   	const void *fdt = gd->fdt_blob;
>>   	u32 f_min_max[2];
>> @@ -56,14 +63,25 @@ static int pic32_sdhci_probe(struct udevice *dev)
>>   		return ret;
>>   	}
>>   
>> -	host->max_clk   = f_min_max[1];
>> -
>> -	ret = add_sdhci(host, 0, f_min_max[0]);
>> -	if (ret)
>> +	ret = sdhci_setup_cfg(&plat->cfg, host, /*max*/0, /*min*/f_min_max[0]);
> What are "/*max*, /*min*/" ?

It documents the parameters. I'll change it to be more clear in the code.

Alan.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] mmc: pic32_sdhci: Complete the transition to driver model
  2017-06-30 21:30     ` Alan Ott
@ 2017-07-02 23:47       ` Jaehoon Chung
  0 siblings, 0 replies; 8+ messages in thread
From: Jaehoon Chung @ 2017-07-02 23:47 UTC (permalink / raw)
  To: u-boot

Hi Alan,

On 07/01/2017 06:30 AM, Alan Ott wrote:
> On 06/30/2017 12:00 AM, Jaehoon Chung wrote:
>> On 06/21/2017 12:23 PM, Alan Ott wrote:
>>> Previously this driver appeared to have been half-way converted to the new
>>> driver model and did not work at all.
>>>
>>> Complete the transition to the driver model, adding the necessary
>>> connections.
>>>
>>> Signed-off-by: Alan Ott <alan@softiron.com>
>>> ---
>>>   configs/pic32mzdask_defconfig |  1 -
>>>   drivers/mmc/Kconfig           |  2 +-
>>>   drivers/mmc/pic32_sdhci.c     | 31 ++++++++++++++++++++++++++-----
>>>   3 files changed, 27 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig
>>> index 688b989..afb1bdb 100644
>>> --- a/configs/pic32mzdask_defconfig
>>> +++ b/configs/pic32mzdask_defconfig
>>> @@ -25,7 +25,6 @@ CONFIG_CMD_EXT4_WRITE=y
>>>   # CONFIG_EFI_PARTITION is not set
>>>   CONFIG_OF_EMBED=y
>>>   CONFIG_NET_RANDOM_ETHADDR=y
>>> -# CONFIG_BLK is not set
>>>   CONFIG_CLK=y
>>>   CONFIG_DM_GPIO=y
>>>   CONFIG_MMC=y
>>> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
>>> index 0dd4443..b70775d 100644
>>> --- a/drivers/mmc/Kconfig
>>> +++ b/drivers/mmc/Kconfig
>>> @@ -274,7 +274,7 @@ config MMC_SDHCI_MV
>>>     config MMC_SDHCI_PIC32
>>>       bool "Microchip PIC32 on-chip SDHCI support"
>>> -    depends on DM_MMC && MACH_PIC32
>>> +    depends on DM_MMC && BLK && DM_MMC_OPS && MACH_PIC32
>> If DM_MMC is enabled,,then CONFIG_BLK and CONFIG_DM_MMC_OPS are "y" by default.
>> Why do you touch this?
> 
> I made it look like other drivers which use BLK and DM_MMC_OPS.
> 
> At some point it seemed required because of build failures I was having, but maybe my .config was just out of date. I will remove this, but again, other examples in the same directory are the same, so they should probably be fixed too, separately.
> 
>>
>>>       depends on MMC_SDHCI
>>>       help
>>>         Support for Microchip PIC32 SDHCI controller.
>>> diff --git a/drivers/mmc/pic32_sdhci.c b/drivers/mmc/pic32_sdhci.c
>>> index 212e22e..fc6d7f3 100644
>>> --- a/drivers/mmc/pic32_sdhci.c
>>> +++ b/drivers/mmc/pic32_sdhci.c
>>> @@ -15,6 +15,11 @@
>>>     DECLARE_GLOBAL_DATA_PTR;
>>>   +struct pic32_sdhci_plat {
>>> +    struct mmc_config cfg;
>>> +    struct mmc mmc;
>>> +};
>>> +
>>>   static int pic32_sdhci_get_cd(struct sdhci_host *host)
>>>   {
>>>       /* PIC32 SDHCI CD errata:
>>> @@ -31,6 +36,8 @@ static const struct sdhci_ops pic32_sdhci_ops = {
>>>     static int pic32_sdhci_probe(struct udevice *dev)
>>>   {
>>> +    struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
>>> +    struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
>>>       struct sdhci_host *host = dev_get_priv(dev);
>>>       const void *fdt = gd->fdt_blob;
>>>       u32 f_min_max[2];
>>> @@ -56,14 +63,25 @@ static int pic32_sdhci_probe(struct udevice *dev)
>>>           return ret;
>>>       }
>>>   -    host->max_clk   = f_min_max[1];
>>> -
>>> -    ret = add_sdhci(host, 0, f_min_max[0]);
>>> -    if (ret)
>>> +    ret = sdhci_setup_cfg(&plat->cfg, host, /*max*/0, /*min*/f_min_max[0]);
>> What are "/*max*, /*min*/" ?
> 
> It documents the parameters. I'll change it to be more clear in the code.

Don't need to describe it..It's enough to put the arguments.

Best Regards,
Jaehoon chung

> 
> Alan.
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2] mmc: pic32_sdhci: Complete the transition to driver model
  2017-06-21  3:23 ` [U-Boot] [PATCH] mmc: pic32_sdhci: Complete the transition to driver model Alan Ott
  2017-06-30  4:00   ` Jaehoon Chung
@ 2017-07-08 19:58   ` Alan Ott
  2017-07-10  9:17     ` Jaehoon Chung
  1 sibling, 1 reply; 8+ messages in thread
From: Alan Ott @ 2017-07-08 19:58 UTC (permalink / raw)
  To: u-boot

Previously this driver appeared to have been half-way converted to the new
driver model and did not work at all.

Complete the transition to the driver model, adding the necessary
connections.

Signed-off-by: Alan Ott <alan@softiron.com>
---

 Differences since v1:
   * Removed comments around min and max speed parameters
   * Removed unnecessary explicit dependencies in Kconfig

 configs/pic32mzdask_defconfig |  1 -
 drivers/mmc/pic32_sdhci.c     | 31 ++++++++++++++++++++++++++-----
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig
index 688b989..afb1bdb 100644
--- a/configs/pic32mzdask_defconfig
+++ b/configs/pic32mzdask_defconfig
@@ -25,7 +25,6 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_EFI_PARTITION is not set
 CONFIG_OF_EMBED=y
 CONFIG_NET_RANDOM_ETHADDR=y
-# CONFIG_BLK is not set
 CONFIG_CLK=y
 CONFIG_DM_GPIO=y
 CONFIG_MMC=y
diff --git a/drivers/mmc/pic32_sdhci.c b/drivers/mmc/pic32_sdhci.c
index 212e22e..66d4b6c 100644
--- a/drivers/mmc/pic32_sdhci.c
+++ b/drivers/mmc/pic32_sdhci.c
@@ -15,6 +15,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+struct pic32_sdhci_plat {
+	struct mmc_config cfg;
+	struct mmc mmc;
+};
+
 static int pic32_sdhci_get_cd(struct sdhci_host *host)
 {
 	/* PIC32 SDHCI CD errata:
@@ -31,6 +36,8 @@ static const struct sdhci_ops pic32_sdhci_ops = {
 
 static int pic32_sdhci_probe(struct udevice *dev)
 {
+	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
 	struct sdhci_host *host = dev_get_priv(dev);
 	const void *fdt = gd->fdt_blob;
 	u32 f_min_max[2];
@@ -56,14 +63,25 @@ static int pic32_sdhci_probe(struct udevice *dev)
 		return ret;
 	}
 
-	host->max_clk   = f_min_max[1];
-
-	ret = add_sdhci(host, 0, f_min_max[0]);
-	if (ret)
+	ret = sdhci_setup_cfg(&plat->cfg, host, 0, f_min_max[0]);
+	if (ret) {
+		printf("pic32_sdhci: sdhci_setup_cfg() failed\n");
 		return ret;
+	}
+
+	host->mmc = &plat->mmc;
 	host->mmc->dev = dev;
+	host->mmc->priv = host;
+	upriv->mmc = host->mmc;
 
-	return 0;
+	return sdhci_probe(dev);
+}
+
+static int pic32_sdhci_bind(struct udevice *dev)
+{
+	struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
+
+	return sdhci_bind(dev, &plat->mmc, &plat->cfg);
 }
 
 static const struct udevice_id pic32_sdhci_ids[] = {
@@ -75,6 +93,9 @@ U_BOOT_DRIVER(pic32_sdhci_drv) = {
 	.name			= "pic32_sdhci",
 	.id			= UCLASS_MMC,
 	.of_match		= pic32_sdhci_ids,
+	.ops                    = &sdhci_ops,
+	.bind                   = pic32_sdhci_bind,
 	.probe			= pic32_sdhci_probe,
 	.priv_auto_alloc_size	= sizeof(struct sdhci_host),
+	.platdata_auto_alloc_size = sizeof(struct pic32_sdhci_plat),
 };
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2] mmc: pic32_sdhci: Complete the transition to driver model
  2017-07-08 19:58   ` [U-Boot] [PATCH v2] " Alan Ott
@ 2017-07-10  9:17     ` Jaehoon Chung
  2017-07-17 11:05       ` Jaehoon Chung
  0 siblings, 1 reply; 8+ messages in thread
From: Jaehoon Chung @ 2017-07-10  9:17 UTC (permalink / raw)
  To: u-boot

Hi Alan,

On 07/09/2017 04:58 AM, Alan Ott wrote:
> Previously this driver appeared to have been half-way converted to the new
> driver model and did not work at all.
> 
> Complete the transition to the driver model, adding the necessary
> connections.

Thanks for resending v2. This patch will pick when open then next merge window.

Best Regards,
Jaehoon Chung

> 
> Signed-off-by: Alan Ott <alan@softiron.com>
> ---
> 
>  Differences since v1:
>    * Removed comments around min and max speed parameters
>    * Removed unnecessary explicit dependencies in Kconfig
> 
>  configs/pic32mzdask_defconfig |  1 -
>  drivers/mmc/pic32_sdhci.c     | 31 ++++++++++++++++++++++++++-----
>  2 files changed, 26 insertions(+), 6 deletions(-)
> 
> diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig
> index 688b989..afb1bdb 100644
> --- a/configs/pic32mzdask_defconfig
> +++ b/configs/pic32mzdask_defconfig
> @@ -25,7 +25,6 @@ CONFIG_CMD_EXT4_WRITE=y
>  # CONFIG_EFI_PARTITION is not set
>  CONFIG_OF_EMBED=y
>  CONFIG_NET_RANDOM_ETHADDR=y
> -# CONFIG_BLK is not set
>  CONFIG_CLK=y
>  CONFIG_DM_GPIO=y
>  CONFIG_MMC=y
> diff --git a/drivers/mmc/pic32_sdhci.c b/drivers/mmc/pic32_sdhci.c
> index 212e22e..66d4b6c 100644
> --- a/drivers/mmc/pic32_sdhci.c
> +++ b/drivers/mmc/pic32_sdhci.c
> @@ -15,6 +15,11 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> +struct pic32_sdhci_plat {
> +	struct mmc_config cfg;
> +	struct mmc mmc;
> +};
> +
>  static int pic32_sdhci_get_cd(struct sdhci_host *host)
>  {
>  	/* PIC32 SDHCI CD errata:
> @@ -31,6 +36,8 @@ static const struct sdhci_ops pic32_sdhci_ops = {
>  
>  static int pic32_sdhci_probe(struct udevice *dev)
>  {
> +	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
> +	struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
>  	struct sdhci_host *host = dev_get_priv(dev);
>  	const void *fdt = gd->fdt_blob;
>  	u32 f_min_max[2];
> @@ -56,14 +63,25 @@ static int pic32_sdhci_probe(struct udevice *dev)
>  		return ret;
>  	}
>  
> -	host->max_clk   = f_min_max[1];
> -
> -	ret = add_sdhci(host, 0, f_min_max[0]);
> -	if (ret)
> +	ret = sdhci_setup_cfg(&plat->cfg, host, 0, f_min_max[0]);
> +	if (ret) {
> +		printf("pic32_sdhci: sdhci_setup_cfg() failed\n");
>  		return ret;
> +	}
> +
> +	host->mmc = &plat->mmc;
>  	host->mmc->dev = dev;
> +	host->mmc->priv = host;
> +	upriv->mmc = host->mmc;
>  
> -	return 0;
> +	return sdhci_probe(dev);
> +}
> +
> +static int pic32_sdhci_bind(struct udevice *dev)
> +{
> +	struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
> +
> +	return sdhci_bind(dev, &plat->mmc, &plat->cfg);
>  }
>  
>  static const struct udevice_id pic32_sdhci_ids[] = {
> @@ -75,6 +93,9 @@ U_BOOT_DRIVER(pic32_sdhci_drv) = {
>  	.name			= "pic32_sdhci",
>  	.id			= UCLASS_MMC,
>  	.of_match		= pic32_sdhci_ids,
> +	.ops                    = &sdhci_ops,
> +	.bind                   = pic32_sdhci_bind,
>  	.probe			= pic32_sdhci_probe,
>  	.priv_auto_alloc_size	= sizeof(struct sdhci_host),
> +	.platdata_auto_alloc_size = sizeof(struct pic32_sdhci_plat),
>  };
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH v2] mmc: pic32_sdhci: Complete the transition to driver model
  2017-07-10  9:17     ` Jaehoon Chung
@ 2017-07-17 11:05       ` Jaehoon Chung
  0 siblings, 0 replies; 8+ messages in thread
From: Jaehoon Chung @ 2017-07-17 11:05 UTC (permalink / raw)
  To: u-boot

On 07/10/2017 06:17 PM, Jaehoon Chung wrote:
> Hi Alan,
> 
> On 07/09/2017 04:58 AM, Alan Ott wrote:
>> Previously this driver appeared to have been half-way converted to the new
>> driver model and did not work at all.
>>
>> Complete the transition to the driver model, adding the necessary
>> connections.
> 
> Thanks for resending v2. This patch will pick when open then next merge window.

Applied to u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

> 
> Best Regards,
> Jaehoon Chung
> 
>>
>> Signed-off-by: Alan Ott <alan@softiron.com>
>> ---
>>
>>  Differences since v1:
>>    * Removed comments around min and max speed parameters
>>    * Removed unnecessary explicit dependencies in Kconfig
>>
>>  configs/pic32mzdask_defconfig |  1 -
>>  drivers/mmc/pic32_sdhci.c     | 31 ++++++++++++++++++++++++++-----
>>  2 files changed, 26 insertions(+), 6 deletions(-)
>>
>> diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig
>> index 688b989..afb1bdb 100644
>> --- a/configs/pic32mzdask_defconfig
>> +++ b/configs/pic32mzdask_defconfig
>> @@ -25,7 +25,6 @@ CONFIG_CMD_EXT4_WRITE=y
>>  # CONFIG_EFI_PARTITION is not set
>>  CONFIG_OF_EMBED=y
>>  CONFIG_NET_RANDOM_ETHADDR=y
>> -# CONFIG_BLK is not set
>>  CONFIG_CLK=y
>>  CONFIG_DM_GPIO=y
>>  CONFIG_MMC=y
>> diff --git a/drivers/mmc/pic32_sdhci.c b/drivers/mmc/pic32_sdhci.c
>> index 212e22e..66d4b6c 100644
>> --- a/drivers/mmc/pic32_sdhci.c
>> +++ b/drivers/mmc/pic32_sdhci.c
>> @@ -15,6 +15,11 @@
>>  
>>  DECLARE_GLOBAL_DATA_PTR;
>>  
>> +struct pic32_sdhci_plat {
>> +	struct mmc_config cfg;
>> +	struct mmc mmc;
>> +};
>> +
>>  static int pic32_sdhci_get_cd(struct sdhci_host *host)
>>  {
>>  	/* PIC32 SDHCI CD errata:
>> @@ -31,6 +36,8 @@ static const struct sdhci_ops pic32_sdhci_ops = {
>>  
>>  static int pic32_sdhci_probe(struct udevice *dev)
>>  {
>> +	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
>> +	struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
>>  	struct sdhci_host *host = dev_get_priv(dev);
>>  	const void *fdt = gd->fdt_blob;
>>  	u32 f_min_max[2];
>> @@ -56,14 +63,25 @@ static int pic32_sdhci_probe(struct udevice *dev)
>>  		return ret;
>>  	}
>>  
>> -	host->max_clk   = f_min_max[1];
>> -
>> -	ret = add_sdhci(host, 0, f_min_max[0]);
>> -	if (ret)
>> +	ret = sdhci_setup_cfg(&plat->cfg, host, 0, f_min_max[0]);
>> +	if (ret) {
>> +		printf("pic32_sdhci: sdhci_setup_cfg() failed\n");
>>  		return ret;
>> +	}
>> +
>> +	host->mmc = &plat->mmc;
>>  	host->mmc->dev = dev;
>> +	host->mmc->priv = host;
>> +	upriv->mmc = host->mmc;
>>  
>> -	return 0;
>> +	return sdhci_probe(dev);
>> +}
>> +
>> +static int pic32_sdhci_bind(struct udevice *dev)
>> +{
>> +	struct pic32_sdhci_plat *plat = dev_get_platdata(dev);
>> +
>> +	return sdhci_bind(dev, &plat->mmc, &plat->cfg);
>>  }
>>  
>>  static const struct udevice_id pic32_sdhci_ids[] = {
>> @@ -75,6 +93,9 @@ U_BOOT_DRIVER(pic32_sdhci_drv) = {
>>  	.name			= "pic32_sdhci",
>>  	.id			= UCLASS_MMC,
>>  	.of_match		= pic32_sdhci_ids,
>> +	.ops                    = &sdhci_ops,
>> +	.bind                   = pic32_sdhci_bind,
>>  	.probe			= pic32_sdhci_probe,
>>  	.priv_auto_alloc_size	= sizeof(struct sdhci_host),
>> +	.platdata_auto_alloc_size = sizeof(struct pic32_sdhci_plat),
>>  };
>>
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-07-17 11:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170621032345epcas2p4cb9c7cfcf97e58d7dc20471faa1e28d0@epcas2p4.samsung.com>
2017-06-21  3:23 ` [U-Boot] [PATCH] mmc: pic32_sdhci: Complete the transition to driver model Alan Ott
2017-06-30  4:00   ` Jaehoon Chung
2017-06-30  5:51     ` Masahiro Yamada
2017-06-30 21:30     ` Alan Ott
2017-07-02 23:47       ` Jaehoon Chung
2017-07-08 19:58   ` [U-Boot] [PATCH v2] " Alan Ott
2017-07-10  9:17     ` Jaehoon Chung
2017-07-17 11:05       ` Jaehoon Chung

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.