Skip to contentSkip to conversation

arm:mmc:goni/exynos: Fix wrong mmc base register devices offset.

PATCH New Przemyslaw Marczak 4 participants 18 messages Aug 20, 2013 – Sep 2, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 arm:mmc:goni/exynos: Fix wrong mmc base register devices offset.

On s5pc1xx mmc devices offset is multiply of 0x100000, wrong value was 0x10000. Register offset always points to mmc 0 before this change.

Add macro definition of mmc dev register offset to s5pc1xx and exynos mmc.

---
 arch/arm/include/asm/arch-exynos/mmc.h  |    6 +++++-
 arch/arm/include/asm/arch-s5pc1xx/mmc.h |    6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-exynos/mmc.h +5 -1
index 96610b8..98312d1 100644
@@ -8,6 +8,8 @@
 #ifndef __ASM_ARCH_MMC_H_
 #define __ASM_ARCH_MMC_H_
 
+#define S5P_MMC_DEV_OFFSET	0x10000
+
 #define SDHCI_CONTROL2		0x80
 #define SDHCI_CONTROL3		0x84
 #define SDHCI_CONTROL4		0x8C
@@ -55,7 +57,9 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width);
 
 static inline unsigned int s5p_mmc_init(int index, int bus_width)
 {
-	unsigned int base = samsung_get_base_mmc() + (0x10000 * index);
+	unsigned int base = samsung_get_base_mmc() +
+				(S5P_MMC_DEV_OFFSET * index);
+
 	return s5p_sdhci_init(base, index, bus_width);
 }
 #endif
arch/arm/include/asm/arch-s5pc1xx/mmc.h +5 -1
index 96610b8..55ff10b 100644
@@ -8,6 +8,8 @@
 #ifndef __ASM_ARCH_MMC_H_
 #define __ASM_ARCH_MMC_H_
 
+#define S5P_MMC_DEV_OFFSET	0x100000
+
 #define SDHCI_CONTROL2		0x80
 #define SDHCI_CONTROL3		0x84
 #define SDHCI_CONTROL4		0x8C
@@ -55,7 +57,9 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width);
 
 static inline unsigned int s5p_mmc_init(int index, int bus_width)
 {
-	unsigned int base = samsung_get_base_mmc() + (0x10000 * index);
+	unsigned int base = samsung_get_base_mmc() +
+				 (S5P_MMC_DEV_OFFSET * index);
+
 	return s5p_sdhci_init(base, index, bus_width);
 }
 #endif
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/3 arm:mmc:goni/exynos: Fix wrong mmc base register devices offset.

Hi Minkyu,

Quoted 6 lines

On s5pc1xx mmc devices offset is multiply of 0x100000, wrong value was 0x10000. Register offset always points to mmc 0 before this change.

Add macro definition of mmc dev register offset to s5pc1xx and exynos mmc.

Could you review this patch, please?

Quoted 58 lines
---
  arch/arm/include/asm/arch-exynos/mmc.h  |    6 +++++-
  arch/arm/include/asm/arch-s5pc1xx/mmc.h |    6 +++++-
  2 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-exynos/mmc.h +5 -1
index 96610b8..98312d1 100644
@@ -8,6 +8,8 @@
  #ifndef __ASM_ARCH_MMC_H_
  #define __ASM_ARCH_MMC_H_
 
+#define S5P_MMC_DEV_OFFSET	0x10000
+
  #define SDHCI_CONTROL2		0x80
  #define SDHCI_CONTROL3		0x84
  #define SDHCI_CONTROL4		0x8C
@@ -55,7 +57,9 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width);
 
  static inline unsigned int s5p_mmc_init(int index, int bus_width)
  {
-	unsigned int base = samsung_get_base_mmc() + (0x10000 * index);
+	unsigned int base = samsung_get_base_mmc() +
+				(S5P_MMC_DEV_OFFSET * index);
+
  	return s5p_sdhci_init(base, index, bus_width);
  }
  #endif
arch/arm/include/asm/arch-s5pc1xx/mmc.h +5 -1
index 96610b8..55ff10b 100644
@@ -8,6 +8,8 @@
  #ifndef __ASM_ARCH_MMC_H_
  #define __ASM_ARCH_MMC_H_
 
