Skip to contentSkip to conversation

dm: rockchip: Move rockchip boards to to use CONFIG_BLK

PATCH New Simon Glass 4 participants 50 messages May 14, 2016 – Jun 29, 2016

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

cover dm: rockchip: Move rockchip boards to to use CONFIG_BLK

This series expands the CONFIG_BLK support to SPL, fixes up the EFI boot code and adds a few other tweaks so that all rockchip boards can move to using driver model for block devices.

It also introduces snprintf() in the tiny-printf code and tidies up the mmc code a little.

Overall the code size for firefly-rk3288 drops by 1KB. This is mostly due to removing GPIO support and cutting down on unnecessary strings. The move to CONFIG_BLK unfortunately adds 0.5KB, or the improvement would be greater.

Simon Glass (20):
tiny-printf: Tidy up a few nits
tiny-printf: Support snprintf()
reset: Drop the reset failure message
mmc: Drop mmc_register()
mmc: Drop dead mmc code for non-generic MMC
mmc: Use byte array for multipliers
arm: Avoid error messages in cache_v7
rockchip: Check image name for the rksd image
rockchip: Drop unnecessary SPL properties
rockchip: video: Flush the cache when the display is updated
rockchip: Drop SPL GPIO support for rk3288
dm: env: mmc: Convert env_mmc to support CONFIG_BLK
dm: mmc: Convert sdhci to support CONFIG_BLK
dm: efi: Update for CONFIG_BLK
dm: mmc: spl: Add support for CONFIG_BLK
dm: mmc: dwmmc: Support CONFIG_BLK
dm: rockchip: mmc: Allow use of CONFIG_BLK
dm: mmc: Fix up mmc_bread/bwrite() prototypes for SPL
dm: mmc: Use cfg directly in mmc_bind()
dm: rockchip: Enable CONFIG_BLK

 arch/arm/cpu/armv7/cache_v7.c    |  8 +++---
 arch/arm/mach-rockchip/Kconfig   |  3 ++
 cmd/mmc.c                        | 62 ----------------------------------------
 common/env_mmc.c                 |  8 +++---
 common/spl/spl_mmc.c             |  9 +++---
 configs/firefly-rk3288_defconfig |  2 +-
 drivers/misc/reset-uclass.c      |  2 +-
 drivers/mmc/dw_mmc.c             | 42 ++++++++++++++++++---------
 drivers/mmc/mmc.c                | 13 ++-------
 drivers/mmc/mmc_private.h        | 14 +++++++++
 drivers/mmc/rockchip_dw_mmc.c    | 31 ++++++++++++++++++++
 drivers/mmc/sdhci.c              |  2 +-
 drivers/video/rockchip/rk_vop.c  |  1 +
 include/configs/rk3288_common.h  |  1 -
 include/dwmmc.h                  |  7 ++++-
 include/efi_loader.h             |  2 +-
 include/mmc.h                    |  5 ----
 lib/efi_loader/efi_disk.c        | 61 +++++++++++++++++++++++++++++----------
 lib/tiny-printf.c                | 43 +++++++++++++++++++++-------
 tools/rkimage.c                  |  7 +----
 20 files changed, 181 insertions(+), 142 deletions(-)
Signature · 1 line
2.8.0.rc3.226.g39d4020
#1 lore raw

PATCH 1/20 tiny-printf: Tidy up a few nits

- Rename 'w' to 'width' to make it more obvious what it is used for
- Use bool and int types instead of char to avoid register-masking on 32-bit machines

---

 lib/tiny-printf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
lib/tiny-printf.c +8 -8
index a06abed..fbd5368 100644
@@ -52,8 +52,8 @@ int vprintf(const char *fmt, va_list va)
 		if (ch != '%') {
 			putc(ch);
 		} else {
-			char lz = 0;
-			char w = 0;
+			bool lz = false;
+			int width = 0;
 
 			ch = *(fmt++);
 			if (ch == '0') {
@@ -62,9 +62,9 @@ int vprintf(const char *fmt, va_list va)
 			}
 
 			if (ch >= '0' && ch <= '9') {
-				w = 0;
+				width = 0;
 				while (ch >= '0' && ch <= '9') {
-					w = (w * 10) + ch - '0';
+					width = (width * 10) + ch - '0';
 					ch = *fmt++;
 				}
 			}
@@ -73,7 +73,7 @@ int vprintf(const char *fmt, va_list va)
 			zs = 0;
 
 			switch (ch) {
-			case 0:
+			case '\0':
 				goto abort;
 			case 'u':
 			case 'd':
@@ -112,9 +112,9 @@ int vprintf(const char *fmt, va_list va)
 
 			*bf = 0;
 			bf = p;
-			while (*bf++ && w > 0)
-				w--;
-			while (w-- > 0)
+			while (*bf++ && width > 0)
+				width--;
+			while (width-- > 0)
 				putc(lz ? '0' : ' ');
 			if (p) {
 				while ((ch = *p++))
Signature · 1 line
2.8.0.rc3.226.g39d4020
#3 lore raw

PATCH 1/20 tiny-printf: Tidy up a few nits

Quoted 7 lines · Stefan Roese
Quoted 5 lines · Simon Glass

- Rename 'w' to 'width' to make it more obvious what it is used for
- Use bool and int types instead of char to avoid register-masking on 32-bit machines

Quoted 7 lines
Quoted 1 line

Thanks,
Stefan

Applied to u-boot-dm.

#4 lore raw

PATCH 2/20 tiny-printf: Support snprintf()

In reply to Simon Glass

Add a simple version of this function for SPL. It does not check the buffer size as this would add to the code size.

---

 lib/tiny-printf.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)
lib/tiny-printf.c +25 -2
index fbd5368..4b70263 100644
@@ -16,6 +16,9 @@
 static char *bf;
 static char zs;
 
+/* Current position in sprintf() output string */
+static char *outstr;
+
 static void out(char c)
 {
 	*bf++ = c;
@@ -40,7 +43,7 @@ static void div_out(unsigned int *num, unsigned int div)
 		out_dgt(dgt);
 }
 
-int vprintf(const char *fmt, va_list va)
+int _vprintf(const char *fmt, va_list va, void (*putc)(const char ch))
 {
 	char ch;
 	char *p;
@@ -133,8 +136,28 @@ int printf(const char *fmt, ...)
 	int ret;
 
 	va_start(va, fmt);
-	ret = vprintf(fmt, va);
+	ret = _vprintf(fmt, va, putc);
+	va_end(va);
+
+	return ret;
+}
+
+static void putc_outstr(char ch)
+{
+	*outstr++ = ch;
+}
+
+/* Note that size is ignored */
+int snprintf(char *buf, size_t size, const char *fmt, ...)
+{
+	va_list va;
+	int ret;
+
+	va_start(va, fmt);
+	outstr = buf;
+	ret = _vprintf(fmt, va, putc_outstr);
 	va_end(va);
+	*outstr = '\0';
 
 	return ret;
 }
Signature · 1 line
2.8.0.rc3.226.g39d4020
#7 lore raw

PATCH 3/20 reset: Drop the reset failure message

In reply to Simon Glass

This adds to code size and is not needed, since hang() will print a message.

---

 drivers/misc/reset-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/reset-uclass.c +1 -1
index fdb5c6f..52b9e7e 100644
@@ -55,7 +55,7 @@ void reset_walk_halt(enum reset_t type)
 		mdelay(100);
 
 	/* Still no reset? Give up */
-	printf("Reset not supported on this platform\n");
+	debug("Reset not supported on this platform\n");
 	hang();
 }
 
Signature · 1 line
2.8.0.rc3.226.g39d4020
#8 lore raw

PATCH 3/20 reset: Drop the reset failure message

Quoted 7 lines · Simon Glass

This adds to code size and is not needed, since hang() will print a message.

---

 drivers/misc/reset-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm.

#9 lore raw

PATCH 4/20 mmc: Drop mmc_register()

In reply to Simon Glass

This function is no longer used.

---

 drivers/mmc/mmc.c | 9 ---------
 include/mmc.h     | 1 -
 2 files changed, 10 deletions(-)
drivers/mmc/mmc.c +0 -9
index 74b3d68..1ddeff4 100644
@@ -1531,15 +1531,6 @@ static int mmc_send_if_cond(struct mmc *mmc)
 	return 0;
 }
 
