基于iTop-4412的U-Boot 2017移植[1]:成功运行

基于iTop-4412的U-Boot 2017移植[1]:成功运行

参考资料:
+ Exynos 4412的启动过程分析
+ 基于tiny4412的u-boot移植

获取U-Boot

本博客使用的版本是 U-Boot 2017.05-rc1

$ git clone git://git.denx.de/u-boot.git

开始移植

本博客参考一款类似与iTOP-4412的开发板(采用相同的SoC):origen 进行移植。

(一) 创建iTOP-4412板级目录

cp board/samsung/origen board/samsung/itop4412 –raf
mv board/samsung/itop4412/origen.c board/samsung/itop4412/itop4412.c
mv board/samsung/itop4412/tools/mkorigenspl.c board/samsung/itop4412/tools/mkitop4412spl.c

(二) 增加文件

cp include/configs/origen.h include/configs/itop4412.h
cp configs/origen_defconfig configs/itop4412_defconfig
cp arch/arm/dts/exynos4412-odroid.dts arch/arm/dts/exynos4412-itop4412.dts
touch arch/arm/mach-exynos/itop4412_setup.h
touch arch/arm/mach-exynos/board.c

其中board.c将对iTOP-4412的电源管理初始化,不会导致复位。

(三) 修改文件

1、修改arch/arm/dts/Makefile,用于编译设备树:

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index bc4dc2c..3be2f3a 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -14,7 +14,8 @@ dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \
    exynos4210-universal_c210.dtb \
    exynos4210-trats.dtb \
    exynos4412-trats2.dtb \
-   exynos4412-odroid.dtb
+   exynos4412-odroid.dtb \
+   exynos4412-itop4412.dtb

 dtb-$(CONFIG_TARGET_HIKEY) += hi6220-hikey.dtb

2、修改arch/arm/include/asm/mach-types.h,增加iTOP-4412的machine ID:

diff --git a/arch/arm/include/asm/mach-types.h b/arch/arm/include/asm/mach-types.h
index 9f82efe..e19b24b 100644
--- a/arch/arm/include/asm/mach-types.h
+++ b/arch/arm/include/asm/mach-types.h
@@ -5057,4 +5057,5 @@
 #define MACH_TYPE_NASM25               5112
 #define MACH_TYPE_TOMATO               5113
 #define MACH_TYPE_OMAP3_MRC3D          5114
+#define MACH_TYPE_ITOP4412             5115
 #endif

3、修改arch/arm/mach-exynos/Kconfig

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 46981a5..9078fc5 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -53,6 +53,10 @@ config TARGET_ORIGEN
    bool "Exynos4412 Origen board"
    select SUPPORT_SPL

+config TARGET_ITOP4412
+   bool "Exynos4412 iTop-4412 board"
+   select SUPPORT_SPL
+
 config TARGET_TRATS2
    bool "Exynos4412 Trat2 board"

@@ -149,6 +153,7 @@ source "board/samsung/smdkv310/Kconfig"
 source "board/samsung/trats/Kconfig"
 source "board/samsung/universal_c210/Kconfig"
 source "board/samsung/origen/Kconfig"
+source "board/samsung/itop4412/Kconfig"
 source "board/samsung/trats2/Kconfig"
 source "board/samsung/odroid/Kconfig"
 source "board/samsung/arndale/Kconfig"

4、修改 board/samsung/itop4412/Kconfig

diff --git a/board/samsung/itop4412/Kconfig b/board/samsung/itop4412/Kconfig
new file mode 100644
index 0000000..8dfef9a
--- /dev/null
+++ b/board/samsung/itop4412/Kconfig
@@ -0,0 +1,12 @@
+if TARGET_ITOP4412
+
+config SYS_BOARD
+   default "itop4412"
+
+config SYS_VENDOR
+   default "samsung"
+
+config SYS_CONFIG_NAME
+   default "itop4412"
+
+endif

5、修改board/samsung/itop4412/Makefile

diff --git a/board/samsung/itop4412/Makefile b/board/samsung/itop4412/Makefile
new file mode 100644
index 0000000..9697620
--- /dev/null
+++ b/board/samsung/itop4412/Makefile
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2011 Samsung Electronics
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+ifdef CONFIG_SPL_BUILD
+# necessary to create built-in.o
+obj- := __dummy__.o
+
+hostprogs-y := tools/mkitop4412spl
+always := $(hostprogs-y)
+
+# omit -O2 option to suppress
+#   warning: dereferencing type-punned pointer will break strict-aliasing rules
+#
+# TODO:
+# Fix the root cause in tools/mkorigenspl.c and delete the following work-around
+$(obj)/tools/mkitop4412spl: HOSTCFLAGS:=$(filter-out -O2,$(HOSTCFLAGS))
+else
+obj-y  += itop4412.o
+endif

