Skip to contentSkip to conversation

ARM: legoev3: updates

PATCH New David Lechner 2 participants 11 messages May 20, 2018 – Jun 6, 2018

lore
Share & tools
lore
#0 lore raw

cover ARM: legoev3: updates

This series contains some updates for LEGO MINDSTORMS EV3. There are a couple of cleanups, a fix for some console messages not printing and device tree support.

David Lechner (5):
ARM: legoev3: increase flash image sizes
ARM: legoev3: Move UART enable to early init
ARM: legoev3: disable networking
ARM: legoev3: remove unused configuration options
ARM: legoev3: update boot script to load uEnv.txt and .dtb

 board/lego/ev3/README     |  36 ++++++++++---
 board/lego/ev3/legoev3.c  |  14 +++--
 configs/legoev3_defconfig |   4 +-
 include/configs/legoev3.h | 104 ++++++++++++++------------------------
 4 files changed, 72 insertions(+), 86 deletions(-)
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/5 ARM: legoev3: increase flash image sizes

This increases the kernel image to 4M and the rootfs image to 10M.

It is getting hard to get a kernel image to fit in 3M.

---
 board/lego/ev3/README     | 4 ++--
 include/configs/legoev3.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
board/lego/ev3/README +2 -2
index 1a50ca9d03..a356373249 100644
@@ -14,8 +14,8 @@ see if there is a boot.scr file on the first FAT partition of the mmc. If there
 is, it will run the script and boot the kernel from the uImage file also in
 the FAT partition. Otherwise, it will load a kernel and rootfs from the flash.
 The kernel must be stored at address 0x50000 on the flash and have a maximum
-size of 3MiB. The rootfs must be a squasfs image and stored at 0x350000 in the
-flash and have a maximum size of 9.3MiB. The flash starting at 0xCB0000 is
+size of 4MiB. The rootfs must be a squasfs image and stored at 0x450000 in the
+flash and have a maximum size of 10MiB. The flash starting at 0xE50000 is
 reserved for user data.
 
 Writing image to flash
include/configs/legoev3.h +1 -1
index 542b8f072c..812fd0c14a 100644
@@ -164,7 +164,7 @@
 	"mmcargs=setenv bootargs mem=${memsize} console=${console} root=/dev/mmcblk0p2 rw rootwait lpj=747520\0" \
 	"mmcboot=bootm ${loadaddr}\0" \
 	"flashargs=setenv bootargs mem=${memsize} initrd=${filesysaddr},${filesyssize} root=/dev/ram0 rw rootfstype=squashfs console=${console} lpj=747520\0" \
-	"flashboot=sf probe 0; sf read ${loadaddr} 0x50000 0x300000; sf read ${filesysaddr} 0x350000 0x960000; bootm ${loadaddr}\0" \
+	"flashboot=sf probe 0; sf read ${loadaddr} 0x50000 0x400000; sf read ${filesysaddr} 0x450000 0xA00000; bootm ${loadaddr}\0" \
 	"loadimage=fatload mmc 0 ${loadaddr} uImage\0" \
 	"loadbootscr=fatload mmc 0 ${bootscraddr} boot.scr\0" \
 	"bootscript=source ${bootscraddr}\0" \
Signature · 1 line
2.17.0
#2 lore raw

PATCH 1/5 ARM: legoev3: increase flash image sizes

Quoted 5 lines · David Lechner

This increases the kernel image to 4M and the rootfs image to 10M.

It is getting hard to get a kernel image to fit in 3M.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180606/22a3789d/attachment.sig>
#3 lore raw

PATCH 2/5 ARM: legoev3: Move UART enable to early init

In reply to David Lechner

This moves the UART init for LEGO MINDSTORMS EV3 to board_early_init_f(). Some console messages were not being printed because the UART was not enabled until later in the init process.

---
 board/lego/ev3/legoev3.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
board/lego/ev3/legoev3.c +5 -5
index 5e70363588..69010055d3 100644
@@ -132,6 +132,11 @@ void get_board_serial(struct tag_serialnr *serialnr)
 
 int board_early_init_f(void)
 {
+	/* enable the console UART */
+	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
+		DAVINCI_UART_PWREMU_MGMT_UTRST),
+	       &davinci_uart1_ctrl_regs->pwremu_mgmt);
+
 	/*
 	 * Power on required peripherals
 	 * ARM does not have access by default to PSC0 and PSC1
@@ -166,10 +171,5 @@ int board_init(void)
 	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
 		return 1;
 
-	/* enable the console UART */
-	writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
-		DAVINCI_UART_PWREMU_MGMT_UTRST),
-	       &davinci_uart1_ctrl_regs->pwremu_mgmt);
-
 	return 0;
 }
Signature · 1 line
2.17.0
#4 lore raw

PATCH 2/5 ARM: legoev3: Move UART enable to early init

Quoted 5 lines · David Lechner

This moves the UART init for LEGO MINDSTORMS EV3 to board_early_init_f(). Some console messages were not being printed because the UART was not enabled until later in the init process.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180606/fb2f9068/attachment.sig>
#5 lore raw