-/* not used any more */
-int __deprecated mmc_register(struct mmc *mmc)
-{
-#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
-	printf("%s is deprecated! use mmc_create() instead.\n", __func__);
-#endif
-	return -1;
-}
-
 #ifdef CONFIG_BLK
 int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
 {
include/mmc.h +0 -1
index a5c6573..056296e 100644
@@ -411,7 +411,6 @@ enum mmc_hwpart_conf_mode {
 	MMC_HWPART_CONF_COMPLETE,
 };
 
-int mmc_register(struct mmc *mmc);
 struct mmc *mmc_create(const struct mmc_config *cfg, void *priv);
 
 /**
Signature · 1 line
2.8.0.rc3.226.g39d4020
#10 lore raw

PATCH 4/20 mmc: Drop mmc_register()

Quoted 8 lines · Simon Glass

This function is no longer used.

---

 drivers/mmc/mmc.c | 9 ---------
 include/mmc.h     | 1 -
 2 files changed, 10 deletions(-)

Applied to u-boot-dm.

#11 lore raw

PATCH 5/20 mmc: Drop dead mmc code for non-generic MMC

In reply to Simon Glass

All boards that use MMC define CONFIG_GENERIC_MMC now, so we can drop this old code.

---

 cmd/mmc.c     | 62 -----------------------------------------------------------
 include/mmc.h |  4 ----
 2 files changed, 66 deletions(-)
cmd/mmc.c +0 -62
index eb4a547..b2761e9 100644
@@ -11,66 +11,6 @@
 #include <mmc.h>
 
 static int curr_device = -1;
-#ifndef CONFIG_GENERIC_MMC
-int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	int dev;
-
-	if (argc < 2)
-		return CMD_RET_USAGE;
-
-	if (strcmp(argv[1], "init") == 0) {
-		if (argc == 2) {
-			if (curr_device < 0)
-				dev = 1;
-			else
-				dev = curr_device;
-		} else if (argc == 3) {
-			dev = (int)simple_strtoul(argv[2], NULL, 10);
-		} else {
-			return CMD_RET_USAGE;
-		}
-
-		if (mmc_legacy_init(dev) != 0) {
-			puts("No MMC card found\n");
-			return 1;
-		}
-
-		curr_device = dev;
-		printf("mmc%d is available\n", curr_device);
-	} else if (strcmp(argv[1], "device") == 0) {
-		if (argc == 2) {
-			if (curr_device < 0) {
-				puts("No MMC device available\n");
-				return 1;
-			}
-		} else if (argc == 3) {
-			dev = (int)simple_strtoul(argv[2], NULL, 10);
-
-#ifdef CONFIG_SYS_MMC_SET_DEV
-			if (mmc_set_dev(dev) != 0)
-				return 1;
-#endif
-			curr_device = dev;
-		} else {
-			return CMD_RET_USAGE;
-		}
-
-		printf("mmc%d is current device\n", curr_device);
-	} else {
-		return CMD_RET_USAGE;
-	}
-
-	return 0;
-}
-
-U_BOOT_CMD(
-	mmc, 3, 1, do_mmc,
-	"MMC sub-system",
-	"init [dev] - init MMC sub system\n"
-	"mmc device [dev] - show or set current device"
-);
-#else /* !CONFIG_GENERIC_MMC */
 
 static void print_mmcinfo(struct mmc *mmc)
 {
@@ -881,5 +821,3 @@ U_BOOT_CMD(
 	"display MMC info",
 	"- display info of the current MMC device"
 );
-
-#endif /* !CONFIG_GENERIC_MMC */
include/mmc.h +0 -4
index 056296e..7fdfc32 100644
@@ -491,16 +491,12 @@ int mmc_start_init(struct mmc *mmc);
  */
 void mmc_set_preinit(struct mmc *mmc, int preinit);
 
-#ifdef CONFIG_GENERIC_MMC
 #ifdef CONFIG_MMC_SPI
 #define mmc_host_is_spi(mmc)	((mmc)->cfg->host_caps & MMC_MODE_SPI)
 #else
 #define mmc_host_is_spi(mmc)	0
 #endif
 struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode);
-#else
-int mmc_legacy_init(int verbose);
-#endif
 
 void board_mmc_power_init(void);
 int board_mmc_init(bd_t *bis);
Signature · 1 line
2.8.0.rc3.226.g39d4020
#12 lore raw

PATCH 5/20 mmc: Drop dead mmc code for non-generic MMC

Quoted 9 lines · Simon Glass

All boards that use MMC define CONFIG_GENERIC_MMC now, so we can drop this old code.

---

 cmd/mmc.c     | 62 -----------------------------------------------------------
 include/mmc.h |  4 ----
 2 files changed, 66 deletions(-)

Applied to u-boot-dm.

#13 lore raw

PATCH 6/20 mmc: Use byte array for multipliers

In reply to Simon Glass

We don't need an int since no value is over 80. This saves a small amount of SPL space (about 44 bytes).

---

 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index 1ddeff4..b7c936c 100644
@@ -984,7 +984,7 @@ static const int fbase[] = {
 /* Multiplier values for TRAN_SPEED.  Multiplied by 10 to be nice
  * to platforms without floating point.
  */
-static const int multipliers[] = {
+static const u8 multipliers[] = {
 	0,	/* reserved */
 	10,
 	12,
Signature · 1 line
2.8.0.rc3.226.g39d4020
#14 lore raw

PATCH 6/20 mmc: Use byte array for multipliers

Quoted 8 lines · Simon Glass

We don't need an int since no value is over 80. This saves a small amount of SPL space (about 44 bytes).

---

 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm.

#15 lore raw

PATCH 7/20 arm: Avoid error messages in cache_v7

In reply to Simon Glass

Move these to debug() like the one in check_cache range(), to save SPL space.

---

 arch/arm/cpu/armv7/cache_v7.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/cache_v7.c +4 -4
index dc309da..68cf62e 100644
@@ -66,8 +66,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
 	 * invalidate the first cache-line
 	 */
 	if (start & (line_len - 1)) {
-		printf("ERROR: %s - start address is not aligned - 0x%08x\n",
-			__func__, start);
+		debug("ERROR: %s - start address is not aligned - 0x%08x\n",
+		      __func__, start);
 		/* move to next cache line */
 		start = (start + line_len - 1) & ~(line_len - 1);
 	}
@@ -77,8 +77,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
 	 * invalidate the last cache-line
 	 */
 	if (stop & (line_len - 1)) {
-		printf("ERROR: %s - stop address is not aligned - 0x%08x\n",
-			__func__, stop);
+		debug("ERROR: %s - stop address is not aligned - 0x%08x\n",
+		      __func__, stop);
 		/* align to the beginning of this cache line */
 		stop &= ~(line_len - 1);
 	}
Signature · 1 line
2.8.0.rc3.226.g39d4020
#16 lore raw

PATCH 7/20 arm: Avoid error messages in cache_v7

Quoted 1 line · Simon Glass

Move these to debug() like the one in check_cache range(), to save SPL space.

This hides cache problems, which were visibly reported so far. I am opposed to this patch.

Wouldn't it make more sense to completely disable printf() and co. in SPL if you're after saving space?

Quoted 33 lines

---

 arch/arm/cpu/armv7/cache_v7.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/cache_v7.c +4 -4
index dc309da..68cf62e 100644
@@ -66,8 +66,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
 	 * invalidate the first cache-line
 	 */
 	if (start & (line_len - 1)) {
-		printf("ERROR: %s - start address is not aligned - 0x%08x\n",
-			__func__, start);
+		debug("ERROR: %s - start address is not aligned - 0x%08x\n",
+		      __func__, start);
 		/* move to next cache line */
 		start = (start + line_len - 1) & ~(line_len - 1);
 	}
@@ -77,8 +77,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
 	 * invalidate the last cache-line
 	 */
 	if (stop & (line_len - 1)) {
-		printf("ERROR: %s - stop address is not aligned - 0x%08x\n",
-			__func__, stop);
+		debug("ERROR: %s - stop address is not aligned - 0x%08x\n",
+		      __func__, stop);
 		/* align to the beginning of this cache line */
 		stop &= ~(line_len - 1);
 	}
Signature · 2 lines
Best regards,
Marek Vasut
#17 lore raw

PATCH 7/20 arm: Avoid error messages in cache_v7

Hi Marek,

Quoted 5 lines · Marek Vasut
Quoted 1 line · Simon Glass

Move these to debug() like the one in check_cache range(), to save SPL space.

This hides cache problems, which were visibly reported so far. I am opposed to this patch.

Sure, but see check_cache_range(). It uses debug(). In fact I found the at91 cache problem only after trying #define DEBUG in the code there.

Quoted 3 lines

Wouldn't it make more sense to completely disable printf() and co. in SPL if you're after saving space?

Or maybe we need something that prints a message in U-Boot proper, but not SPL? I'll take a look.

Quoted 31 lines
Quoted 31 lines

---

 arch/arm/cpu/armv7/cache_v7.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/cache_v7.c +4 -4
index dc309da..68cf62e 100644
@@ -66,8 +66,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
       * invalidate the first cache-line
       */
      if (start & (line_len - 1)) {
-             printf("ERROR: %s - start address is not aligned - 0x%08x\n",
-                     __func__, start);
+             debug("ERROR: %s - start address is not aligned - 0x%08x\n",
+                   __func__, start);
              /* move to next cache line */
              start = (start + line_len - 1) & ~(line_len - 1);
      }
@@ -77,8 +77,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
       * invalidate the last cache-line
       */
      if (stop & (line_len - 1)) {
-             printf("ERROR: %s - stop address is not aligned - 0x%08x\n",
-                     __func__, stop);
+             debug("ERROR: %s - stop address is not aligned - 0x%08x\n",
+                   __func__, stop);
              /* align to the beginning of this cache line */
Quoted 8 lines

arch/arm/cpu/armv7/cache_v7.c static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len) · line 84

Quoted 3 lines
arch/arm/cpu/armv7/cache_v7.c +0 -0
              stop &= ~(line_len - 1);
      }

--
Best regards,
Marek Vasut

Regards,
Simon

#18 lore raw

PATCH 7/20 arm: Avoid error messages in cache_v7

Quoted 1 line · Simon Glass

Hi Marek,

Hi!

Quoted 10 lines · Marek Vasut
Quoted 5 lines · Simon Glass
Quoted 1 line

Move these to debug() like the one in check_cache range(), to save SPL space.

This hides cache problems, which were visibly reported so far. I am opposed to this patch.

Sure, but see check_cache_range(). It uses debug(). In fact I found the at91 cache problem only after trying #define DEBUG in the code there.

Which is the reason we should really be vocal about such cache misuse. I had a few of such cache problems bite me too, which is why I would like to avoid silencing this warning with debug() by default.

I think check_cache_range() should also be fixed and should use printf() by default.

Quoted 6 lines
Quoted 3 lines

Wouldn't it make more sense to completely disable printf() and co. in SPL if you're after saving space?

Or maybe we need something that prints a message in U-Boot proper, but not SPL? I'll take a look.

But what if you trigger the issue only in SPL ?

Quoted 44 lines
Quoted 31 lines
Quoted 31 lines

---

 arch/arm/cpu/armv7/cache_v7.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/cache_v7.c +4 -4
index dc309da..68cf62e 100644
@@ -66,8 +66,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
       * invalidate the first cache-line
       */
      if (start & (line_len - 1)) {
-             printf("ERROR: %s - start address is not aligned - 0x%08x\n",
-                     __func__, start);
+             debug("ERROR: %s - start address is not aligned - 0x%08x\n",
+                   __func__, start);
              /* move to next cache line */
              start = (start + line_len - 1) & ~(line_len - 1);
      }
@@ -77,8 +77,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
       * invalidate the last cache-line
       */
      if (stop & (line_len - 1)) {
-             printf("ERROR: %s - stop address is not aligned - 0x%08x\n",
-                     __func__, stop);
+             debug("ERROR: %s - stop address is not aligned - 0x%08x\n",
+                   __func__, stop);
              /* align to the beginning of this cache line */
Quoted 8 lines

arch/arm/cpu/armv7/cache_v7.c static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len) · line 84

Quoted 3 lines
arch/arm/cpu/armv7/cache_v7.c +0 -0
              stop &= ~(line_len - 1);
      }

--
Best regards,
Marek Vasut

Regards,
Simon

Signature · 2 lines
Best regards,
Marek Vasut
#19 lore raw

PATCH 7/20 arm: Avoid error messages in cache_v7

Hi Marek,

Quoted 24 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi!

Quoted 10 lines · Marek Vasut
Quoted 5 lines · Simon Glass
Quoted 1 line

Move these to debug() like the one in check_cache range(), to save SPL space.

This hides cache problems, which were visibly reported so far. I am opposed to this patch.

Sure, but see check_cache_range(). It uses debug(). In fact I found the at91 cache problem only after trying #define DEBUG in the code there.

Which is the reason we should really be vocal about such cache misuse. I had a few of such cache problems bite me too, which is why I would like to avoid silencing this warning with debug() by default.

I think check_cache_range() should also be fixed and should use printf() by default.

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Wouldn't it make more sense to completely disable printf() and co. in SPL if you're after saving space?

Or maybe we need something that prints a message in U-Boot proper, but not SPL? I'll take a look.

But what if you trigger the issue only in SPL ?

Yes, but is that likely? So far I don't think the cache is enabled in SPL...

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines

---

 arch/arm/cpu/armv7/cache_v7.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/cache_v7.c +2 -2
index dc309da..68cf62e 100644
@@ -66,8 +66,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
       * invalidate the first cache-line
       */
      if (start & (line_len - 1)) {
-             printf("ERROR: %s - start address is not aligned - 0x%08x\n",
-                     __func__, start);
+             debug("ERROR: %s - start address is not aligned - 0x%08x\n",
+                   __func__, start);
              /* move to next cache line */
              start = (start + line_len - 1) & ~(line_len - 1);
      }
@@ -77,8 +77,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
       * invalidate the last cache-line
       */
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

arch/arm/cpu/armv7/cache_v7.c static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len) · line 84

Quoted 8 lines
arch/arm/cpu/armv7/cache_v7.c +2 -2
      if (stop & (line_len - 1)) {
-             printf("ERROR: %s - stop address is not aligned - 0x%08x\n",
-                     __func__, stop);
+             debug("ERROR: %s - stop address is not aligned - 0x%08x\n",
+                   __func__, stop);
              /* align to the beginning of this cache line */
              stop &= ~(line_len - 1);
      }

Regards,
Simon

#20 lore raw

PATCH 7/20 arm: Avoid error messages in cache_v7

Quoted 30 lines · Simon Glass

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi!

Quoted 10 lines · Marek Vasut
Quoted 5 lines · Simon Glass
Quoted 1 line

Move these to debug() like the one in check_cache range(), to save SPL space.

This hides cache problems, which were visibly reported so far. I am opposed to this patch.

Sure, but see check_cache_range(). It uses debug(). In fact I found the at91 cache problem only after trying #define DEBUG in the code there.

Which is the reason we should really be vocal about such cache misuse. I had a few of such cache problems bite me too, which is why I would like to avoid silencing this warning with debug() by default.

I think check_cache_range() should also be fixed and should use printf() by default.

Quoted 4 lines
Quoted 3 lines

Wouldn't it make more sense to completely disable printf() and co. in SPL if you're after saving space?

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Or maybe we need something that prints a message in U-Boot proper, but not SPL? I'll take a look.

But what if you trigger the issue only in SPL ?

Yes, but is that likely? So far I don't think the cache is enabled in SPL...

Yeah, it's probably unlikely.

btw have you tried patching away all console IO support in SPL? Does it save space?

Quoted 38 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines

---

 arch/arm/cpu/armv7/cache_v7.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/cache_v7.c +2 -2
index dc309da..68cf62e 100644
@@ -66,8 +66,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
       * invalidate the first cache-line
       */
      if (start & (line_len - 1)) {
-             printf("ERROR: %s - start address is not aligned - 0x%08x\n",
-                     __func__, start);
+             debug("ERROR: %s - start address is not aligned - 0x%08x\n",
+                   __func__, start);
              /* move to next cache line */
              start = (start + line_len - 1) & ~(line_len - 1);
      }
@@ -77,8 +77,8 @@ static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len)
       * invalidate the last cache-line
       */
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

