码迷,mamicode.com
首页 > 其他好文 > 详细

[uboot]E9-i.MX6Q-uboot移植

时间:2016-10-06 06:52:39      阅读:511      评论:0      收藏:0      [点我收藏+]

标签:

 

参照:http://blog.csdn.net/girlkoo/article/details/45420977

文档参照:

  • 《i.MX BSP Porting Guide-2015/12, Rev.0》---------uboot porting steps
  • 《E9_TQIMX6Q_V1_20131031.pdf》------------------E9 schematics
  • 《E9_User_Manual-V3.1.0》---------------------------Burned methods

BSP版本:L3.14.52.1.1.0

Step1:创建单板board目录,这里选择mx6sabresd作为参考

1 $cp -R board/freescale/mx6sabresd/ board/freescale/mx6q_tqE9/

Step2:创建board配置config文件,这里面设定了dtb文件名称,Stack/Heap大小,DDR大小,zImage装载地址

1 $cp include/configs/mx6sabresd.h include/configs/mx6q_tqE9.h

Step3:<UBOOT_DIR>/configs/目录,创建config选项配置文件, 复制mx6qsabresd_defconfig --> mx6q_tqE9_defconfig, 然后修改为:

1 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6q_tqE9.cfg,MX6Q"
2 CONFIG_ARM=y
3 CONFIG_TARGET_MX6Q<customer_board>=y
4 CONFIG_SYS_MALLOC_F=y
5 CONFIG_SYS_MALLOC_F_LEN=0x400
6 CONFIG_DM=y
7 CONFIG_DM_THERMAL=y

Step4:文件重命名

1 board/freescale/mx6q_tqE9/mx6sabresd.c --> board/freescale/mx6q_tqE9/mx6q_tqE9.c
2 board/freescale/mx6q_tqE9/mx6qp.cfg --> board/freescale/mx6q_tqE9/mx6q_tqE9.cfg

Step5: 修改board/freescale/mx6q_tqE9目录的Makefile

1 obj-y:= mx6sabresd.o --> obj-y  := mx6q_tqE9.o

Step6: 修改Kconfig

  • arch/arm/Kconfig

添加:

1 config TARGET_MX6Q_TQE9
2   bool "Support mx6q_tqE9"
3   select CPU_V7
4 source "board/freescale/mx6q_tqE9/Kconfig"
  • board/freescale/mx6q_tqE9/Kconfig

修改为:

 1 if TARGET_MX6Q_TQE9
 2 
 3 config SYS_BOARD
 4     default "mx6q_tqE9"
 5 
 6 config SYS_VENDOR
 7     default "freescale"
 8 
 9 config SYS_SOC
10     default "mx6"
11 
12 config SYS_CONFIG_NAME
13     default "mx6q_tqE9"
14 
15 endif

 Step7:创建编译脚本

1 #!/bin/bash
2 export ARCH=arm
3 export CROSS_COMPILE=/opt/Embedsky/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/tq-linaro-toolchain/bin/arm-fsl-linux-gnueabi-
4 make distclean;
5 make mx6q_tqE9_defconfig
6 make

Step8:参照@girlkoo:

1. 定制DDR,目录为board/freescale/mx6q_tqE9/mx6q_tqE9.cfg

 1 DATA 4, 0x020e0798, 0x000C0000  
 2 DATA 4, 0x020e0758, 0x00000000  
 3 DATA 4, 0x020e0588, 0x00000030  
 4 DATA 4, 0x020e0594, 0x00000030  
 5 DATA 4, 0x020e056c, 0x00000030  
 6 DATA 4, 0x020e0578, 0x00000030  
 7 DATA 4, 0x020e074c, 0x00000030  
 8 DATA 4, 0x020e057c, 0x00000030  
 9 DATA 4, 0x020e058c, 0x00000000  
