All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] ARM: uniphier: eMMC boot support
@ 2016-02-16  8:08 Masahiro Yamada
  2016-02-16  8:08 ` [U-Boot] [PATCH 1/4] ARM: uniphier: add " Masahiro Yamada
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Masahiro Yamada @ 2016-02-16  8:08 UTC (permalink / raw)
  To: u-boot



Masahiro Yamada (4):
  ARM: uniphier: add eMMC boot support
  ARM: uniphier: add a command to find the first MMC (non-SD) device
  ARM: uniphier: add emmcupdate command
  ARM: uniphier: default to environment in eMMC

 arch/arm/dts/uniphier-ph1-pro4-sanji.dts     | 12 +++++
 arch/arm/dts/uniphier-proxstream2-gentil.dts | 12 +++++
 arch/arm/dts/uniphier-proxstream2-vodka.dts  | 12 +++++
 arch/arm/mach-uniphier/boot-mode/boot-mode.c | 66 ++++++++++++++++++++++++++++
 doc/README.uniphier                          | 14 ++++++
 include/configs/uniphier.h                   | 22 +++++++---
 6 files changed, 132 insertions(+), 6 deletions(-)

-- 
1.9.1

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

* [U-Boot] [PATCH 1/4] ARM: uniphier: add eMMC boot support
  2016-02-16  8:08 [U-Boot] [PATCH 0/4] ARM: uniphier: eMMC boot support Masahiro Yamada
@ 2016-02-16  8:08 ` Masahiro Yamada
  2016-02-16  8:08 ` [U-Boot] [PATCH 2/4] ARM: uniphier: add a command to find the first MMC (non-SD) device Masahiro Yamada
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2016-02-16  8:08 UTC (permalink / raw)
  To: u-boot

Export device nodes needed for eMMC boot (eMMC node, pinctrl, and
clock) to the SPL DTB.  CONFIG_SUPPORT_EMMC_BOOT is also necessary
to use "mmc partconf" command.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm/dts/uniphier-ph1-pro4-sanji.dts     | 12 ++++++++++++
 arch/arm/dts/uniphier-proxstream2-gentil.dts | 12 ++++++++++++
 arch/arm/dts/uniphier-proxstream2-vodka.dts  | 12 ++++++++++++
 arch/arm/mach-uniphier/boot-mode/boot-mode.c | 25 +++++++++++++++++++++++++
 include/configs/uniphier.h                   |  3 +++
 5 files changed, 64 insertions(+)

diff --git a/arch/arm/dts/uniphier-ph1-pro4-sanji.dts b/arch/arm/dts/uniphier-ph1-pro4-sanji.dts
index 1ca1042..82e2bd0 100644
--- a/arch/arm/dts/uniphier-ph1-pro4-sanji.dts
+++ b/arch/arm/dts/uniphier-ph1-pro4-sanji.dts
@@ -95,6 +95,14 @@
 	u-boot,dm-pre-reloc;
 };
 
+&mio {
+	u-boot,dm-pre-reloc;
+};
+
+&emmc {
+	u-boot,dm-pre-reloc;
+};
+
 &pinctrl {
 	u-boot,dm-pre-reloc;
 };
@@ -102,3 +110,7 @@
 &pinctrl_uart0 {
 	u-boot,dm-pre-reloc;
 };
+
+&pinctrl_emmc {
+	u-boot,dm-pre-reloc;
+};
diff --git a/arch/arm/dts/uniphier-proxstream2-gentil.dts b/arch/arm/dts/uniphier-proxstream2-gentil.dts
index c3551fe..eb1d2bc 100644
--- a/arch/arm/dts/uniphier-proxstream2-gentil.dts
+++ b/arch/arm/dts/uniphier-proxstream2-gentil.dts
@@ -75,6 +75,14 @@
 	u-boot,dm-pre-reloc;
 };
 
+&mio {
+	u-boot,dm-pre-reloc;
+};
+
+&emmc {
+	u-boot,dm-pre-reloc;
+};
+
 &pinctrl {
 	u-boot,dm-pre-reloc;
 };
@@ -82,3 +90,7 @@
 &pinctrl_uart2 {
 	u-boot,dm-pre-reloc;
 };
+
+&pinctrl_emmc {
+	u-boot,dm-pre-reloc;
+};
diff --git a/arch/arm/dts/uniphier-proxstream2-vodka.dts b/arch/arm/dts/uniphier-proxstream2-vodka.dts
index d61e0b6..e7d5db8 100644
--- a/arch/arm/dts/uniphier-proxstream2-vodka.dts
+++ b/arch/arm/dts/uniphier-proxstream2-vodka.dts
@@ -60,6 +60,14 @@
 	u-boot,dm-pre-reloc;
 };
 
+&mio {
+	u-boot,dm-pre-reloc;
+};
+
+&emmc {
+	u-boot,dm-pre-reloc;
+};
+
 &pinctrl {
 	u-boot,dm-pre-reloc;
 };
@@ -67,3 +75,7 @@
 &pinctrl_uart2 {
 	u-boot,dm-pre-reloc;
 };
+
+&pinctrl_emmc {
+	u-boot,dm-pre-reloc;
+};
diff --git a/arch/arm/mach-uniphier/boot-mode/boot-mode.c b/arch/arm/mach-uniphier/boot-mode/boot-mode.c
index 935e551..2f2e45d 100644
--- a/arch/arm/mach-uniphier/boot-mode/boot-mode.c
+++ b/arch/arm/mach-uniphier/boot-mode/boot-mode.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <mmc.h>
 #include <spl.h>
 
 #include "../sbc/sbc-regs.h"
@@ -52,3 +53,27 @@ u32 spl_boot_device(void)
 
 	return ret == BOOT_DEVICE_USB ? BOOT_DEVICE_NOR : ret;
 }
+
+u32 spl_boot_mode(void)
+{
+	struct mmc *mmc;
+
+	/*
+	 * work around a bug in the Boot ROM of PH1-sLD3, LD4, Pro4, and sLD8:
+	 *
+	 * The boot ROM in these SoCs breaks the PARTITION_CONFIG [179] of
+	 * Extended CSD register; when switching to the Boot Partition 1, the
+	 * Boot ROM should issue the SWITCH command (CMD6) with Set Bits for
+	 * the Access Bits, but in fact it uses Write Byte for the Access Bits.
+	 * As a result, the BOOT_PARTITION_ENABLE field of the PARTITION_CONFIG
+	 * is lost.  This bug was fixed for PH1-Pro5 and later SoCs.
+	 *
+	 * Fixup mmc->part_config here because it is used to determine the
+	 * partition which the U-Boot image is read from.
+	 */
+	mmc = find_mmc_device(0);
+	mmc->part_config &= ~EXT_CSD_BOOT_PART_NUM(PART_ACCESS_MASK);
+	mmc->part_config |= EXT_CSD_BOOT_PARTITION_ENABLE;
+
+	return MMCSD_MODE_EMMCBOOT;
+}
diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h
index 9d14155..19dbfbb 100644
--- a/include/configs/uniphier.h
+++ b/include/configs/uniphier.h
@@ -148,6 +148,7 @@
 
 /* SD/MMC */
 #define CONFIG_CMD_MMC
+#define CONFIG_SUPPORT_EMMC_BOOT
 #define CONFIG_GENERIC_MMC
 
 /* memtest works on */
@@ -263,6 +264,7 @@
 #define CONFIG_SPL_FRAMEWORK
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_MMC_SUPPORT
 
 #define CONFIG_SPL_LIBCOMMON_SUPPORT	/* for mem_malloc_init */
 #define CONFIG_SPL_LIBGENERIC_SUPPORT
@@ -270,6 +272,7 @@
 #define CONFIG_SPL_BOARD_INIT
 
 #define CONFIG_SYS_NAND_U_BOOT_OFFS		0x10000
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	0x80
 
 #define CONFIG_SPL_MAX_FOOTPRINT		0x10000
 
-- 
1.9.1

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

* [U-Boot] [PATCH 2/4] ARM: uniphier: add a command to find the first MMC (non-SD) device
  2016-02-16  8:08 [U-Boot] [PATCH 0/4] ARM: uniphier: eMMC boot support Masahiro Yamada
  2016-02-16  8:08 ` [U-Boot] [PATCH 1/4] ARM: uniphier: add " Masahiro Yamada