arch/arm/cpu/armv7/cache_v7.c static void v7_dcache_inval_range(u32 start, u32 stop, u32 line_len) · line 84

Quoted 8 lines
arch/arm/cpu/armv7/cache_v7.c +2 -2
      if (stop & (line_len - 1)) {
-             printf("ERROR: %s - stop address is not aligned - 0x%08x\n",
-                     __func__, stop);
+             debug("ERROR: %s - stop address is not aligned - 0x%08x\n",
+                   __func__, stop);
              /* align to the beginning of this cache line */
              stop &= ~(line_len - 1);
      }

Regards,
Simon

Signature · 2 lines
Best regards,
Marek Vasut
#21 lore raw

PATCH 7/20 arm: Avoid error messages in cache_v7

Hi Marek,

Quoted 34 lines · Marek Vasut
Quoted 33 lines · Simon Glass

Hi Marek,

Quoted 30 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi!

Quoted 10 lines · Marek Vasut
Quoted 5 lines · Simon Glass
Quoted 1 line

Move these to debug() like the one in check_cache range(), to save SPL space.

This hides cache problems, which were visibly reported so far. I am opposed to this patch.

Sure, but see check_cache_range(). It uses debug(). In fact I found the at91 cache problem only after trying #define DEBUG in the code there.