10 DATA 4, 0x020e059c, 0x00000030  
11 DATA 4, 0x020e05a0, 0x00000030  
12 DATA 4, 0x020e078c, 0x00000030  
13 DATA 4, 0x020e0750, 0x00020000  
14 DATA 4, 0x020e05a8, 0x00000018  
15 DATA 4, 0x020e05b0, 0x00000018  
16 DATA 4, 0x020e0524, 0x00000018  
17 DATA 4, 0x020e051c, 0x00000018  
18 DATA 4, 0x020e0518, 0x00000018  
19 DATA 4, 0x020e050c, 0x00000018  
20 DATA 4, 0x020e05b8, 0x00000018  
21 DATA 4, 0x020e05c0, 0x00000018  
22 DATA 4, 0x020e0774, 0x00020000  
23 DATA 4, 0x020e0784, 0x00000018  
24 DATA 4, 0x020e0788, 0x00000018  
25 DATA 4, 0x020e0794, 0x00000018  
26 DATA 4, 0x020e079c, 0x00000018  
27 DATA 4, 0x020e07a0, 0x00000018  
28 DATA 4, 0x020e07a4, 0x00000018  
29 DATA 4, 0x020e07a8, 0x00000018  
30 DATA 4, 0x020e0748, 0x00000018  
31 DATA 4, 0x020e05ac, 0x00000018  
32 DATA 4, 0x020e05b4, 0x00000018  
33 DATA 4, 0x020e0528, 0x00000018  
34 DATA 4, 0x020e0520, 0x00000018  
35 DATA 4, 0x020e0514, 0x00000018  
36 DATA 4, 0x020e0510, 0x00000018  
37 DATA 4, 0x020e05bc, 0x00000018  
38 DATA 4, 0x020e05c4, 0x00000018  
39 DATA 4, 0x021b0800, 0xa1390003  
40 DATA 4, 0x021b080c, 0x001F001F  
41 DATA 4, 0x021b0810, 0x001F001F  
42 DATA 4, 0x021b480c, 0x001F001F  
43 DATA 4, 0x021b4810, 0x001F001F  
44 DATA 4, 0x021b083c, 0x43270338  
45 DATA 4, 0x021b0840, 0x03200314  
46 DATA 4, 0x021b483c, 0x431A032F  
47 DATA 4, 0x021b4840, 0x03200263  
48 DATA 4, 0x021b0848, 0x4B434748  
49 DATA 4, 0x021b4848, 0x4445404C  
50 DATA 4, 0x021b0850, 0x38444542  
51 DATA 4, 0x021b4850, 0x4935493A  
52 DATA 4, 0x021b081c, 0x33333333  
53 DATA 4, 0x021b0820, 0x33333333  
54 DATA 4, 0x021b0824, 0x33333333  
55 DATA 4, 0x021b0828, 0x33333333  
56 DATA 4, 0x021b481c, 0x33333333  
57 DATA 4, 0x021b4820, 0x33333333  
58 DATA 4, 0x021b4824, 0x33333333  
59 DATA 4, 0x021b4828, 0x33333333  
60 DATA 4, 0x021b08b8, 0x00000800  
61 DATA 4, 0x021b48b8, 0x00000800  
62 DATA 4, 0x021b0004, 0x00020036  
63 DATA 4, 0x021b0008, 0x09444040  
64 DATA 4, 0x021b000c, 0x8A8F7955  
65 DATA 4, 0x021b0010, 0xFF328F64  
66 DATA 4, 0x021b0014, 0x01FF00DB  
67 DATA 4, 0x021b0018, 0x00001740  
68 DATA 4, 0x021b001c, 0x00008000  
69 DATA 4, 0x021b002c, 0x000026d2  
70 DATA 4, 0x021b0030, 0x008F1023  
71 DATA 4, 0x021b0040, 0x00000047  
72 DATA 4, 0x021b0000, 0x841A0000  
73 DATA 4, 0x021b001c, 0x04088032  
74 DATA 4, 0x021b001c, 0x00008033  
75 DATA 4, 0x021b001c, 0x00048031  
76 DATA 4, 0x021b001c, 0x09408030  
77 DATA 4, 0x021b001c, 0x04008040  
78 DATA 4, 0x021b0020, 0x00005800  
79 DATA 4, 0x021b0818, 0x00011117  
80 DATA 4, 0x021b4818, 0x00011117  
81 DATA 4, 0x021b0004, 0x00025576  
82 DATA 4, 0x021b0404, 0x00011006  
83 DATA 4, 0x021b001c, 0x00000000  
84   
85 /* set the default clock gate to save power */  
86 DATA 4, 0x020c4068, 0x00C03F3F  
87 DATA 4, 0x020c406c, 0x0030FC03  
88 DATA 4, 0x020c4070, 0x0FFFC000  
89 DATA 4, 0x020c4074, 0x3FF00000  
90 DATA 4, 0x020c4078, 0x00FFF300  
91 DATA 4, 0x020c407c, 0x0F0000F3  
92 DATA 4, 0x020c4080, 0x000003FF  
93   
94 /* enable AXI cache for VDOA/VPU/IPU */  
95 DATA 4, 0x020e0010, 0xF00000CF  
96 /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */  
97 DATA 4, 0x020e0018, 0x007F007F  
98 DATA 4, 0x020e001c, 0x007F007F  

2. 定制board端子,board/freescale/mx6q_tqE9/mx6q_tqE9.c

<1>.修改串口如下:

1 iomux_v3_cfg_t const uart1_pads[] = {  
2         // MX6_PAD_CSI0_DAT10__UART1_TXD | MUX_PAD_CTRL(UART_PAD_CTRL),  
3         // MX6_PAD_CSI0_DAT11__UART1_RXD | MUX_PAD_CTRL(UART_PAD_CTRL),  
4         MX6_PAD_SD3_DAT7__UART1_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),  
5         MX6_PAD_SD3_DAT6__UART1_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),  
6 };  

