-From 25de6430219d3f3698d709c10358fbea17b24cf1 Mon Sep 17 00:00:00 2001
+From 7b919a74c562ca33ae28c9214f225a79b57209e4 Mon Sep 17 00:00:00 2001
From: Michael Heimpold <mhei@heimpold.de>
-Date: Fri, 21 Apr 2017 11:08:19 +0200
+Date: Thu, 13 Sep 2018 21:40:19 +0200
Subject: [PATCH] arm: mxs: add support for I2SE's Duckbill boards
The Duckbill devices are small, pen-drive sized boards based on
equipped with a micro SD card slot only, the latest generation
(Duckbill 2 series) have an additional internal eMMC onboard.
-Both device generations consists of four "family members":
+Both device generations consist of four "family members":
- Duckbill/Duckbill 2: generic board, intended to be used as
baseboard for custom designs and/or as development board
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
- arch/arm/Kconfig | 9 +-
+ arch/arm/mach-imx/mxs/Kconfig | 5 +
board/i2se/duckbill/Kconfig | 15 +++
board/i2se/duckbill/MAINTAINERS | 6 ++
- board/i2se/duckbill/Makefile | 12 +++
- board/i2se/duckbill/duckbill.c | 181 ++++++++++++++++++++++++++++++++++++
- board/i2se/duckbill/iomux.c | 157 +++++++++++++++++++++++++++++++
- configs/duckbill_defconfig | 31 +++++++
- include/configs/duckbill.h | 199 ++++++++++++++++++++++++++++++++++++++++
- 8 files changed, 609 insertions(+), 1 deletion(-)
+ board/i2se/duckbill/Makefile | 10 ++
+ board/i2se/duckbill/duckbill.c | 186 ++++++++++++++++++++++++++++++++
+ board/i2se/duckbill/iomux.c | 156 +++++++++++++++++++++++++++
+ configs/duckbill_defconfig | 38 +++++++
+ include/configs/duckbill.h | 179 ++++++++++++++++++++++++++++++
+ 8 files changed, 595 insertions(+)
create mode 100644 board/i2se/duckbill/Kconfig
create mode 100644 board/i2se/duckbill/MAINTAINERS
create mode 100644 board/i2se/duckbill/Makefile
create mode 100644 configs/duckbill_defconfig
create mode 100644 include/configs/duckbill.h
---- a/arch/arm/Kconfig
-+++ b/arch/arm/Kconfig
-@@ -373,6 +373,12 @@ config TARGET_MX28EVK
- select SUPPORT_SPL
- select BOARD_EARLY_INIT_F
+--- a/arch/arm/mach-imx/mxs/Kconfig
++++ b/arch/arm/mach-imx/mxs/Kconfig
+@@ -50,6 +50,10 @@ config TARGET_APX4DEVKIT
+ config TARGET_BG0900
+ bool "Support bg0900"
+config TARGET_DUCKBILL
+ bool "Support duckbill"
-+ select CPU_ARM926EJS
-+ select SUPPORT_SPL
+ select BOARD_EARLY_INIT_F
+
- config TARGET_MX23_OLINUXINO
- bool "Support mx23_olinuxino"
- select CPU_ARM926EJS
-@@ -1250,6 +1256,7 @@ source "board/gumstix/pepper/Kconfig"
- source "board/h2200/Kconfig"
- source "board/hisilicon/hikey/Kconfig"
- source "board/hisilicon/poplar/Kconfig"
-+source "board/i2se/duckbill/Kconfig"
- source "board/imx31_phycore/Kconfig"
- source "board/isee/igep003x/Kconfig"
- source "board/olimex/mx23_olinuxino/Kconfig"
-@@ -1279,7 +1286,7 @@ source "arch/arm/Kconfig.debug"
- endmenu
-
- config SPL_LDSCRIPT
-- default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if TARGET_APX4DEVKIT || TARGET_BG0900 || TARGET_M28EVK || TARGET_MX23_OLINUXINO || TARGET_MX23EVK || TARGET_MX28EVK || TARGET_SANSA_FUZE_PLUS || TARGET_SC_SPS_1 || TARGET_TS4600 || TARGET_XFI3
-+ default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if TARGET_APX4DEVKIT || TARGET_BG0900 || TARGET_M28EVK || TARGET_MX23_OLINUXINO || TARGET_MX23EVK || TARGET_MX28EVK || TARGET_DUCKBILL || TARGET_SANSA_FUZE_PLUS || TARGET_SC_SPS_1 || TARGET_TS4600 || TARGET_XFI3
- default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136
- default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64
+ config TARGET_MX28EVK
+ bool "Support mx28evk"
+ select BOARD_EARLY_INIT_F
+@@ -67,6 +71,7 @@ config SYS_SOC
+ source "board/bluegiga/apx4devkit/Kconfig"
+ source "board/freescale/mx28evk/Kconfig"
++source "board/i2se/duckbill/Kconfig"
+ source "board/ppcag/bg0900/Kconfig"
+ source "board/schulercontrol/sc_sps_1/Kconfig"
+ source "board/technologic/ts4600/Kconfig"
--- /dev/null
+++ b/board/i2se/duckbill/Kconfig
@@ -0,0 +1,15 @@
+F: configs/duckbill_defconfig
--- /dev/null
+++ b/board/i2se/duckbill/Makefile
-@@ -0,0 +1,12 @@
+@@ -0,0 +1,10 @@
++# SPDX-License-Identifier: GPL-2.0+
+#
-+# (C) Copyright 2014-2017
++# (C) Copyright 2014-2018
+# Michael Heimpold, mhei@heimpold.de.
-+#
-+# SPDX-License-Identifier: GPL-2.0+
-+#
+
+ifndef CONFIG_SPL_BUILD
+obj-y := duckbill.o
+endif
--- /dev/null
+++ b/board/i2se/duckbill/duckbill.c
-@@ -0,0 +1,181 @@
+@@ -0,0 +1,186 @@
++// SPDX-License-Identifier: GPL-2.0+
+/*
+ * I2SE Duckbill board
+ *
-+ * (C) Copyright 2014-2017 Michael Heimpold <mhei@heimpold.de>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0+
++ * (C) Copyright 2014-2018 Michael Heimpold <mhei@heimpold.de>
+ */
+
+#include <common.h>
+ /* give PHY some time to get out of the reset */
+ udelay(10000);
+
-+ ret = fecmxc_initialize(bis);
++ ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE);
+ if (ret) {
+ puts("FEC MXS: Unable to init FEC\n");
+ return ret;
+ uint8_t enetaddr[6];
+ u32 mac = 0;
+
-+ enetaddr[0] = 0x00;
-+ enetaddr[1] = 0x01;
-+ enetaddr[2] = 0x87;
-+
+#ifdef CONFIG_MXS_OCOTP
+ /* only Duckbill SPI has a MAC for the QCA7k */
+ fuse_read(0, 1, &mac);
+#endif
+
+ if (mac != 0) {
++ enetaddr[0] = 0x00;
++ enetaddr[1] = 0x01;
++ enetaddr[2] = 0x87;
+ enetaddr[3] = (mac >> 16) & 0xff;
+ enetaddr[4] = (mac >> 8) & 0xff;
+ enetaddr[5] = mac & 0xff;
+
-+ fdt_find_and_setprop(blob,
-+ "/apb@80000000/apbh@80000000/ssp@80014000/ethernet@0",
++ fdt_find_and_setprop(blob, "spi1/ethernet@0",
+ "local-mac-address", enetaddr, 6, 1);
+ }
+
+ gpio_get_value(MX28_PAD_LCD_D17__GPIO_1_17);
+ system_rev += 1;
+
++ /* guess DT blob if not set in environment */
++ if (!env_get("fdt_file")) {
++ if (system_rev == 1)
++ env_set("fdt_file", "imx28-duckbill.dtb");
++ else
++ env_set("fdt_file", "imx28-duckbill-2.dtb");
++ }
++
+ /* enable red LED to indicate a running bootloader */
+ if (system_rev == 1)
+ led_red_gpio = MX28_PAD_AUART1_RX__GPIO_3_4;
+}
--- /dev/null
+++ b/board/i2se/duckbill/iomux.c
-@@ -0,0 +1,157 @@
+@@ -0,0 +1,156 @@
++// SPDX-License-Identifier: GPL-2.0+
+/*
+ * I2SE Duckbill IOMUX setup
+ *
-+ * Copyright (C) 2013-2017 Michael Heimpold <mhei@heimpold.de>
-+ *
-+ * SPDX-License-Identifier: GPL-2.0+
++ * Copyright (C) 2013-2018 Michael Heimpold <mhei@heimpold.de>
+ */
+
+#include <common.h>
+}
--- /dev/null
+++ b/configs/duckbill_defconfig
-@@ -0,0 +1,31 @@
+@@ -0,0 +1,38 @@
+CONFIG_ARM=y
-+CONFIG_TARGET_DUCKBILL=y
++CONFIG_ARCH_MX28=y
++CONFIG_SYS_TEXT_BASE=0x40002000
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
++CONFIG_TARGET_DUCKBILL=y
+CONFIG_SPL_SERIAL_SUPPORT=y
++CONFIG_SPL=y
++CONFIG_NR_DRAM_BANKS=1
+CONFIG_BOOTDELAY=1
-+# CONFIG_CONSOLE_MUX is not set
+CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_VERSION_VARIABLE=y
+# CONFIG_DISPLAY_BOARDINFO is not set
-+# CONFIG_EFI_LOADER is not set
+CONFIG_ARCH_MISC_INIT=y
-+CONFIG_SPL=y
++# CONFIG_SPL_FRAMEWORK is not set
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_BOOTZ=y
-+# CONFIG_CMD_IMLS is not set
++# CONFIG_CMD_ELF is not set
++CONFIG_CMD_UNZIP=y
+# CONFIG_CMD_FLASH is not set
-+CONFIG_CMD_MMC=y
++CONFIG_CMD_FUSE=y
+CONFIG_CMD_GPIO=y
++CONFIG_CMD_MMC=y
++CONFIG_CMD_MMC_SWRITE=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
-+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
-+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
++CONFIG_DOS_PARTITION=y
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_MMC_MXS=y
++CONFIG_MII=y
++CONFIG_CONS_INDEX=0
+CONFIG_OF_LIBFDT=y
++# CONFIG_EFI_LOADER is not set
--- /dev/null
+++ b/include/configs/duckbill.h
-@@ -0,0 +1,199 @@
+@@ -0,0 +1,179 @@
++/* SPDX-License-Identifier: GPL-2.0+ */
+/*
-+ * Copyright (C) 2014-2015 Michael Heimpold <mhei@heimpold.de>
++ * Copyright (C) 2014-2018 Michael Heimpold <mhei@heimpold.de>
+ *
-+ * SPDX-License-Identifier: GPL-2.0+
+ */
+#ifndef __CONFIGS_DUCKBILL_H__
+#define __CONFIGS_DUCKBILL_H__
+
+/* System configurations */
-+#define CONFIG_MX28 /* i.MX28 SoC */
+#define CONFIG_MACH_TYPE MACH_TYPE_DUCKBILL
+
+#define CONFIG_MISC_INIT_R
+
+#define CONFIG_SYS_MXS_VDD5V_ONLY
+
-+/* U-Boot Commands */
-+#define CONFIG_CMD_FUSE
-+#define CONFIG_CMD_UNZIP
-+
+/* Memory configuration */
-+#define CONFIG_NR_DRAM_BANKS 1 /* 1 bank of DRAM */
+#define PHYS_SDRAM_1 0x40000000 /* Base address */
+#define PHYS_SDRAM_1_SIZE 0x40000000 /* Max 1 GB RAM */
+#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
+
+/* FEC Ethernet on SoC */
-+#ifdef CONFIG_CMD_NET
++#ifdef CONFIG_CMD_NET
+#define CONFIG_FEC_MXC
-+#define CONFIG_NET_MULTI
+#define CONFIG_MX28_FEC_MAC_IN_OCOTP
-+#define CONFIG_FEC_MXC_PHYADDR 1
-+#define IMX_FEC_BASE MXS_ENET0_BASE
++#define CONFIG_FEC_MXC_MDIO_BASE MXS_ENET0_BASE
+#endif
+
+#define CONFIG_IPADDR 192.168.1.10
+#define CONFIG_NETMASK 255.255.255.0
+#define CONFIG_GATEWAYIP 192.168.1.254
+
-+/* BOOTP options */
-+#define CONFIG_BOOTP_SUBNETMASK
-+#define CONFIG_BOOTP_GATEWAY
-+#define CONFIG_BOOTP_HOSTNAME
-+
-+/* SPI */
-+#ifdef CONFIG_CMD_SPI
-+#define CONFIG_DEFAULT_SPI_BUS 2
-+#define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0
-+#endif
-+
+/* Boot Linux */
+#define CONFIG_BOOTDELAY 1
+#define CONFIG_BOOTFILE "zImage"
+ "setexpr i ${update_fw_parts}; setexpr error 0; " \
+ "while itest ${i} -gt 0; do " \
+ "echo Transfering firmware image part ${i} of ${update_fw_parts}; " \
-+ "if itest ${i} -le 9; then " \
++ "if itest ${i} -le f; then " \
+ "setenv j 0${i}; " \
+ "else " \
+ "setenv j ${i}; " \
+ "erase_env2=mmc erase 200 100\0" \
+ "image=zImage\0" \
+ "console=ttyAMA0\0" \
-+ "fdt_file=imx28-duckbill-2.dtb\0" \
+ "fdt_addr=0x41000000\0" \
+ "boot_fdt=try\0" \
+ "ip_dyn=yes\0" \