Which is the reason we should really be vocal about such cache misuse. I had a few of such cache problems bite me too, which is why I would like to avoid silencing this warning with debug() by default.

I think check_cache_range() should also be fixed and should use printf() by default.

Quoted 6 lines
Quoted 3 lines

Wouldn't it make more sense to completely disable printf() and co. in SPL if you're after saving space?

Or maybe we need something that prints a message in U-Boot proper, but not SPL? I'll take a look.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

But what if you trigger the issue only in SPL ?

Yes, but is that likely? So far I don't think the cache is enabled in SPL...

Yeah, it's probably unlikely.

btw have you tried patching away all console IO support in SPL? Does it save space?

No I have not. I imagine it would, though. There is also the option now of using the debug UART, which avoids the small amount of serial/console overhead.

[snip]

Regards,
Simon

#22 lore raw

PATCH 8/20 rockchip: Check image name for the rksd image

In reply to Simon Glass

We need a correct name (rk3288, rk3036) so check this to avoid a crash later.

---

 tools/rkimage.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
tools/rkimage.c +1 -6
index f9fdcfa..ef31cb6 100644
@@ -13,11 +13,6 @@
 
 static uint32_t header;
 
-static int rkimage_check_params(struct image_tool_params *params)
-{
-	return 0;
-}
-
 static int rkimage_verify_header(unsigned char *buf, int size,
 				 struct image_tool_params *params)
 {
@@ -56,7 +51,7 @@ U_BOOT_IMAGE_TYPE(
 	"Rockchip Boot Image support",
 	4,
 	&header,
-	rkimage_check_params,
+	rkcommon_check_params,
 	rkimage_verify_header,
 	rkimage_print_header,
 	rkimage_set_header,
Signature · 1 line
2.8.0.rc3.226.g39d4020
#23 lore raw

PATCH 8/20 rockchip: Check image name for the rksd image

Quoted 8 lines · Simon Glass

We need a correct name (rk3288, rk3036) so check this to avoid a crash later.

---

 tools/rkimage.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Applied to u-boot-dm.

#24 lore raw

PATCH 9/20 rockchip: Drop unnecessary SPL properties

In reply to Simon Glass

While we consider whether to drop use of DT in SPL, remove some unwanted properties. This reduces SPL size by about 250 bytes.

---

 configs/firefly-rk3288_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/firefly-rk3288_defconfig +1 -1
index 0995f9b..0d566c7 100644
@@ -28,7 +28,7 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_SPL_OF_CONTROL=y
-CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent"
+CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SYSCON=y
Signature · 1 line
2.8.0.rc3.226.g39d4020
#25 lore raw

PATCH 9/20 rockchip: Drop unnecessary SPL properties

Quoted 8 lines · Simon Glass

While we consider whether to drop use of DT in SPL, remove some unwanted properties. This reduces SPL size by about 250 bytes.

---

 configs/firefly-rk3288_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm.

#26 lore raw

PATCH 10/20 rockchip: video: Flush the cache when the display is updated

In reply to Simon Glass

Enable this option to correct display artifacts when a write-back cache is in use.

---

 drivers/video/rockchip/rk_vop.c | 1 +
 1 file changed, 1 insertion(+)
drivers/video/rockchip/rk_vop.c +1 -0
index a54af17..db09d9a 100644
@@ -326,6 +326,7 @@ static int rk_vop_probe(struct udevice *dev)
 		if (!ret)
 			break;
 	}
+	video_set_flush_dcache(dev, 1);
 
 	return ret;
 }