+#define S5P_MMC_DEV_OFFSET	0x100000
+
  #define SDHCI_CONTROL2		0x80
  #define SDHCI_CONTROL3		0x84
  #define SDHCI_CONTROL4		0x8C
@@ -55,7 +57,9 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width);
 
  static inline unsigned int s5p_mmc_init(int index, int bus_width)
  {
-	unsigned int base = samsung_get_base_mmc() + (0x10000 * index);
+	unsigned int base = samsung_get_base_mmc() +
+				 (S5P_MMC_DEV_OFFSET * index);
+
  	return s5p_sdhci_init(base, index, bus_width);
  }
  #endif
Signature · 4 lines
Best Regards
Przemyslaw Marczak

SRPOL | Linux Platform Group
#2 lore raw

PATCH 1/3 arm:mmc:goni/exynos: Fix wrong mmc base register devices offset.

Looks good to me.

Quoted 71 lines · Przemyslaw Marczak

Hi Minkyu,

Quoted 6 lines

On s5pc1xx mmc devices offset is multiply of 0x100000, wrong value was 0x10000. Register offset always points to mmc 0 before this change.

Add macro definition of mmc dev register offset to s5pc1xx and exynos mmc.

Could you review this patch, please?

Quoted 58 lines
---
  arch/arm/include/asm/arch-exynos/mmc.h  |    6 +++++-
  arch/arm/include/asm/arch-s5pc1xx/mmc.h |    6 +++++-
  2 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-exynos/mmc.h +5 -1
index 96610b8..98312d1 100644
@@ -8,6 +8,8 @@
  #ifndef __ASM_ARCH_MMC_H_
  #define __ASM_ARCH_MMC_H_
 
+#define S5P_MMC_DEV_OFFSET    0x10000
+
  #define SDHCI_CONTROL2        0x80
  #define SDHCI_CONTROL3        0x84
  #define SDHCI_CONTROL4        0x8C
@@ -55,7 +57,9 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width);
 
  static inline unsigned int s5p_mmc_init(int index, int bus_width)
  {
-    unsigned int base = samsung_get_base_mmc() + (0x10000 * index);
+    unsigned int base = samsung_get_base_mmc() +
+                (S5P_MMC_DEV_OFFSET * index);
+
      return s5p_sdhci_init(base, index, bus_width);
  }
  #endif
arch/arm/include/asm/arch-s5pc1xx/mmc.h +5 -1
index 96610b8..55ff10b 100644
@@ -8,6 +8,8 @@
  #ifndef __ASM_ARCH_MMC_H_
  #define __ASM_ARCH_MMC_H_
 
+#define S5P_MMC_DEV_OFFSET    0x100000
+
  #define SDHCI_CONTROL2        0x80
  #define SDHCI_CONTROL3        0x84
  #define SDHCI_CONTROL4        0x8C
@@ -55,7 +57,9 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width);
 
  static inline unsigned int s5p_mmc_init(int index, int bus_width)
  {
-    unsigned int base = samsung_get_base_mmc() + (0x10000 * index);
+    unsigned int base = samsung_get_base_mmc() +
+                 (S5P_MMC_DEV_OFFSET * index);
+
      return s5p_sdhci_init(base, index, bus_width);
  }
  #endif
#3 lore raw

PATCH 2/3 arm:goni:mmc: Add sd card detection and initialization.

In reply to Przemyslaw Marczak

This change allow to use sd card on Goni the same like mmc 0. SD card is mmc dev 1, so it can be used like this: "fatls mmc 1:2".

---
 board/samsung/goni/goni.c |   32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
board/samsung/goni/goni.c +31 -1
index c05801d..3b236b4 100644
@@ -69,6 +69,7 @@ int checkboard(void)
 int board_mmc_init(bd_t *bis)
 {
 	int i;
+	int ret;
 
 	/* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */
 	s5p_gpio_direction_output(&s5pc110_gpio->j2, 7, 1);
@@ -91,7 +92,36 @@ int board_mmc_init(bd_t *bis)
 		s5p_gpio_set_drv(&s5pc110_gpio->g0, i, GPIO_DRV_4X);
 	}
 
