-From b66c70cd15fa02297b94d928970932ef62c2ff02 Mon Sep 17 00:00:00 2001
+From 83ee930c18b068c9a16b66c01aaa5d6e06570152 Mon Sep 17 00:00:00 2001
From: Michael Heimpold <mhei@heimpold.de>
-Date: Sun, 3 Nov 2019 00:50:21 +0100
+Date: Sun, 19 Apr 2020 02:46:46 +0200
Subject: [PATCH] arm: mxs: add support for I2SE's Duckbill boards
The Duckbill devices are small, pen-drive sized boards based on
---
arch/arm/mach-imx/mxs/Kconfig | 5 +
board/i2se/duckbill/Kconfig | 15 +++
- board/i2se/duckbill/MAINTAINERS | 6 ++
+ board/i2se/duckbill/MAINTAINERS | 6 +
board/i2se/duckbill/Makefile | 10 ++
- board/i2se/duckbill/duckbill.c | 186 ++++++++++++++++++++++++++++++++
- board/i2se/duckbill/iomux.c | 156 +++++++++++++++++++++++++++
- configs/duckbill_defconfig | 41 +++++++
- include/configs/duckbill.h | 176 ++++++++++++++++++++++++++++++
- 8 files changed, 595 insertions(+)
+ board/i2se/duckbill/duckbill.c | 189 ++++++++++++++++++++++++++++++++
+ board/i2se/duckbill/iomux.c | 157 ++++++++++++++++++++++++++
+ configs/duckbill_defconfig | 43 ++++++++
+ include/configs/duckbill.h | 172 +++++++++++++++++++++++++++++
+ 8 files changed, 597 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 include/configs/duckbill.h
diff --git a/arch/arm/mach-imx/mxs/Kconfig b/arch/arm/mach-imx/mxs/Kconfig
-index 68072d5a1f..82aaa3ef76 100644
+index b90d7b6e41..e7d8bc6792 100644
--- a/arch/arm/mach-imx/mxs/Kconfig
+++ b/arch/arm/mach-imx/mxs/Kconfig
@@ -50,6 +50,10 @@ config TARGET_APX4DEVKIT
config TARGET_MX28EVK
bool "Support mx28evk"
select BOARD_EARLY_INIT_F
-@@ -67,6 +71,7 @@ config SYS_SOC
+@@ -70,6 +74,7 @@ config SYS_SOC
source "board/bluegiga/apx4devkit/Kconfig"
source "board/freescale/mx28evk/Kconfig"
+source "board/i2se/duckbill/Kconfig"
+ source "board/liebherr/xea/Kconfig"
source "board/ppcag/bg0900/Kconfig"
source "board/schulercontrol/sc_sps_1/Kconfig"
- source "board/technologic/ts4600/Kconfig"
diff --git a/board/i2se/duckbill/Kconfig b/board/i2se/duckbill/Kconfig
new file mode 100644
index 0000000000..98c1e4689f
+F: configs/duckbill_defconfig
diff --git a/board/i2se/duckbill/Makefile b/board/i2se/duckbill/Makefile
new file mode 100644
-index 0000000000..0079eb413c
+index 0000000000..11bac98e4c
--- /dev/null
+++ b/board/i2se/duckbill/Makefile
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
-+# (C) Copyright 2014-2019
++# (C) Copyright 2014-2020
+# Michael Heimpold, mhei@heimpold.de.
+
+ifndef CONFIG_SPL_BUILD
+endif
diff --git a/board/i2se/duckbill/duckbill.c b/board/i2se/duckbill/duckbill.c
new file mode 100644
-index 0000000000..f93c372611
+index 0000000000..93defc6c28
--- /dev/null
+++ b/board/i2se/duckbill/duckbill.c
-@@ -0,0 +1,186 @@
+@@ -0,0 +1,189 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * I2SE Duckbill board
+ *
-+ * (C) Copyright 2014-2019 Michael Heimpold <mhei@heimpold.de>
++ * Copyright (C) 2014-2020 Michael Heimpold <mhei@heimpold.de>
+ */
+
+#include <common.h>
+ return 0;
+}
+
-+#ifdef CONFIG_CMD_MMC
++#ifdef CONFIG_CMD_MMC
+int board_mmc_init(bd_t *bis)
+{
+ return mxsmmc_initialize(bis, 0, NULL, NULL);
+}
+#endif
+
-+#ifdef CONFIG_CMD_NET
++#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ unsigned int reset_gpio;
+ reset_gpio = MX28_PAD_GPMI_ALE__GPIO_0_26;
+
+ /* Reset PHY */
++ gpio_request(reset_gpio, "enet0_phy_rst");
+ gpio_direction_output(reset_gpio, 0);
+ udelay(200);
+ gpio_set_value(reset_gpio, 1);
+ char *s;
+
+ /* Board revision detection */
++ gpio_request(MX28_PAD_LCD_D17__GPIO_1_17, "board_revision");
+ gpio_direction_input(MX28_PAD_LCD_D17__GPIO_1_17);
+
+ /* MX28_PAD_LCD_D17__GPIO_1_17: v1 = pull-down, v2 = pull-up */
+ led_red_gpio = MX28_PAD_AUART1_RX__GPIO_3_4;
+ else
+ led_red_gpio = MX28_PAD_SAIF0_LRCLK__GPIO_3_21;
++ gpio_request(led_red_gpio, "led_red");
+ gpio_direction_output(led_red_gpio, 1);
+
+ if (system_rev == 1)
+}
diff --git a/board/i2se/duckbill/iomux.c b/board/i2se/duckbill/iomux.c
new file mode 100644
-index 0000000000..1db3c52c34
+index 0000000000..c6cc211181
--- /dev/null
+++ b/board/i2se/duckbill/iomux.c
-@@ -0,0 +1,156 @@
+@@ -0,0 +1,157 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * I2SE Duckbill IOMUX setup
+ *
-+ * Copyright (C) 2013-2019 Michael Heimpold <mhei@heimpold.de>
++ * Copyright (C) 2013-2020 Michael Heimpold <mhei@heimpold.de>
+ */
+
+#include <common.h>
+{
+ mxs_common_spl_init(arg, resptr, iomux_setup, ARRAY_SIZE(iomux_setup));
+
++ gpio_request(MX28_PAD_LCD_D17__GPIO_1_17, "board_revision");
+ gpio_direction_input(MX28_PAD_LCD_D17__GPIO_1_17);
+
+ if (gpio_get_value(MX28_PAD_LCD_D17__GPIO_1_17))
+}
diff --git a/configs/duckbill_defconfig b/configs/duckbill_defconfig
new file mode 100644
-index 0000000000..fcdec4f3c7
+index 0000000000..b2d7fbcf77
--- /dev/null
+++ b/configs/duckbill_defconfig
-@@ -0,0 +1,41 @@
+@@ -0,0 +1,43 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MX28=y
+CONFIG_SYS_TEXT_BASE=0x40002000
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_DOS_PARTITION=y
+CONFIG_ENV_IS_IN_MMC=y
++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
++CONFIG_ENV_OFFSET_REDUND=0x40000
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_MXS_GPIO=y
+CONFIG_MMC_MXS=y
+CONFIG_OF_LIBFDT=y
diff --git a/include/configs/duckbill.h b/include/configs/duckbill.h
new file mode 100644
-index 0000000000..76da1008b8
+index 0000000000..565d8c58b7
--- /dev/null
+++ b/include/configs/duckbill.h
-@@ -0,0 +1,176 @@
+@@ -0,0 +1,172 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
-+ * Copyright (C) 2014-2019 Michael Heimpold <mhei@heimpold.de>
++ * Copyright (C) 2014-2020 Michael Heimpold <mhei@heimpold.de>
+ *
+ */
+#ifndef __CONFIGS_DUCKBILL_H__
+/* Environment is in MMC */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_SYS_MMC_ENV_DEV 0
-+#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
+
+/* FEC Ethernet on SoC */
+#ifdef CONFIG_CMD_NET
+ "else " \
+ "echo Firmware Update OK; " \
+ "fi; setenv error\0" \
-+ "erase_mmc=mmc erase 0 2\0" \
-+ "erase_env1=mmc erase 100 100\0" \
-+ "erase_env2=mmc erase 200 100\0" \
+ "image=zImage\0" \
+ "console=ttyAMA0\0" \
+ "fdt_addr=0x41000000\0" \
+ "mmcargs=setenv bootargs console=${console},${baudrate} " \
+ "root=${mmcroot} " \
+ "rootwait bootsys=${bootsys} panic=1 ${extraargs}\0" \
-+ "loadimage=ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${image}\0" \
-+ "loadfdt=ext4load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/${fdt_file}\0" \
++ "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} /boot/${image}\0" \
++ "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} /boot/${fdt_file}\0" \
+ "mmcboot=echo Booting from mmc ...; " \
+ "setexpr mmcpart 1 + ${bootsys}; " \
+ "setenv mmcroot /dev/mmcblk0p${mmcpart}; " \