Signature · 1 line
2.8.0.rc3.226.g39d4020
#27 lore raw

PATCH 10/20 rockchip: video: Flush the cache when the display is updated

Quoted 8 lines · Simon Glass

Enable this option to correct display artifacts when a write-back cache is in use.

---

 drivers/video/rockchip/rk_vop.c | 1 +
 1 file changed, 1 insertion(+)

Applied to u-boot-dm.

#28 lore raw

PATCH 11/20 rockchip: Drop SPL GPIO support for rk3288

In reply to Simon Glass

This is not currently used and saves a little over 1KB of SPL image size.

---

 include/configs/rk3288_common.h | 1 -
 1 file changed, 1 deletion(-)
include/configs/rk3288_common.h +0 -1
index 8a81397..9d50d83 100644
@@ -69,7 +69,6 @@
 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot.img"
 
 #define CONFIG_SPL_PINCTRL_SUPPORT
-#define CONFIG_SPL_GPIO_SUPPORT
 #define CONFIG_SPL_RAM_SUPPORT
 #define CONFIG_SPL_DRIVERS_MISC_SUPPORT
 
Signature · 1 line
2.8.0.rc3.226.g39d4020
#29 lore raw

PATCH 11/20 rockchip: Drop SPL GPIO support for rk3288

Quoted 7 lines · Simon Glass

This is not currently used and saves a little over 1KB of SPL image size.

---

 include/configs/rk3288_common.h | 1 -
 1 file changed, 1 deletion(-)

Applied to u-boot-dm.

#30 lore raw

PATCH 12/20 dm: env: mmc: Convert env_mmc to support CONFIG_BLK

In reply to Simon Glass

Update the MMC environment code so that it works with driver-model enabled for block devices.

---

 common/env_mmc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
common/env_mmc.c +4 -4
index c7fef18..16f6a17 100644
@@ -128,12 +128,12 @@ static inline int write_env(struct mmc *mmc, unsigned long size,
 			    unsigned long offset, const void *buffer)
 {
 	uint blk_start, blk_cnt, n;
+	struct blk_desc *desc = mmc_get_blk_desc(mmc);
 
 	blk_start	= ALIGN(offset, mmc->write_bl_len) / mmc->write_bl_len;
 	blk_cnt		= ALIGN(size, mmc->write_bl_len) / mmc->write_bl_len;
 
-	n = mmc->block_dev.block_write(&mmc->block_dev, blk_start,
-					blk_cnt, (u_char *)buffer);
+	n = blk_dwrite(desc, blk_start, blk_cnt, (u_char *)buffer);
 
 	return (n == blk_cnt) ? 0 : -1;
 }