-	return s5p_mmc_init(0, 4);
+	ret = s5p_mmc_init(0, 4);
+	if (ret) {
+		puts("MMC: Failed to init MMC:0.\n");
+		return ret;
+	}
+
+	/*
+	 * SD card (T_FLASH) detect and init
+	 * T_FLASH_DETECT: EINT28: GPH3[4] input mode
+	 */
+	s5p_gpio_cfg_pin(&s5pc110_gpio->h3, 4, GPIO_INPUT);
+	s5p_gpio_set_pull(&s5pc110_gpio->h3, 4, GPIO_PULL_UP);
+
+	if (!s5p_gpio_get_value(&s5pc110_gpio->h3, 4)) {
+		for (i = 0; i < 7; i++) {
+			if (i == 2)
+				continue;
+			/* GPG2[0:6] special function 2 */
+			s5p_gpio_cfg_pin(&s5pc110_gpio->g2, i, 0x2);
+			/* GPG2[0:6] pull disable */
+			s5p_gpio_set_pull(&s5pc110_gpio->g2, i, GPIO_PULL_NONE);
+			/* GPG2[0:6] drv 4x */
+			s5p_gpio_set_drv(&s5pc110_gpio->g2, i, GPIO_DRV_4X);
+		}
+		if (s5p_mmc_init(2, 4))
+			puts("MMC: Failed to init SD card (MMC:2).\n");
+	}
+
+	/* SD card init is optional so print information when it fails only */
+	return ret;
 }
 #endif
 
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 2/3 arm:goni:mmc: Add sd card detection and initialization.

Hello Minkyu,

Quoted 2 lines

This change allow to use sd card on Goni the same like mmc 0. SD card is mmc dev 1, so it can be used like this: "fatls mmc 1:2".

Could you review this patch, please?

Quoted 59 lines
---
  board/samsung/goni/goni.c |   32 +++++++++++++++++++++++++++++++-
  1 file changed, 31 insertions(+), 1 deletion(-)
board/samsung/goni/goni.c +31 -1
index c05801d..3b236b4 100644
@@ -69,6 +69,7 @@ int checkboard(void)
  int board_mmc_init(bd_t *bis)
  {
  	int i;
+	int ret;
 
  	/* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */
  	s5p_gpio_direction_output(&s5pc110_gpio->j2, 7, 1);
@@ -91,7 +92,36 @@ int board_mmc_init(bd_t *bis)
  		s5p_gpio_set_drv(&s5pc110_gpio->g0, i, GPIO_DRV_4X);
  	}
 
-	return s5p_mmc_init(0, 4);
+	ret = s5p_mmc_init(0, 4);
+	if (ret) {
+		puts("MMC: Failed to init MMC:0.\n");
+		return ret;
+	}
+
+	/*
+	 * SD card (T_FLASH) detect and init
+	 * T_FLASH_DETECT: EINT28: GPH3[4] input mode
+	 */
+	s5p_gpio_cfg_pin(&s5pc110_gpio->h3, 4, GPIO_INPUT);
+	s5p_gpio_set_pull(&s5pc110_gpio->h3, 4, GPIO_PULL_UP);
+
+	if (!s5p_gpio_get_value(&s5pc110_gpio->h3, 4)) {
+		for (i = 0; i < 7; i++) {
+			if (i == 2)
+				continue;
+			/* GPG2[0:6] special function 2 */
+			s5p_gpio_cfg_pin(&s5pc110_gpio->g2, i, 0x2);
+			/* GPG2[0:6] pull disable */
+			s5p_gpio_set_pull(&s5pc110_gpio->g2, i, GPIO_PULL_NONE);
+			/* GPG2[0:6] drv 4x */
+			s5p_gpio_set_drv(&s5pc110_gpio->g2, i, GPIO_DRV_4X);
+		}
+		if (s5p_mmc_init(2, 4))
+			puts("MMC: Failed to init SD card (MMC:2).\n");
+	}
+
+	/* SD card init is optional so print information when it fails only */
+	return ret;
  }
  #endif
 
Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#5 lore raw

PATCH 2/3 arm:goni:mmc: Add sd card detection and initialization.

Quoted 31 lines · Przemyslaw Marczak

Hello Minkyu,

Quoted 2 lines