@ 2016-02-16  8:08 ` Masahiro Yamada
  2016-02-16  8:08 ` [U-Boot] [PATCH 3/4] ARM: uniphier: add emmcupdate command Masahiro Yamada
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2016-02-16  8:08 UTC (permalink / raw)
  To: u-boot

UniPhier SoC family supports both (e)MMC boot and SD card boot;
however, both of them are handled in the same uclass.

When booting from the eMMC, we want to know the device number
of the (e)MMC, not SD.  This command is useful to find the first
MMC (non-SD) device.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm/mach-uniphier/boot-mode/boot-mode.c | 36 ++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/arch/arm/mach-uniphier/boot-mode/boot-mode.c b/arch/arm/mach-uniphier/boot-mode/boot-mode.c
index 2f2e45d..481e209 100644
--- a/arch/arm/mach-uniphier/boot-mode/boot-mode.c
+++ b/arch/arm/mach-uniphier/boot-mode/boot-mode.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <mmc.h>
 #include <spl.h>
+#include <linux/err.h>
 
 #include "../sbc/sbc-regs.h"
 #include "../soc-info.h"
@@ -77,3 +78,38 @@ u32 spl_boot_mode(void)
 
 	return MMCSD_MODE_EMMCBOOT;
 }
+
+#ifdef CONFIG_DM_MMC
+static int find_first_mmc_device(void)
+{
+	struct mmc *mmc;
+	int i;
+
+	for (i = 0; (mmc = find_mmc_device(i)); i++) {
+		if (!mmc_init(mmc) && IS_MMC(mmc))
+			return i;
+	}
+
+	return -ENODEV;
+}
+
+#ifndef CONFIG_SPL_BUILD
+static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	int dev;
+
+	dev = find_first_mmc_device();
+	if (dev < 0)
+		return CMD_RET_FAILURE;
+
+	setenv_ulong("mmc_first_dev", dev);
+	return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(
+	   mmcsetn,	1,	1,	do_mmcsetn,
+	"Set the first MMC (not SD) dev number to \"mmc_first_dev\" enviroment",
+	""
+);
+#endif
+#endif
-- 
1.9.1

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

