[U-Boot] [PATCH v2 6/6] board: add stm3210e-eval board support

Matt Porter
2015-04-21T17:36:58Z

Add support for the STM32F1-based stm3210e-eval boards
from ST. UART, Flash, GPIO, and LEDs are supported.

Signed-off-by: Matt Porter <mporter@konsulko.com>
---
arch/arm/Kconfig | 5 ++
board/st/stm3210e-eval/Kconfig | 19 ++++++
board/st/stm3210e-eval/MAINTAINERS | 5 ++
board/st/stm3210e-eval/Makefile | 13 ++++
board/st/stm3210e-eval/stm3210e-eval.c | 85 ++++++++++++++++++++++++
configs/stm3210e-eval_defconfig | 3 +
include/configs/stm3210e-eval.h | 117 +++++++++++++++++++++++++++++++++
7 files changed, 247 insertions(+)
create mode 100644 board/st/stm3210e-eval/Kconfig
create mode 100644 board/st/stm3210e-eval/MAINTAINERS
create mode 100644 board/st/stm3210e-eval/Makefile
create mode 100644 board/st/stm3210e-eval/stm3210e-eval.c
create mode 100644 configs/stm3210e-eval_defconfig
create mode 100644 include/configs/stm3210e-eval.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4eb047c..bcf4e46 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -731,6 +731,10 @@ config ARCH_UNIPHIER
select SPL
select OF_CONTROL