@@ -197,12 +197,12 @@ static inline int read_env(struct mmc *mmc, unsigned long size,
 			   unsigned long offset, const void *buffer)
 {
 	uint blk_start, blk_cnt, n;
+	struct blk_desc *desc = mmc_get_blk_desc(mmc);
 
 	blk_start	= ALIGN(offset, mmc->read_bl_len) / mmc->read_bl_len;
 	blk_cnt		= ALIGN(size, mmc->read_bl_len) / mmc->read_bl_len;
 
-	n = mmc->block_dev.block_read(&mmc->block_dev, blk_start, blk_cnt,
-				      (uchar *)buffer);
+	n = blk_dread(desc, blk_start, blk_cnt, (uchar *)buffer);
 
 	return (n == blk_cnt) ? 0 : -1;
 }
Signature · 1 line
2.8.0.rc3.226.g39d4020
#31 lore raw

PATCH 12/20 dm: env: mmc: Convert env_mmc to support CONFIG_BLK

Quoted 8 lines · Simon Glass

Update the MMC environment code so that it works with driver-model enabled for block devices.

---

 common/env_mmc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied to u-boot-dm.

#32 lore raw

PATCH 13/20 dm: mmc: Convert sdhci to support CONFIG_BLK

In reply to Simon Glass

Update sdhci.c so that it works with driver model enabled for block devices.

---

 drivers/mmc/sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/sdhci.c +1 -1
index ef7e615..5c71ab8 100644
@@ -137,7 +137,7 @@ static int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
 	int trans_bytes = 0, is_aligned = 1;
 	u32 mask, flags, mode;
 	unsigned int time = 0, start_addr = 0;
-	int mmc_dev = mmc->block_dev.devnum;
+	int mmc_dev = mmc_get_blk_desc(mmc)->devnum;
 	unsigned start = get_timer(0);
 
 	/* Timeout unit - ms */
Signature · 1 line
2.8.0.rc3.226.g39d4020
#33 lore raw

PATCH 13/20 dm: mmc: Convert sdhci to support CONFIG_BLK

Quoted 7 lines · Simon Glass

Update sdhci.c so that it works with driver model enabled for block devices.

---

 drivers/mmc/sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm.

#34 lore raw

PATCH 14/20 dm: efi: Update for CONFIG_BLK

In reply to Simon Glass

This code does not currently build with driver model enabled for block devices. Update it to correct this.

---

 include/efi_loader.h      |  2 +-
 lib/efi_loader/efi_disk.c | 61 +++++++++++++++++++++++++++++++++++------------
 2 files changed, 47 insertions(+), 16 deletions(-)
include/efi_loader.h +1 -1
index 88b8149..44a950f 100644
@@ -134,7 +134,7 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
 int efi_memory_init(void);
 
 /* Convert strings from normal C strings to uEFI strings */
-static inline void ascii2unicode(u16 *unicode, char *ascii)
+static inline void ascii2unicode(u16 *unicode, const char *ascii)
 {
 	while (*ascii)
 		*(unicode++) = *(ascii++);
lib/efi_loader/efi_disk.c +46 -15

130 lines not on this page · raw message

Signature · 1 line
2.8.0.rc3.226.g39d4020
#37 lore raw

PATCH 15/20 dm: mmc: spl: Add support for CONFIG_BLK

In reply to Simon Glass

Allow driver model to be used for block devices in SPL.

---

 common/spl/spl_mmc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
common/spl/spl_mmc.c +4 -5
index cf527da..5d0c9f9 100644
@@ -30,9 +30,8 @@ static int mmc_load_legacy(struct mmc *mmc, ulong sector,
 			     mmc->read_bl_len;
 
 	/* Read the header too to avoid extra memcpy */
-	count = mmc->block_dev.block_read(&mmc->block_dev, sector,
-					  image_size_sectors,
-					  (void *)(ulong)spl_image.load_addr);
+	count = blk_dread(mmc_get_blk_desc(mmc), sector, image_size_sectors,
+			  (void *)(ulong)spl_image.load_addr);
 	debug("read %x sectors to %x\n", image_size_sectors,
 	      spl_image.load_addr);
 	if (count != image_size_sectors)
@@ -46,7 +45,7 @@ static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
 {
 	struct mmc *mmc = load->dev;
 
-	return mmc->block_dev.block_read(&mmc->block_dev, sector, count, buf);
+	return blk_dread(mmc_get_blk_desc(mmc), sector, count, buf);
 }
 
 static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
@@ -59,7 +58,7 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
 					 sizeof(struct image_header));
 
 	/* read image header to find the image size & load address */
-	count = mmc->block_dev.block_read(&mmc->block_dev, sector, 1, header);
+	count = blk_dread(mmc_get_blk_desc(mmc), sector, 1, header);
 	debug("hdr read sector %lx, count=%lu\n", sector, count);
 	if (count == 0) {
 		ret = -EIO;
Signature · 1 line
2.8.0.rc3.226.g39d4020
#38 lore raw

PATCH 15/20 dm: mmc: spl: Add support for CONFIG_BLK

Quoted 7 lines · Simon Glass

Allow driver model to be used for block devices in SPL.

---

 common/spl/spl_mmc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Applied to u-boot-dm.

#39 lore raw

PATCH 16/20 dm: mmc: dwmmc: Support CONFIG_BLK

In reply to Simon Glass

Add support for using driver model for block devices in this driver.

---

 drivers/mmc/dw_mmc.c | 42 ++++++++++++++++++++++++++++--------------
 include/dwmmc.h      |  7 ++++++-
 2 files changed, 34 insertions(+), 15 deletions(-)
drivers/mmc/dw_mmc.c +28 -14
index 7329f40..74a2663 100644
@@ -454,27 +454,40 @@ static const struct mmc_ops dwmci_ops = {
 	.init		= dwmci_init,
 };
 
-int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk)
+void dwmci_setup_cfg(struct mmc_config *cfg, const char *name, int buswidth,
+		     uint caps, u32 max_clk, u32 min_clk)
 {
-	host->cfg.name = host->name;
-	host->cfg.ops = &dwmci_ops;
-	host->cfg.f_min = min_clk;
-	host->cfg.f_max = max_clk;
+	cfg->name = name;
+	cfg->ops = &dwmci_ops;
+	cfg->f_min = min_clk;
+	cfg->f_max = max_clk;
 
-	host->cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
+	cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
 
-	host->cfg.host_caps = host->caps;
+	cfg->host_caps = caps;
 
-	if (host->buswidth == 8) {
-		host->cfg.host_caps |= MMC_MODE_8BIT;
-		host->cfg.host_caps &= ~MMC_MODE_4BIT;
+	if (buswidth == 8) {
+		cfg->host_caps |= MMC_MODE_8BIT;
+		cfg->host_caps &= ~MMC_MODE_4BIT;
 	} else {
-		host->cfg.host_caps |= MMC_MODE_4BIT;
-		host->cfg.host_caps &= ~MMC_MODE_8BIT;
+		cfg->host_caps |= MMC_MODE_4BIT;
+		cfg->host_caps &= ~MMC_MODE_8BIT;
 	}
-	host->cfg.host_caps |= MMC_MODE_HS | MMC_MODE_HS_52MHz;
+	cfg->host_caps |= MMC_MODE_HS | MMC_MODE_HS_52MHz;
+
+	cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
+}
 
-	host->cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
+#ifdef CONFIG_BLK
+int dwmci_bind(struct udevice *dev, struct mmc *mmc, struct mmc_config *cfg)
+{
+	return mmc_bind(dev, mmc, cfg);
+}
+#else
+int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk)
+{
+	dwmci_setup_cfg(&host->cfg, host->name, host->buswidth, host->caps,
+			max_clk, min_clk);
 
 	host->mmc = mmc_create(&host->cfg, host);
 	if (host->mmc == NULL)
@@ -482,3 +495,4 @@ int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk)
 
 	return 0;
 }
