All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] mmc: mmc-uclass: use the fixed devnum with alias node
       [not found] <CGME20170202044119epcas5p10bc788d837e864e308d2410adf205097@epcas5p1.samsung.com>
@ 2017-02-02  4:41 ` Jaehoon Chung
  2017-02-09  5:24   ` Jaehoon Chung
  0 siblings, 1 reply; 2+ messages in thread
From: Jaehoon Chung @ 2017-02-02  4:41 UTC (permalink / raw)
  To: u-boot

If there are alias nodes as "mmc", use the devnum as alias index
number.
This patch is for fixing a problem of Exynos4 series.
Problem is the below thing.

Current legacy mode:
EXYNOS DWMMC: 0, SAMSUNG SDHCI: 1

After using DM:
SAMSUNG SDHCI: 0, EXYNOS DWMMC: 1

Dev index is swapped.
Then u-boot can't find the kernel image..because it is already set to 0 as mmcdev.
If change from legacy to DM, also needs to touch all exynos4 config file.
For using simply, just supporting the fixed devnum with alias node is better than it.

Usage:
alaise {
	....
	mmc0 = &sdhci2; /* eMMC */
	mmc1 = &sdhci1; /* SD */
	...
}

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
Changelog on V2:
- Add the #ifndef CONFIG_SPL_BUILD
- Fixes the typo by Simon's comment

 drivers/mmc/mmc-uclass.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 2fe5d61..de7acb6 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -13,6 +13,8 @@
 #include <dm/root.h>
 #include "mmc_private.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #ifdef CONFIG_DM_MMC_OPS
 int dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
 		    struct mmc_data *data)
@@ -192,10 +194,15 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
 {
 	struct blk_desc *bdesc;
 	struct udevice *bdev;
-	int ret;
+	int ret, devnum = -1;
+
+#ifndef CONFIG_SPL_BUILD
+	/* Use the fixed index with aliase node's index */
+	fdtdec_get_alias_seq(gd->fdt_blob, "mmc", dev->of_offset, &devnum);
+#endif
 
-	ret = blk_create_devicef(dev, "mmc_blk", "blk", IF_TYPE_MMC, -1, 512,
-				 0, &bdev);
+	ret = blk_create_devicef(dev, "mmc_blk", "blk", IF_TYPE_MMC,
+			devnum, 512, 0, &bdev);
 	if (ret) {
 		debug("Cannot create block device\n");
 		return ret;
-- 
2.10.2

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

* [U-Boot] [PATCH v2] mmc: mmc-uclass: use the fixed devnum with alias node
  2017-02-02  4:41 ` [U-Boot] [PATCH v2] mmc: mmc-uclass: use the fixed devnum with alias node Jaehoon Chung
@ 2017-02-09  5:24   ` Jaehoon Chung
  0 siblings, 0 replies; 2+ messages in thread
From: Jaehoon Chung @ 2017-02-09  5:24 UTC (permalink / raw)
  To: u-boot

On 02/02/2017 01:41 PM, Jaehoon Chung wrote:
> If there are alias nodes as "mmc", use the devnum as alias index
> number.
> This patch is for fixing a problem of Exynos4 series.
> Problem is the below thing.
> 
> Current legacy mode:
> EXYNOS DWMMC: 0, SAMSUNG SDHCI: 1
> 
> After using DM:
> SAMSUNG SDHCI: 0, EXYNOS DWMMC: 1
> 
> Dev index is swapped.
> Then u-boot can't find the kernel image..because it is already set to 0 as mmcdev.
> If change from legacy to DM, also needs to touch all exynos4 config file.
> For using simply, just supporting the fixed devnum with alias node is better than it.
> 
> Usage:
> alaise {
> 	....
> 	mmc0 = &sdhci2; /* eMMC */
> 	mmc1 = &sdhci1; /* SD */
> 	...
> }
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied on u-boot-mmc.

Best Regards,
Jaehoon Chung

> ---
> Changelog on V2:
> - Add the #ifndef CONFIG_SPL_BUILD
> - Fixes the typo by Simon's comment
> 
>  drivers/mmc/mmc-uclass.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 2fe5d61..de7acb6 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -13,6 +13,8 @@
>  #include <dm/root.h>
>  #include "mmc_private.h"
>  
> +DECLARE_GLOBAL_DATA_PTR;
> +
>  #ifdef CONFIG_DM_MMC_OPS
>  int dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
>  		    struct mmc_data *data)
> @@ -192,10 +194,15 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
>  {
>  	struct blk_desc *bdesc;
>  	struct udevice *bdev;
> -	int ret;
> +	int ret, devnum = -1;
> +
> +#ifndef CONFIG_SPL_BUILD
> +	/* Use the fixed index with aliase node's index */
> +	fdtdec_get_alias_seq(gd->fdt_blob, "mmc", dev->of_offset, &devnum);
> +#endif
>  
> -	ret = blk_create_devicef(dev, "mmc_blk", "blk", IF_TYPE_MMC, -1, 512,
> -				 0, &bdev);
> +	ret = blk_create_devicef(dev, "mmc_blk", "blk", IF_TYPE_MMC,
> +			devnum, 512, 0, &bdev);
>  	if (ret) {
>  		debug("Cannot create block device\n");
>  		return ret;
> 

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

end of thread, other threads:[~2017-02-09  5:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170202044119epcas5p10bc788d837e864e308d2410adf205097@epcas5p1.samsung.com>
2017-02-02  4:41 ` [U-Boot] [PATCH v2] mmc: mmc-uclass: use the fixed devnum with alias node Jaehoon Chung
2017-02-09  5:24   ` 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.