summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfang hui <hui.fang@freescale.com>2016-08-25 12:29:49 +0800
committerfang hui <hui.fang@freescale.com>2016-08-25 12:33:23 +0800
commiteeb692a379202a4d5edbcc2c4dbaff13be36f090 (patch)
tree45a1fe1b8b7b37b6c91298ac22118ad6d003ec1a
parentbc5cea6a517ce6517d2fee0a160893d35f9b09af (diff)
downloadu-boot-imx-eeb692a379202a4d5edbcc2c4dbaff13be36f090.zip
u-boot-imx-eeb692a379202a4d5edbcc2c4dbaff13be36f090.tar.gz
u-boot-imx-eeb692a379202a4d5edbcc2c4dbaff13be36f090.tar.bz2
MA-8615 - [brillo] support gpt for pico-emmc
. for pico, add CONFIG_EFI_PARTITION to support gpt . for pico, save boot_para in boot0 area . align partition sequence as brillo defined boot_a, boot_b, system_a, system_b, oem_a, oem_b, misc, userdata, fbmic . in fsl_caam.c, use mask 0xffffffc0 to assure the addr is 64 bytes align Signed-off-by: fang hui <hui.fang@freescale.com>
-rwxr-xr-xdrivers/crypto/fsl_caam.c54
-rw-r--r--drivers/usb/gadget/f_fastboot.c132
-rw-r--r--include/configs/mx6ul_14x14_evk_android.h25
-rw-r--r--include/configs/mx6ul_14x14_evk_brillo.h6
-rw-r--r--include/configs/picosom-imx6ul.h3
-rw-r--r--include/fsl_fastboot.h2
6 files changed, 154 insertions, 68 deletions
diff --git a/drivers/crypto/fsl_caam.c b/drivers/crypto/fsl_caam.c
index 4ba4718..3ae9bf7 100755
--- a/drivers/crypto/fsl_caam.c
+++ b/drivers/crypto/fsl_caam.c
@@ -86,6 +86,8 @@ static uint8_t skeymod[] = {
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00
};
+/* arm v7 need 64 align */
+#define ALIGN_MASK 0xffffffc0
/*!
* Secure memory run command.
@@ -155,14 +157,14 @@ uint32_t caam_decap_blob(uint32_t plain_text, uint32_t blob_addr, uint32_t size)
/* Add job to input ring */
g_input_ring[0] = (uint32_t)decap_dsc;
- flush_dcache_range((uint32_t)blob_addr & 0xffffffe0,
- ((uint32_t)blob_addr & 0xffffffe0) + 2*size);
- flush_dcache_range((uint32_t)plain_text & 0xffffffe0,
- ((uint32_t)plain_text & 0xffffffe0) + 2*size);
- flush_dcache_range((uint32_t)decap_dsc & 0xffffffe0,
- ((uint32_t)decap_dsc & 0xffffffe0) + 128);
- flush_dcache_range((uint32_t)g_input_ring & 0xffffffe0,
- ((uint32_t)g_input_ring & 0xffffffe0) + 128);
+ flush_dcache_range((uint32_t)blob_addr & ALIGN_MASK,
+ ((uint32_t)blob_addr & ALIGN_MASK) + 2*size);
+ flush_dcache_range((uint32_t)plain_text & ALIGN_MASK,
+ ((uint32_t)plain_text & ALIGN_MASK) + 2*size);
+ flush_dcache_range((uint32_t)decap_dsc & ALIGN_MASK,
+ ((uint32_t)decap_dsc & ALIGN_MASK) + 128);
+ flush_dcache_range((uint32_t)g_input_ring & ALIGN_MASK,
+ ((uint32_t)g_input_ring & ALIGN_MASK) + 128);
/* Increment jobs added */
__raw_writel(1, CAAM_IRJAR0);
@@ -170,8 +172,8 @@ uint32_t caam_decap_blob(uint32_t plain_text, uint32_t blob_addr, uint32_t size)
while(__raw_readl(CAAM_ORSFR0) != 1);
// TODO: check if Secure memory is cacheable.
- invalidate_dcache_range((uint32_t)g_output_ring & 0xffffffe0,
- ((uint32_t)g_output_ring & 0xffffffe0) + 128);
+ invalidate_dcache_range((uint32_t)g_output_ring & ALIGN_MASK,
+ ((uint32_t)g_output_ring & ALIGN_MASK) + 128);
/* check that descriptor address is the one expected in the output ring */
if(g_output_ring[0] == (uint32_t)decap_dsc)
{
@@ -187,8 +189,8 @@ uint32_t caam_decap_blob(uint32_t plain_text, uint32_t blob_addr, uint32_t size)
printf("Error: blob decap job output ring descriptor address does" \
" not match\n");
}
- flush_dcache_range((uint32_t)plain_text & 0xffffffe0,
- ((uint32_t)plain_text & 0xffffffe0) + 2*size);
+ flush_dcache_range((uint32_t)plain_text & ALIGN_MASK,
+ ((uint32_t)plain_text & ALIGN_MASK) + 2*size);
/* Remove job from Job Ring Output Queue */
@@ -254,12 +256,12 @@ uint32_t caam_gen_blob(uint32_t plain_data_addr, uint32_t blob_addr, uint32_t si
/* Add job to input ring */
g_input_ring[0] = (uint32_t)encap_dsc;
- flush_dcache_range((uint32_t)plain_data_addr & 0xffffffe0,
- ((uint32_t)plain_data_addr & 0xffffffe0) + size);
- flush_dcache_range((uint32_t)encap_dsc & 0xffffffe0,
- ((uint32_t)encap_dsc & 0xffffffe0) + 128);
- flush_dcache_range((uint32_t)blob & 0xffffffe0,
- ((uint32_t)g_input_ring & 0xffffffe0) + 2 * size);
+ flush_dcache_range((uint32_t)plain_data_addr & ALIGN_MASK,
+ ((uint32_t)plain_data_addr & ALIGN_MASK) + size);
+ flush_dcache_range((uint32_t)encap_dsc & ALIGN_MASK,
+ ((uint32_t)encap_dsc & ALIGN_MASK) + 128);
+ flush_dcache_range((uint32_t)blob & ALIGN_MASK,
+ ((uint32_t)g_input_ring & ALIGN_MASK) + 2 * size);
/* Increment jobs added */
__raw_writel(1, CAAM_IRJAR0);
@@ -267,10 +269,10 @@ uint32_t caam_gen_blob(uint32_t plain_data_addr, uint32_t blob_addr, uint32_t si
while(__raw_readl(CAAM_ORSFR0) != 1);
// flush cache
- invalidate_dcache_range((uint32_t)g_output_ring & 0xffffffe0,
- ((uint32_t)g_output_ring & 0xffffffe0) + 128);
- invalidate_dcache_range((uint32_t)g_output_ring & 0xffffffe0,
- ((uint32_t)g_output_ring & 0xffffffe0) + 128);
+ invalidate_dcache_range((uint32_t)g_output_ring & ALIGN_MASK,
+ ((uint32_t)g_output_ring & ALIGN_MASK) + 128);
+ invalidate_dcache_range((uint32_t)g_output_ring & ALIGN_MASK,
+ ((uint32_t)g_output_ring & ALIGN_MASK) + 128);
/* check that descriptor address is the one expected in the output ring */
if(g_output_ring[0] == (uint32_t)encap_dsc)
{
@@ -362,8 +364,8 @@ void caam_open(void)
/* Add job to input ring */
g_input_ring[0] = (uint32_t)rng_inst_dsc;
- flush_dcache_range((uint32_t)g_input_ring & 0xffffffe0,
- ((uint32_t)g_input_ring & 0xffffffe0) + 128);
+ flush_dcache_range((uint32_t)g_input_ring & ALIGN_MASK,
+ ((uint32_t)g_input_ring & ALIGN_MASK) + 128);
/* Increment jobs added */
__raw_writel(1, CAAM_IRJAR0);
@@ -371,8 +373,8 @@ void caam_open(void)
while(__raw_readl(CAAM_ORSFR0) != 1);
- invalidate_dcache_range((uint32_t)g_output_ring & 0xffffffe0,
- ((uint32_t)g_output_ring & 0xffffffe0) + 128);
+ invalidate_dcache_range((uint32_t)g_output_ring & ALIGN_MASK,
+ ((uint32_t)g_output_ring & ALIGN_MASK) + 128);
/* check that descriptor address is the one expected in the out ring */
if(g_output_ring[0] == (uint32_t)rng_inst_dsc)
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index b22ec76..1fd551c 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -152,6 +152,12 @@ static struct usb_gadget_strings *fastboot_strings[] = {
#ifdef CONFIG_FSL_FASTBOOT
+
+#ifdef CONFIG_EFI_PARTITION
+#define ANDROID_GPT_OFFSET 0
+#define ANDROID_GPT_SIZE 0x10000
+#endif
+
#define ANDROID_MBR_OFFSET 0
#define ANDROID_MBR_SIZE 0x200
#define ANDROID_BOOTLOADER_OFFSET 0x400
@@ -170,6 +176,28 @@ static struct usb_gadget_strings *fastboot_strings[] = {
/*pentry index internally*/
+#ifdef CONFIG_BRILLO_SUPPORT
+
+enum {
+#ifdef CONFIG_EFI_PARTITION
+ PTN_GPT_INDEX = 0,
+#endif
+ PTN_MBR_INDEX = 0,
+ PTN_BOOTLOADER_INDEX,
+ PTN_BOOT_A_INDEX,
+ PTN_BOOT_B_INDEX,
+ PTN_SYSTEM_A_INDEX,
+ PTN_SYSTEM_B_INDEX,
+ PTN_ODM_A_INDEX,
+ PTN_ODM_B_INDEX,
+ PTN_MISC_INDEX,
+ PTN_DATA_INDEX,
+ PTN_FBMISC_INDEX,
+ PTN_NUM
+};
+
+#else
+
enum {
PTN_MBR_INDEX = 0,
PTN_BOOTLOADER_INDEX,
@@ -178,14 +206,11 @@ enum {
PTN_SYSTEM_INDEX,
PTN_RECOVERY_INDEX,
PTN_DATA_INDEX,
-#ifdef CONFIG_BRILLO_SUPPORT
- PTN_KERNEL_B_INDEX,
- PTN_SYSTEM_B_INDEX,
- PTN_MISC_INDEX,
-#endif
PTN_NUM
};
+#endif
+
static unsigned int download_bytes_unpadded;
static struct cmd_fastboot_interface interface = {
@@ -1137,20 +1162,32 @@ static int _fastboot_parts_add_ptable_entry(int ptable_index,
struct fastboot_ptentry *ptable)
{
disk_partition_t info;
- strcpy(ptable[ptable_index].name, name);
- strcpy(ptable[ptable_index].fstype, fstype);
if (get_partition_info(dev_desc,
mmc_dos_partition_index, &info)) {
- printf("Bad partition index:%d for partition:%s\n",
- mmc_dos_partition_index, name);
+ printf("%s, Bad partition index:%d for partition:%s\n",
+ __func__, mmc_dos_partition_index, name);
return -1;
+ }
+
+ ptable[ptable_index].start = info.start;
+ ptable[ptable_index].length = info.size;
+ ptable[ptable_index].partition_id = mmc_partition_index;
+ ptable[ptable_index].partition_index = mmc_dos_partition_index;
+
+#ifdef CONFIG_EFI_PARTITION
+ strcpy(ptable[ptable_index].name, (const char *)info.name);
+ strcpy(ptable[ptable_index].fstype, (const char *)info.type);
+#else
+ strcpy(ptable[ptable_index].name, name);
+ if (!strcmp(name, "userdata") || !strcmp(name, "system_a") ||
+ !strcmp(name, "system_b")) {
+ strcpy(ptable[ptable_index].fstype, "ext4");
} else {
- ptable[ptable_index].start = info.start;
- ptable[ptable_index].length = info.size;
- ptable[ptable_index].partition_id = mmc_partition_index;
- ptable[ptable_index].partition_index = mmc_dos_partition_index;
+ strcpy(ptable[ptable_index].fstype, "emmc");
}
+#endif
+
return 0;
}
@@ -1216,11 +1253,21 @@ static int _fastboot_parts_load_from_ptable(void)
memset((char *)ptable, 0,
sizeof(struct fastboot_ptentry) * (PTN_NUM));
+
+#ifdef CONFIG_EFI_PARTITION
+ /* GPT */
+ strcpy(ptable[PTN_GPT_INDEX].name, "gpt");
+ ptable[PTN_GPT_INDEX].start = ANDROID_GPT_OFFSET / dev_desc->blksz;
+ ptable[PTN_GPT_INDEX].length = ANDROID_GPT_SIZE / dev_desc->blksz;
+ ptable[PTN_GPT_INDEX].partition_id = user_partition;
+#else
/* MBR */
strcpy(ptable[PTN_MBR_INDEX].name, "mbr");
ptable[PTN_MBR_INDEX].start = ANDROID_MBR_OFFSET / dev_desc->blksz;
ptable[PTN_MBR_INDEX].length = ANDROID_MBR_SIZE / dev_desc->blksz;
ptable[PTN_MBR_INDEX].partition_id = user_partition;
+#endif
+
/* Bootloader */
strcpy(ptable[PTN_BOOTLOADER_INDEX].name, FASTBOOT_PARTITION_BOOTLOADER);
ptable[PTN_BOOTLOADER_INDEX].start =
@@ -1230,41 +1277,48 @@ static int _fastboot_parts_load_from_ptable(void)
ptable[PTN_BOOTLOADER_INDEX].partition_id = boot_partition;
#ifdef CONFIG_BRILLO_SUPPORT
- _fastboot_parts_add_ptable_entry(PTN_KERNEL_INDEX,
+
+#ifdef CONFIG_EFI_PARTITION
+
+ int tbl_idx;
+ int part_idx = 1;
+ int ret;
+ for (tbl_idx = 2; tbl_idx < PTN_NUM; tbl_idx++) {
+ ret = _fastboot_parts_add_ptable_entry(tbl_idx,
+ part_idx++,
+ user_partition,
+ NULL,
+ NULL,
+ dev_desc, ptable);
+
+ if (ret)
+ break;
+ }
+
+#else
+
+ _fastboot_parts_add_ptable_entry(PTN_BOOT_A_INDEX,
CONFIG_ANDROID_BOOT_PARTITION_MMC,
user_partition,
FASTBOOT_PARTITION_BOOT_A,
FASTBOOT_PARTITION_BOOT_FS,
dev_desc, ptable);
- _fastboot_parts_add_ptable_entry(PTN_RECOVERY_INDEX,
- CONFIG_ANDROID_RECOVERY_PARTITION_MMC,
+ _fastboot_parts_add_ptable_entry(PTN_BOOT_B_INDEX,
+ CONFIG_ANDROID_BOOT_B_PARTITION_MMC,
user_partition,
- FASTBOOT_PARTITION_RECOVERY,
- FASTBOOT_PARTITION_RECOVERY_FS,
+ FASTBOOT_PARTITION_BOOT_B,
+ FASTBOOT_PARTITION_BOOT_FS,
dev_desc, ptable);
- _fastboot_parts_add_ptable_entry(PTN_SYSTEM_INDEX,
+
+ _fastboot_parts_add_ptable_entry(PTN_SYSTEM_A_INDEX,
CONFIG_ANDROID_SYSTEM_PARTITION_MMC,
user_partition,
FASTBOOT_PARTITION_SYSTEM_A,
FASTBOOT_PARTITION_SYSTEM_FS,
dev_desc, ptable);
- _fastboot_parts_add_ptable_entry(PTN_DATA_INDEX,
- CONFIG_ANDROID_DATA_PARTITION_MMC,
- user_partition,
- FASTBOOT_PARTITION_DATA,
- FASTBOOT_PARTITION_DATA_FS,
- dev_desc, ptable);
-
- _fastboot_parts_add_ptable_entry(PTN_KERNEL_B_INDEX,
- CONFIG_ANDROID_BOOT_B_PARTITION_MMC,
- user_partition,
- FASTBOOT_PARTITION_BOOT_B,
- FASTBOOT_PARTITION_BOOT_FS,
- dev_desc, ptable);
-
_fastboot_parts_add_ptable_entry(PTN_SYSTEM_B_INDEX,
CONFIG_ANDROID_SYSTEM_B_PARTITION_MMC,
user_partition,
@@ -1278,7 +1332,17 @@ static int _fastboot_parts_load_from_ptable(void)
FASTBOOT_PARTITION_MISC,
FASTBOOT_PARTITION_MISC_FS,
dev_desc, ptable);
-#else
+
+ _fastboot_parts_add_ptable_entry(PTN_DATA_INDEX,
+ CONFIG_ANDROID_DATA_PARTITION_MMC,
+ user_partition,
+ FASTBOOT_PARTITION_DATA,
+ FASTBOOT_PARTITION_DATA_FS,
+ dev_desc, ptable);
+
+#endif /* CONFIG_EFI_PARTITION */
+
+#else /* CONFIG_BRILLO_SUPPORT */
_fastboot_parts_add_ptable_entry(PTN_KERNEL_INDEX,
CONFIG_ANDROID_BOOT_PARTITION_MMC,
user_partition,
diff --git a/include/configs/mx6ul_14x14_evk_android.h b/include/configs/mx6ul_14x14_evk_android.h
index 71c94e0..1565597 100644
--- a/include/configs/mx6ul_14x14_evk_android.h
+++ b/include/configs/mx6ul_14x14_evk_android.h
@@ -41,11 +41,36 @@
#endif
#define CONFIG_ANDROID_MAIN_MMC_BUS 2
+
+
+#ifdef CONFIG_BRILLO_SUPPORT
+
+#ifdef CONFIG_EFI_PARTITION
+#define CONFIG_ANDROID_BOOT_PARTITION_MMC 1
+#define CONFIG_ANDROID_BOOT_B_PARTITION_MMC 2
+#define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 3
+#define CONFIG_ANDROID_SYSTEM_B_PARTITION_MMC 4
+#define CONFIG_ANDROID_MISC_PARTITION_MMC 7
+#define CONFIG_ANDROID_DATA_PARTITION_MMC 8
+#define FSL_FASTBOOT_FB_PART_NUM 9
+#else
+#define CONFIG_ANDROID_BOOT_PARTITION_MMC 1
+#define CONFIG_ANDROID_BOOT_B_PARTITION_MMC 7
+#define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 5
+#define CONFIG_ANDROID_SYSTEM_B_PARTITION_MMC 8
+#define CONFIG_ANDROID_MISC_PARTITION_MMC 9
+#define CONFIG_ANDROID_DATA_PARTITION_MMC 4
+#define FSL_FASTBOOT_FB_PART_NUM 10
+#endif
+
+#else
+
#define CONFIG_ANDROID_BOOT_PARTITION_MMC 1
#define CONFIG_ANDROID_SYSTEM_PARTITION_MMC 5
#define CONFIG_ANDROID_RECOVERY_PARTITION_MMC 2
#define CONFIG_ANDROID_CACHE_PARTITION_MMC 6
#define CONFIG_ANDROID_DATA_PARTITION_MMC 4
+#endif
#define CONFIG_CMD_BOOTA
#define CONFIG_SUPPORT_RAW_INITRD
diff --git a/include/configs/mx6ul_14x14_evk_brillo.h b/include/configs/mx6ul_14x14_evk_brillo.h
index a91ff04..50c0887 100644
--- a/include/configs/mx6ul_14x14_evk_brillo.h
+++ b/include/configs/mx6ul_14x14_evk_brillo.h
@@ -8,9 +8,6 @@
#ifndef __MX6UL_EVK_BRILLO_H
#define __MX6UL_EVK_BRILLO_H
-#define CONFIG_ANDROID_BOOT_B_PARTITION_MMC 7
-#define CONFIG_ANDROID_SYSTEM_B_PARTITION_MMC 8
-#define CONFIG_ANDROID_MISC_PARTITION_MMC 9
#define CONFIG_CMD_FAT
#define CONFIG_DOS_PARTITION
@@ -18,8 +15,7 @@
#define CONFIG_FASTBOOT_LOCK
#define FSL_FASTBOOT_FB_DEV "mmc"
-#define FSL_FASTBOOT_DATA_PART_NUM 4
-#define FSL_FASTBOOT_FB_PART_NUM 10
+#define FSL_FASTBOOT_DATA_PART_NUM CONFIG_ANDROID_DATA_PARTITION_MMC
#define CONFIG_FSL_CAAM_KB
#define CONFIG_SHA1
diff --git a/include/configs/picosom-imx6ul.h b/include/configs/picosom-imx6ul.h
index 7c96376..849d5bc 100644
--- a/include/configs/picosom-imx6ul.h
+++ b/include/configs/picosom-imx6ul.h
@@ -66,6 +66,7 @@
#define CONFIG_MMC
#define CONFIG_CMD_MMC
#define CONFIG_GENERIC_MMC
+#define CONFIG_EFI_PARTITION
#define CONFIG_CMD_FAT
#define CONFIG_DOS_PARTITION
#define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */
@@ -336,7 +337,7 @@
#endif
#define CONFIG_SYS_MMC_ENV_DEV 1 /* USDHC2 */
-#define CONFIG_SYS_MMC_ENV_PART 0 /* user area */
+#define CONFIG_SYS_MMC_ENV_PART 1 /* boot0 area */
#define CONFIG_MMCROOT "/dev/mmcblk1p2" /* USDHC2 */
#define CONFIG_OF_LIBFDT
diff --git a/include/fsl_fastboot.h b/include/fsl_fastboot.h
index 3548986..1abfe9a 100644
--- a/include/fsl_fastboot.h
+++ b/include/fsl_fastboot.h
@@ -35,7 +35,6 @@
#ifdef CONFIG_BRILLO_SUPPORT
#define FASTBOOT_PARTITION_BOOT_A "boot_a"
-#define FASTBOOT_PARTITION_RECOVERY "recovery"
#define FASTBOOT_PARTITION_SYSTEM_A "system_a"
#define FASTBOOT_PARTITION_BOOTLOADER "bootloader"
#define FASTBOOT_PARTITION_DATA "userdata"
@@ -44,7 +43,6 @@
#define FASTBOOT_PARTITION_MISC "misc"
#define FASTBOOT_PARTITION_BOOT_FS "emmc"
-#define FASTBOOT_PARTITION_RECOVERY_FS "emmc"
#define FASTBOOT_PARTITION_SYSTEM_FS "ext4"
#define FASTBOOT_PARTITION_BOOTLOADER_FS "emmc"
#define FASTBOOT_PARTITION_DATA_FS "ext4"