+#endif
include/dwmmc.h +6 -1
index 05b0817..335af51 100644
@@ -180,8 +180,9 @@ struct dwmci_host {
 	 * @freq:	Frequency the host is trying to achieve
 	 */
 	unsigned int (*get_mmc_clk)(struct dwmci_host *host, uint freq);
-
+#ifndef CONFIG_BLK
 	struct mmc_config cfg;
+#endif
 
 	/* use fifo mode to read and write data */
 	bool fifo_mode;
@@ -223,5 +224,9 @@ static inline u8 dwmci_readb(struct dwmci_host *host, int reg)
 	return readb(host->ioaddr + reg);
 }
 
+void dwmci_setup_cfg(struct mmc_config *cfg, const char *name, int buswidth,
+		     uint caps, u32 max_clk, u32 min_clk);
+int dwmci_bind(struct udevice *dev, struct mmc *mmc, struct mmc_config *cfg);
+
 int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk);
 #endif	/* __DWMMC_HW_H */
Signature · 1 line
2.8.0.rc3.226.g39d4020
#40 lore raw

PATCH 16/20 dm: mmc: dwmmc: Support CONFIG_BLK

Quoted 8 lines · Simon Glass

Add support for using driver model for block devices in this driver.

---

 drivers/mmc/dw_mmc.c | 42 ++++++++++++++++++++++++++++--------------
 include/dwmmc.h      |  7 ++++++-
 2 files changed, 34 insertions(+), 15 deletions(-)

Applied to u-boot-dm.

#41 lore raw

PATCH 17/20 dm: rockchip: mmc: Allow use of CONFIG_BLK

In reply to Simon Glass

Allow driver model to be used for block devices in the rockchip mmc driver.

---

 drivers/mmc/rockchip_dw_mmc.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
drivers/mmc/rockchip_dw_mmc.c +31 -0
index 0a261c5..750ab9f 100644
@@ -18,6 +18,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+struct rockchip_mmc_plat {
+	struct mmc_config cfg;
+	struct mmc mmc;
+};
+
 struct rockchip_dwmmc_priv {
 	struct udevice *clk;
 	int periph;
@@ -62,6 +67,9 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)
 
 static int rockchip_dwmmc_probe(struct udevice *dev)
 {
+#ifdef CONFIG_BLK
+	struct rockchip_mmc_plat *plat = dev_get_platdata(dev);
+#endif
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
 	struct rockchip_dwmmc_priv *priv = dev_get_priv(dev);
 	struct dwmci_host *host = &priv->host;
@@ -100,16 +108,37 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
 			return ret;
 	}
 #endif
+#ifdef CONFIG_BLK
+	dwmci_setup_cfg(&plat->cfg, dev->name, host->buswidth, host->caps,
+			minmax[1], minmax[0]);
+	host->mmc = &plat->mmc;
+#else
 	ret = add_dwmci(host, minmax[1], minmax[0]);
 	if (ret)
 		return ret;
 
+#endif
+	host->mmc->priv = &priv->host;
 	host->mmc->dev = dev;
 	upriv->mmc = host->mmc;
 
 	return 0;
 }
 
