[U-Boot] [PATCH 9/9] ARM: Exynos: Add Exynos5433 based TM2 board support

Marek Szyprowski m.szyprowski at samsung.com
Wed Nov 7 15:05:14 UTC 2018


This patch adds support for Exynos5433 based TM2 and TM2e boards.

u-boot is used to load and decompress kernel image or alternatively
(when 'volume down' button is pressed during boot) provide THOR download
USB feature for flashing kernel and rootfs images.

Based on earlier work done by Lukasz Majewski <l.majewski at samsung.com>.

Signed-off-by: Marek Szyprowski <m.szyprowski at samsung.com>
---
 arch/arm/dts/Makefile           |   3 +
 arch/arm/dts/exynos5433-tm2.dts |  37 ++++++++++
 arch/arm/mach-exynos/Kconfig    |  14 ++++
 board/samsung/tm2/Kconfig       |  14 ++++
 board/samsung/tm2/Makefile      |   8 ++
 board/samsung/tm2/tm2.c         | 127 ++++++++++++++++++++++++++++++++
 configs/tm2_defconfig           |  52 +++++++++++++
 include/configs/tm2.h           |  60 +++++++++++++++
 8 files changed, 315 insertions(+)
 create mode 100644 arch/arm/dts/exynos5433-tm2.dts
 create mode 100644 board/samsung/tm2/Kconfig
 create mode 100644 board/samsung/tm2/Makefile
 create mode 100644 board/samsung/tm2/tm2.c
 create mode 100644 configs/tm2_defconfig
 create mode 100644 include/configs/tm2.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index d36447d18d..f8c671589a 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -25,6 +25,9 @@ dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \
 	exynos5800-peach-pi.dtb \
 	exynos5422-odroidxu3.dtb
 dtb-$(CONFIG_EXYNOS7420) += exynos7420-espresso7420.dtb
+
+dtb-$(CONFIG_TARGET_TM2) += exynos5433-tm2.dtb
+
 dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rk3036-sdk.dtb \
 	rk3128-evb.dtb \
diff --git a/arch/arm/dts/exynos5433-tm2.dts b/arch/arm/dts/exynos5433-tm2.dts
new file mode 100644
index 0000000000..c9b178efdc
--- /dev/null
+++ b/arch/arm/dts/exynos5433-tm2.dts
@@ -0,0 +1,37 @@
+/*
+ * TM2 device tree source
+ *
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+/dts-v1/;
+#include "exynos5433.dtsi"
+
+/ {
+	model = "TM2 based on EXYNOS5433";
+	compatible = "samsung,tm2", "samsung,exynos5433";
+
+	aliases {
+		serial0 = &serial_1;
+		console = &serial_1;
+		i2c0 = &i2c;
+	};
+
+	i2c: i2c {
+		compatible = "i2c-gpio";
+		gpios = <&gpb0 0 0>,	/* sda */
+			<&gpb0 1 0>;	/* scl */
+		i2c-gpio,delay-us = <2>;        /* ~100 kHz */
+	};
+};
+
+&mmc_0 {
+	status = "okay";
+};
+
+&serial_1 {
+	status = "okay";
+};
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 4a49c8dcc2..cf3bed57f3 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -137,6 +137,19 @@ config TARGET_PEACH_PIT
 endchoice
 endif
 
+if ARCH_EXYNOS5433
+
+choice
+	prompt "EXYNOS5433 board select"
+
+config  TARGET_TM2
+	bool "TM2 board"
+	select ARM64
+	select OF_CONTROL
+
+endchoice
+endif
+
 if ARCH_EXYNOS7
 
 choice
@@ -168,6 +181,7 @@ source "board/samsung/odroid/Kconfig"
 source "board/samsung/arndale/Kconfig"
 source "board/samsung/smdk5250/Kconfig"
 source "board/samsung/smdk5420/Kconfig"
+source "board/samsung/tm2/Kconfig"
 source "board/samsung/espresso7420/Kconfig"
 
 config SPL_LDSCRIPT