This change allow to use sd card on Goni the same like mmc 0. SD card is mmc dev 1, so it can be used like this: "fatls mmc 1:2".

Could you review this patch, please?

Quoted 24 lines
---
  board/samsung/goni/goni.c |   32 +++++++++++++++++++++++++++++++-
  1 file changed, 31 insertions(+), 1 deletion(-)
board/samsung/goni/goni.c +1 -0
index c05801d..3b236b4 100644
@@ -69,6 +69,7 @@ int checkboard(void)
  int board_mmc_init(bd_t *bis)
  {
      int i;
+    int ret;
 
      /* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */
      s5p_gpio_direction_output(&s5pc110_gpio->j2, 7, 1);
@@ -91,7 +92,36 @@ int board_mmc_init(bd_t *bis)
          s5p_gpio_set_drv(&s5pc110_gpio->g0, i, GPIO_DRV_4X);
      }
 
Quoted 6 lines

board/samsung/goni/goni.c int board_mmc_init(bd_t *bis) · line 99

Quoted 6 lines
board/samsung/goni/goni.c +5 -1
-    return s5p_mmc_init(0, 4);
+    ret = s5p_mmc_init(0, 4);
+    if (ret) {
+        puts("MMC: Failed to init MMC:0.\n");
+        return ret;
+    }

When eMMC init is failed, immediately return?
I think that even if eMMC init is failed, there is worth that try to init SD-card.

Best Regards,
Jaehoon Chung

Quoted 31 lines
Quoted 29 lines
board/samsung/goni/goni.c +25 -0
+
+    /*
+     * SD card (T_FLASH) detect and init
+     * T_FLASH_DETECT: EINT28: GPH3[4] input mode
+     */
+    s5p_gpio_cfg_pin(&s5pc110_gpio->h3, 4, GPIO_INPUT);
+    s5p_gpio_set_pull(&s5pc110_gpio->h3, 4, GPIO_PULL_UP);
+
+    if (!s5p_gpio_get_value(&s5pc110_gpio->h3, 4)) {
+        for (i = 0; i < 7; i++) {
+            if (i == 2)
+                continue;
+            /* GPG2[0:6] special function 2 */
+            s5p_gpio_cfg_pin(&s5pc110_gpio->g2, i, 0x2);
+            /* GPG2[0:6] pull disable */
+            s5p_gpio_set_pull(&s5pc110_gpio->g2, i, GPIO_PULL_NONE);
+            /* GPG2[0:6] drv 4x */
+            s5p_gpio_set_drv(&s5pc110_gpio->g2, i, GPIO_DRV_4X);
+        }
+        if (s5p_mmc_init(2, 4))
+            puts("MMC: Failed to init SD card (MMC:2).\n");
+    }
+
+    /* SD card init is optional so print information when it fails only */
+    return ret;
  }
  #endif
 
#6 lore raw

PATCH 2/3 arm:goni:mmc: Add sd card detection and initialization.

Quoted 5 lines · Jaehoon Chung

When eMMC init is failed, immediately return?
I think that even if eMMC init is failed, there is worth that try to init SD-card.

Best Regards,
Jaehoon Chung

Hi Jaehoon,
You're right, I will change this.
Regards

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#7 lore raw

PATCH v2 1/1 arm:goni:mmc: Add sd card detection and initialization.

In reply to Przemyslaw Marczak

This change allow to use sd card on Goni the same like mmc 0. SD card is mmc dev 1, so it can be used like this: "fatls mmc 1:2".

Changes in V2:
- Init SD card even if eMMC init fail.

---
 board/samsung/goni/goni.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
board/samsung/goni/goni.c +30 -1
index c05801d..2bb2507 100644
@@ -69,6 +69,7 @@ int checkboard(void)
 int board_mmc_init(bd_t *bis)
 {
 	int i;
+	int ret;
 
 	/* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */
 	s5p_gpio_direction_output(&s5pc110_gpio->j2, 7, 1);
@@ -91,7 +92,35 @@ int board_mmc_init(bd_t *bis)
 		s5p_gpio_set_drv(&s5pc110_gpio->g0, i, GPIO_DRV_4X);
 	}
 
