mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-31 11:31:32 +00:00
ARM: at91: ma5d4: Support both SF and eMMC SoMs
Discern the SoMs based on the presence of SPI flash to support both variants of the SoM, one booting from SPI NOR and one booting from eMMC. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Andreas Bießmann <andreas.devel@googlemail.com>
This commit is contained in:
parent
7c22476b19
commit
e3f40720ba
2 changed files with 38 additions and 10 deletions
|
@ -22,11 +22,14 @@
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <netdev.h>
|
#include <netdev.h>
|
||||||
#include <spi.h>
|
#include <spi.h>
|
||||||
|
#include <spi_flash.h>
|
||||||
#include <spl.h>
|
#include <spl.h>
|
||||||
#include <version.h>
|
#include <version.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
static u8 boot_mode_sf;
|
||||||
|
|
||||||
#ifdef CONFIG_ATMEL_SPI
|
#ifdef CONFIG_ATMEL_SPI
|
||||||
int spi_cs_is_valid(unsigned int bus, unsigned int cs)
|
int spi_cs_is_valid(unsigned int bus, unsigned int cs)
|
||||||
{
|
{
|
||||||
|
@ -201,18 +204,20 @@ void ma5d4evk_mci1_hw_init(void)
|
||||||
int board_mmc_init(bd_t *bis)
|
int board_mmc_init(bd_t *bis)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
void *mci0 = (void *)ATMEL_BASE_MCI0;
|
||||||
|
void *mci1 = (void *)ATMEL_BASE_MCI1;
|
||||||
|
|
||||||
/* De-assert reset on On-SoM eMMC */
|
/* De-assert reset on On-SoM eMMC */
|
||||||
at91_set_pio_output(AT91_PIO_PORTE, 15, 1);
|
at91_set_pio_output(AT91_PIO_PORTE, 15, 1);
|
||||||
at91_pio3_set_pio_pulldown(AT91_PIO_PORTE, 15, 0);
|
at91_pio3_set_pio_pulldown(AT91_PIO_PORTE, 15, 0);
|
||||||
|
|
||||||
ret = atmel_mci_init((void *)ATMEL_BASE_MCI1);
|
ret = atmel_mci_init(boot_mode_sf ? mci0 : mci1);
|
||||||
if (ret) /* eMMC init failed, skip it. */
|
if (ret) /* eMMC init failed, skip it. */
|
||||||
at91_set_pio_output(AT91_PIO_PORTE, 15, 0);
|
at91_set_pio_output(AT91_PIO_PORTE, 15, 0);
|
||||||
|
|
||||||
/* Enable the power supply to On-board MicroSD */
|
/* Enable the power supply to On-board MicroSD */
|
||||||
at91_set_pio_output(AT91_PIO_PORTE, 17, 0);
|
at91_set_pio_output(AT91_PIO_PORTE, 17, 0);
|
||||||
ret = atmel_mci_init((void *)ATMEL_BASE_MCI0);
|
ret = atmel_mci_init(boot_mode_sf ? mci1 : mci0);
|
||||||
if (ret) /* uSD init failed, power it down. */
|
if (ret) /* uSD init failed, power it down. */
|
||||||
at91_set_pio_output(AT91_PIO_PORTE, 17, 1);
|
at91_set_pio_output(AT91_PIO_PORTE, 17, 1);
|
||||||
|
|
||||||
|
@ -274,6 +279,14 @@ int board_early_init_f(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void board_identify(void)
|
||||||
|
{
|
||||||
|
struct spi_flash *sf;
|
||||||
|
sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS,
|
||||||
|
CONFIG_SF_DEFAULT_SPEED, CONFIG_SF_DEFAULT_MODE);
|
||||||
|
boot_mode_sf = (sf != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
int board_init(void)
|
int board_init(void)
|
||||||
{
|
{
|
||||||
/* adress of boot parameters */
|
/* adress of boot parameters */
|
||||||
|
@ -299,6 +312,8 @@ int board_init(void)
|
||||||
at91_udp_hw_init();
|
at91_udp_hw_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
board_identify();
|
||||||
|
|
||||||
/* Reset CAN controllers */
|
/* Reset CAN controllers */
|
||||||
at91_set_pio_output(AT91_PIO_PORTB, 21, 0);
|
at91_set_pio_output(AT91_PIO_PORTB, 21, 0);
|
||||||
udelay(100);
|
udelay(100);
|
||||||
|
@ -308,6 +323,12 @@ int board_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int board_late_init(void)
|
||||||
|
{
|
||||||
|
setenv("bootmode", boot_mode_sf ? "sf" : "emmc");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int dram_init(void)
|
int dram_init(void)
|
||||||
{
|
{
|
||||||
gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
|
gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
|
||||||
|
@ -344,6 +365,7 @@ void spl_board_init(void)
|
||||||
ma5d4evk_mci0_hw_init();
|
ma5d4evk_mci0_hw_init();
|
||||||
ma5d4evk_mci1_hw_init();
|
ma5d4evk_mci1_hw_init();
|
||||||
#endif
|
#endif
|
||||||
|
board_identify();
|
||||||
}
|
}
|
||||||
|
|
||||||
void board_boot_order(u32 *spl_boot_list)
|
void board_boot_order(u32 *spl_boot_list)
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "at91-sama5_common.h"
|
#include "at91-sama5_common.h"
|
||||||
#undef CONFIG_BOOTARGS
|
#undef CONFIG_BOOTARGS
|
||||||
#define CONFIG_SYS_USE_SERIALFLASH 1
|
#define CONFIG_SYS_USE_SERIALFLASH 1
|
||||||
|
#define CONFIG_BOARD_LATE_INIT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory configurations
|
* Memory configurations
|
||||||
|
@ -174,18 +175,23 @@
|
||||||
"nfsargs=" \
|
"nfsargs=" \
|
||||||
"setenv bootargs root=/dev/nfs rw " \
|
"setenv bootargs root=/dev/nfs rw " \
|
||||||
"nfsroot=${serverip}:${rootpath},v3,tcp\0" \
|
"nfsroot=${serverip}:${rootpath},v3,tcp\0" \
|
||||||
|
"fdtimg=if test ${bootmode} = \"sf\" ; then " \
|
||||||
|
"setenv kernel_fdt 1 ; " \
|
||||||
|
"else ; " \
|
||||||
|
"setenv kernel_fdt 2 ; " \
|
||||||
|
"fi\0" \
|
||||||
"mmc_mmc=" \
|
"mmc_mmc=" \
|
||||||
"run mmcload mmcargs addargs ; " \
|
"run fdtimg mmcload mmcargs addargs ; " \
|
||||||
"bootm ${kernel_addr_r}\0" \
|
"bootm ${kernel_addr_r}:kernel@1 - ${kernel_addr_r}:fdt@${kernel_fdt}\0" \
|
||||||
"mmc_nfs=" \
|
"mmc_nfs=" \
|
||||||
"run mmcload nfsargs addip addargs ; " \
|
"run fdtimg mmcload nfsargs addip addargs ; " \
|
||||||
"bootm ${kernel_addr_r}\0" \
|
"bootm ${kernel_addr_r}:kernel@1 - ${kernel_addr_r}:fdt@${kernel_fdt}\0" \
|
||||||
"net_mmc=" \
|
"net_mmc=" \
|
||||||
"run netload mmcargs addargs ; " \
|
"run fdtimg netload mmcargs addargs ; " \
|
||||||
"bootm ${kernel_addr_r}\0" \
|
"bootm ${kernel_addr_r}:kernel@1 - ${kernel_addr_r}:fdt@${kernel_fdt}\0" \
|
||||||
"net_nfs=" \
|
"net_nfs=" \
|
||||||
"run netload nfsargs addip addargs ; " \
|
"run fdtimg netload nfsargs addip addargs ; " \
|
||||||
"bootm ${kernel_addr_r}\0" \
|
"bootm ${kernel_addr_r}:kernel@1 - ${kernel_addr_r}:fdt@${kernel_fdt}\0" \
|
||||||
"try_bootscript=" \
|
"try_bootscript=" \
|
||||||
"mmc rescan;" \
|
"mmc rescan;" \
|
||||||
"if test -e mmc 1:1 ${bootscript} ; then " \
|
"if test -e mmc 1:1 ${bootscript} ; then " \
|
||||||
|
|
Loading…
Add table
Reference in a new issue