From 5473f245d0a884ffd1a7f353b86d5d11e01d3ebd Mon Sep 17 00:00:00 2001 From: Siva Durga Prasad Paladugu Date: Fri, 26 Oct 2018 17:47:55 +0530 Subject: arm64: zynqmp: Fix logic in CG/EG/EV detection The VCU disable bit(8) in IP disable register of efuse is valid only if PL powered up and hence PL powerup status has to be considered while determining the CG part also. This patch considers the PL powerup status and ignores the VCU disable bit if PL not powered up. This fixes the issue of "unknown" id for CG parts if PL not powered up and VCU bit(8) is not set. Signed-off-by: Siva Durga Prasad Paladugu Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp.c | 48 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'board') diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index af91cde7c8..168cf5c14b 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -72,6 +72,7 @@ static const struct { .id = 0x20, .ver = 0x12c, .name = "5cg", + .evexists = 1, }, { .id = 0x21, @@ -88,6 +89,7 @@ static const struct { .id = 0x21, .ver = 0x12c, .name = "4cg", + .evexists = 1, }, { .id = 0x30, @@ -104,6 +106,7 @@ static const struct { .id = 0x30, .ver = 0x12c, .name = "7cg", + .evexists = 1, }, { .id = 0x38, @@ -234,14 +237,18 @@ int chip_id(unsigned char id) #define ZYNQMP_VERSION_SIZE 9 #define ZYNQMP_PL_STATUS_BIT 9 +#define ZYNQMP_IPDIS_VCU_BIT 8 #define ZYNQMP_PL_STATUS_MASK BIT(ZYNQMP_PL_STATUS_BIT) #define ZYNQMP_CSU_VERSION_MASK ~(ZYNQMP_PL_STATUS_MASK) +#define ZYNQMP_CSU_VCUDIS_VER_MASK ZYNQMP_CSU_VERSION_MASK & \ + ~BIT(ZYNQMP_IPDIS_VCU_BIT) +#define MAX_VARIANTS_EV 3 #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \ !defined(CONFIG_SPL_BUILD) static char *zynqmp_get_silicon_idcode_name(void) { - u32 i, id, ver; + u32 i, id, ver, j; char *buf; static char name[ZYNQMP_VERSION_SIZE]; @@ -249,24 +256,43 @@ static char *zynqmp_get_silicon_idcode_name(void) ver = chip_id(IDCODE2); for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) { - if ((zynqmp_devices[i].id == id) && - (zynqmp_devices[i].ver == (ver & - ZYNQMP_CSU_VERSION_MASK))) { - strncat(name, "zu", 2); - strncat(name, zynqmp_devices[i].name, - ZYNQMP_VERSION_SIZE - 3); - break; + if (zynqmp_devices[i].id == id) { + if (zynqmp_devices[i].evexists && + !(ver & ZYNQMP_PL_STATUS_MASK)) + break; + if (zynqmp_devices[i].ver == (ver & + ZYNQMP_CSU_VERSION_MASK)) + break; } } if (i >= ARRAY_SIZE(zynqmp_devices)) return "unknown"; - if (!zynqmp_devices[i].evexists) + strncat(name, "zu", 2); + if (!zynqmp_devices[i].evexists || + (ver & ZYNQMP_PL_STATUS_MASK)) { + strncat(name, zynqmp_devices[i].name, + ZYNQMP_VERSION_SIZE - 3); return name; + } - if (ver & ZYNQMP_PL_STATUS_MASK) - return name; + /* + * Here we are means, PL not powered up and ev variant + * exists. So, we need to ignore VCU disable bit(8) in + * version and findout if its CG or EG/EV variant. + */ + for (j = 0; j < MAX_VARIANTS_EV; j++, i++) { + if ((zynqmp_devices[i].ver & ~BIT(ZYNQMP_IPDIS_VCU_BIT)) == + (ver & ZYNQMP_CSU_VCUDIS_VER_MASK)) { + strncat(name, zynqmp_devices[i].name, + ZYNQMP_VERSION_SIZE - 3); + break; + } + } + + if (j >= MAX_VARIANTS_EV) + return "unknown"; if (strstr(name, "eg") || strstr(name, "ev")) { buf = strstr(name, "e"); -- cgit v1.2.3 From 0dc69f4193cb5ad8bbb57cb64435734f5fbbe81a Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 19 Nov 2018 15:46:04 +0100 Subject: ARM: zynq: Guard zynq_help_text with CONFIG_SYS_LONGHELP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If SYS_LONGHELP is disabled the following warning is generated: board/xilinx/zynq/cmds.c:496:13: warning: ‘zynq_help_text’ defined but not used [-Wunused-variable] Normal way for fixing this is to guard the whole variable. Signed-off-by: Michal Simek --- board/xilinx/zynq/cmds.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'board') diff --git a/board/xilinx/zynq/cmds.c b/board/xilinx/zynq/cmds.c index 0b2a8178d6..8b48ea3a03 100644 --- a/board/xilinx/zynq/cmds.c +++ b/board/xilinx/zynq/cmds.c @@ -493,6 +493,7 @@ static int do_zynq(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return cmd_process_error(zynq_cmd, ret); } +#ifdef CONFIG_SYS_LONGHELP static char zynq_help_text[] = "" #ifdef CONFIG_CMD_ZYNQ_RSA @@ -507,6 +508,7 @@ static char zynq_help_text[] = " destination address\n" #endif ; +#endif U_BOOT_CMD(zynq, 6, 0, do_zynq, "Zynq specific commands", zynq_help_text -- cgit v1.2.3 From 656185a5d725c32ebd65daf0a4d1e66dcb662591 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 22 Nov 2018 12:39:18 +0100 Subject: microblaze: Use standard functions for memory decoding The standard function is less error prone than custom one. Signed-off-by: Michal Simek --- .../xilinx/microblaze-generic/microblaze-generic.c | 27 +++------------------- 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'board') diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c index 44fb48b347..c946ec3208 100644 --- a/board/xilinx/microblaze-generic/microblaze-generic.c +++ b/board/xilinx/microblaze-generic/microblaze-generic.c @@ -32,34 +32,13 @@ ulong ram_base; int dram_init_banksize(void) { - gd->bd->bi_dram[0].start = ram_base; - gd->bd->bi_dram[0].size = get_effective_memsize(); - - return 0; + return fdtdec_setup_memory_banksize(); } int dram_init(void) { - int node; - fdt_addr_t addr; - fdt_size_t size; - const void *blob = gd->fdt_blob; - - node = fdt_node_offset_by_prop_value(blob, -1, "device_type", - "memory", 7); - if (node == -FDT_ERR_NOTFOUND) { - debug("DRAM: Can't get memory node\n"); - return 1; - } - addr = fdtdec_get_addr_size(blob, node, "reg", &size); - if (addr == FDT_ADDR_T_NONE || size == 0) { - debug("DRAM: Can't get base address or size\n"); - return 1; - } - ram_base = addr; - - gd->ram_top = addr; /* In setup_dest_addr() is done +ram_size */ - gd->ram_size = size; + if (fdtdec_setup_mem_size_base() != 0) + return -EINVAL; return 0; }; -- cgit v1.2.3 From fdba86972f23cab99710e19a04f36f170d1870e0 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 29 Nov 2018 10:31:02 +0100 Subject: ARM: zynq: Wire SPL configuration for cse nor/nand targets These symlinks are here only for testing purpose where SPL is used for soc configuration. Signed-off-by: Michal Simek --- board/xilinx/zynq/zynq-cse-nand | 1 + board/xilinx/zynq/zynq-cse-nor | 1 + 2 files changed, 2 insertions(+) create mode 120000 board/xilinx/zynq/zynq-cse-nand create mode 120000 board/xilinx/zynq/zynq-cse-nor (limited to 'board') diff --git a/board/xilinx/zynq/zynq-cse-nand b/board/xilinx/zynq/zynq-cse-nand new file mode 120000 index 0000000000..9d89a9957e --- /dev/null +++ b/board/xilinx/zynq/zynq-cse-nand @@ -0,0 +1 @@ +zynq-zc770-xm011 \ No newline at end of file diff --git a/board/xilinx/zynq/zynq-cse-nor b/board/xilinx/zynq/zynq-cse-nor new file mode 120000 index 0000000000..bb80693eab --- /dev/null +++ b/board/xilinx/zynq/zynq-cse-nor @@ -0,0 +1 @@ +zynq-zc770-xm012 \ No newline at end of file -- cgit v1.2.3 From a837cfe5b2497ad948c246c34884647626033b62 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 29 Nov 2018 15:03:40 +0100 Subject: arm64: zynqmp: Enable SPL for mini qspi configuration Wire up mini_qspi SPL with zcu102 for testing purpose. Normally mini u-boot runs with FSBL/SPL for certain board. Enabling SPL and configuration from zcu102 helps with testing. Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp-mini-qspi | 1 + 1 file changed, 1 insertion(+) create mode 120000 board/xilinx/zynqmp/zynqmp-mini-qspi (limited to 'board') diff --git a/board/xilinx/zynqmp/zynqmp-mini-qspi b/board/xilinx/zynqmp/zynqmp-mini-qspi new file mode 120000 index 0000000000..5a70cd2f5e --- /dev/null +++ b/board/xilinx/zynqmp/zynqmp-mini-qspi @@ -0,0 +1 @@ +zynqmp-zcu102-rev1.0 \ No newline at end of file -- cgit v1.2.3 From ee97a9996a4e18d52f57095232eb12134a722272 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 29 Nov 2018 10:37:49 +0100 Subject: arm64: zynqmp: Add mini mtest configuration This configuration is useful when you want to run small u-boot and perform DDR memory test to make sure that DDR is properly configured. It is use for board bringup because alternative u-boot memory tests is quite good. Configuration is running out of OCM. As is done for others mini configurations 0x80 bytes for variables is enough and only default variables are stored there. Alternative memtest is enabled and also 2GB of DDR via DTS files. Configuration is enabling ZYNQMP_PSU_INIT_ENABLED and include psu_init() from zcu102 for testing purpose. In case of size issue this can be moved to SPL configuration as is done for mini_qspi configuration but it is not a problem now. Log: U-Boot 2018.11-00268-gbd58b8ba8915 (Nov 29 2018 - 15:33:35 +0100) Model: ZynqMP MINI Board: Xilinx ZynqMP DRAM: WARNING: Initializing TCM overwrites TCM content 2 GiB EL Level: EL3 In: dcc Out: dcc Err: dcc ZynqMP> Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp-mini | 1 + 1 file changed, 1 insertion(+) create mode 120000 board/xilinx/zynqmp/zynqmp-mini (limited to 'board') diff --git a/board/xilinx/zynqmp/zynqmp-mini b/board/xilinx/zynqmp/zynqmp-mini new file mode 120000 index 0000000000..5a70cd2f5e --- /dev/null +++ b/board/xilinx/zynqmp/zynqmp-mini @@ -0,0 +1 @@ +zynqmp-zcu102-rev1.0 \ No newline at end of file -- cgit v1.2.3 From e615f39e7f686f7ffef3283c61751e92a5962606 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 5 Oct 2018 08:55:16 +0200 Subject: arm64: zynqmp: Start usb ethernet gadget automatically If only usb ethernet gadget is enabled it can start automatically. If more gagdets are enabled usb ethernet gadget can be bind by "bind /amba/usb1@ff9e0000/dwc3@fe300000 usb_ether" (on zcu100) Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'board') diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 168cf5c14b..13c404b6ef 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -543,6 +543,10 @@ int board_late_init(void) char *env_targets; int ret; +#if defined(CONFIG_USB_ETHER) && !defined(CONFIG_USB_GADGET_DOWNLOAD) + usb_ether_init(); +#endif + if (!(gd->flags & GD_FLG_ENV_DEFAULT)) { debug("Saved variables - Skipping\n"); return 0; -- cgit v1.2.3 From f5ed777d29f92b7808abdeff59fec4c196886a91 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 30 Nov 2018 10:18:53 +0100 Subject: arm64: zynqmp: Wire mini-emmc0 configuration with zcu100 For testing purpose use zcu100 which has SD at controller 0 and this can be used for testing this mini configuration. U-Boot 2018.11-00281-gc5d48466e76e (Nov 30 2018 - 10:41:05 +0100) Model: ZynqMP MINI EMMC0 Board: Xilinx ZynqMP DRAM: 512 MiB EL Level: EL3 MMC: sdhci@ff160000: 0 In: dcc Out: dcc Err: dcc ZynqMP> Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp-mini-emmc0 | 1 + 1 file changed, 1 insertion(+) create mode 120000 board/xilinx/zynqmp/zynqmp-mini-emmc0 (limited to 'board') diff --git a/board/xilinx/zynqmp/zynqmp-mini-emmc0 b/board/xilinx/zynqmp/zynqmp-mini-emmc0 new file mode 120000 index 0000000000..f2beed309a --- /dev/null +++ b/board/xilinx/zynqmp/zynqmp-mini-emmc0 @@ -0,0 +1 @@ +zynqmp-zcu100-revC \ No newline at end of file -- cgit v1.2.3 From ebcc1a223e05cc3c387f2bed75112f969a1b62f4 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 30 Nov 2018 10:20:43 +0100 Subject: arm64: zynqmp: Wire mini-emmc1 configuration with zcu102 For testing purpose use zcu102 which has SD at controller 1 and this can be used for testing this mini configuration. U-Boot 2018.11-00279-gdc482e7ee092 (Nov 30 2018 - 10:22:56 +0100) Model: ZynqMP MINI EMMC1 Board: Xilinx ZynqMP DRAM: 512 MiB EL Level: EL3 MMC: sdhci@ff170000: 0 In: dcc Out: dcc Err: dcc ZynqMP> Signed-off-by: Michal Simek --- board/xilinx/zynqmp/zynqmp-mini-emmc1 | 1 + 1 file changed, 1 insertion(+) create mode 120000 board/xilinx/zynqmp/zynqmp-mini-emmc1 (limited to 'board') diff --git a/board/xilinx/zynqmp/zynqmp-mini-emmc1 b/board/xilinx/zynqmp/zynqmp-mini-emmc1 new file mode 120000 index 0000000000..5a70cd2f5e --- /dev/null +++ b/board/xilinx/zynqmp/zynqmp-mini-emmc1 @@ -0,0 +1 @@ +zynqmp-zcu102-rev1.0 \ No newline at end of file -- cgit v1.2.3