mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-24 02:48:51 +09:00
![Lukasz Majewski](/assets/img/avatar_default.png)
This patch introduces support for i.MX28 based XEA board. This board supports DM/DTS in U-Boot proper as well as DM aware drivers in SPL (u-boot.sb) by using OF_PLATDATA. More detailed information regarding usage of it can be found in ./board/liebherr/xea/README file. U-Boot SPL 2019.10-rc1-00233-g6aa549f05c (Aug 12 2019 - 09:23:36 +0200) Trying to boot from MMC1 MMC0: Command 8 timeout (status 0xf0344020) mmc_load_image_raw_sector: mmc block read error U-Boot 2019.10-rc1-00233-g6aa549f05c (Aug 12 2019 - 09:23:36 +0200) CPU: Freescale i.MX28 rev1.2 at 454 MHz BOOT: SSP SPI #3, master, 3V3 NOR Model: Liebherr (LWE) XEA i.MX28 Board DRAM: 128 MiB MMC: MXS MMC: 0 Loading Environment from SPI Flash... SF: Detected n25q128a13 with page size 256 Bytes, erase size 64 KiB, total 16 MiB OK In: serial Out: serial Err: serial Net: Warning: ethernet@800f0000 (eth0) using random MAC address - ce:e1:9e:46:f3:a2 eth0: ethernet@800f0000 Hit any key to stop autoboot: 0 Signed-off-by: Lukasz Majewski <lukma@denx.de>
154 lines
2.9 KiB
C
154 lines
2.9 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* XEA iMX28 board
|
|
*
|
|
* Copyright (C) 2019 DENX Software Engineering
|
|
* Lukasz Majewski, DENX Software Engineering, lukma@denx.de
|
|
*
|
|
* Copyright (C) 2018 DENX Software Engineering
|
|
* Måns Rullgård, DENX Software Engineering, mans@mansr.com
|
|
*
|
|
* Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
|
|
* on behalf of DENX Software Engineering GmbH
|
|
*
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <asm/gpio.h>
|
|
#include <asm/io.h>
|
|
#include <asm/arch/imx-regs.h>
|
|
#include <asm/arch/iomux-mx28.h>
|
|
#include <asm/arch/clock.h>
|
|
#include <asm/arch/sys_proto.h>
|
|
#include <linux/mii.h>
|
|
#include <miiphy.h>
|
|
#include <netdev.h>
|
|
#include <errno.h>
|
|
#include <usb.h>
|
|
#include <serial.h>
|
|
|
|
#ifdef CONFIG_SPL_BUILD
|
|
#include <spl.h>
|
|
#endif
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
/*
|
|
* Functions
|
|
*/
|
|
|
|
static void init_clocks(void)
|
|
{
|
|
/* IO0 clock at 480MHz */
|
|
mxs_set_ioclk(MXC_IOCLK0, 480000);
|
|
/* IO1 clock at 480MHz */
|
|
mxs_set_ioclk(MXC_IOCLK1, 480000);
|
|
|
|
/* SSP0 clock at 96MHz */
|
|
mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
|
|
/* SSP2 clock at 160MHz */
|
|
mxs_set_sspclk(MXC_SSPCLK2, 160000, 0);
|
|
/* SSP3 clock at 96MHz */
|
|
mxs_set_sspclk(MXC_SSPCLK3, 96000, 0);
|
|
}
|
|
|
|
#ifdef CONFIG_SPL_BUILD
|
|
void board_init_f(ulong arg)
|
|
{
|
|
init_clocks();
|
|
preloader_console_init();
|
|
}
|
|
|
|
static int boot_tiva0, boot_tiva1;
|
|
|
|
/* Check if TIVAs request booting via U-Boot proper */
|
|
void spl_board_init(void)
|
|
{
|
|
struct gpio_desc btiva0, btiva1;
|
|
int ret;
|
|
|
|
ret = dm_gpio_lookup_name("GPIO0_23", &btiva0);
|
|
if (ret)
|
|
printf("Cannot get GPIO0_23\n");
|
|
|
|
ret = dm_gpio_lookup_name("GPIO0_25", &btiva1);
|
|
if (ret)
|
|
printf("Cannot get GPIO0_25\n");
|
|
|
|
ret = dm_gpio_request(&btiva0, "boot-tiva0");
|
|
if (ret)
|
|
printf("Cannot request GPIO0_23\n");
|
|
|
|
ret = dm_gpio_request(&btiva1, "boot-tiva1");
|
|
if (ret)
|
|
printf("Cannot request GPIO0_25\n");
|
|
|
|
dm_gpio_set_dir_flags(&btiva0, GPIOD_IS_IN);
|
|
dm_gpio_set_dir_flags(&btiva1, GPIOD_IS_IN);
|
|
|
|
udelay(1000);
|
|
|
|
boot_tiva0 = dm_gpio_get_value(&btiva0);
|
|
boot_tiva1 = dm_gpio_get_value(&btiva1);
|
|
}
|
|
|
|
void board_boot_order(u32 *spl_boot_list)
|
|
{
|
|
spl_boot_list[0] = BOOT_DEVICE_MMC1;
|
|
spl_boot_list[1] = BOOT_DEVICE_SPI;
|
|
}
|
|
|
|
int spl_start_uboot(void)
|
|
{
|
|
/* break into full u-boot on 'c' */
|
|
if (serial_tstc() && serial_getc() == 'c')
|
|
return 1;
|
|
|
|
debug("%s: btiva0: %d btiva1: %d\n", __func__, boot_tiva0, boot_tiva1);
|
|
return !boot_tiva0 || !boot_tiva1;
|
|
}
|
|
#else
|
|
|
|
int board_early_init_f(void)
|
|
{
|
|
init_clocks();
|
|
|
|
return 0;
|
|
}
|
|
|
|
int board_init(void)
|
|
{
|
|
struct gpio_desc phy_rst;
|
|
int ret;
|
|
|
|
/* Address of boot parameters */
|
|
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
|
|
|
|
cpu_eth_init(NULL);
|
|
|
|
/* PHY INT#/PWDN# */
|
|
ret = dm_gpio_lookup_name("GPIO4_13", &phy_rst);
|
|
if (ret) {
|
|
printf("Cannot get GPIO4_13\n");
|
|
return ret;
|
|
}
|
|
|
|
ret = dm_gpio_request(&phy_rst, "phy-rst");
|
|
if (ret) {
|
|
printf("Cannot request GPIO4_13\n");
|
|
return ret;
|
|
}
|
|
|
|
dm_gpio_set_dir_flags(&phy_rst, GPIOD_IS_IN);
|
|
udelay(1000);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int dram_init(void)
|
|
{
|
|
return mxs_dram_init();
|
|
}
|
|
|
|
#endif /* CONFIG_SPL_BUILD */
|