Merge git://git.denx.de/u-boot-imx

This commit is contained in:
Tom Rini
2017-12-29 09:27:04 -05:00
54 changed files with 522 additions and 265 deletions

View File

@@ -210,48 +210,6 @@ static int cm_fx6_setup_issd(void)
#define CM_FX6_SATA_INIT_RETRIES 10
# if !CONFIG_IS_ENABLED(AHCI)
int sata_initialize(void)
{
int err, i;
/* Make sure this gpio has logical 0 value */
gpio_direction_output(CM_FX6_SATA_PWLOSS_INT, 0);
udelay(100);
cm_fx6_sata_power(1);
for (i = 0; i < CM_FX6_SATA_INIT_RETRIES; i++) {
err = setup_sata();
if (err) {
printf("SATA setup failed: %d\n", err);
return err;
}
udelay(100);
err = __sata_initialize();
if (!err)
break;
/* There is no device on the SATA port */
if (sata_port_status(0, 0) == 0)
break;
/* There's a device, but link not established. Retry */
}
return err;
}
int sata_stop(void)
{
__sata_stop();
cm_fx6_sata_power(0);
mdelay(250);
return 0;
}
# endif
#else
static int cm_fx6_setup_issd(void) { return 0; }
#endif
@@ -548,35 +506,6 @@ static void cm_fx6_setup_gpmi_nand(void)
static void cm_fx6_setup_gpmi_nand(void) {}
#endif
#ifdef CONFIG_FSL_ESDHC
static struct fsl_esdhc_cfg usdhc_cfg[3] = {
{USDHC1_BASE_ADDR},
{USDHC2_BASE_ADDR},
{USDHC3_BASE_ADDR},
};
static enum mxc_clock usdhc_clk[3] = {
MXC_ESDHC_CLK,
MXC_ESDHC2_CLK,
MXC_ESDHC3_CLK,
};
int board_mmc_init(bd_t *bis)
{
int i;
cm_fx6_set_usdhc_iomux();
for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
usdhc_cfg[i].sdhc_clk = mxc_get_clock(usdhc_clk[i]);
usdhc_cfg[i].max_bus_width = 4;
fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
enable_usdhc_clk(1, i);
}
return 0;
}
#endif
#ifdef CONFIG_MXC_SPI
int cm_fx6_setup_ecspi(void)
{

View File

@@ -387,10 +387,6 @@ void board_init_f(ulong dummy)
&dhcom6sdl_grp_ioregs);
mx6_dram_cfg(&dhcom_ddr_info, &dhcom_mmdc_calib, &dhcom_mem_ddr);
/* Perform DDR DRAM calibration */
udelay(100);
mmdc_do_dqs_calibration(&dhcom_ddr_info);
/* Clear the BSS. */
memset(__bss_start, 0, __bss_end - __bss_start);

View File

@@ -397,39 +397,9 @@ int board_eth_init(bd_t *bis)
return cpu_eth_init(bis);
}
#define BOARD_REV_B 0x200
#define BOARD_REV_A 0x100
static int mx6sabre_rev(void)
{
/*
* Get Board ID information from OCOTP_GP1[15:8]
* i.MX6Q ARD RevA: 0x01
* i.MX6Q ARD RevB: 0x02
*/
struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
struct fuse_bank *bank = &ocotp->bank[4];
struct fuse_bank4_regs *fuse =
(struct fuse_bank4_regs *)bank->fuse_regs;
int reg = readl(&fuse->gp1);
int ret;
switch (reg >> 8 & 0x0F) {
case 0x02:
ret = BOARD_REV_B;
break;
case 0x01:
default:
ret = BOARD_REV_A;
break;
}
return ret;
}
u32 get_board_rev(void)
{
int rev = mx6sabre_rev();
int rev = nxp_board_rev();
return (get_cpu_rev() & ~(0xF << 8)) | rev;
}
@@ -703,20 +673,7 @@ int board_late_init(void)
int checkboard(void)
{
int rev = mx6sabre_rev();
char *revname;
switch (rev) {
case BOARD_REV_B:
revname = "B";
break;
case BOARD_REV_A:
default:
revname = "A";
break;
}
printf("Board: MX6Q-Sabreauto rev%s\n", revname);
printf("Board: MX6Q-Sabreauto rev%c\n", nxp_board_rev_string());
return 0;
}

View File