<2>.修改SD卡端子:

 1 iomux_v3_cfg_t const usdhc2_pads[] = {  
 2         MX6_PAD_SD2_CLK__USDHC2_CLK     | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
 3         MX6_PAD_SD2_CMD__USDHC2_CMD     | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
 4         MX6_PAD_SD2_DAT0__USDHC2_DAT0   | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
 5         MX6_PAD_SD2_DAT1__USDHC2_DAT1   | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
 6         MX6_PAD_SD2_DAT2__USDHC2_DAT2   | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
 7         MX6_PAD_SD2_DAT3__USDHC2_DAT3   | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
 8         // MX6_PAD_NANDF_D4__USDHC2_DAT4        | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
 9         // MX6_PAD_NANDF_D5__USDHC2_DAT5        | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
10         // MX6_PAD_NANDF_D6__USDHC2_DAT6        | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
11         // MX6_PAD_NANDF_D7__USDHC2_DAT7        | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
12         // MX6_PAD_NANDF_D2__GPIO_2_2   | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */  
13 };  
14   
15 iomux_v3_cfg_t const usdhc3_pads[] = {  
16         MX6_PAD_SD3_CLK__USDHC3_CLK   | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
17         MX6_PAD_SD3_CMD__USDHC3_CMD   | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
18         MX6_PAD_SD3_DAT0__USDHC3_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
19         MX6_PAD_SD3_DAT1__USDHC3_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
20         MX6_PAD_SD3_DAT2__USDHC3_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
21         MX6_PAD_SD3_DAT3__USDHC3_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
22         MX6_PAD_SD3_DAT4__USDHC3_DAT4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
23         MX6_PAD_SD3_DAT5__USDHC3_DAT5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
24         // MX6_PAD_SD3_DAT6__USDHC3_DAT6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
25         // MX6_PAD_SD3_DAT7__USDHC3_DAT7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),  
26         MX6_PAD_NANDF_D0__GPIO_2_0    | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */  
27 };  

<3>.定制Card Detect端子,否则SD卡插入会检测不到

1 #define USDHC2_CD_GPIO  IMX_GPIO_NR(1, 4)  

Step9: 编译

1 ./build_uboot.sh 

Step10: 烧写,下载:

烧写SD卡:

sudo dd if=u-boot.imx of=/dev/sdc bs=512 seek=2 

更改E9为SD卡启动:

Jumper为1~7: 1 0 0 0 0 0 1.

输出log:

 1 U-Boot 2015.04-imx_v2015.04_3.14.52_1.1.0_ga+g6cf684a (Oct 05 2016 - 23:57:59)
 2 
 3 CPU: Freescale i.MX6Q rev1.2 at 792 MHz
 4 CPU: Temperature -140462619 C
 5 Reset cause: POR
 6 Board: MX6-TQE9
 7 I2C: ready
 8 DRAM: 2 GiB
 9 Cant find PMIC:PFUZE100
10 initcall sequence 8ff93570 failed at call 178036e8 (err=-19)
11 ### ERROR ### Please RESET the board ###

Issue: 这里遇到一个问题就是串口管脚的修改,E9的管脚UART1_TXD(SD3_DAT7)和UART1_RXD(SD3_DAT6),所以需要修改,而原有在sabresd板子中配置为MX6_PAD_CSI0_DAT10__UART1_TX_DATA和MX6_PAD_CSI0_DAT11__UART1_RX_DATA,使用grep并找不到定义,所以也就找不到此版本下SD3_DAT7和SD3_DAT6应该怎么表示,刚开始修改不对,uboot打印一直不出现。

后来通过mx6q_tqE9.c包含头文件找到arch/arm/include/asm/arch-mx6/mx6q_pins.h:851:

1 MX6_PAD_DECL(SD3_DAT7__UART1_TX_DATA, 0x0690, 0x02A8, 1, 0x0000, 0, 0)

而在arch/arm/include/asm/arch-mx6/mx6-pins.h中有这样定义:

1 #elif defined(CONFIG_MX6Q)
2 enum {
3 #define MX6_PAD_DECL(name, pco, mc, mm, sio, si, pc) 4 MX6_PAD_DECLARE(MX6_PAD_,name, pco, mc, mm, sio, si, pc),
5 #include "mx6q_pins.h"
6 };

进而有同样在arch/arm/include/asm/arch-mx6/mx6-pins.h: 

1 #define MX6_PAD_DECLARE(prefix, name, pco, mc, mm, sio, si, pc) 2     prefix##name = IOMUX_PAD(pco, mc, mm, sio, si, pc) 

这样也就有了串口MX6_PAD_SD3_DAT7__UART1_TX_DATA的定义。

  

问题

1. SD卡格式化

mkfs.ext4 /dev/sdc

2. 格式化完后分区

3. 以上的编译使用的工具链还是较老的工具链,E9光盘安装,并没有更新

[uboot]E9-i.MX6Q-uboot移植

标签:

原文地址:http://www.cnblogs.com/aaronLinux/p/5933309.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!