mmc: pic32_sdhci: Complete the transition to driver model
PATCH 1/1 mmc: pic32_sdhci: Complete the transition to driver model
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.
--- configs/pic32mzdask_defconfig | 1 - drivers/mmc/Kconfig | 2 +- drivers/mmc/pic32_sdhci.c | 31 ++++++++++++++++++++++++++----- 3 files changed, 27 insertions(+), 7 deletions(-)
configs/pic32mzdask_defconfig +0 -1
@@ -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
drivers/mmc/Kconfig +1 -1
@@ -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.
drivers/mmc/pic32_sdhci.c +26 -5
@@ -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), };
Signature · 1 line
2.9.3
PATCH 1/1 mmc: pic32_sdhci: Complete the transition to driver model
Quoted 30 lines · Alan Ott
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 <[email protected]>--- configs/pic32mzdask_defconfig | 1 - drivers/mmc/Kconfig | 2 +- drivers/mmc/pic32_sdhci.c | 31 ++++++++++++++++++++++++++----- 3 files changed, 27 insertions(+), 7 deletions(-)configs/pic32mzdask_defconfig +0
-1@@ -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=ydrivers/mmc/Kconfig +0
-0
drivers/mmc/Kconfig config MMC_SDHCI_MV · line 277
Quoted 5 lines
drivers/mmc/Kconfig +1
-1@@ -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?
Quoted 29 lines
drivers/mmc/Kconfig +0
-0depends on MMC_SDHCI help Support for Microchip PIC32 SDHCI controller.drivers/mmc/pic32_sdhci.c +7
-0@@ -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 ];
drivers/mmc/pic32_sdhci.c static int pic32_sdhci_probe(struct udevice *dev) · line 66
Quoted 8 lines
drivers/mmc/pic32_sdhci.c +1
-4@@ -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*/" ?
Quoted 33 lines
drivers/mmc/pic32_sdhci.c +18
-1+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), };
PATCH 1/1 mmc: pic32_sdhci: Complete the transition to driver model
2017-06-30 13:00 GMT+09:00 Jaehoon Chung <[email protected]>:
Quoted 32 lines · Alan Ott
Quoted 31 lines
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 <[email protected]>--- configs/pic32mzdask_defconfig | 1 - drivers/mmc/Kconfig | 2 +- drivers/mmc/pic32_sdhci.c | 31 ++++++++++++++++++++++++++----- 3 files changed, 27 insertions(+), 7 deletions(-)configs/pic32mzdask_defconfig +0
-1@@ -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=ydrivers/mmc/Kconfig +0
-0@@ -274,7 +274,7 @@ config MMC_SDHCI_MV
Quoted 8 lines
drivers/mmc/Kconfig config MMC_SDHCI_MV · line 277
Quoted 4 lines
drivers/mmc/Kconfig +1
-1config 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_PIC32If
DM_MMCis enabled,,thenCONFIG_BLKandCONFIG_DM_MMC_OPSare "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.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 1/1 mmc: pic32_sdhci: Complete the transition to driver model
In reply to Jaehoon ChungQuoted 32 lines · Jaehoon Chung
Quoted 31 lines · Alan Ott
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 <[email protected]>--- configs/pic32mzdask_defconfig | 1 - drivers/mmc/Kconfig | 2 +- drivers/mmc/pic32_sdhci.c | 31 ++++++++++++++++++++++++++----- 3 files changed, 27 insertions(+), 7 deletions(-)configs/pic32mzdask_defconfig +0
-1@@ -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=ydrivers/mmc/Kconfig +0
-0@@ -274,7 +274,7 @@ config MMC_SDHCI_MV
Quoted 6 lines
drivers/mmc/Kconfig config MMC_SDHCI_MV · line 277
Quoted 4 lines
drivers/mmc/Kconfig +1
-1config 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_PIC32If
DM_MMCis enabled,,thenCONFIG_BLKandCONFIG_DM_MMC_OPSare "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.
Quoted 33 lines
Quoted 33 lines
drivers/mmc/Kconfig +0
-0depends on MMC_SDHCI help Support for Microchip PIC32 SDHCI controller.drivers/mmc/pic32_sdhci.c +7
-0@@ -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; }
Quoted 6 lines
drivers/mmc/pic32_sdhci.c static int pic32_sdhci_probe(struct udevice *dev) · line 66
Quoted 5 lines
drivers/mmc/pic32_sdhci.c +1
-4- 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.
PATCH 1/1 mmc: pic32_sdhci: Complete the transition to driver model
Hi Alan,
Quoted 79 lines · Alan Ott
Quoted 29 lines · Jaehoon Chung
Quoted 28 lines · Alan Ott
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 <[email protected]>--- configs/pic32mzdask_defconfig | 1 - drivers/mmc/Kconfig | 2 +- drivers/mmc/pic32_sdhci.c | 31 ++++++++++++++++++++++++++----- 3 files changed, 27 insertions(+), 7 deletions(-)configs/pic32mzdask_defconfig +0
-1@@ -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=ydrivers/mmc/Kconfig +0
-1--- a/drivers/mmc/KconfigQuoted 8 lines
drivers/mmc/Kconfig config MMC_SDHCI_MV · line 276
Quoted 6 lines
+++ b/drivers/mmc/Kconfig
drivers/mmc/Kconfig +1
-1@@ -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_PIC32If
DM_MMCis enabled,,thenCONFIG_BLKandCONFIG_DM_MMC_OPSare "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.
Quoted 27 lines
Quoted 27 lines
drivers/mmc/Kconfig +0
-0depends on MMC_SDHCI help Support for Microchip PIC32 SDHCI controller.drivers/mmc/pic32_sdhci.c +6
-0@@ -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)Quoted 8 lines
drivers/mmc/pic32_sdhci.c static int pic32_sdhci_probe(struct udevice *dev) · line 66
Quoted 7 lines
drivers/mmc/pic32_sdhci.c +1
-3return 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*/" ?
Quoted 1 line
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
Quoted 6 lines
Alan.
PATCH v2 1/1 mmc: pic32_sdhci: Complete the transition to driver model
In reply to Alan OttPreviously 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.
---
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(-)
configs/pic32mzdask_defconfig +0 -1
@@ -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
drivers/mmc/pic32_sdhci.c +26 -5
@@ -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), };
Signature · 1 line
2.9.3
PATCH v2 1/1 mmc: pic32_sdhci: Complete the transition to driver model
Hi Alan,
Quoted 5 lines · Alan Ott
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
Quoted 91 lines
Signed-off-by Alan Ott <[email protected]>---
Differences since v1:
* Removed comments around min and max speed parameters
* Removed unnecessary explicit dependencies inKconfigconfigs/pic32mzdask_defconfig | 1 - drivers/mmc/pic32_sdhci.c | 31 ++++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-)configs/pic32mzdask_defconfig +0
-1@@ -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=ydrivers/mmc/pic32_sdhci.c +26
-5@@ -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), };
PATCH v2 1/1 mmc: pic32_sdhci: Complete the transition to driver model
Quoted 10 lines · Jaehoon Chung
Hi Alan,
Quoted 5 lines · Alan Ott
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
Quoted 101 lines
Best Regards,
Jaehoon ChungQuoted 82 lines
Signed-off-by Alan Ott <[email protected]>---
Differences since v1:
* Removed comments around min and max speed parameters
* Removed unnecessary explicit dependencies inKconfigconfigs/pic32mzdask_defconfig | 1 - drivers/mmc/pic32_sdhci.c | 31 ++++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-)configs/pic32mzdask_defconfig +0
-1@@ -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=ydrivers/mmc/pic32_sdhci.c +23
-5@@ -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[] = {drivers/mmc/pic32_sdhci.c U_BOOT_DRIVER(pic32_sdhci_drv) = { · line 101
Quoted 9 lines
drivers/mmc/pic32_sdhci.c +3
-0@@ -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