summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorzhang sanshan <sanshan.zhang@nxp.com>2017-05-22 15:17:44 +0800
committerChen Guoyin <guoyin.chen@nxp.com>2017-07-10 15:08:58 +0800
commit2c1196079eaf31bd8a7bf5a15e1cbf3c6c7902bb (patch)
tree5148602bd0fc6f1d90666fd1d1494bbbc41dbccc /drivers
parentff92794f05268eac978e9ab3e7d97a651819fe36 (diff)
downloadu-boot-imx-2c1196079eaf31bd8a7bf5a15e1cbf3c6c7902bb.zip
u-boot-imx-2c1196079eaf31bd8a7bf5a15e1cbf3c6c7902bb.tar.gz
u-boot-imx-2c1196079eaf31bd8a7bf5a15e1cbf3c6c7902bb.tar.bz2
MA-9409-3 Add base board support for android and android things.
* add board support for android and android things. mx6ul_nxpu_iopb, pico-6ul, pico-imx7d, aquila-6ul reorganize the Kconfig, and fix the redefine issue. * add android configure into configure-while * add a common file mx_android_common.h it will be included by android and android things. defconfig only include ANDROID_THINGS_SUPPORT or ANDROID_SUPPORT * move partition_table_valid into f_fastboot.c. it's a common code. * add invalidate_dcache_range in fixed order. It will have salt invalid issue if we do not add it in order * add display for pico-7d. Change-Id: I6f8a4876c2f8bbd098034d1e3f53033109300bca Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
Diffstat (limited to 'drivers')
-rwxr-xr-xdrivers/crypto/fsl_caam.c13
-rw-r--r--drivers/usb/gadget/f_fastboot.c54
-rw-r--r--drivers/usb/gadget/fastboot_lock_unlock.c8
3 files changed, 48 insertions, 27 deletions
diff --git a/drivers/crypto/fsl_caam.c b/drivers/crypto/fsl_caam.c
index ee556bd..e9edb67 100755
--- a/drivers/crypto/fsl_caam.c
+++ b/drivers/crypto/fsl_caam.c
@@ -151,6 +151,14 @@ uint32_t caam_decap_blob(uint32_t plain_text, uint32_t blob_addr, uint32_t size)
flush_dcache_range((uint32_t)g_input_ring & ALIGN_MASK,
((uint32_t)g_input_ring & ALIGN_MASK) + 128);
+ invalidate_dcache_range((uint32_t)decap_dsc & ALIGN_MASK,
+ ((uint32_t)decap_dsc & ALIGN_MASK) + 128);
+ invalidate_dcache_range((uint32_t)g_input_ring & ALIGN_MASK,
+ ((uint32_t)g_input_ring & ALIGN_MASK) + 128);
+ invalidate_dcache_range((uint32_t)blob_addr & ALIGN_MASK,
+ (((uint32_t)blob_addr + 2 * size + 64) & ALIGN_MASK));
+ invalidate_dcache_range((uint32_t)plain_text & ALIGN_MASK,
+ (((uint32_t)plain_text + 2 * size + 64) & ALIGN_MASK));
/* Increment jobs added */
__raw_writel(1, CAAM_IRJAR0);
@@ -160,6 +168,8 @@ uint32_t caam_decap_blob(uint32_t plain_text, uint32_t blob_addr, uint32_t size)
// TODO: check if Secure memory is cacheable.
flush_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)decap_dsc)
{
@@ -224,6 +234,9 @@ uint32_t caam_gen_blob(uint32_t plain_data_addr, uint32_t blob_addr, uint32_t si
(((uint32_t)blob + 2 * size + 64) & ALIGN_MASK));
flush_dcache_range((uint32_t)g_input_ring & ALIGN_MASK,
((uint32_t)g_input_ring & ALIGN_MASK) + 128);
+
+ invalidate_dcache_range((uint32_t)blob & ALIGN_MASK,
+ (((uint32_t)blob + 2 * size + 64) & ALIGN_MASK));
/* Increment jobs added */
__raw_writel(1, CAAM_IRJAR0);
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 2f19e50..f7974d9 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -1320,7 +1320,7 @@ static int _fastboot_parts_add_ptable_entry(int ptable_index,
if (part_get_info(dev_desc,
mmc_dos_partition_index, &info)) {
- printf("Bad partition index:%d for partition:%s\n",
+ debug("Bad partition index:%d for partition:%s\n",
mmc_dos_partition_index, name);
return -1;
}
@@ -1329,11 +1329,23 @@ static int _fastboot_parts_add_ptable_entry(int ptable_index,
ptable[ptable_index].partition_id = mmc_partition_index;
ptable[ptable_index].partition_index = mmc_dos_partition_index;
strcpy(ptable[ptable_index].name, (const char *)info.name);
- strcpy(ptable[ptable_index].fstype, (const char *)info.type);
#ifdef CONFIG_PARTITION_UUIDS
strcpy(ptable[ptable_index].uuid, (const char *)info.uuid);
#endif
+#ifdef CONFIG_ANDROID_AB_SUPPORT
+ if (!strcmp((const char *)info.name, FASTBOOT_PARTITION_SYSTEM_A) ||
+ !strcmp((const char *)info.name, FASTBOOT_PARTITION_SYSTEM_B) ||
+ !strcmp((const char *)info.name, FASTBOOT_PARTITION_DATA))
+#else
+ if (!strcmp((const char *)info.name, FASTBOOT_PARTITION_SYSTEM) ||
+ !strcmp((const char *)info.name, FASTBOOT_PARTITION_DATA) ||
+ !strcmp((const char *)info.name, FASTBOOT_PARTITION_DEVICE) ||
+ !strcmp((const char *)info.name, FASTBOOT_PARTITION_CACHE))
+#endif
+ strcpy(ptable[ptable_index].fstype, "ext4");
+ else
+ strcpy(ptable[ptable_index].fstype, "emmc");
return 0;
}
@@ -2112,7 +2124,7 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int mmcc = -1;
struct andr_img_hdr *hdr = &boothdr;
ulong image_size;
- bool check_image_arm64;
+ bool check_image_arm64 = false;
#ifdef CONFIG_SECURE_BOOT
#define IVT_SIZE 0x20
#define CSF_PAD_SIZE CONFIG_CSF_SIZE
@@ -2233,7 +2245,7 @@ use_given_ptn:
}
/* flush cache after read */
flush_cache((ulong)load_addr, bootimg_sectors * 512); /* FIXME */
- check_image_arm64 = image_arm64(load_addr + hdr->page_size);
+ check_image_arm64 = image_arm64((void *)(load_addr + hdr->page_size));
addr = load_addr;
#ifdef CONFIG_FASTBOOT_LOCK
int verifyresult = -1;
@@ -2777,19 +2789,6 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
return;
}
- else if (is_slotvar(cmd)) {
-#ifdef CONFIG_AVB_SUPPORT
- if (get_slotvar_avb(&fsl_avb_ab_ops, cmd,
- response + strlen(response), chars_left + 1) < 0)
- goto fail;
-#elif CONFIG_FSL_BOOTCTL
- if (get_slotvar(cmd, response + strlen(response), chars_left + 1) < 0)
- goto fail;
-#else
- strncat(response, FASTBOOT_VAR_NO, chars_left);
-#endif
- }
-
char *str = cmd;
if ((str = strstr(cmd, "partition-size:"))) {
str +=strlen("partition-size:");
@@ -2865,6 +2864,18 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
strncat(response, FASTBOOT_VAR_NO, chars_left);
}
#endif
+ else if (is_slotvar(cmd)) {
+#ifdef CONFIG_AVB_SUPPORT
+ if (get_slotvar_avb(&fsl_avb_ab_ops, cmd,
+ response + strlen(response), chars_left + 1) < 0)
+ goto fail;
+#elif defined(CONFIG_FSL_BOOTCTL)
+ if (get_slotvar(cmd, response + strlen(response), chars_left + 1) < 0)
+ goto fail;
+#else
+ strncat(response, FASTBOOT_VAR_NO, chars_left);
+#endif
+ }
else {
char envstr[32];
@@ -2879,7 +2890,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
fastboot_tx_write_str(response);
return;
fail:
- strncpy(response, "FAIL", 4);
+ strncpy(response, "FAIL", 5);
fastboot_tx_write_str(response);
return;
}
@@ -3167,7 +3178,10 @@ static int partition_table_valid(void)
disk_partition_t info;
mmc_no = fastboot_devinfo.dev_id;
dev_desc = blk_get_dev("mmc", mmc_no);
- status = part_get_info(dev_desc, 1, &info);
+ if (dev_desc)
+ status = part_get_info(dev_desc, 1, &info);
+ else
+ status = -1;
return (status == 0);
}
@@ -3372,7 +3386,7 @@ static const struct cmd_dispatch_info cmd_dispatch_info[] = {
.cmd = "set_active",
.cb = cb_set_active_avb,
},
-#elif CONFIG_FSL_BOOTCTL
+#elif defined(CONFIG_FSL_BOOTCTL)
{
.cmd = "set_active",
.cb = cb_set_active,
diff --git a/drivers/usb/gadget/fastboot_lock_unlock.c b/drivers/usb/gadget/fastboot_lock_unlock.c
index ee26f17..14ef88e 100644
--- a/drivers/usb/gadget/fastboot_lock_unlock.c
+++ b/drivers/usb/gadget/fastboot_lock_unlock.c
@@ -50,6 +50,7 @@
#endif
+int fastboot_flash_find_index(const char *name);
#ifndef FASTBOOT_ENCRYPT_LOCK
@@ -239,8 +240,6 @@ int fastboot_set_lock_stat(FbLockState lock) {
ret = -1;
goto fail;
}
- FB_DEBUG("%s %s partition.start=%d, size=%d\n",FSL_FASTBOOT_FB_DEV,
- get_mmc_part(mmc_id), fs_partition.start, fs_partition.size);
status = encrypt_lock_store(lock, bdata);
if (status < 0) {
@@ -289,8 +288,6 @@ FbLockState fastboot_get_lock_stat(void) {
ret = g_lockstat;
goto fail;
}
- FB_DEBUG("%s %s partition.start=%d, size=%d\n",FSL_FASTBOOT_FB_DEV,
- get_mmc_part(mmc_id), fs_partition.start, fs_partition.size);
status = fs_dev_desc->block_read(fs_dev_desc, fs_partition.start, 1, bdata);
if (!status) {
@@ -343,7 +340,6 @@ void set_fastboot_lock_disable(void) {
}
lbaint_t target_block = fs_partition.start + fs_partition.size - 1;
- FB_DEBUG("target_block.start=%d, size=%d target_block=%d\n", fs_partition.start, fs_partition.size, target_block);
status = fs_dev_desc->block_write(fs_dev_desc, target_block, 1, bdata);
if (!status) {
printf("%s: error in block read\n", __FUNCTION__);
@@ -383,7 +379,6 @@ FbLockEnableResult fastboot_lock_enable() {
//The data is stored in the last blcok of this partition.
lbaint_t target_block = fs_partition.start + fs_partition.size - 1;
- FB_DEBUG("target_block.start=%d, size=%d target_block=%d\n", fs_partition.start, fs_partition.size, target_block);
status = fs_dev_desc->block_read(fs_dev_desc, target_block, 1, bdata);
if (!status) {
printf("%s: error in block read\n", __FUNCTION__);
@@ -456,7 +451,6 @@ int fastboot_wipe_data_partition(void)
printf("error in get device partition for wipe /data\n");
return -1;
}
- FB_DEBUG("fs->start=%x, size=%d\n", fs_partition.start, fs_partition.size);
status = fs_dev_desc->block_erase(fs_dev_desc, fs_partition.start , fs_partition.size );
if (status != fs_partition.size ) {
printf("erase not complete\n");