diff --git a/board/samsung/tm2/Kconfig b/board/samsung/tm2/Kconfig
new file mode 100644
index 0000000000..745faf6a95
--- /dev/null
+++ b/board/samsung/tm2/Kconfig
@@ -0,0 +1,14 @@
+if TARGET_TM2
+
+config SYS_BOARD
+	default "tm2"
+	help
+	  TM2 is Exynos5433 SoC based board, Tizen reference board.
+
+config SYS_VENDOR
+	default "samsung"
+
+config SYS_CONFIG_NAME
+	default "tm2"
+
+endif
diff --git a/board/samsung/tm2/Makefile b/board/samsung/tm2/Makefile
new file mode 100644
index 0000000000..53621774dd
--- /dev/null
+++ b/board/samsung/tm2/Makefile
@@ -0,0 +1,8 @@
+#
+# Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+# Lukasz Majewski <l.majewski at samsung.com>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	:= tm2.o
diff --git a/board/samsung/tm2/tm2.c b/board/samsung/tm2/tm2.c
new file mode 100644
index 0000000000..31ec8f5641
--- /dev/null
+++ b/board/samsung/tm2/tm2.c
@@ -0,0 +1,127 @@
+/*
+ * (C) Copyright 2018 Samsung
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <malloc.h>
+#include <dwc3-uboot.h>
+#include <asm/armv8/mmu.h>
+#include <asm/arch/dwmmc.h>
+#include <usb.h>
+#include <dwc3-uboot.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/power.h>
+#include <asm/gpio.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_init(void)
+{
+	/* start Multi Core Timer to get ARM Architected Timers working */
+	writel(1 << 8, 0x101c0240);
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->ram_size = PHYS_SDRAM_1_SIZE;
+	return 0;
+}
+
+int dram_init_banksize(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+	return 0;
+}
+
+unsigned long get_uart_clk(int id)
+{
+	return 200000000;
+}
+
+unsigned long get_mmc_clk(int id)
+{
+	return 100000000;
+}
+
+unsigned long set_mmc_clk(int id, int div)
+{
+	return 0;
+}
+
+unsigned long get_i2c_clk(int id)
+{
+	return 66666667;
+}
+
+#ifdef CONFIG_USB_DWC3
+static struct dwc3_device dwc3_device_data = {
+	.maximum_speed = USB_SPEED_SUPER,
+	.base = 0x15400000,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 0,
+};
+
+int usb_gadget_handle_interrupts(void)
+{
+	dwc3_uboot_handle_interrupt(0);
+	return 0;
+}
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+	void *base = (void *)0x15500000; /* Exynos5433 DRD PHY */
+
+	/* CMU TOP: set SCLK_USBDRD30_RATIO divider to 1 */
+	writel(0x0007770b, (void *)0x10030634);
+
+	/* CMU FSYS: set PHYCLK_USBDRD30_UDRD30_PHYCLOCK and
+	   PHYCLK_USBDRD30_UDRD30_PIPE_PCLK muxes to 1 */
+	writel(0x00000011, (void *)0x156e0208);
+
+	/* CMU FSYS: enable MUX_SCLK_USBDRD30_USER gate and
+	   keep other gates enabled */
+	writel(0x01101001, (void *)0x156e0204);
+
+	/* CMU: TOP: set MUX_SCLK_USBDRD30 mux source to pll */
+	writel(0x00000101, (void *)0x10030234);
+
+	/* PMU: bypass USB DEV PHY isolation */
+	writel(0x00000001, (void *)0x105c0704);
+
+	/* copied from Linux kernel register dump */
+	writel(0x0, base + 0x14);
+	writel(0x0, base + 0x34);
+	writel(0x8000040, base + 0x4);
+	writel(0x24d466e4, base + 0x1c);
+	writel(0x4, base + 0x30);
+	writel(0x24d466e4, base + 0x1c);
+	writel(0x3fff81c, base + 0x20);
+	writel(0x40, base + 0x8);
+	writel(0x0, base + 0x28);
+	writel(0xc41805bf, base + 0x10);
+	udelay(10);
+	writel(0xc41805bd, base + 0x10);
+	writel(0x3fff81c, base + 0x20);
+	writel(0x0, base + 0x28);
+	writel(0xc41b40bf, base + 0x10);
+	udelay(10);
+	writel(0xc41b40bd, base + 0x10);
+
+	return dwc3_uboot_init(&dwc3_device_data);
+}
+#endif
+
+int checkboard(void)
+{
+	const char *board_info;
+
+	board_info = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
+	printf("Board: %s\n", board_info ? board_info : "unknown");
+
+	return 0;
+}
diff --git a/configs/tm2_defconfig b/configs/tm2_defconfig
new file mode 100644
index 0000000000..4080366c97
--- /dev/null
+++ b/configs/tm2_defconfig
@@ -0,0 +1,52 @@
+CONFIG_ARM=y
+# CONFIG_ARM64_SUPPORT_AARCH32 is not set
+CONFIG_ARCH_EXYNOS=y
+CONFIG_SYS_TEXT_BASE=0x20080000
+CONFIG_ARCH_EXYNOS5433=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_IDENT_STRING="\nSamsung Exynos5433 TM2"
+CONFIG_FIT=y
+CONFIG_BOOTDELAY=-2
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_HUSH_PARSER=y
+# CONFIG_CMD_CONSOLE is not set
+# CONFIG_CMD_ELF is not set
+# CONFIG_CMD_GO is not set
+CONFIG_CMD_THOR_DOWNLOAD=y
+# CONFIG_CMD_EXPORTENV is not set
+# CONFIG_CMD_IMPORTENV is not set
+# CONFIG_CMD_EDITENV is not set
+# CONFIG_CMD_SAVEENV is not set
+# CONFIG_CMD_ENV_EXISTS is not set
+# CONFIG_CMD_DM is not set
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+# CONFIG_RANDOM_UUID is not set
+CONFIG_CMD_I2C=y
+# CONFIG_CMD_LOADB is not set
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+# CONFIG_CMD_SOURCE is not set
+# CONFIG_CMD_SETEXPR is not set
+# CONFIG_CMD_NET is not set
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_DEFAULT_DEVICE_TREE="exynos5433-tm2"
+# CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_DFU_MMC=y
+CONFIG_DM_I2C_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_DW=y
+CONFIG_USB=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GADGET=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x04e8
+CONFIG_USB_GADGET_PRODUCT_NUM=0x685D
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_FUNCTION_MASS_STORAGE=y
+CONFIG_USB_FUNCTION_THOR=y
+# CONFIG_SYS_WHITE_ON_BLACK is not set
+# CONFIG_EFI_LOADER is not set
diff --git a/include/configs/tm2.h b/include/configs/tm2.h
new file mode 100644
index 0000000000..ce656b494a
--- /dev/null
+++ b/include/configs/tm2.h
@@ -0,0 +1,60 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2018 Samsung Electronics
+ * Marek Szyprowski <m.szyprowski at samsung.com>
+ *
+ * Configuation settings for the Exynos5433 TM2 board.
+ */
+
+#ifndef __SAMSUNG_TM2_H
+#define __SAMSUNG_TM2_H
+
+#include <asm/arch/cpu.h>
+#include <linux/sizes.h>
+
+/* High Level Configuration Options */
+#define CONFIG_SAMSUNG			/* in a SAMSUNG core */
+#define CONFIG_EXYNOS5433		/* Exynos5433 Family */
+#define CONFIG_S5P
+
+/* Timer input clock frequency */
+#define COUNTER_FREQUENCY		24000000
+
+/* SD/MMC configuration */
+#define CONFIG_BOUNCE_BUFFER
+
+/* THOR */
+#define CONFIG_G_DNL_THOR_VENDOR_NUM	CONFIG_USB_GADGET_VENDOR_NUM
+#define CONFIG_G_DNL_THOR_PRODUCT_NUM	0x685D
+
+/* required to avoid build break */
+#define CONFIG_G_DNL_UMS_VENDOR_NUM	CONFIG_USB_GADGET_VENDOR_NUM
+#define CONFIG_G_DNL_UMS_PRODUCT_NUM	0xA4A5
+
+#define PHYS_SDRAM_1			0x20000000
+#define PHYS_SDRAM_1_SIZE		0xbf700000
+
+#define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
+#define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_SDRAM_BASE + 0x7fff0)
+#define CONFIG_SYS_LOAD_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x80000)
+
+/* Size of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN		(80 << 20)
+#define CONFIG_SYS_BOOTM_LEN		(130 << 20)
+
+/* Initial environment variables */
+#define CONFIG_BOOTCOMMAND		"run modedetect"
+#define CONFIG_EXTRA_ENV_SETTINGS	"dfu_alt_info=kernel part 0 9 offset 0x400;rootfs part 0 18;system-data part 0 19;user part 0 21\0" \
+					"modedetect=if gpio input gpa21 || itest.l *0x105c080c == 0x12345671; then run download; else run bootkernel; fi; reset\0" \
+					"fdt_high=0xffffffffffffffff\0" \
+					"bootargs=console=ttySAC1,115200 earlycon=exynos4210,0x14C20000 ess_setup=0x26000000 loglevel=7 root=/dev/mmcblk0p18 rootfstype=ext4 rootwait\0" \
+					"bootkernel=echo Booting kernel; run boarddetect; run loadkernel; bootm 0x30080000#$board\0" \
+					"boarddetect=if itest.l *0x138000b4 == 0x0063f9ff; then setenv board tm2e; elif itest.l *0x138000b4 == 0x0059f9ff; then setenv board tm2; else setenv board unknown; fi; echo Detected $board board\0" \
+					"loadkernel=part start mmc 0 9 kernel_sect; part size mmc 0 9 kernel_size; mmc read 0x30000000 $kernel_sect $kernel_size\0" \
+					"muicsetusb=i2c dev 0; i2c mw 25 c 9; i2c mw 25 d 3b; i2c mw 25 e 05; i2c mw 25 16 10\0" \
+					"displayimg=unzip 200d0000 67000000; mw.l 138000b4 0059f9ff; mw.l 138001a0 67e10000; mw.l 13800200 00001680; mw.l 13801410 1; mw.l 13802040 e0000018; sleep 1; mw.l 13802040 e0000008\0" \
+					"download=echo Thor mode enabled; run muicsetusb; run displayimg; mw.l 0x105c080c 0; thor 0 mmc 0\0"
+
+#define CONFIG_ENV_SIZE			0x1000
+
+#endif /* __SAMSUNG_TM2_H */
-- 
2.17.1



More information about the U-Boot mailing list