@@ -8,6 +8,8 @@
*
* The syntax is taken as close as possible with the kwbimage
*/
#define __ASSEMBLY__
#include <config.h>
/* image version */
@@ -20,6 +22,13 @@ IMAGE_VERSION 2
BOOT_FROM sd
/*
* Secure boot support
*/
#ifdef CONFIG_SECURE_BOOT
CSF CONFIG_CSF_SIZE
#endif
/*
* Device Configuration Data (DCD)
*

View File

@@ -540,9 +540,23 @@ int board_init(void)
return 0;
}
static bool is_reva(void)
{
return (nxp_board_rev() == 1);
}
int board_late_init(void)
{
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
if (is_reva())
env_set("board_rev", "REVA");
#endif
return 0;
}
int checkboard(void)
{
puts("Board: MX6SX SABRE SDB\n");
printf("Board: MX6SX SABRE SDB rev%c\n", nxp_board_rev_string());
return 0;
}

View File

@@ -4,4 +4,4 @@
# SPDX-License-Identifier: GPL-2.0+
#
obj-y := vpd_reader.o
obj-y := vpd_reader.o ge_common.o

View File

@@ -0,0 +1,55 @@
/*
* Copyright 2017 General Electric Company
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <i2c.h>
#include <rtc.h>
void check_time(void)
{
int ret, i;
struct rtc_time tm;
u8 retry = 3;
unsigned int current_i2c_bus = i2c_get_bus_num();
ret = i2c_set_bus_num(CONFIG_SYS_RTC_BUS_NUM);
if (ret < 0)
return;
rtc_init();
for (i = 0; i < retry; i++) {
ret = rtc_get(&tm);
if (!ret || ret == -EINVAL)
break;
}
if (ret < 0)
env_set("rtc_status", "RTC_ERROR");
if (tm.tm_year > 2037) {
tm.tm_sec = 0;
tm.tm_min = 0;
tm.tm_hour = 0;
tm.tm_mday = 1;
tm.tm_wday = 2;
tm.tm_mon = 1;
tm.tm_year = 2036;
for (i = 0; i < retry; i++) {
ret = rtc_set(&tm);
if (!ret)
break;
}
if (ret < 0)
env_set("rtc_status", "RTC_ERROR");
}
i2c_set_bus_num(current_i2c_bus);
}

View File

@@ -0,0 +1,7 @@
/*
* Copyright 2017 General Electric Company
*
* SPDX-License-Identifier: GPL-2.0+
*/
void check_time(void);

View File

@@ -33,8 +33,8 @@
#include <watchdog.h>
#include "ppd_gpio.h"
#include <stdlib.h>
#include "../../ge/common/ge_common.h"
#include "../../ge/common/vpd_reader.h"
#include <rtc.h>
#define MX53PPD_LCD_POWER IMX_GPIO_NR(3, 24)
@@ -357,51 +357,6 @@ static int read_vpd(uint eeprom_bus)
return res;
}
static void check_time(void)
{
int ret, i;
struct rtc_time tm;
u8 retry = 3;
unsigned int current_i2c_bus = i2c_get_bus_num();
ret = i2c_set_bus_num(CONFIG_SYS_RTC_BUS_NUM);
if (ret < 0)
return;
rtc_init();
for (i = 0; i < retry; i++) {
ret = rtc_get(&tm);
if (!ret || ret == -EINVAL)
break;
}
if (ret < 0)
env_set("rtc_status", "RTC_ERROR");
if (tm.tm_year > 2037) {
tm.tm_sec = 0;
tm.tm_min = 0;
tm.tm_hour = 0;
tm.tm_mday = 1;
tm.tm_wday = 2;
tm.tm_mon = 1;
tm.tm_year = 2036;
for (i = 0; i < retry; i++) {
ret = rtc_set(&tm);
if (!ret)
break;
}
if (ret < 0)
env_set("rtc_status", "RTC_ERROR");
}
i2c_set_bus_num(current_i2c_bus);
}
int board_init(void)
{
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;

View File

@@ -8,6 +8,8 @@
*
* The syntax is taken as close as possible with the kwbimage
*/
#define __ASSEMBLY__
#include <config.h>
/* image version */
@@ -20,6 +22,13 @@ IMAGE_VERSION 2
BOOT_FROM sd
/*
* Secure boot support
*/
#ifdef CONFIG_SECURE_BOOT
CSF CONFIG_CSF_SIZE
#endif
/*
* Device Configuration Data (DCD)
*