-	return s5p_mmc_init(0, 4);
+	ret = s5p_mmc_init(0, 4);
+	if (ret) {
+		puts("MMC: Failed to init MMC:0.\n");
+	}
+
+	/*
+	 * SD card (T_FLASH) detect and init
+	 * T_FLASH_DETECT: EINT28: GPH3[4] input mode
+	 */
+	s5p_gpio_cfg_pin(&s5pc110_gpio->h3, 4, GPIO_INPUT);
+	s5p_gpio_set_pull(&s5pc110_gpio->h3, 4, GPIO_PULL_UP);
+
+	if (!s5p_gpio_get_value(&s5pc110_gpio->h3, 4)) {
+		for (i = 0; i < 7; i++) {
+			if (i == 2)
+				continue;
+			/* GPG2[0:6] special function 2 */
+			s5p_gpio_cfg_pin(&s5pc110_gpio->g2, i, 0x2);
+			/* GPG2[0:6] pull disable */
+			s5p_gpio_set_pull(&s5pc110_gpio->g2, i, GPIO_PULL_NONE);
+			/* GPG2[0:6] drv 4x */
+			s5p_gpio_set_drv(&s5pc110_gpio->g2, i, GPIO_DRV_4X);
+		}
+		if (s5p_mmc_init(2, 4))
+			puts("MMC: Failed to init SD card (MMC:2).\n");
+	}
+
+	/* SD card init is optional so print information when it fails only */
+	return ret;
 }
 #endif
 
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH v2 1/1 arm:goni:mmc: Add sd card detection and initialization.

Hi Przemyslaw,

Quoted 26 lines · Przemyslaw Marczak

This change allow to use sd card on Goni the same like mmc 0. SD card is mmc dev 1, so it can be used like this: "fatls mmc 1:2".

Changes in V2:
- Init SD card even if eMMC init fail.

---
 board/samsung/goni/goni.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
board/samsung/goni/goni.c +1 -0
index c05801d..2bb2507 100644
@@ -69,6 +69,7 @@ int checkboard(void)
 int board_mmc_init(bd_t *bis)
 {
 	int i;
+	int ret;
 
 	/* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */
 	s5p_gpio_direction_output(&s5pc110_gpio->j2, 7, 1);

board/samsung/goni/goni.c int board_mmc_init(bd_t *bis) · line 98

Quoted 8 lines
board/samsung/goni/goni.c +4 -1
@@ -91,7 +92,35 @@ int board_mmc_init(bd_t *bis)
 		s5p_gpio_set_drv(&s5pc110_gpio->g0, i, GPIO_DRV_4X);
 	}
 
-	return s5p_mmc_init(0, 4);
+	ret = s5p_mmc_init(0, 4);
+	if (ret) {
+		puts("MMC: Failed to init MMC:0.\n");
+	}

Can remove the bracket.
Then looks good to me.

Best Regards,
Jaehoon Chung

Quoted 29 lines
board/samsung/goni/goni.c +25 -0
+
+	/*
+	 * SD card (T_FLASH) detect and init
+	 * T_FLASH_DETECT: EINT28: GPH3[4] input mode
+	 */
+	s5p_gpio_cfg_pin(&s5pc110_gpio->h3, 4, GPIO_INPUT);
+	s5p_gpio_set_pull(&s5pc110_gpio->h3, 4, GPIO_PULL_UP);
+
+	if (!s5p_gpio_get_value(&s5pc110_gpio->h3, 4)) {
+		for (i = 0; i < 7; i++) {
+			if (i == 2)
+				continue;
+			/* GPG2[0:6] special function 2 */
+			s5p_gpio_cfg_pin(&s5pc110_gpio->g2, i, 0x2);
+			/* GPG2[0:6] pull disable */
+			s5p_gpio_set_pull(&s5pc110_gpio->g2, i, GPIO_PULL_NONE);
+			/* GPG2[0:6] drv 4x */
+			s5p_gpio_set_drv(&s5pc110_gpio->g2, i, GPIO_DRV_4X);
+		}
+		if (s5p_mmc_init(2, 4))
+			puts("MMC: Failed to init SD card (MMC:2).\n");
+	}
+
+	/* SD card init is optional so print information when it fails only */
+	return ret;
 }
 #endif
 