* [U-Boot] [PATCH 3/4] ARM: uniphier: add emmcupdate command
  2016-02-16  8:08 [U-Boot] [PATCH 0/4] ARM: uniphier: eMMC boot support Masahiro Yamada
  2016-02-16  8:08 ` [U-Boot] [PATCH 1/4] ARM: uniphier: add " Masahiro Yamada
  2016-02-16  8:08 ` [U-Boot] [PATCH 2/4] ARM: uniphier: add a command to find the first MMC (non-SD) device Masahiro Yamada
@ 2016-02-16  8:08 ` Masahiro Yamada
  2016-02-16  8:08 ` [U-Boot] [PATCH 4/4] ARM: uniphier: default to environment in eMMC Masahiro Yamada
  2016-02-26 15:42 ` [U-Boot] [PATCH 0/4] ARM: uniphier: eMMC boot support Masahiro Yamada
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2016-02-16  8:08 UTC (permalink / raw)
  To: u-boot

The Boot ROM expects the boot image (SPL) in the Boot Partition 1.
So, updating images involves the hardware partition switch.  It might
be a bit advanced for some users.

To be user-friendly, this commit adds a useful command to update the
images; just put SPL and U-Boot proper into the public directory of
the TFTP server and execute "run emmcupdate" from the command line.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 doc/README.uniphier        | 14 ++++++++++++++
 include/configs/uniphier.h |  7 +++++++
 2 files changed, 21 insertions(+)

diff --git a/doc/README.uniphier b/doc/README.uniphier
index 7cfff97..47b4d78 100644
--- a/doc/README.uniphier
+++ b/doc/README.uniphier
@@ -78,6 +78,20 @@ directory, and then run the following command at the U-Boot command line:
   => run nandupdate
 
 
+Burn U-Boot images to eMMC
+--------------------------
+
+Write two files to the Boot partition 1 of the eMMC device as follows:
+ - spl/u-boot-spl.bin at the offset address 0x00000000
+ - u-boot.img         at the offset address 0x00010000
+
+If a TFTP server is available, the images can be easily updated.
+Just copy the u-boot-spl-dtb.bin and u-boot-dtb.img to the TFTP public
+directory, and then run the following command at the U-Boot command line:
+
+  => run emmcupdate
+
+
 UniPhier specific commands
 --------------------------
 
diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h
index 19dbfbb..1b28cdc 100644
--- a/include/configs/uniphier.h
+++ b/include/configs/uniphier.h
@@ -233,6 +233,13 @@
 	"netdev=eth0\0"						\
 	"verify=n\0"						\
 	"nor_base=0x42000000\0"					\
+	"emmcupdate=mmcsetn &&"					\
+		"mmc partconf $mmc_first_dev 0 1 1 &&"		\
+		"mmc erase 0 800 &&"				\
+		"tftpboot u-boot-spl.bin &&"			\
+		"mmc write $loadaddr 0 80 &&"			\
+		"tftpboot u-boot.img &&"			\
+		"mmc write $loadaddr 80 780\0"			\
 	"nandupdate=nand erase 0 0x00100000 &&"			\
 		"tftpboot u-boot-spl.bin &&"			\
 		"nand write $loadaddr 0 0x00010000 &&"		\
-- 
1.9.1

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

* [U-Boot] [PATCH 4/4] ARM: uniphier: default to environment in eMMC
  2016-02-16  8:08 [U-Boot] [PATCH 0/4] ARM: uniphier: eMMC boot support Masahiro Yamada
                   ` (2 preceding siblings ...)
  2016-02-16  8:08 ` [U-Boot] [PATCH 3/4] ARM: uniphier: add emmcupdate command Masahiro Yamada
@ 2016-02-16  8:08 ` Masahiro Yamada
  2016-02-26 15:42 ` [U-Boot] [PATCH 0/4] ARM: uniphier: eMMC boot support Masahiro Yamada
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2016-02-16  8:08 UTC (permalink / raw)
  To: u-boot

Of the several boot devices supported, it looks like the eMMC is the
most commonly used.  Enable CONFIG_ENV_IS_IN_MMC by default.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm/mach-uniphier/boot-mode/boot-mode.c |  5 +++++
 include/configs/uniphier.h                   | 12 ++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-uniphier/boot-mode/boot-mode.c b/arch/arm/mach-uniphier/boot-mode/boot-mode.c
index 481e209..d5ef10a 100644
--- a/arch/arm/mach-uniphier/boot-mode/boot-mode.c
+++ b/arch/arm/mach-uniphier/boot-mode/boot-mode.c
@@ -93,6 +93,11 @@ static int find_first_mmc_device(void)
 	return -ENODEV;
 }
 
+int mmc_get_env_dev(void)
+{
+	return find_first_mmc_device();
+}
+
 #ifndef CONFIG_SPL_BUILD
 static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h
index 1b28cdc..b1c8ccb 100644
--- a/include/configs/uniphier.h
+++ b/include/configs/uniphier.h
@@ -99,16 +99,16 @@
 
 #define CONFIG_CONS_INDEX		1
 
-/*
- * For NAND booting the environment is embedded in the U-Boot image. Please take
- * look at the file board/amcc/canyonlands/u-boot-nand.lds for details.
- */
+/* #define CONFIG_ENV_IS_NOWHERE */
 /* #define CONFIG_ENV_IS_IN_NAND */
-#define CONFIG_ENV_IS_NOWHERE
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_ENV_OFFSET			0x80000
 #define CONFIG_ENV_SIZE				0x2000
-#define CONFIG_ENV_OFFSET			0x0
 /* #define CONFIG_ENV_OFFSET_REDUND	(CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) */
 
+#define CONFIG_SYS_MMC_ENV_DEV		0
+#define CONFIG_SYS_MMC_ENV_PART		1
+
 /* Time clock 1MHz */
 #define CONFIG_SYS_TIMER_RATE			1000000
 
-- 
1.9.1

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

* [U-Boot] [PATCH 0/4] ARM: uniphier: eMMC boot support
  2016-02-16  8:08 [U-Boot] [PATCH 0/4] ARM: uniphier: eMMC boot support Masahiro Yamada
                   ` (3 preceding siblings ...)
  2016-02-16  8:08 ` [U-Boot] [PATCH 4/4] ARM: uniphier: default to environment in eMMC Masahiro Yamada
@ 2016-02-26 15:42 ` Masahiro Yamada
  4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2016-02-26 15:42 UTC (permalink / raw)
  To: u-boot

