Skip to content
Permalink
Browse files
u-boot-rt: support boot from emmc with SPI ROM
  • Loading branch information
BPI-SINOVOIP committed Sep 13, 2018
1 parent bb590a4 commit c8e8e9cea4e84934744a100727975cd912f1fc73
@@ -111,10 +111,23 @@
* pddrive_nf0, pddrive_nf1, pddrive_nf2, pddrive_nf3, pddrive_nf4 ; for sdr50
* pddrive_nf0, pddrive_nf1, pddrive_nf2, pddrive_nf3, pddrive_nf4 ; for hs200
*/

sdio@98010A00 {
compatible = "Realtek,rtk1295-sdio";
status = "disabled";
};

sdmmc@98010400 {
compatible = "Realtek,rtk1295-sdmmc";
status = "okay";
/* status = "disabled"; */
};

emmc@98012000 {
compatible = "Realtek,rtk1295-emmc";
pddrive_nf_s0 = <0x77 0x77 0x77 0x77 0x77>;
pddrive_nf_s2 = <0xbb 0xbb 0xbb 0xbb 0xbb>;
phase_tuning = <1 1>; /* BPI arg0: tx tuning switch, arg1: rx tuning switch*/
};

dptx@9803D000 {
@@ -66,6 +66,11 @@ DECLARE_GLOBAL_DATA_PTR;

ulong monitor_flash_len;

#ifdef BPI
#else
int bpi_boot=0; // 0: SD 1: eMMC
#endif

#ifdef CONFIG_HAS_DATAFLASH
extern int AT91F_DataflashInit(void);
extern void dataflash_print_info(void);
@@ -746,6 +751,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
EXECUTE_CUSTOMIZE_FUNC(0); // insert execute customer callback at here
if(bringup_mmc_driver() < 0) {
printf("[ERR] bringup mmc failed\n");
bpi_boot=0; // 0: SD 1: eMMC
}
#endif
#endif
@@ -761,6 +767,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
extern int sd_card_init(void);
if( sd_card_init() != 0 ) {
puts("SD: initialize card failed\n");
bpi_boot=1; // 0: SD 1: eMMC
}
#endif /* CONFIG_SYS_RTK_SD_FLASH */
#endif /* CONFIG_RTK_SD */
@@ -797,6 +804,12 @@ void board_init_r(gd_t *id, ulong dest_addr)
else
set_default_env(NULL);

#ifdef BPI
#else
if(bpi_boot) {
setenv("device", "mmc");
}
#endif
#if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI)
arm_pci_init();
#endif
@@ -17,7 +17,11 @@ extern void RTK_power_saving(void);
DECLARE_GLOBAL_DATA_PTR;

const struct rtd1295_sysinfo sysinfo = {
#ifdef BPI
"Board: Realtek QA Board\n"
#else
"Board: Banana Pi BPI-W2 (RTD1296)\n"
#endif
};

/**
@@ -1,5 +1,6 @@

#./build_bananapi.sh 1296 b00 spi
#./build_bananapi.sh 1296 b00 sd
#./build_bananapi.sh 1296 b00 emmc
./buildw2.sh sd
./bpi-uimgz.sh
@@ -527,7 +527,7 @@ int boot_from_sd(void)
if ((filename = getenv("sd_boot_dtb")) == NULL) {
filename =(char*) CONFIG_BOOT_FROM_SD_DTB;
}
sprintf(tmpbuf, "fatload sd 0:1 %s %s", getenv("fdt_loadaddr"), filename);
sprintf(tmpbuf, "fatload %s 0:1 %s %s", getenv("device"), getenv("fdt_loadaddr"), filename);
if (run_command(tmpbuf, 0) != 0) {
DDDDRED("load %s to %s failed\n", filename, getenv("fdt_loadaddr"));
goto loading_failed;
@@ -552,7 +552,7 @@ int boot_from_sd(void)
#endif
}
else {
sprintf(tmpbuf, "fatload sd 0:1 %s %s", getenv("rootfs_loadaddr"), filename);
sprintf(tmpbuf, "fatload %s 0:1 %s %s", getenv("device"), getenv("rootfs_loadaddr"), filename);
if (run_command(tmpbuf, 0) != 0) {
DDDDRED("load %s to %s failed\n", filename, getenv("rootfs_loadaddr"));
#if 0 /* it is not essential for ubuntu kernel */
@@ -582,7 +582,7 @@ int boot_from_sd(void)
}
else
{
sprintf(tmpbuf, "fatload sd 0:1 %s %s", getenv("kernel_loadaddr"), filename);
sprintf(tmpbuf, "fatload %s 0:1 %s %s", getenv("device"), getenv("kernel_loadaddr"), filename);
if (run_command(tmpbuf, 0) != 0) {
DDDDRED("load %s to %s failed\n", filename, getenv("kernel_loadaddr"));
goto loading_failed;
@@ -634,7 +634,7 @@ int boot_from_sd(void)
}
else
{
sprintf(tmpbuf, "fatload sd 0:1 %s %s", getenv("audio_loadaddr"), filename);
sprintf(tmpbuf, "fatload %s 0:1 %s %s", getenv("device"), getenv("audio_loadaddr"), filename);
if (run_command(tmpbuf, 0) != 0) {
DDDDRED("load %s to %s failed\n", filename, getenv("audio_loadaddr"));
goto loading_failed;
@@ -646,6 +646,7 @@ int boot_from_sd(void)
boot_mode = BOOT_RESCUE_MODE;

#ifdef CONFIG_WAIT_AFW_1_SECOND
printf("CONFIG_WAIT_AFW_1_SECOND on\n");
mdelay(1000); /* wait audio fw log print out */
#endif

@@ -18,6 +18,8 @@
#include <div64.h>
#include <asm/arch/rtkemmc.h>

//BPI
#define CONFIG_SYS_RTK_EMMC_FLASH
#define SUPPORT_HS200
#define SUPPORT_WRITE_PROT
//#define MMC_DEBUG
@@ -1774,11 +1774,14 @@ int rtkemmc_Stream( unsigned int cmd_idx,UINT32 blk_addr, UINT32 dma_addr, UINT3
if (CMD_IDX_MASK(cmd_idx)==MMC_READ_SINGLE_BLOCK || CMD_IDX_MASK(cmd_idx)==MMC_READ_MULTIPLE_BLOCK ||
CMD_IDX_MASK(cmd_idx)==MMC_SEND_EXT_CSD || CMD_IDX_MASK(cmd_idx)==MMC_SEND_WRITE_PROT_TYPE) {

#ifdef BPI
if (dma_addr >= 0x20000 && dma_addr < 0xe0000){

printf("panic: dma_addr = 0x%08x \n", dma_addr);
while(1);
}
#else
#endif

wait_done_timeout((UINT32 *)CR_EMMC_ISR, 0x2, 0x2); //dma_done_int
cr_writel(0x2, CR_EMMC_ISR);
@@ -58,6 +58,8 @@ void pcb_gen_kernel_cmd_line(char *buffer, PCB_ENUM_T *ppcb_enum) {
extern BOOT_FLASH_T boot_flash_type;
unsigned int pcb_get_boot_flash_type(void)
{
#ifdef BPI
/*
#if defined(CONFIG_SYS_RTK_SPI_FLASH)
return boot_flash_type=BOOT_NOR_SERIAL; // 0
#elif defined(CONFIG_SYS_RTK_SD_FLASH)
@@ -69,6 +71,17 @@ unsigned int pcb_get_boot_flash_type(void)
rtd_maskl(SYS_muxpad0, ~0xFFFF0FFF, 0xaaaa0aa8);
return boot_flash_type=BOOT_EMMC; // 2
#endif
*/
#else //BPI
extern int bpi_boot;
if(bpi_boot) {
rtd_maskl(SYS_muxpad0, ~0xFFFF0FFF, 0xaaaa0aa8);
return boot_flash_type=BOOT_EMMC; // 2
}
else {
return boot_flash_type=BOOT_SD; // 3
}
#endif //BPI
}

char *pcb_get_boot_flash_type_string(void)
Binary file not shown.
@@ -281,9 +281,13 @@
#define CONFIG_CMD_RUN
#define CONFIG_CMD_IMPORTENV
#define CONFIG_CMD_EXPORTENV
#define CONFIG_EFI_PARTITION
#define CONFIG_CMD_GPT
#define CONFIG_PARTITION_UUIDS
#define CONFIG_FS_EXT4
#define CONFIG_CMD_EXT4

/* USB Setting */
#define CONFIG_CMD_EXT4
#define CONFIG_CMD_FAT
#define CONFIG_FAT_WRITE
#define CONFIG_CMD_RTKMKFAT
@@ -363,7 +367,12 @@
/* Auto detect sink*/
#define CONFIG_SYS_AUTO_DETECT
#define CONFIG_HDMITX_MODE 1 // 0:Always OFF, 1: Always ON, 2: Auto
/* drivers/logo_disp/rtk_rpc.h */
#ifdef BPI
#define CONFIG_DEFAULT_TV_SYSTEM 25 //1080P_60
#else
#define CONFIG_DEFAULT_TV_SYSTEM 13 //720P_60
#endif

/* If partition table */
#ifndef CONFIG_PARTITIONS
@@ -67,7 +67,7 @@
#define CONFIG_CMD_RTKGPT
#define CONFIG_CMD_RTKFDT

//#define CONFIG_WAIT_AFW_1_SECOND
#define CONFIG_WAIT_AFW_1_SECOND

/* ENV */
#undef CONFIG_ENV_SIZE

0 comments on commit c8e8e9c

Please sign in to comment.