+config TARGET_STM3210E_EVAL
+ bool "Support STM3210E-EVAL board"
+ select CPU_V7M
+
config TARGET_STM32F429_DISCOVERY
bool "Support STM32F429 Discovery"
select CPU_V7M
@@ -872,6 +876,7 @@ source "board/spear/spear600/Kconfig"
source "board/spear/x600/Kconfig"
source "board/st-ericsson/snowball/Kconfig"
source "board/st-ericsson/u8500/Kconfig"
+source "board/st/stm3210e-eval/Kconfig"
source "board/st/stm32f429-discovery/Kconfig"
source "board/st/stv0991/Kconfig"
source "board/sunxi/Kconfig"
diff --git a/board/st/stm3210e-eval/Kconfig b/board/st/stm3210e-eval/Kconfig
new file mode 100644
index 0000000..49bc770
--- /dev/null
+++ b/board/st/stm3210e-eval/Kconfig
@@ -0,0 +1,19 @@
+if TARGET_STM3210E_EVAL
+
+config SYS_BOARD
+ string
+ default "stm3210e-eval"
+
+config SYS_VENDOR
+ string
+ default "st"
+
+config SYS_SOC
+ string
+ default "stm32f1"
+
+config SYS_CONFIG_NAME
+ string
+ default "stm3210e-eval"
+
+endif
diff --git a/board/st/stm3210e-eval/MAINTAINERS b/board/st/stm3210e-eval/MAINTAINERS
new file mode 100644
index 0000000..0f9f31b
--- /dev/null
+++ b/board/st/stm3210e-eval/MAINTAINERS
@@ -0,0 +1,5 @@
+M: Matt Porter <mporter@konsulko.com>
+S: Maintained
+F: board/st/stm3210e-eval/
+F: include/configs/stm3210e-eval.h
+F: configs/stm3210e-eval_defconfig
diff --git a/board/st/stm3210e-eval/Makefile b/board/st/stm3210e-eval/Makefile
new file mode 100644
index 0000000..b018e08
--- /dev/null
+++ b/board/st/stm3210e-eval/Makefile
@@ -0,0 +1,13 @@
+#
+# (C) Copyright 2000-2004
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2015
+# Kamil Lulko, <rev13@wp.pl>
+#
+# Copyright 2015 Konsulko Group, Matt Porter <mporter@konsulko.com>
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y := stm3210e-eval.o
diff --git a/board/st/stm3210e-eval/stm3210e-eval.c b/board/st/stm3210e-eval/stm3210e-eval.c
new file mode 100644
index 0000000..a801983
--- /dev/null
+++ b/board/st/stm3210e-eval/stm3210e-eval.c
@@ -0,0 +1,85 @@
+/*
+ * (C) Copyright 2011, 2012, 2013
+ * Yuri Tikhonov, Emcraft Systems, yur at emcraft.com
+ * Alexander Potashev, Emcraft Systems, aspotashev at emcraft.com
+ * Vladimir Khusainov, Emcraft Systems, vlad at emcraft.com
+ * Pavel Boldin, Emcraft Systems, paboldin at emcraft.com
+ *
+ * (C) Copyright 2015
+ * Kamil Lulko, <rev13@wp.pl>
+ *
+ * Copyright 2015 Konsulko Group, Matt Porter <mporter@konsulko.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/armv7m.h>
+#include <asm/arch/stm32.h>
+#include <asm/arch/gpio.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+const struct stm32_gpio_ctl gpio_ctl_usart[] = {
+ /* TX */
+ {
+ .mode = STM32_GPIO_MODE_OUT_50M,
+ .ocnf = STM32_GPIO_OCNF_AF_PP,
+ },
+ /* RX */
+ {
+ .mode = STM32_GPIO_MODE_IN,
+ .icnf = STM32_GPIO_ICNF_IN_FLT,
+ }
+};
+
+static const struct stm32_gpio_dsc usart1_gpio[] = {
+ {STM32_GPIO_PORT_A, STM32_GPIO_PIN_9}, /* TX */
+ {STM32_GPIO_PORT_A, STM32_GPIO_PIN_10}, /* RX */
+};
+
+int uart2_setup_gpio(void)
+{
+ int i;
+ int rv = 0;
+
+ for (i = 0; i < ARRAY_SIZE(usart1_gpio); i++) {
+ rv = stm32_gpio_config(&usart1_gpio[i], &gpio_ctl_usart[i]);
+ if (rv)
+ goto out;
+ }
+
+out:
+ return rv;
+}
+
+int dram_init(void)
+{
+ gd->ram_size = CONFIG_SYS_RAM_SIZE;
+
+ return 0;
+}
+
+u32 get_board_rev(void)
+{
+ return 0;
+}
+
+int board_early_init_f(void)
+{
+ int res;
+
+ res = uart2_setup_gpio();
+ if (res)
+ return res;
+
+ return 0;
+}
+
+int board_init(void)
+{
+ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+ return 0;
+}
diff --git a/configs/stm3210e-eval_defconfig b/configs/stm3210e-eval_defconfig
new file mode 100644
index 0000000..ac3cad3
--- /dev/null
+++ b/configs/stm3210e-eval_defconfig
@@ -0,0 +1,3 @@
+CONFIG_ARM=y
+CONFIG_TARGET_STM3210E_EVAL=y
+CONFIG_CMD_BOOTM=n
diff --git a/include/configs/stm3210e-eval.h b/include/configs/stm3210e-eval.h
new file mode 100644
index 0000000..295c472
--- /dev/null
+++ b/include/configs/stm3210e-eval.h
@@ -0,0 +1,117 @@
+/*
+ * (C) Copyright 2015
+ * Kamil Lulko, <rev13@wp.pl>
+ *
+ * Copyright 2015 Konsulko Group, Matt Porter <mporter@konsulko.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_STM32F1
+#define CONFIG_STM3210E_EVAL
+#define CONFIG_SYS_GENERIC_BOARD
+
+#define CONFIG_BOARD_EARLY_INIT_F
+
+#define CONFIG_SYS_MAX_FLASH_BANKS 2
+#define CONFIG_SYS_MAX_FLASH_SECT 256
+#define CONFIG_SYS_FLASH_BASE 0x08000000
+
+#define CONFIG_SYS_INIT_SP_ADDR 0x20010000
+#define CONFIG_SYS_TEXT_BASE 0x08000000
+
+#define CONFIG_SYS_ICACHE_OFF
+#define CONFIG_SYS_DCACHE_OFF
+
+#define CONFIG_SYS_RAM_SIZE 0x00018000
+#define CONFIG_SYS_SDRAM_BASE 0x20000000
+#define CONFIG_SYS_LOAD_ADDR 0x20000000
+#define CONFIG_LOADADDR 0x20000000
+
+#define CONFIG_ENV_IS_IN_FLASH
+#define CONFIG_ENV_OFFSET (64 << 10)
+#define CONFIG_ENV_SECT_SIZE (2 << 10)
+#define CONFIG_ENV_SIZE (2 << 10)
+#define CONFIG_ENV_MAX_ENTRIES 32
+
+#define CONFIG_GPIO_LED
+#define CONFIG_STATUS_LED
+#define CONFIG_BOARD_SPECIFIC_LED
+#define STATUS_LED_BOOT 0
+#define STATUS_LED_BIT 86 /* LD1 - Green */
+#define STATUS_LED_STATE STATUS_LED_OFF
+#define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 10)
+#define STATUS_LED_BIT1 87 /* LD2 - Orange */
+#define STATUS_LED_STATE1 STATUS_LED_OFF
+#define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ / 10)
+#define STATUS_LED_BIT2 88 /* LD3 - Red */
+#define STATUS_LED_STATE2 STATUS_LED_OFF
+#define STATUS_LED_PERIOD2 (CONFIG_SYS_HZ / 10)
+#define STATUS_LED_BIT3 89 /* LD4 - Blue */
+#define STATUS_LED_STATE3 STATUS_LED_OFF
+#define STATUS_LED_PERIOD3 (CONFIG_SYS_HZ / 10)
+
+#define CONFIG_STM32_GPIO
+#define CONFIG_STM32_SERIAL
+#define CONFIG_STM32_USART1
+
+#define CONFIG_STM32_HSE_HZ 8000000
+
+#define CONFIG_SYS_HZ_CLOCK 1000000 /* Timer is clocked@1MHz */
+
+#define CONFIG_SYS_CBSIZE 256
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE \
+ + sizeof(CONFIG_SYS_PROMPT) + 16)
+
+#define CONFIG_SYS_MAXARGS 16
+
+#define CONFIG_SYS_MALLOC_LEN (2048)
+
+#define CONFIG_STACKSIZE (2048)
+
+#define CONFIG_BAUDRATE 115200
+
+#define CONFIG_SYS_BARGSIZE 64
+
+#define CONFIG_BOOTDELAY 3
+#define CONFIG_AUTOBOOT
+
+/*
+ * Command line configuration.
+ */
+#define CONFIG_SYS_LONGHELP
+#undef CONFIG_CMD_BDI /* bdinfo */
+#undef CONFIG_CMD_BOOTD /* bootd */
+#define CONFIG_CMD_ECHO /* echo arguments */
+#define CONFIG_CMD_LOADB /* loadb */
+#define CONFIG_CMD_MEMORY /* md mm nm mw cp cmp crc base loop */
+#undef CONFIG_CMD_MISC /* Misc functions like sleep etc*/
+#undef CONFIG_CMD_RUN /* run command in env variable */
+#define CONFIG_CMD_SAVEENV /* saveenv */
+#define CONFIG_CRC32
+
+#undef CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT "STM3210E-EVAL> "
+#undef CONFIG_AUTO_COMPLETE
+#undef CONFIG_CMDLINE_EDITING
+
+#define CONFIG_CMD_FLASH
+#undef CONFIG_CMD_MISC
+#undef CONFIG_CMD_TIMER
+#define CONFIG_CMD_LED
+
+#undef CONFIG_BOOTM_LINUX
+#undef CONFIG_BOOTM_NETBSD
+#undef CONFIG_BOOTM_PLAN9
+#undef CONFIG_BOOTM_RTEMS
+#undef CONFIG_BOOTM_VXWORKS
+
+#undef CONFIG_GZIP
+#undef CONFIG_ZLIB
+#undef CONFIG_PARTITIONS
+
+
+#endif /* __CONFIG_H */
--
2.1.0