From: David Lechner <david@lechnology.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ARM: legoev3: convert to driver model
Date: Tue, 28 May 2019 20:56:42 -0500 [thread overview]
Message-ID: <20190529015642.18393-1-david@lechnology.com> (raw)
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.
Signed-off-by: David Lechner <david@lechnology.com>
---
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
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 31ef2b66a3..fcbfc2a912 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -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 \
diff --git a/arch/arm/dts/da850-lego-ev3.dts b/arch/arm/dts/da850-lego-ev3.dts
new file mode 100644
index 0000000000..e281d039fd
--- /dev/null
+++ b/arch/arm/dts/da850-lego-ev3.dts
@@ -0,0 +1,89 @@
+/*
+ * Device tree for LEGO MINDSTORMS EV3
+ *
+ * Copyright (C) 2017 David Lechner <david@lechnology.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * This is an absolute minimum device tree instead of using the one from Linux
+ * because the bootloader on the EV3 is limited to 256k. This saves us >10k.
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "lego,ev3", "ti,da850";
+ model = "LEGO MINDSTORMS EV3";
+
+ aliases {
+ serial1 = &serial1;
+ spi0 = &spi0;
+ };
+
+ chosen {
+ stdout-path = &serial1;
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <0xc0000000 0x04000000>;
+ };
+
+ arm {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
+ intc: interrupt-controller at fffee000 {
+ compatible = "ti,cp-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ ti,intc-size = <101>;
+ reg = <0xfffee000 0x2000>;
+ };
+ };
+
+ soc at 1c00000 {
+ compatible = "simple-bus";
+ model = "da850";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0x0 0x01c00000 0x400000>;
+ interrupt-parent = <&intc>;
+
+ mmc0: mmc at 40000 {
+ compatible = "ti,da830-mmc";
+ reg = <0x40000 0x1000>;
+ cap-sd-highspeed;
+ cap-mmc-highspeed;
+ interrupts = <16>;
+ max-frequency = <50000000>;
+ bus-width = <4>;
+ };
+
+ spi0: spi at 41000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "ti,da830-spi";
+ reg = <0x41000 0x1000>;
+ num-cs = <6>;
+ ti,davinci-spi-intr-line = <1>;
+ interrupts = <20>;
+
+ flash at 0 {
+ compatible = "micron,n25q128a13", "jedec,spi-nor", "spi-flash";
+ reg = <0>;
+ spi-max-frequency = <50000000>;
+ };
+ };
+
+ serial1: serial at 10c000 {
+ compatible = "ti,da830-uart", "ns16550a";
+ reg = <0x10c000 0x100>;
+ reg-io-width = <4>;
+ reg-shift = <2>;
+ interrupts = <53>;
+ };
+ };
+};
diff --git a/board/lego/ev3/README b/board/lego/ev3/README
index da62a649ba..9ad93e8205 100644
--- a/board/lego/ev3/README
+++ b/board/lego/ev3/README
@@ -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!
diff --git a/board/lego/ev3/legoev3.c b/board/lego/ev3/legoev3.c
index 423c2fa44b..fa099e95f5 100644
--- a/board/lego/ev3/legoev3.c
+++ b/board/lego/ev3/legoev3.c
@@ -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),
diff --git a/configs/legoev3_defconfig b/configs/legoev3_defconfig
index 32cd52c13e..78cca8eb56 100644
--- a/configs/legoev3_defconfig
+++ b/configs/legoev3_defconfig
@@ -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
diff --git a/include/configs/legoev3.h b/include/configs/legoev3.h
index 36ca3b201e..c97e6a0ebb 100644
--- a/include/configs/legoev3.h
+++ b/include/configs/legoev3.h
@@ -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)
/*
--
2.17.1
next reply other threads:[~2019-05-29 1:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-29 1:56 David Lechner [this message]
2019-07-14 13:07 ` [U-Boot] [PATCH] ARM: legoev3: convert to driver model Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190529015642.18393-1-david@lechnology.com \
--to=david@lechnology.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.