am335x system upgrade uboot sd boot(一)

时间:2023-03-08 22:32:11

由于上层应用的需求,需要运行arm docker,在kernel3.2上面还不支持,且编译器的glibc版本比较低的问题,故需要做系统升级

新的内核4.14.40驱动开发和以往有很大的不同,关键在于dts,本质来说就是把以往通过注册设备资源来加载驱动,查找总线的挂载的驱动,通过比较驱动名称,来加载驱动。

现在变成了通过dst来表述设备资源,对比驱动当中的id,来加载驱动。

第一阶段的目标:

由TI官网上面下载TI SDK 5.0,搭建成功之后,第一件事情就是希望系统能引导起来,能挂载文件系统,能通过网口上网,然后再来调通外围的设备驱动。

如何让系统默认从SD引导,通过在增加如下配置选项:

Index: board-support/u-boot-2018.01/include/configs/am335x_evm.h
===================================================================
--- board-support/u-boot-2018.01/include/configs/am335x_evm.h (revision 4)
+++ board-support/u-boot-2018.01/include/configs/am335x_evm.h (revision 5)
@@ -17,6 +17,7 @@
#define __CONFIG_AM335X_EVM_H

#include <configs/ti_am335x_common.h>
+#define CONFIG_SD_BOOT

#ifndef CONFIG_SPL_BUILD
# define CONFIG_TIMESTAMP

接上来需要对相应的IO做初始化

Index: mux.c
===================================================================
--- mux.c (revision 5)
+++ mux.c (revision 6)
@@ -340,6 +340,7 @@

void enable_board_pin_mux(void)
{
+#if 0
/* Do board-specific muxes. */
if (board_is_bone()) {
/* Beaglebone pinmux */
@@ -400,4 +401,9 @@
/* Unknown board. We might still be able to boot. */
puts("Bad EEPROM or unknown board, cannot configure pinmux.");
}
+#endif
+ configure_module_pin_mux(i2c1_pin_mux);
+ configure_module_pin_mux(gpio0_7_pin_mux);
+ configure_module_pin_mux(rgmii1_pin_mux);
+ configure_module_pin_mux(mmc0_pin_mux_sk_evm);
}

由于自家的版子与 官方的板子有区别,去掉Uboot当中的判断

Index: board.c
===================================================================
--- board.c (revision 5)
+++ board.c (revision 6)
@@ -82,9 +82,9 @@
#ifndef CONFIG_DM_SERIAL
struct serial_device *default_serial_console(void)
{
- if (board_is_icev2())
- return &eserial4_device;
- else
+ //if (board_is_icev2())
+ // return &eserial4_device;
+ //else
return &eserial1_device;
}
#endif
@@ -262,14 +262,14 @@
{
int ind = get_sys_clk_index();

- if (board_is_evm_sk())
+ //if (board_is_evm_sk())
return &dpll_ddr3_303MHz[ind];
- else if (board_is_bone_lt() || board_is_icev2())
- return &dpll_ddr3_400MHz[ind];
- else if (board_is_evm_15_or_later())
- return &dpll_ddr3_303MHz[ind];
- else
- return &dpll_ddr2_266MHz[ind];
+ //else if (board_is_bone_lt() || board_is_icev2())
+ // return &dpll_ddr3_400MHz[ind];
+ //else if (board_is_evm_15_or_later())
+ // return &dpll_ddr3_303MHz[ind];
+ //else
+ // return &dpll_ddr2_266MHz[ind];
}