2016-02-16 17:08 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
>
>
> Masahiro Yamada (4):
>   ARM: uniphier: add eMMC boot support
>   ARM: uniphier: add a command to find the first MMC (non-SD) device
>   ARM: uniphier: add emmcupdate command
>   ARM: uniphier: default to environment in eMMC
>
>  arch/arm/dts/uniphier-ph1-pro4-sanji.dts     | 12 +++++
>  arch/arm/dts/uniphier-proxstream2-gentil.dts | 12 +++++
>  arch/arm/dts/uniphier-proxstream2-vodka.dts  | 12 +++++
>  arch/arm/mach-uniphier/boot-mode/boot-mode.c | 66 ++++++++++++++++++++++++++++
>  doc/README.uniphier                          | 14 ++++++
>  include/configs/uniphier.h                   | 22 +++++++---
>  6 files changed, 132 insertions(+), 6 deletions(-)
>

Series, applied to u-boot-uniphier.


-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2016-02-26 15:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-16  8:08 [U-Boot] [PATCH 0/4] ARM: uniphier: eMMC boot support Masahiro Yamada
2016-02-16  8:08 ` [U-Boot] [PATCH 1/4] ARM: uniphier: add " Masahiro Yamada
2016-02-16  8:08 ` [U-Boot] [PATCH 2/4] ARM: uniphier: add a command to find the first MMC (non-SD) device Masahiro Yamada
2016-02-16  8:08 ` [U-Boot] [PATCH 3/4] ARM: uniphier: add emmcupdate command Masahiro Yamada
2016-02-16  8:08 ` [U-Boot] [PATCH 4/4] ARM: uniphier: default to environment in eMMC Masahiro Yamada
2016-02-26 15:42 ` [U-Boot] [PATCH 0/4] ARM: uniphier: eMMC boot support Masahiro Yamada

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.