PATCH 3/5 ARM: legoev3: disable networking

In reply to David Lechner

This disables networking related items in the config. The EV3 does not have any networking hardware, so this is wasted space.

---
 board/lego/ev3/legoev3.c  | 4 +---
 configs/legoev3_defconfig | 4 +---
 include/configs/legoev3.h | 2 --
 3 files changed, 2 insertions(+), 8 deletions(-)
board/lego/ev3/legoev3.c +1 -3
index 69010055d3..423c2fa44b 100644
@@ -14,8 +14,6 @@
 
 #include <common.h>
 #include <i2c.h>
-#include <net.h>
-#include <netdev.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <asm/arch/hardware.h>
@@ -162,7 +160,7 @@ int board_init(void)
 
 	/* setup the SUSPSRC for ARM to control emulation suspend */
 	writel(readl(&davinci_syscfg_regs->suspsrc) &
-	       ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C |
+	       ~(DAVINCI_SYSCFG_SUSPSRC_I2C |
 		 DAVINCI_SYSCFG_SUSPSRC_SPI0 | DAVINCI_SYSCFG_SUSPSRC_TIMER0 |
 		 DAVINCI_SYSCFG_SUSPSRC_UART1),
 	       &davinci_syscfg_regs->suspsrc);
configs/legoev3_defconfig +1 -3
index c5f54a98d3..8ee2d223fd 100644
@@ -18,9 +18,7 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_SPI=y
 # CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_MII=y
-CONFIG_CMD_PING=y
+# CONFIG_CMD_NET is not set
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_DIAG=y
include/configs/legoev3.h +0 -2
index 812fd0c14a..6972cedabf 100644
@@ -43,7 +43,6 @@
 	DAVINCI_SYSCFG_SUSPSRC_TIMER0 |		\
 	DAVINCI_SYSCFG_SUSPSRC_SPI0 |		\
 	DAVINCI_SYSCFG_SUSPSRC_UART1 |		\
-	DAVINCI_SYSCFG_SUSPSRC_EMAC |		\
 	DAVINCI_SYSCFG_SUSPSRC_I2C)
 
 /*
@@ -152,7 +151,6 @@
 		"run flashboot; " \
 	"fi"
 #define CONFIG_EXTRA_ENV_SETTINGS \
-	"hostname=EV3\0" \
 	"memsize=64M\0" \
 	"filesyssize=10M\0" \
 	"verify=n\0" \
Signature · 1 line
2.17.0
#6 lore raw

PATCH 3/5 ARM: legoev3: disable networking

Quoted 4 lines · David Lechner

This disables networking related items in the config. The EV3 does not have any networking hardware, so this is wasted space.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180606/42889f8e/attachment.sig>
#7 lore raw

PATCH 4/5 ARM: legoev3: remove unused configuration options

In reply to David Lechner

This removes the unused clock and RAM config options that were cargo- culted when this board was copied from the DA850 EVM.

---
 include/configs/legoev3.h | 54 ---------------------------------------
 1 file changed, 54 deletions(-)
include/configs/legoev3.h +0 -54
index 6972cedabf..9eb95bc030 100644
@@ -39,60 +39,6 @@
 
 #define CONFIG_NR_DRAM_BANKS	1 /* we have 1 bank of DRAM */
 
-#define CONFIG_SYS_DA850_SYSCFG_SUSPSRC (	\
-	DAVINCI_SYSCFG_SUSPSRC_TIMER0 |		\
-	DAVINCI_SYSCFG_SUSPSRC_SPI0 |		\
-	DAVINCI_SYSCFG_SUSPSRC_UART1 |		\
-	DAVINCI_SYSCFG_SUSPSRC_I2C)
-
-/*
- * PLL configuration
- */
-
-#define CONFIG_SYS_DA850_PLL0_PLLM     24
-#define CONFIG_SYS_DA850_PLL1_PLLM     21
-
-/*
- * DDR2 memory configuration
- */
-#define CONFIG_SYS_DA850_DDR2_DDRPHYCR (DV_DDR_PHY_PWRDNEN | \
-					DV_DDR_PHY_EXT_STRBEN | \
-					(0x4 << DV_DDR_PHY_RD_LATENCY_SHIFT))
-
-#define CONFIG_SYS_DA850_DDR2_SDBCR (		\
-	(1 << DV_DDR_SDCR_MSDRAMEN_SHIFT) |	\
-	(1 << DV_DDR_SDCR_DDREN_SHIFT) |	\
-	(1 << DV_DDR_SDCR_SDRAMEN_SHIFT) |	\
-	(1 << DV_DDR_SDCR_BUS_WIDTH_SHIFT) |	\
-	(0x3 << DV_DDR_SDCR_CL_SHIFT) |		\
-	(0x2 << DV_DDR_SDCR_IBANK_SHIFT) |	\
-	(0x2 << DV_DDR_SDCR_PAGESIZE_SHIFT))
-
-/* SDBCR2 is only used if IBANK_POS bit in SDBCR is set */
-#define CONFIG_SYS_DA850_DDR2_SDBCR2 0
-
-#define CONFIG_SYS_DA850_DDR2_SDTIMR (		\
-	(14 << DV_DDR_SDTMR1_RFC_SHIFT) |	\
-	(2 << DV_DDR_SDTMR1_RP_SHIFT) |		\
-	(2 << DV_DDR_SDTMR1_RCD_SHIFT) |	\
-	(1 << DV_DDR_SDTMR1_WR_SHIFT) |		\
-	(5 << DV_DDR_SDTMR1_RAS_SHIFT) |	\
-	(8 << DV_DDR_SDTMR1_RC_SHIFT) |		\
-	(1 << DV_DDR_SDTMR1_RRD_SHIFT) |	\
-	(0 << DV_DDR_SDTMR1_WTR_SHIFT))
-
-#define CONFIG_SYS_DA850_DDR2_SDTIMR2 (		\
-	(7 << DV_DDR_SDTMR2_RASMAX_SHIFT) |	\
-	(0 << DV_DDR_SDTMR2_XP_SHIFT) |		\
-	(0 << DV_DDR_SDTMR2_ODT_SHIFT) |	\
-	(17 << DV_DDR_SDTMR2_XSNR_SHIFT) |	\
-	(199 << DV_DDR_SDTMR2_XSRD_SHIFT) |	\
-	(0 << DV_DDR_SDTMR2_RTP_SHIFT) |	\
-	(0 << DV_DDR_SDTMR2_CKE_SHIFT))
-
-#define CONFIG_SYS_DA850_DDR2_SDRCR    0x00000494
-#define CONFIG_SYS_DA850_DDR2_PBBPR    0x30
-
 /*
  * Serial Driver info
  */