#9 lore raw

PATCH v2 1/1 arm:goni:mmc: Add sd card detection and initialization.

In reply to Przemyslaw Marczak

Dear Przemyslaw Marczak,

Quoted 6 lines · Przemyslaw Marczak

This change allow to use sd card on Goni the same like mmc 0. SD card is mmc dev 1, so it can be used like this: "fatls mmc 1:2".

Changes in V2:
- Init SD card even if eMMC init fail.

Quoted 7 lines
---
 board/samsung/goni/goni.c |   31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

Your v1 patchset is made by 3 patches. But this patch is only one patch.

Do you want to separate patchset? Then please send each patches again. or not, please send whole patchset.

Thanks,
Minkyu Kang.

#10 lore raw

PATCH v2 1/1 arm:goni:mmc: Add sd card detection and initialization.

Quoted 5 lines · Minkyu Kang

Dear Przemyslaw Marczak,
...
Your v1 patchset is made by 3 patches. But this patch is only one patch.

Quoted 8 lines

Do you want to separate patchset? Then please send each patches again. or not, please send whole patchset.

Thanks,
Minkyu Kang.

Hello Minkyu Kang,
I send patchset by mistake and each patch will be send again soon.

Thank you

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#11 lore raw

PATCH 3/3 ums: Extend ums to use all mmc devices.

In reply to Przemyslaw Marczak

This change allows using every mmc device instance with ums, like eMMC or SD cards.

Example: ums <device_number> for mmc devices.

---
 common/cmd_usb_mass_storage.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
