From 91be51284600fcccbc165cf55d3420124c0f33fa Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 31 Aug 2017 19:58:11 +0900 Subject: [PATCH 1/2] uniphier: fix code indent for conditional statement checkpatch.pl from Linux reports tons of coding style errors and warnings. I am just fixing under plat/socionext/uniphier/. Signed-off-by: Masahiro Yamada --- plat/socionext/uniphier/uniphier_nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plat/socionext/uniphier/uniphier_nand.c b/plat/socionext/uniphier/uniphier_nand.c index 88f906c24..a118b8512 100644 --- a/plat/socionext/uniphier/uniphier_nand.c +++ b/plat/socionext/uniphier/uniphier_nand.c @@ -108,7 +108,7 @@ static int uniphier_nand_block_isbad(struct uniphier_nand *nand, int block) /* if possible, save the result for future re-use */ if (block < ARRAY_SIZE(nand->bbt)) - nand->bbt[block] = is_bad; + nand->bbt[block] = is_bad; if (is_bad) WARN("found bad block at %d. skip.\n", block); From 9bdccff4622d5bbc53596cb3c174cc06bd0d0afc Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 31 Aug 2017 16:30:47 +0900 Subject: [PATCH 2/2] uniphier: work around Boot ROM bug for USB boot mode of PXs3 SoC Due to a bug in the Boot ROM, the USB load API turned out not working as expected. It is unfixable because the Boot ROM is hard-wired. Add work around code in TF to bypass the problematic Boot ROM code. Signed-off-by: Masahiro Yamada --- plat/socionext/uniphier/uniphier_usb.c | 30 ++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/plat/socionext/uniphier/uniphier_usb.c b/plat/socionext/uniphier/uniphier_usb.c index 49ca8e509..4be0e908c 100644 --- a/plat/socionext/uniphier/uniphier_usb.c +++ b/plat/socionext/uniphier/uniphier_usb.c @@ -16,6 +16,7 @@ #define UNIPHIER_LD11_USB_DESC_BASE 0x30010000 #define UNIPHIER_LD20_USB_DESC_BASE 0x30014000 +#define UNIPHIER_PXS3_USB_DESC_BASE 0x30014000 #define UNIPHIER_SRB_OCM_CONT 0x61200000 @@ -41,6 +42,13 @@ struct uniphier_ld20_op { void *dev_desc; }; +struct uniphier_pxs3_op { + uint8_t __pad[184]; + struct uniphier_ld20_trans_op *trans_op; + void *__pad2; + void *dev_desc; +}; + static int (*__uniphier_usb_read)(int lba, uintptr_t buf, size_t size); static void uniphier_ld11_usb_init(void) @@ -91,14 +99,27 @@ static int uniphier_ld20_usb_read(int lba, uintptr_t buf, size_t size) return ret ? 0 : -1; } +static void uniphier_pxs3_usb_init(void) +{ + struct uniphier_pxs3_op *op = (void *)UNIPHIER_PXS3_USB_DESC_BASE; + + op->trans_op = (void *)(op + 1); + + op->dev_desc = op->trans_op + 1; +} + static int uniphier_pxs3_usb_read(int lba, uintptr_t buf, size_t size) { - static int (*rom_usb_read)(unsigned int lba, unsigned int size, - uintptr_t buf); + static int (*rom_usb_read)(uintptr_t desc, unsigned int lba, + unsigned int size, uintptr_t buf); + int ret; + + rom_usb_read = (__typeof(rom_usb_read))0x39e8; - rom_usb_read = (__typeof(rom_usb_read))0x100c; + /* ROM-API - return 1 on success, 0 on error */ + ret = rom_usb_read(UNIPHIER_PXS3_USB_DESC_BASE, lba, size, buf); - return rom_usb_read(lba, size, buf); + return ret ? 0 : -1; } struct uniphier_usb_rom_param { @@ -116,6 +137,7 @@ static const struct uniphier_usb_rom_param uniphier_usb_rom_params[] = { .read = uniphier_ld20_usb_read, }, [UNIPHIER_SOC_PXS3] = { + .init = uniphier_pxs3_usb_init, .read = uniphier_pxs3_usb_read, }, };