diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-01-15 07:58:30 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-01-15 07:58:30 +0100 |
commit | 6a1fca3a18ac01a183a787a3ccbd1d9c623391bc (patch) | |
tree | c70e6a205b3299a04fc7a1dc1c2737a693b87649 /arch/arm | |
parent | 56c313fe1751756ba978824798f61b4abe6ac49c (diff) | |
parent | e76009b5953371b30005382f60863a385526d4d5 (diff) | |
download | barebox-6a1fca3a18ac01a183a787a3ccbd1d9c623391bc.tar.gz barebox-6a1fca3a18ac01a183a787a3ccbd1d9c623391bc.tar.xz |
Merge branch 'for-next/zynq'
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/boards/avnet-zedboard/lowlevel.c | 48 | ||||
-rw-r--r-- | arch/arm/dts/zynq-7000.dtsi | 15 | ||||
-rw-r--r-- | arch/arm/dts/zynq-zed.dts | 18 | ||||
-rw-r--r-- | arch/arm/mach-zynq/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-zynq/bootm-zynqimg.c | 49 | ||||
-rw-r--r-- | arch/arm/mach-zynq/cpu_init.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-zynq/include/mach/init.h | 8 |
7 files changed, 150 insertions, 4 deletions
diff --git a/arch/arm/boards/avnet-zedboard/lowlevel.c b/arch/arm/boards/avnet-zedboard/lowlevel.c index 93e4da96ec..912eb11fda 100644 --- a/arch/arm/boards/avnet-zedboard/lowlevel.c +++ b/arch/arm/boards/avnet-zedboard/lowlevel.c @@ -20,7 +20,9 @@ #include <io.h> #include <asm/barebox-arm.h> #include <asm/barebox-arm-head.h> +#include <mach/init.h> #include <mach/zynq7000-regs.h> +#include <serial/cadence.h> #define DCI_DONE (1 << 13) #define PLL_ARM_LOCK (1 << 0) @@ -29,10 +31,17 @@ extern char __dtb_zynq_zed_start[]; -ENTRY_FUNCTION(start_avnet_zedboard, r0, r1, r2) +static void avnet_zedboard_ps7_init(void) { - - void *fdt = __dtb_zynq_zed_start + get_runtime_offset(); + /* + * Read OCM mapping configuration, if only the upper 64 KByte are + * mapped to the high address, it's very likely that we just got control + * from the BootROM. If the mapping is changed something other than the + * BootROM was running before us. Skip PS7 init to avoid cutting the + * branch we are sitting on in that case. + */ + if ((readl(0xf8000910) & 0xf) != 0x8) + return; /* open sesame */ writel(0x0000DF0D, ZYNQ_SLCR_UNLOCK); @@ -234,9 +243,18 @@ ENTRY_FUNCTION(start_avnet_zedboard, r0, r1, r2) /* UART1 pinmux */ writel(0x000002E1, ZYNQ_MIO_BASE + 0xC8); writel(0x000002E0, ZYNQ_MIO_BASE + 0xCC); + /* QSPI pinmux */ + writel(0x00001602, ZYNQ_MIO_BASE + 0x04); + writel(0x00000702, ZYNQ_MIO_BASE + 0x08); + writel(0x00000702, ZYNQ_MIO_BASE + 0x0c); + writel(0x00000702, ZYNQ_MIO_BASE + 0x10); + writel(0x00000702, ZYNQ_MIO_BASE + 0x14); + writel(0x00000702, ZYNQ_MIO_BASE + 0x18); + writel(0x00000602, ZYNQ_MIO_BASE + 0x20); /* poor mans clkctrl */ writel(0x00001403, ZYNQ_CLOCK_CTRL_BASE + ZYNQ_UART_CLK_CTRL); + writel(0x00000101, ZYNQ_CLOCK_CTRL_BASE + ZYNQ_LQSPI_CLK_CTRL); /* GEM0 */ writel(0x00000001, 0xf8000138); @@ -260,8 +278,32 @@ ENTRY_FUNCTION(start_avnet_zedboard, r0, r1, r2) /* lock up. secure, secure */ writel(0x0000767B, ZYNQ_SLCR_LOCK); +} + +static void avnet_zedboard_pbl_console_init(void) +{ + relocate_to_current_adr(); + setup_c(); + barrier(); + + cadence_uart_init((void *)ZYNQ_UART1_BASE_ADDR); + pbl_set_putc(cadence_uart_putc, (void *)ZYNQ_UART1_BASE_ADDR); + + pr_debug("\nAvnet ZedBoard PBL\n"); +} + +ENTRY_FUNCTION(start_avnet_zedboard, r0, r1, r2) +{ + + void *fdt = __dtb_zynq_zed_start + get_runtime_offset(); arm_cpu_lowlevel_init(); + zynq_cpu_lowlevel_init(); + + avnet_zedboard_ps7_init(); + + if (IS_ENABLED(CONFIG_PBL_CONSOLE)) + avnet_zedboard_pbl_console_init(); barebox_arm_entry(0, SZ_512M, fdt); } diff --git a/arch/arm/dts/zynq-7000.dtsi b/arch/arm/dts/zynq-7000.dtsi new file mode 100644 index 0000000000..3791f743a4 --- /dev/null +++ b/arch/arm/dts/zynq-7000.dtsi @@ -0,0 +1,15 @@ + +&amba { + qspi: spi@e000d000 { + compatible = "xlnx,zynq-qspi-1.0"; + reg = <0xe000d000 0x1000>; + interrupt-parent = <&intc>; + interrupts = <0 19 4>; + clocks = <&clkc 10>, <&clkc 43>; + clock-names = "ref_clk", "pclk"; + status = "disabled"; + + #address-cells = <1>; + #size-cells = <0>; + }; +}; diff --git a/arch/arm/dts/zynq-zed.dts b/arch/arm/dts/zynq-zed.dts index 52d6833249..a6b1da854b 100644 --- a/arch/arm/dts/zynq-zed.dts +++ b/arch/arm/dts/zynq-zed.dts @@ -1,7 +1,25 @@ #include <arm/zynq-zed.dts> +#include "zynq-7000.dtsi" / { chosen { stdout-path = &uart1; }; }; + +&qspi { + status = "okay"; + num-cs = <1>; + + qspi_flash: flash@0 { + compatible = "spansion,s25fl256s1", "jedec,spi-nor"; + reg = <0>; + spi-tx-bus-width = <1>; + spi-rx-bus-width = <4>; + spi-max-frequency = <50000000>; + m25p,fast-read; + + #address-cells = <1>; + #size-cells = <1>; + }; +}; diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile index 3252247d17..06c2ce996c 100644 --- a/arch/arm/mach-zynq/Makefile +++ b/arch/arm/mach-zynq/Makefile @@ -1 +1,2 @@ -obj-y += zynq.o +obj-y += zynq.o bootm-zynqimg.o +lwl-y += cpu_init.o diff --git a/arch/arm/mach-zynq/bootm-zynqimg.c b/arch/arm/mach-zynq/bootm-zynqimg.c new file mode 100644 index 0000000000..e903ab6679 --- /dev/null +++ b/arch/arm/mach-zynq/bootm-zynqimg.c @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <bootm.h> +#include <common.h> +#include <init.h> +#include <memory.h> + +static int do_bootm_zynqimage(struct image_data *data) +{ + resource_size_t start, end; + void (*barebox)(void); + u32 *header; + int ret; + + ret = memory_bank_first_find_space(&start, &end); + if (ret) + return ret; + + ret = bootm_load_os(data, start); + if (ret) + return ret; + + header = (u32*)start; + barebox = (void*)start + header[12]; + + if (data->verbose) + printf("Loaded barebox image to 0x%08lx\n", + (unsigned long)barebox); + + shutdown_barebox(); + + barebox(); + + return -EIO; +} + +static struct image_handler zynq_image_handler = { + .name = "Zynq image", + .bootm = do_bootm_zynqimage, + .filetype = filetype_zynq_image, +}; + +static int zynq_register_image_handler(void) +{ + register_image_handler(&zynq_image_handler); + + return 0; +} +late_initcall(zynq_register_image_handler); diff --git a/arch/arm/mach-zynq/cpu_init.c b/arch/arm/mach-zynq/cpu_init.c new file mode 100644 index 0000000000..ca7c4b2979 --- /dev/null +++ b/arch/arm/mach-zynq/cpu_init.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <common.h> +#include <asm/barebox-arm-head.h> +#include <asm/errata.h> +#include <mach/init.h> + +void zynq_cpu_lowlevel_init(void) +{ + enable_arm_errata_761320_war(); + enable_arm_errata_794072_war(); + enable_arm_errata_845369_war(); +} diff --git a/arch/arm/mach-zynq/include/mach/init.h b/arch/arm/mach-zynq/include/mach/init.h new file mode 100644 index 0000000000..c458f602e4 --- /dev/null +++ b/arch/arm/mach-zynq/include/mach/init.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __MACH_INIT_H +#define __MACH_INIT_H + +void zynq_cpu_lowlevel_init(void); + +#endif |