common/cmd_usb_mass_storage.c +5 -2
index 33a4715..4181d3a 100644
@@ -14,6 +14,7 @@
 int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 			       int argc, char * const argv[])
 {
+	struct mmc *mmc = NULL;
 	char *ep;
 	unsigned int dev_num = 0, offset = 0, part_size = 0;
 	int rc;
@@ -28,8 +29,10 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 
 	dev_num = (int)simple_strtoul(argv[1], &ep, 16);
 
-	if (dev_num) {
-		puts("\nSet eMMC device to 0! - e.g. ums 0\n");
+	mmc = find_mmc_device(dev_num);
+
+	if (!mmc) {
+		printf("\neMMC device: %d not found! Try ums 0.\n", dev_num);
 		goto fail;
 	}
 
Signature · 1 line
1.7.9.5
#12 lore raw

PATCH 3/3 ums: Extend ums to use all mmc devices.

Hello Marek,

Quoted 4 lines

This change allows using every mmc device instance with ums, like eMMC or SD cards.

Example: ums <device_number> for mmc devices.

Could you review this patch, please?

Quoted 34 lines
---
  common/cmd_usb_mass_storage.c |    7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
common/cmd_usb_mass_storage.c +5 -2
index 33a4715..4181d3a 100644
@@ -14,6 +14,7 @@
  int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
  			       int argc, char * const argv[])
  {
+	struct mmc *mmc = NULL;
  	char *ep;
  	unsigned int dev_num = 0, offset = 0, part_size = 0;
  	int rc;
@@ -28,8 +29,10 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 
  	dev_num = (int)simple_strtoul(argv[1], &ep, 16);
 
-	if (dev_num) {
-		puts("\nSet eMMC device to 0! - e.g. ums 0\n");
+	mmc = find_mmc_device(dev_num);
+
+	if (!mmc) {
+		printf("\neMMC device: %d not found! Try ums 0.\n", dev_num);
  		goto fail;
  	}
 
Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#13 lore raw

PATCH 3/3 ums: Extend ums to use all mmc devices.

In reply to Przemyslaw Marczak

Dear Przemyslaw Marczak,

Quoted 26 lines

This change allows using every mmc device instance with ums, like eMMC or SD cards.

Example: ums <device_number> for mmc devices.

---
 common/cmd_usb_mass_storage.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
common/cmd_usb_mass_storage.c +1 -0
index 33a4715..4181d3a 100644
@@ -14,6 +14,7 @@
 int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 			       int argc, char * const argv[])
 {
+	struct mmc *mmc = NULL;
 	char *ep;
 	unsigned int dev_num = 0, offset = 0, part_size = 0;
 	int rc;
@@ -28,8 +29,10 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 

common/cmd_usb_mass_storage.c int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, · line 37

Quoted 10 lines
common/cmd_usb_mass_storage.c +4 -2
 	dev_num = (int)simple_strtoul(argv[1], &ep, 16);
 
-	if (dev_num) {
-		puts("\nSet eMMC device to 0! - e.g. ums 0\n");
+	mmc = find_mmc_device(dev_num);
+
+	if (!mmc) {
+		printf("\neMMC device: %d not found! Try ums 0.\n", dev_num);
 		goto fail;
 	}

You still use dev_num further in the code, why not convert the whole thing to use *mmc ?

Best regards,
Marek Vasut

#14 lore raw

PATCH 3/3 ums: Extend ums to use all mmc devices.

Quoted 6 lines · Marek Vasut

You still use dev_num further in the code, why not convert the whole thing to use *mmc ?

Best regards,
Marek Vasut.

Hello,
I don't know exactly what do you mean.
I suppose that putting "mmc device number" as a parameter is easy to maintain at command code and also intuitive to use at prompt. Do you prefer set mmc dev number by command "mmc dev <num>" ? Should we depends one command on another? If yes, then what about e.g. fat or ext command set?

Thank you.

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#15 lore raw

PATCH 3/3 ums: Extend ums to use all mmc devices.

Dear Przemyslaw Marczak,

Quoted 7 lines · Marek Vasut
Quoted 5 lines

You still use dev_num further in the code, why not convert the whole thing to use *mmc ?

Best regards,
Marek Vasut.

Quoted 7 lines

Hello,
I don't know exactly what do you mean.
I suppose that putting "mmc device number" as a parameter is easy to maintain at command code and also intuitive to use at prompt. Do you prefer set mmc dev number by command "mmc dev <num>" ? Should we depends one command on another? If yes, then what about e.g. fat or ext command set?

What I mean is ... for example, you pass dev_num to board_ums_init() . See the trats board, find_mmc_device() is called again in there. Why not just pass the *mmc directly?

Best regards,
Marek Vasut

#16 lore raw

PATCH 3/3 ums: Extend ums to use all mmc devices.

Quoted 15 lines · Marek Vasut

Dear Przemyslaw Marczak,

Quoted 6 lines · Marek Vasut
Quoted 5 lines

You still use dev_num further in the code, why not convert the whole thing to use *mmc ?

Best regards,
Marek Vasut.

Quoted 7 lines

Hello,
I don't know exactly what do you mean.
I suppose that putting "mmc device number" as a parameter is easy to maintain at command code and also intuitive to use at prompt. Do you prefer set mmc dev number by command "mmc dev <num>" ? Should we depends one command on another? If yes, then what about e.g. fat or ext command set?

Quoted 7 lines

What I mean is ... for example, you pass dev_num to board_ums_init() . See the trats board, find_mmc_device() is called again in there. Why not just pass the *mmc directly?

Best regards,
Marek Vasut.

Oh, now I see. You are absolutely right, it was just code duplication. I will change it and resend patch.
Thank you,

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#17 lore raw

PATCH 3/3 ums: Extend ums to use all mmc devices.

Dear Przemyslaw Marczak,

Quoted 22 lines · Marek Vasut
Quoted 21 lines

Dear Przemyslaw Marczak,

Quoted 7 lines · Marek Vasut
Quoted 5 lines

You still use dev_num further in the code, why not convert the whole thing to use *mmc ?

Best regards,
Marek Vasut.

Quoted 7 lines

Hello,
I don't know exactly what do you mean.
I suppose that putting "mmc device number" as a parameter is easy to maintain at command code and also intuitive to use at prompt. Do you prefer set mmc dev number by command "mmc dev <num>" ? Should we depends one command on another? If yes, then what about e.g. fat or ext command set?

What I mean is ... for example, you pass dev_num to board_ums_init() . See the trats board, find_mmc_device() is called again in there. Why not just pass the *mmc directly?

Quoted 5 lines
Quoted 2 lines

Best regards,
Marek Vasut.

Oh, now I see. You are absolutely right, it was just code duplication. I will change it and resend patch.

Try and see if *mmc can not be passed all around instead of the dev_num too.

Best regards,
Marek Vasut