static u8 bone_not_connected_to_ac_power(void)
@@ -291,13 +291,13 @@
{
int ind = get_sys_clk_index();
int freq = am335x_get_efuse_mpu_max_freq(cdev);
-
+#if 0
if (bone_not_connected_to_ac_power())
freq = MPUPLL_M_600;

if (board_is_bone_lt())
freq = MPUPLL_M_1000;
-
+#endif
switch (freq) {
case MPUPLL_M_1000:
return &dpll_mpu_opp[ind][5];
@@ -324,8 +324,8 @@
* Only perform PMIC configurations if board rev > A1
* on Beaglebone White
*/
- if (board_is_bone() && !strncmp(board_ti_get_rev(), "00A1", 4))
- return;
+ //if (board_is_bone() && !strncmp(board_ti_get_rev(), "00A1", 4))
+ // return;

if (i2c_probe(TPS65217_CHIP_PM))
return;
@@ -334,15 +334,15 @@
* On Beaglebone White we need to ensure we have AC power
* before increasing the frequency.
*/
- if (bone_not_connected_to_ac_power())
- freq = MPUPLL_M_600;
+ //if (bone_not_connected_to_ac_power())
+ // freq = MPUPLL_M_600;

/*
* Override what we have detected since we know if we have
* a Beaglebone Black it supports 1GHz.
*/
- if (board_is_bone_lt())
- freq = MPUPLL_M_1000;
+ //if (board_is_bone_lt())
+ // freq = MPUPLL_M_1000;

switch (freq) {
case MPUPLL_M_1000:
@@ -389,19 +389,19 @@
* Set LDO3, LDO4 output voltage to 3.3V for Beaglebone.
* Set LDO3 to 1.8V and LDO4 to 3.3V for Beaglebone Black.
*/
- if (board_is_bone()) {
+ /*if (board_is_bone()) {
if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
TPS65217_DEFLS1,
TPS65217_LDO_VOLTAGE_OUT_3_3,
TPS65217_LDO_MASK))
puts("tps65217_reg_write failure\n");
- } else {
- if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
+ } else {*/
+ if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
TPS65217_DEFLS1,
TPS65217_LDO_VOLTAGE_OUT_1_8,
TPS65217_LDO_MASK))
puts("tps65217_reg_write failure\n");
- }
+

if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
TPS65217_DEFLS2,
@@ -463,9 +463,9 @@
gpi2c_init();
freq = am335x_get_efuse_mpu_max_freq(cdev);

- if (board_is_beaglebonex())
- scale_vcores_bone(freq);
- else
+ //if (board_is_beaglebonex())
+ // scale_vcores_bone(freq);
+ //else
scale_vcores_generic(freq);
}

@@ -533,15 +533,18 @@
gpio_request(GPIO_DDR_VTT_EN, "ddr_vtt_en");
gpio_direction_output(GPIO_DDR_VTT_EN, 1);
}
-
+#if 0
if (board_is_icev2()) {
gpio_request(ICE_GPIO_DDR_VTT_EN, "ddr_vtt_en");
gpio_direction_output(ICE_GPIO_DDR_VTT_EN, 1);
}
-
- if (board_is_evm_sk())
+#endif
+
+ //if (board_is_evm_sk())
config_ddr(303, &ioregs_evmsk, &ddr3_data,
&ddr3_cmd_ctrl_data, &ddr3_emif_reg_data, 0);
+
+#if 0
else if (board_is_bone_lt())
config_ddr(400, &ioregs_bonelt,
&ddr3_beagleblack_data,
@@ -560,6 +563,7 @@
else
config_ddr(266, &ioregs, &ddr2_data,
&ddr2_cmd_ctrl_data, &ddr2_emif_reg_data, 0);
+#endif
}
#endif

@@ -723,7 +727,7 @@

#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
char *name = NULL;
-
+#if 0
if (board_is_bone_lt()) {
/* BeagleBoard.org BeagleBone Black Wireless: */
if (!strncmp(board_ti_get_rev(), "BWA", 3)) {
@@ -742,6 +746,8 @@
if (board_is_bbg1())
name = "BBG1";
set_board_info_env(name);
+#endif
+ set_board_info_env("A335X_SK");

/*
* Default FIT boot on HS devices. Non FIT images are not allowed

初次调试,增加MLO的串口打印以方便调试:

Index: board-support/u-boot-2018.01/common/spl/spl.c
===================================================================
--- board-support/u-boot-2018.01/common/spl/spl.c (revision 6)
+++ board-support/u-boot-2018.01/common/spl/spl.c (revision 7)
@@ -20,6 +20,8 @@
#include <dm/root.h>
#include <linux/compiler.h>
#include <fdt_support.h>
+#define DEBUG

DECLARE_GLOBAL_DATA_PTR;

通过SDK提供的编译uboot命令: make u-boot

将生成的MLO及u-boot.img 放入SD之后,系统正常启动