mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
projects/Amlogic: LePotato: allow booting from eMMC
Requires direct burning the image to eMMC using dd
This commit is contained in:
parent
8f4f5eaed4
commit
adfbee2df4
@ -32,6 +32,8 @@ bootm loados
|
||||
bootm fdt
|
||||
if test "${vpu}" = "0"; then fdt rm /mesonstream; fdt rm /vdec; fdt rm /ppmgr; fi
|
||||
if test "${hdmioutput}" = "0"; then fdt rm /mesonfb; fi
|
||||
# Remove aml partition layout from device tree (required for eMMC boot)
|
||||
fdt rm /partitions
|
||||
bootm prep
|
||||
|
||||
# Boot the board
|
||||
|
@ -1,5 +1,21 @@
|
||||
From 2896063602000eb099eb0774d001bbdc76df264a Mon Sep 17 00:00:00 2001
|
||||
From: kszaq <kszaquitto@gmail.com>
|
||||
Date: Mon, 12 Feb 2018 22:44:10 +0100
|
||||
Subject: [PATCH] libretech_cc: amend boot procedure for LibreELEC
|
||||
|
||||
* make eMMC use MBR instead of AML partition structure
|
||||
* port eMMC/SD renumbering from Hardkernel to allow booting from either SD or eMMC
|
||||
* remove NAND driver (not in use)
|
||||
* remove fastboot, bcb, store interface (not in use and conflicts with eMMC MBR)
|
||||
* remove preboot steps that are not requried for faster booting
|
||||
---
|
||||
board/amlogic/configs/libretech_cc.h | 47 ++++----------------
|
||||
board/amlogic/libretech_cc/libretech_cc.c | 71 ++++++++++++++-----------------
|
||||
drivers/mmc/aml_sd_emmc.c | 1 -
|
||||
3 files changed, 41 insertions(+), 78 deletions(-)
|
||||
|
||||
diff --git a/board/amlogic/configs/libretech_cc.h b/board/amlogic/configs/libretech_cc.h
|
||||
index b3ccfae..6052a87 100644
|
||||
index b3ccfae..84f66ae 100644
|
||||
--- a/board/amlogic/configs/libretech_cc.h
|
||||
+++ b/board/amlogic/configs/libretech_cc.h
|
||||
@@ -45,10 +45,10 @@
|
||||
@ -15,7 +31,20 @@ index b3ccfae..6052a87 100644
|
||||
|
||||
/* SMP Definitinos */
|
||||
#define CPU_RELEASE_ADDR secondary_boot_func
|
||||
@@ -209,7 +209,7 @@
|
||||
@@ -62,12 +62,6 @@
|
||||
/* support ext4*/
|
||||
#define CONFIG_CMD_EXT4 1
|
||||
|
||||
-/* Bootloader Control Block function
|
||||
- That is used for recovery and the bootloader to talk to each other
|
||||
- */
|
||||
-#define CONFIG_BOOTLOADER_CONTROL_BLOCK
|
||||
-
|
||||
-
|
||||
/* Serial config */
|
||||
#define CONFIG_CONS_INDEX 2
|
||||
#define CONFIG_BAUDRATE 115200
|
||||
@@ -209,7 +203,7 @@
|
||||
"if imgread kernel ${recovery_part} ${loadaddr} ${recovery_offset}; then wipeisb; bootm ${loadaddr}; fi;"\
|
||||
"\0"\
|
||||
"init_display="\
|
||||
@ -24,7 +53,7 @@ index b3ccfae..6052a87 100644
|
||||
"\0"\
|
||||
"cmdline_keys="\
|
||||
"if keyman init 0x1234; then "\
|
||||
@@ -236,15 +236,8 @@
|
||||
@@ -236,17 +230,10 @@
|
||||
"\0"\
|
||||
|
||||
#define CONFIG_PREBOOT \
|
||||
@ -37,12 +66,25 @@ index b3ccfae..6052a87 100644
|
||||
- "run switch_bootmode;" \
|
||||
- "cfgload;"
|
||||
-#define CONFIG_BOOTCOMMAND "run storeboot"
|
||||
-
|
||||
-//#define CONFIG_ENV_IS_NOWHERE 1
|
||||
+ "run init_display;"
|
||||
+#define CONFIG_BOOTCOMMAND "cfgload"
|
||||
|
||||
//#define CONFIG_ENV_IS_NOWHERE 1
|
||||
+
|
||||
+#define CONFIG_ENV_IS_NOWHERE 1
|
||||
#define CONFIG_ENV_SIZE (64*1024)
|
||||
@@ -298,7 +291,7 @@
|
||||
#define CONFIG_FIT 1
|
||||
#define CONFIG_OF_LIBFDT 1
|
||||
@@ -283,7 +270,7 @@
|
||||
#define CONFIG_DDR_USE_EXT_VREF 0 //0:disable, 1:enable. ddr use external vref
|
||||
|
||||
/* storage: emmc/nand/sd */
|
||||
-#define CONFIG_STORE_COMPATIBLE 1
|
||||
+//#define CONFIG_STORE_COMPATIBLE 1
|
||||
/*
|
||||
* storage
|
||||
* |---------|---------|
|
||||
@@ -298,7 +285,7 @@
|
||||
/* support for mtd */
|
||||
//#define CONFIG_AML_MTD 1
|
||||
/* support for nftl */
|
||||
@ -51,20 +93,89 @@ index b3ccfae..6052a87 100644
|
||||
|
||||
#if defined(CONFIG_AML_NAND) && defined(CONFIG_AML_MTD)
|
||||
#error CONFIG_AML_NAND/CONFIG_AML_MTD can not support at the sametime;
|
||||
@@ -390,7 +383,7 @@
|
||||
@@ -389,21 +376,6 @@
|
||||
#define CONFIG_USB_XHCI_AMLOGIC_GXL 1
|
||||
#endif //#if defined(CONFIG_CMD_USB)
|
||||
|
||||
//UBOOT fastboot config
|
||||
-//UBOOT fastboot config
|
||||
-#define CONFIG_CMD_FASTBOOT 1
|
||||
+// #define CONFIG_CMD_FASTBOOT 1
|
||||
#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1
|
||||
#define CONFIG_FASTBOOT_FLASH 1
|
||||
#define CONFIG_USB_GADGET 1
|
||||
-#define CONFIG_FASTBOOT_FLASH_MMC_DEV 1
|
||||
-#define CONFIG_FASTBOOT_FLASH 1
|
||||
-#define CONFIG_USB_GADGET 1
|
||||
-#define CONFIG_USBDOWNLOAD_GADGET 1
|
||||
-#define CONFIG_SYS_CACHELINE_SIZE 64
|
||||
-#define CONFIG_DEVICE_PRODUCT "libretech-cc"
|
||||
-
|
||||
-//UBOOT Facotry usb/sdcard burning config
|
||||
-#define CONFIG_AML_V2_FACTORY_BURN 1 //support facotry usb burning
|
||||
-#define CONFIG_AML_FACTORY_BURN_LOCAL_UPGRADE 1 //support factory sdcard burning
|
||||
-#define CONFIG_POWER_KEY_NOT_SUPPORTED_FOR_BURN 1 //There isn't power-key for factory sdcard burning
|
||||
-#define CONFIG_SD_BURNING_SUPPORT_UI 1 //Displaying upgrading progress bar when sdcard/udisk burning
|
||||
-
|
||||
#define CONFIG_AML_SECURITY_KEY 1
|
||||
#ifndef DTB_BIND_KERNEL
|
||||
#define CONFIG_UNIFY_KEY_MANAGE 1
|
||||
@@ -449,7 +421,6 @@
|
||||
|
||||
/*file system*/
|
||||
#define CONFIG_DOS_PARTITION 1
|
||||
-#define CONFIG_AML_PARTITION 1
|
||||
#define CONFIG_MMC 1
|
||||
#define CONFIG_FS_FAT 1
|
||||
#define CONFIG_FS_EXT4 1
|
||||
diff --git a/board/amlogic/libretech_cc/libretech_cc.c b/board/amlogic/libretech_cc/libretech_cc.c
|
||||
index 33bd007..b1748d9 100644
|
||||
index 33bd007..fa66aaa 100644
|
||||
--- a/board/amlogic/libretech_cc/libretech_cc.c
|
||||
+++ b/board/amlogic/libretech_cc/libretech_cc.c
|
||||
@@ -417,13 +417,6 @@ U_BOOT_CMD(hdmi_init, CONFIG_SYS_MAXARGS, 0, do_hdmi_init,
|
||||
@@ -71,6 +71,23 @@ int dram_init(void)
|
||||
void secondary_boot_func(void)
|
||||
{
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Discover the boot device within MicroSD or eMMC
|
||||
+ * and return 1 for eMMC, otherwise 0.
|
||||
+ */
|
||||
+#define BOOT_DEVICE_RESERVED 0
|
||||
+#define BOOT_DEVICE_EMMC 1
|
||||
+#define BOOT_DEVICE_NAND 2
|
||||
+#define BOOT_DEVICE_SPI 3
|
||||
+#define BOOT_DEVICE_SD 4
|
||||
+#define BOOT_DEVICE_USB 5
|
||||
+
|
||||
+int get_boot_device(void)
|
||||
+{
|
||||
+ return readl(AO_SEC_GP_CFG0) & 0xf;
|
||||
+}
|
||||
+
|
||||
void internalPhyConfig(struct phy_device *phydev)
|
||||
{
|
||||
/*Enable Analog and DSP register Bank access by*/
|
||||
@@ -263,8 +280,21 @@ int board_mmc_init(bd_t *bis)
|
||||
#else
|
||||
//board_mmc_register(SDIO_PORT_B);
|
||||
#endif
|
||||
- board_mmc_register(SDIO_PORT_B);
|
||||
- board_mmc_register(SDIO_PORT_C);
|
||||
+ switch (get_boot_device())
|
||||
+ {
|
||||
+ case BOOT_DEVICE_EMMC:
|
||||
+ board_mmc_register(SDIO_PORT_C); // "mmc0"
|
||||
+ board_mmc_register(SDIO_PORT_B);
|
||||
+ break;
|
||||
+ case BOOT_DEVICE_SD:
|
||||
+ board_mmc_register(SDIO_PORT_B); // "mmc0"
|
||||
+ board_mmc_register(SDIO_PORT_C);
|
||||
+ break;
|
||||
+ default:
|
||||
+ printf("No available mmc device! Check boot device!\n");
|
||||
+ do_reset(NULL, 0, 0, NULL);
|
||||
+ break;
|
||||
+ }
|
||||
// board_mmc_register(SDIO_PORT_B1);
|
||||
#if defined(CONFIG_ENV_IS_NOWHERE) && defined(CONFIG_AML_SD_EMMC)
|
||||
/* try emmc here. */
|
||||
@@ -417,49 +447,12 @@ U_BOOT_CMD(hdmi_init, CONFIG_SYS_MAXARGS, 0, do_hdmi_init,
|
||||
#endif
|
||||
#ifdef CONFIG_BOARD_LATE_INIT
|
||||
int board_late_init(void){
|
||||
@ -78,20 +189,54 @@ index 33bd007..b1748d9 100644
|
||||
#ifndef CONFIG_AML_IRDETECT_EARLY
|
||||
/* after */
|
||||
run_command("cvbs init;hdmitx hpd", 0);
|
||||
@@ -448,16 +441,10 @@ int board_late_init(void){
|
||||
#elif defined(CONFIG_DTB_MEM_ADDR)
|
||||
{
|
||||
char cmd[128];
|
||||
run_command("vout output $outputmode", 0);
|
||||
#endif
|
||||
/*add board late init function here*/
|
||||
-#ifndef DTB_BIND_KERNEL
|
||||
- int ret;
|
||||
- ret = run_command("store dtb read $dtb_mem_addr", 1);
|
||||
- if (ret) {
|
||||
- printf("%s(): [store dtb read $dtb_mem_addr] fail\n", __func__);
|
||||
- #ifdef CONFIG_DTB_MEM_ADDR
|
||||
- char cmd[64];
|
||||
- printf("load dtb to %x\n", CONFIG_DTB_MEM_ADDR);
|
||||
- sprintf(cmd, "store dtb read %x", CONFIG_DTB_MEM_ADDR);
|
||||
- ret = run_command(cmd, 1);
|
||||
- if (ret) {
|
||||
- printf("%s(): %s fail\n", __func__, cmd);
|
||||
- }
|
||||
- #endif
|
||||
- }
|
||||
-#elif defined(CONFIG_DTB_MEM_ADDR)
|
||||
- {
|
||||
- char cmd[128];
|
||||
- int ret;
|
||||
if (!getenv("dtb_mem_addr")) {
|
||||
sprintf(cmd, "setenv dtb_mem_addr 0x%x", CONFIG_DTB_MEM_ADDR);
|
||||
run_command(cmd, 0);
|
||||
}
|
||||
- if (!getenv("dtb_mem_addr")) {
|
||||
- sprintf(cmd, "setenv dtb_mem_addr 0x%x", CONFIG_DTB_MEM_ADDR);
|
||||
- run_command(cmd, 0);
|
||||
- }
|
||||
- sprintf(cmd, "imgread dtb boot ${dtb_mem_addr}");
|
||||
- ret = run_command(cmd, 0);
|
||||
- if (ret) {
|
||||
- printf("%s(): cmd[%s] fail, ret=%d\n", __func__, cmd, ret);
|
||||
- }
|
||||
}
|
||||
#endif// #ifndef DTB_BIND_KERNEL
|
||||
- }
|
||||
-#endif// #ifndef DTB_BIND_KERNEL
|
||||
#ifdef CONFIG_AML_V2_FACTORY_BURN
|
||||
if (0x1b8ec003 == readl(P_PREG_STICKY_REG2))
|
||||
aml_try_factory_usb_burning(1, gd->bd);
|
||||
diff --git a/drivers/mmc/aml_sd_emmc.c b/drivers/mmc/aml_sd_emmc.c
|
||||
index 57f949d..6ea60ee 100644
|
||||
--- a/drivers/mmc/aml_sd_emmc.c
|
||||
+++ b/drivers/mmc/aml_sd_emmc.c
|
||||
@@ -786,7 +786,6 @@ void sd_emmc_register(struct aml_card_sd_info * aml_priv)
|
||||
#endif
|
||||
cfg->f_min = 400000;
|
||||
cfg->f_max = 40000000;
|
||||
- cfg->part_type = PART_TYPE_AML;
|
||||
cfg->b_max = 256;
|
||||
mmc_create(cfg,aml_priv);
|
||||
}
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user