+static int rockchip_dwmmc_bind(struct udevice *dev)
+{
+#ifdef CONFIG_BLK
+	struct rockchip_mmc_plat *plat = dev_get_platdata(dev);
+	int ret;
+
+	ret = dwmci_bind(dev, &plat->mmc, &plat->cfg);
+	if (ret)
+		return ret;
+#endif
+
+	return 0;
+}
+
 static const struct udevice_id rockchip_dwmmc_ids[] = {
 	{ .compatible = "rockchip,rk3288-dw-mshc" },
 	{ }
@@ -120,8 +149,10 @@ U_BOOT_DRIVER(rockchip_dwmmc_drv) = {
 	.id		= UCLASS_MMC,
 	.of_match	= rockchip_dwmmc_ids,
 	.ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata,
+	.bind		= rockchip_dwmmc_bind,
 	.probe		= rockchip_dwmmc_probe,
 	.priv_auto_alloc_size = sizeof(struct rockchip_dwmmc_priv),
+	.platdata_auto_alloc_size = sizeof(struct rockchip_mmc_plat),
 };
 
 #ifdef CONFIG_PWRSEQ
Signature · 1 line
2.8.0.rc3.226.g39d4020
#42 lore raw

PATCH 17/20 dm: rockchip: mmc: Allow use of CONFIG_BLK

Quoted 7 lines · Simon Glass

Allow driver model to be used for block devices in the rockchip mmc driver.

---

 drivers/mmc/rockchip_dw_mmc.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

Applied to u-boot-dm.

#43 lore raw

PATCH 18/20 dm: mmc: Fix up mmc_bread/bwrite() prototypes for SPL

In reply to Simon Glass

When these functions are not compiled in, we still need to declare the correct function signature to avoid a build warnings in SPL. Fix this.

---

 drivers/mmc/mmc_private.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/mmc/mmc_private.h +14 -0
index 27b9e5f..9f0d5c2 100644
@@ -37,6 +37,19 @@ ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 
 /* SPL will never write or erase, declare dummies to reduce code size. */
 
+#ifdef CONFIG_BLK
+static inline unsigned long mmc_berase(struct udevice *dev,
+				       lbaint_t start, lbaint_t blkcnt)
+{
+	return 0;
+}
+
+static inline ulong mmc_bwrite(struct udevice *dev, lbaint_t start,
+			       lbaint_t blkcnt, const void *src)
+{
+	return 0;
+}
+#else
 static inline unsigned long mmc_berase(struct blk_desc *block_dev,
 				       lbaint_t start, lbaint_t blkcnt)
 {
@@ -48,6 +61,7 @@ static inline ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start,
 {
 	return 0;
 }
+#endif
 
 #endif /* CONFIG_SPL_BUILD */
 
Signature · 1 line
2.8.0.rc3.226.g39d4020
#44 lore raw

PATCH 18/20 dm: mmc: Fix up mmc_bread/bwrite() prototypes for SPL

Quoted 8 lines · Simon Glass

When these functions are not compiled in, we still need to declare the correct function signature to avoid a build warnings in SPL. Fix this.

---

 drivers/mmc/mmc_private.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Applied to u-boot-dm.

#45 lore raw

PATCH 19/20 dm: mmc: Use cfg directly in mmc_bind()

In reply to Simon Glass

This small change tidies up the code slightly.

---

 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/mmc.c +1 -1
index b7c936c..94f19ad 100644
@@ -1557,7 +1557,7 @@ int mmc_bind(struct udevice *dev, struct mmc *mmc, const struct mmc_config *cfg)
 	bdesc->removable = 1;
 
 	/* setup initial part type */
-	bdesc->part_type = mmc->cfg->part_type;
+	bdesc->part_type = cfg->part_type;
 	mmc->dev = dev;
 
 	return 0;
Signature · 1 line
2.8.0.rc3.226.g39d4020
#46 lore raw

PATCH 19/20 dm: mmc: Use cfg directly in mmc_bind()

Quoted 7 lines · Simon Glass

This small change tidies up the code slightly.

---

 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm.

#47 lore raw

PATCH 20/20 dm: rockchip: Enable CONFIG_BLK

In reply to Simon Glass

Enable CONFIG_BLK to move to using driver model for block devices. This affects MMC booting in SPL, as well as MMC access in U-Boot proper.

---

 arch/arm/mach-rockchip/Kconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-rockchip/Kconfig +3 -0
index d3bddb7..2a8afac 100644
@@ -41,6 +41,9 @@ config DM_I2C
 config DM_GPIO
 	default y
 
+config BLK
+	default y
+
 source "arch/arm/mach-rockchip/rk3288/Kconfig"
 source "arch/arm/mach-rockchip/rk3036/Kconfig"
 endif
Signature · 1 line
2.8.0.rc3.226.g39d4020
#48 lore raw

PATCH 20/20 dm: rockchip: Enable CONFIG_BLK

Quoted 8 lines · Simon Glass

Enable CONFIG_BLK to move to using driver model for block devices. This affects MMC booting in SPL, as well as MMC access in U-Boot proper.

---

 arch/arm/mach-rockchip/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

Applied to u-boot-dm.

#49 lore raw

cover dm: rockchip: Move rockchip boards to to use CONFIG_BLK

In reply to Simon Glass

Hi,

Quoted 48 lines · Simon Glass

This series expands the CONFIG_BLK support to SPL, fixes up the EFI boot code and adds a few other tweaks so that all rockchip boards can move to using driver model for block devices.

It also introduces snprintf() in the tiny-printf code and tidies up the mmc code a little.

Overall the code size for firefly-rk3288 drops by 1KB. This is mostly due to removing GPIO support and cutting down on unnecessary strings. The move to CONFIG_BLK unfortunately adds 0.5KB, or the improvement would be greater.

Simon Glass (20):
tiny-printf: Tidy up a few nits
tiny-printf: Support snprintf()
reset: Drop the reset failure message
mmc: Drop mmc_register()
mmc: Drop dead mmc code for non-generic MMC
mmc: Use byte array for multipliers
arm: Avoid error messages in cache_v7
rockchip: Check image name for the rksd image
rockchip: Drop unnecessary SPL properties
rockchip: video: Flush the cache when the display is updated
rockchip: Drop SPL GPIO support for rk3288
dm: env: mmc: Convert env_mmc to support CONFIG_BLK
dm: mmc: Convert sdhci to support CONFIG_BLK
dm: efi: Update for CONFIG_BLK
dm: mmc: spl: Add support for CONFIG_BLK
dm: mmc: dwmmc: Support CONFIG_BLK
dm: rockchip: mmc: Allow use of CONFIG_BLK
dm: mmc: Fix up mmc_bread/bwrite() prototypes for SPL
dm: mmc: Use cfg directly in mmc_bind()
dm: rockchip: Enable CONFIG_BLK

 arch/arm/cpu/armv7/cache_v7.c    |  8 +++---
 arch/arm/mach-rockchip/Kconfig   |  3 ++
 cmd/mmc.c                        | 62 ----------------------------------------
 common/env_mmc.c                 |  8 +++---
 common/spl/spl_mmc.c             |  9 +++---
 configs/firefly-rk3288_defconfig |  2 +-
 drivers/misc/reset-uclass.c      |  2 +-
 drivers/mmc/dw_mmc.c             | 42 ++++++++++++++++++---------
 drivers/mmc/mmc.c                | 13 ++-------
 drivers/mmc/mmc_private.h        | 14 +++++++++
 drivers/mmc/rockchip_dw_mmc.c    | 31 ++++++++++++++++++++
 drivers/mmc/sdhci.c              |  2 +-
 drivers/video/rockchip/rk_vop.c  |  1 +
Quoted 8 lines
 include/configs/rk3288_common.h  |  1 -
 include/dwmmc.h                  |  7 ++++-
 include/efi_loader.h             |  2 +-
 include/mmc.h                    |  5 ----
 lib/efi_loader/efi_disk.c        | 61 +++++++++++++++++++++++++++++----------
 lib/tiny-printf.c                | 43 +++++++++++++++++++++-------
 tools/rkimage.c                  |  7 +----
 20 files changed, 181 insertions(+), 142 deletions(-)

Are there any more comments on this series please? I'd like to apply it soon to provide for plenty of test time on the MMC side.

Regards,
Simon