Skip to contentSkip to conversation

ARM: legoev3: convert to driver model

PATCH New David Lechner 2 participants 2 messages May 29, 2019 – Jul 14, 2019 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: legoev3: convert to driver model

This converts LEGO MINDSTORMS EV3 to the driver model. MMC, SERIAL, SPI and SPI_FLASH are converted.

The device tree contains only the minimal nodes required by U-Boot since the size of U-Boot is limited to 256K on this device.

---
 arch/arm/dts/Makefile           |  3 +-
 arch/arm/dts/da850-lego-ev3.dts | 89 +++++++++++++++++++++++++++++++++
 board/lego/ev3/README           |  3 ++
 board/lego/ev3/legoev3.c        | 22 --------
 configs/legoev3_defconfig       |  9 +++-
 include/configs/legoev3.h       |  3 --
 6 files changed, 102 insertions(+), 27 deletions(-)
 create mode 100644 arch/arm/dts/da850-lego-ev3.dts
arch/arm/dts/Makefile +2 -1
index 31ef2b66a3..fcbfc2a912 100644
@@ -30,7 +30,8 @@ dtb-$(CONFIG_EXYNOS7420) += exynos7420-espresso7420.dtb
 
 dtb-$(CONFIG_ARCH_DAVINCI) += \
 	da850-evm.dtb \
-	da850-lcdk.dtb
+	da850-lcdk.dtb \
+	da850-lego-ev3.dtb
 
 dtb-$(CONFIG_KIRKWOOD) += \
 	kirkwood-atl-sbx81lifkw.dtb \
arch/arm/dts/da850-lego-ev3.dts new file +89 -0

89 lines not on this page · raw message

board/lego/ev3/README +3 -0
index da62a649ba..9ad93e8205 100644
@@ -50,3 +50,6 @@ software or a 3rd party program capable of uploading a firmware file.
 If you are booting from the microSD card, it is enough to just write uboot.bin
 to the flash. If you are not using a microSD card, you will need to create an
 image file using the layout described above.
+
+IMPORTANT: The EEPROM bootloader only copies 256k, so u-boot.img must not
+exceed that size!
board/lego/ev3/legoev3.c +0 -22
index 423c2fa44b..fa099e95f5 100644
@@ -25,11 +25,6 @@
 #include <asm/mach-types.h>
 #include <asm/setup.h>
 
-#ifdef CONFIG_MMC_DAVINCI
-#include <mmc.h>
-#include <asm/arch/sdmmc_defs.h>
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 u8 board_rev;
@@ -38,23 +33,6 @@ u8 board_rev;
 #define EEPROM_REV_OFFSET	0x3F00
 #define EEPROM_MAC_OFFSET	0x3F06
 
-#ifdef CONFIG_MMC_DAVINCI
-static struct davinci_mmc mmc_sd0 = {
-	.reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,
-	.host_caps = MMC_MODE_4BIT,     /* DA850 supports only 4-bit SD/MMC */
-	.voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
-	.version = MMC_CTLR_VERSION_2,
-};
-
-int board_mmc_init(bd_t *bis)
-{
-	mmc_sd0.input_clk = clk_get(DAVINCI_MMCSD_CLKID);
-
-	/* Add slot-0 to mmc subsystem */
-	return davinci_mmc_init(bis, &mmc_sd0);
-}
-#endif
-
 const struct pinmux_resource pinmuxes[] = {
 	PINMUX_ITEM(spi0_pins_base),
 	PINMUX_ITEM(spi0_pins_scs0),
configs/legoev3_defconfig +8 -1
index 32cd52c13e..78cca8eb56 100644
@@ -23,12 +23,19 @@ CONFIG_CMD_SPI=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_DIAG=y
+CONFIG_OF_CONTROL=y
+CONFIG_DEFAULT_DEVICE_TREE="da850-lego-ev3"
+CONFIG_DM=y
+# CONFIG_DM_DEVICE_REMOVE is not set
 CONFIG_SYS_I2C_DAVINCI=y
+CONFIG_DM_MMC=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SF_DEFAULT_SPEED=50000000
 CONFIG_SPI_FLASH_STMICRO=y
+CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
+CONFIG_DM_SPI=y
 CONFIG_DAVINCI_SPI=y
-CONFIG_OF_LIBFDT=y
 # CONFIG_EFI_LOADER is not set
include/configs/legoev3.h +0 -3
index 36ca3b201e..c97e6a0ebb 100644
@@ -42,11 +42,8 @@
  * Serial Driver info
  */
 #define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE	-4	/* NS16550 register size */
-#define CONFIG_SYS_NS16550_COM1	DAVINCI_UART1_BASE /* Base address of UART1 */
 #define CONFIG_SYS_NS16550_CLK	clk_get(DAVINCI_UART2_CLKID)
 
-#define CONFIG_SYS_SPI_BASE		DAVINCI_SPI0_BASE
 #define CONFIG_SYS_SPI_CLK		clk_get(DAVINCI_SPI0_CLKID)
 
 /*
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 ARM: legoev3: convert to driver model

Quoted 7 lines · David Lechner

This converts LEGO MINDSTORMS EV3 to the driver model. MMC, SERIAL, SPI and SPI_FLASH are converted.

The device tree contains only the minimal nodes required by U-Boot since the size of U-Boot is limited to 256K on this device.

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/20190714/cefd709c/attachment.sig>