Signature · 1 line
2.17.0
#8 lore raw

PATCH 4/5 ARM: legoev3: remove unused configuration options

Quoted 4 lines · David Lechner

This removes the unused clock and RAM config options that were cargo- culted when this board was copied from the DA850 EVM.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180606/379501c9/attachment.sig>
#9 lore raw

PATCH 5/5 ARM: legoev3: update boot script to load uEnv.txt and .dtb

In reply to David Lechner

This updates the LEGO MINDSTORMS EV3 boot script to try loading a uEnv.txt file and a da850-lego-ev3.dtb device tree during boot.

---
 board/lego/ev3/README     | 36 ++++++++++++++++++++++-------
 include/configs/legoev3.h | 48 ++++++++++++++++++++++++++++++---------
 2 files changed, 65 insertions(+), 19 deletions(-)
board/lego/ev3/README +28 -8
index a356373249..da62a649ba 100644
@@ -9,14 +9,34 @@ Booting
 =======
 
 The EV3 contains a bootloader in EEPROM that loads u-boot.bin from address 0x0
-of the spi flash memory. Using the default configuration, u-boot will check to
-see if there is a boot.scr file on the first FAT partition of the mmc. If there
-is, it will run the script and boot the kernel from the uImage file also in
-the FAT partition. Otherwise, it will load a kernel and rootfs from the flash.
-The kernel must be stored at address 0x50000 on the flash and have a maximum
-size of 4MiB. The rootfs must be a squasfs image and stored at 0x450000 in the
-flash and have a maximum size of 10MiB. The flash starting at 0xE50000 is
-reserved for user data.
+of the SPI flash memory (with a size of 256KiB!). Because the EEPROM is read-
+only and it takes care of low level configuration (PLL and DDR), we don't use
+U-Boot to produce an SPL image.
+
+Using the default configuration, U-Boot had a boot scrips that works as follows:
+
+* Check to see if microSD card is present
+* If it is, try to load boot.scr from the first FAT partition
+* If loading boot.scr was successful, run it
+* Otherwise, try loading uEnv.txt
+* If loading uEnv.txt was successful, import it
+* If there is a uenvcmd variable (from uEnv.txt), run it
+* Try to load uImage from the first FAT partition
+* If it was successful, try to load da850-lego-ev3.dtb
+* If loading uImage was successful, boot it (DT is optional)
+* If none of the above was successful, try booting from flash
+
+Suggested Flash Memory Layout
+=============================
+
+The following is based on the default U-Boot configuration:
+
+| Image (file)       | Start Addr. | Max. Size         |
++--------------------+-------------+-------------------+
+| u-boot.bin         |         0x0 |  0x40000 (256KiB) |
+| da850-lego-ev3.dtb |     0x40000 |  0x10000 (64KiB)  |
+| uImage             |     0x50000 | 0x400000 (4MiB)   |
+| rootfs (squashfs)  |    0x450000 | 0xa00000 (10MiB)  |
 
 Writing image to flash
 ======================
include/configs/legoev3.h +37 -11

71 lines not on this page · raw message

Signature · 1 line
2.17.0
#10 lore raw

PATCH 5/5 ARM: legoev3: update boot script to load uEnv.txt and .dtb

Quoted 4 lines · David Lechner

This updates the LEGO MINDSTORMS EV3 boot script to try loading a uEnv.txt file and a da850-lego-ev3.dtb device tree during boot.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180606/b8af6f9c/attachment.sig>