6、修改arch/arm/dts/exynos4412-itop4412.dts,使用uart3(板子上的CON2)作为终端:

+/*
+ * Topeet iTop-4412 board device tree source
+ *
+ * Copyright (c) 2017 Ziping Chen
+ *     <[email protected]>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+/dts-v1/;
+#include "exynos4412.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
   
+   model = "TOPEET iTop 4412 Elite board";
+   compatible = "topeet,itop4412-elite", "samsung,exynos4412", "samsung,exynos4";
+
+   chosen {
   
+       stdout-path = "serial3:115200n8";
+   };
+
+   aliases {
   
+       serial3 = "/serial@13830000";
+       console = "/serial@13830000";
+   };
+
+   leds {
   
+       compatible = "gpio-leds";
+
+       led2 {
   
+           label = "red:system";
+           gpios = <&gpl2 0 GPIO_ACTIVE_HIGH>;
+           default-state = "off";
+           linux,default-trigger = "heartbeat";
+       };
+
+       led3 {
   
+           label = "red:user";
+           gpios = <&gpk1 1 GPIO_ACTIVE_HIGH>;
+           default-state = "off";
+       };
+   };
+
+   gpio-keys {
   
+       compatible = "gpio-keys";
+
+       home {
   
+           label = "GPIO Key Home";
+           linux,code = <KEY_HOME>;
+           gpios = <&gpx1 1 GPIO_ACTIVE_LOW>;
+       };
+
+       back {
   
+           label = "GPIO Key Back";
+           linux,code = <KEY_BACK>;
+           gpios = <&gpx1 2 GPIO_ACTIVE_LOW>;
+       };
+
+       sleep {
   
+           label = "GPIO Key Sleep";
+           linux,code = <KEY_POWER>;
+           gpios = <&gpx3 3 GPIO_ACTIVE_LOW>;
+       };
+
+       vol-up {
   
+           label = "GPIO Key Vol+";
+           linux,code = <KEY_UP>;
+           gpios = <&gpx2 1 GPIO_ACTIVE_LOW>;
+       };
+
+       vol-down {
   
+           label = "GPIO Key Vol-";
+           linux,code = <KEY_DOWN>;
+           gpios = <&gpx2 0 GPIO_ACTIVE_LOW>;
+       };
+   };
+
+   serial3:serial@13830000 {
   
+       status = "okay";
+   };
+};

7、修改 arch/arm/mach-exynos/Makefile

diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 0cc6c32..d6e87bc 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -5,6 +5,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #

+obj-y  += board.o
 obj-y  += soc.o
 obj-$(CONFIG_CPU_V7) += clock.o pinmux.o power.o system.o
 obj-$(CONFIG_ARM64)   += mmu-arm64.o
@@ -14,7 +15,9 @@ obj-$(CONFIG_EXYNOS5420) += sec_boot.o
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_EXYNOS5) += clock_init_exynos5.o
 obj-$(CONFIG_EXYNOS5) += dmc_common.o dmc_init_ddr3.o
-obj-$(CONFIG_EXYNOS4210)+= dmc_init_exynos4.o clock_init_exynos4.o
+ifneq (,$(filter y, $(CONFIG_EXYNOS4210) $(CONFIG_TARGET_ITOP4412)))
+obj-y     += dmc_init_exynos4.o clock_init_exynos4.o
+endif
 obj-y  += spl_boot.o tzpc.o
 obj-y  += lowlevel_init.o
 endif

8、修改 arch/arm/mach-exynos/clock_init_exynos4.c,时钟初始化

--- a/arch/arm/mach-exynos/clock_init_exynos4.c
+++ b/arch/arm/mach-exynos/clock_init_exynos4.c
@@ -27,15 +27,21 @@
 #include <config.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
+#include <asm/arch/dmc.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/clock.h>
 #include "common_setup.h"
+#ifdef CONFIG_TARGET_ITOP4412
+#include "itop4412_setup.h"
+#else
 #include "exynos4_setup.h"
+#endif

 /*
  * system_clock_init: Initialize core clock and bus clock.
  * void system_clock_init(void)
  */
+#ifndef CONFIG_TARGET_ITOP4412
 void system_clock_init(void)
 {
    struct exynos4_clock *clk =
@@ -92,3 +98,374 @@ void system_clock_init(void)

    sdelay(0x30000);
 }
+#else
+void system_clock_init(void)
+{
+    unsigned int set, clr, clr_src_cpu, clr_pll_con0, clr_src_dmc;
+    struct exynos4x12_clock *clk = (struct exynos4x12_clock *)
+                       
  • 5
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 27
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 27
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值