Re: [PATCH v3 2/5] ARM: zynq: Add new architecture zynq
On Tue, Mar 26, 2013 at 08:19:54AM -0500, Josh Cartwright wrote: > A few comments below, but otherwise: nice work. > > On Tue, Mar 26, 2013 at 10:11:23AM +0100, Steffen Trumtrar wrote: > > Add basic support for the Xilinx Zynq-7000 EPP architecture. > > The Zynq-7000 is an embedded processing platform that combines a Cortex A9 > > dualcore MPSoC with an Artix-7 FPGA. > > > > Signed-off-by: Steffen Trumtrar > > --- > > > > Changes since v2: > > - don't force serial driver in Kconfig > > - remove MACH_HAS_LOWLEVEL_INIT > > - use (void __iomem *) in debug_ll.h > > - remove zynq_add_device inline function > > - use resource_size_t instead of void * > > - use __le32 consistently in zynq-flash-header.h > > - remove useless flash_header_start section > [..] > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > > index fcb2969..ceb45dc 100644 > > --- a/arch/arm/Makefile > > +++ b/arch/arm/Makefile > > @@ -64,6 +64,7 @@ machine-$(CONFIG_ARCH_PXA):= pxa > > machine-$(CONFIG_ARCH_SAMSUNG) := samsung > > machine-$(CONFIG_ARCH_VERSATILE) := versatile > > machine-$(CONFIG_ARCH_TEGRA) := tegra > > +machine-$(CONFIG_ARCH_ZYNQ):= zynq > > > > # Board directory name. This list is sorted alphanumerically > > # by CONFIG_* macro name. > > @@ -157,6 +158,7 @@ board-$(CONFIG_MACH_SABRELITE) := > > freescale-mx6-sabrelite > > board-$(CONFIG_MACH_TX53) := karo-tx53 > > board-$(CONFIG_MACH_GUF_VINCELL) := guf-vincell > > board-$(CONFIG_MACH_EFIKA_MX_SMARTBOOK):= efika-mx-smartbook > > +board-$(CONFIG_MACH_ZEDBOARD) := avnet-zedboard > > machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y)) > > > > diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig > > new file mode 100644 > > index 000..5bbd648 > > --- /dev/null > > +++ b/arch/arm/mach-zynq/Kconfig > > @@ -0,0 +1,38 @@ > > +if ARCH_ZYNQ > > Not sure how much we care here, but with the order of the patchset the > way it is, after this one, it will be possible to select the ZedBoard, > even though all of the other support files get added only in the last > patch. > > > + > > +config ARCH_TEXT_BASE > > + hex > > + default 0x1ff0 if MACH_ZEDBOARD > > + > > +config ZYNQ_DEBUG_LL_UART_BASE > > + hex > > + default 0xe0001000 if MACH_ZEDBOARD > > + > > +config BOARDINFO > > + default "ZedBoard" if MACH_ZEDBOARD > > + > > +choice > > + prompt "Xilinx Zynq type board" > > + > > +config ARCH_ZYNQ7000 > > + bool "Zynq-7000" > > + select CPU_V7 > > + select CLKDEV_LOOKUP > > + select COMMON_CLK > > + select ARM_SMP_TWD > > + > > +endchoice > > + > > +if ARCH_ZYNQ7000 > > + > > +choice > > + prompt "Zynq-7000 Board Type" > > + > > +config MACH_ZEDBOARD > > + bool "Avnet Zynq-7000 ZedBoard" > > + select DRIVER_SERIAL_CADENCE > > + > > +endchoice > > +endif > > + > > +endif > [..] > > diff --git a/arch/arm/mach-zynq/include/mach/zynq-flash-header.h > > b/arch/arm/mach-zynq/include/mach/zynq-flash-header.h > > new file mode 100644 > > index 000..3b67e55 > > --- /dev/null > > +++ b/arch/arm/mach-zynq/include/mach/zynq-flash-header.h > > @@ -0,0 +1,38 @@ > > +#ifndef __MACH_FLASH_HEADER_H > > +#define __MACH_FLASH_HEADER_H > > + > > +#include > > + > > +#define __flash_header_section __section(.flash_header_0x0) > > +#define __ps7reg_entry_section __section(.ps7reg_entry_0x0A0) > > +#define __image_len_section__section(.image_len_0x08c0) > > +#define FLASH_HEADER_OFFSET0x0 > > +#define IMAGE_OFFSET 0x8c0 > > + > > +#define DEST_BASE 0x8c0 > > +#define FLASH_HEADER_BASE (DEST_BASE + FLASH_HEADER_OFFSET) > > + > > +struct zynq_reg_entry { > > + __le32 addr; > > + __le32 val; > > +}; > > + > > +#define WIDTH_DETECTION_MAGIC 0xAA995566 > > +#define IMAGE_IDENTIFICATION 0x584C4E58 /* "XLNX" */ > > + > > +struct zynq_flash_header { > > + __le32 width_det; > > + __le32 image_id; > > + __le32 enc_stat; > > + __le32 user; > > + __le32 flash_offset; > > + __le32 length; > > + __le32 res0; > > + __le32 start_of_exec; > > + __le32 total_len; > > + __le32 res1; > > + __le32 checksum; > > + __le32 res2; > > +}; > > One thing I found during my testing/debugging to be useful is to have a > way to turn off the flash header, to get a header-less barebox.bin I > could use JTAG to load on the board. (I realize I could have done used > it _with_ the flash header and set the PC up at 0x8c0, but this was > easier). > > It would be nice if there was a headerless binary left as a build > artifact that could be used for this purpose. > Yes. Sascha suggested to remove the flash_header and generate the whole thing with the zynq_mkimage tool. But atm I don't really feel the need to do so, as the header is simple in comparison to other SoCs
Re: [PATCH v3 2/5] ARM: zynq: Add new architecture zynq
A few comments below, but otherwise: nice work. On Tue, Mar 26, 2013 at 10:11:23AM +0100, Steffen Trumtrar wrote: > Add basic support for the Xilinx Zynq-7000 EPP architecture. > The Zynq-7000 is an embedded processing platform that combines a Cortex A9 > dualcore MPSoC with an Artix-7 FPGA. > > Signed-off-by: Steffen Trumtrar > --- > > Changes since v2: > - don't force serial driver in Kconfig > - remove MACH_HAS_LOWLEVEL_INIT > - use (void __iomem *) in debug_ll.h > - remove zynq_add_device inline function > - use resource_size_t instead of void * > - use __le32 consistently in zynq-flash-header.h > - remove useless flash_header_start section [..] > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > index fcb2969..ceb45dc 100644 > --- a/arch/arm/Makefile > +++ b/arch/arm/Makefile > @@ -64,6 +64,7 @@ machine-$(CONFIG_ARCH_PXA) := pxa > machine-$(CONFIG_ARCH_SAMSUNG) := samsung > machine-$(CONFIG_ARCH_VERSATILE) := versatile > machine-$(CONFIG_ARCH_TEGRA) := tegra > +machine-$(CONFIG_ARCH_ZYNQ) := zynq > > # Board directory name. This list is sorted alphanumerically > # by CONFIG_* macro name. > @@ -157,6 +158,7 @@ board-$(CONFIG_MACH_SABRELITE):= > freescale-mx6-sabrelite > board-$(CONFIG_MACH_TX53):= karo-tx53 > board-$(CONFIG_MACH_GUF_VINCELL) := guf-vincell > board-$(CONFIG_MACH_EFIKA_MX_SMARTBOOK) := efika-mx-smartbook > +board-$(CONFIG_MACH_ZEDBOARD):= avnet-zedboard > machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y)) > > diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig > new file mode 100644 > index 000..5bbd648 > --- /dev/null > +++ b/arch/arm/mach-zynq/Kconfig > @@ -0,0 +1,38 @@ > +if ARCH_ZYNQ Not sure how much we care here, but with the order of the patchset the way it is, after this one, it will be possible to select the ZedBoard, even though all of the other support files get added only in the last patch. > + > +config ARCH_TEXT_BASE > + hex > + default 0x1ff0 if MACH_ZEDBOARD > + > +config ZYNQ_DEBUG_LL_UART_BASE > + hex > + default 0xe0001000 if MACH_ZEDBOARD > + > +config BOARDINFO > + default "ZedBoard" if MACH_ZEDBOARD > + > +choice > + prompt "Xilinx Zynq type board" > + > +config ARCH_ZYNQ7000 > + bool "Zynq-7000" > + select CPU_V7 > + select CLKDEV_LOOKUP > + select COMMON_CLK > + select ARM_SMP_TWD > + > +endchoice > + > +if ARCH_ZYNQ7000 > + > +choice > + prompt "Zynq-7000 Board Type" > + > +config MACH_ZEDBOARD > + bool "Avnet Zynq-7000 ZedBoard" > + select DRIVER_SERIAL_CADENCE > + > +endchoice > +endif > + > +endif [..] > diff --git a/arch/arm/mach-zynq/include/mach/zynq-flash-header.h > b/arch/arm/mach-zynq/include/mach/zynq-flash-header.h > new file mode 100644 > index 000..3b67e55 > --- /dev/null > +++ b/arch/arm/mach-zynq/include/mach/zynq-flash-header.h > @@ -0,0 +1,38 @@ > +#ifndef __MACH_FLASH_HEADER_H > +#define __MACH_FLASH_HEADER_H > + > +#include > + > +#define __flash_header_section __section(.flash_header_0x0) > +#define __ps7reg_entry_section __section(.ps7reg_entry_0x0A0) > +#define __image_len_section __section(.image_len_0x08c0) > +#define FLASH_HEADER_OFFSET 0x0 > +#define IMAGE_OFFSET 0x8c0 > + > +#define DEST_BASE0x8c0 > +#define FLASH_HEADER_BASE(DEST_BASE + FLASH_HEADER_OFFSET) > + > +struct zynq_reg_entry { > + __le32 addr; > + __le32 val; > +}; > + > +#define WIDTH_DETECTION_MAGIC0xAA995566 > +#define IMAGE_IDENTIFICATION 0x584C4E58 /* "XLNX" */ > + > +struct zynq_flash_header { > + __le32 width_det; > + __le32 image_id; > + __le32 enc_stat; > + __le32 user; > + __le32 flash_offset; > + __le32 length; > + __le32 res0; > + __le32 start_of_exec; > + __le32 total_len; > + __le32 res1; > + __le32 checksum; > + __le32 res2; > +}; One thing I found during my testing/debugging to be useful is to have a way to turn off the flash header, to get a header-less barebox.bin I could use JTAG to load on the board. (I realize I could have done used it _with_ the flash header and set the PC up at 0x8c0, but this was easier). It would be nice if there was a headerless binary left as a build artifact that could be used for this purpose. Josh ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH v3 2/5] ARM: zynq: Add new architecture zynq
Add basic support for the Xilinx Zynq-7000 EPP architecture. The Zynq-7000 is an embedded processing platform that combines a Cortex A9 dualcore MPSoC with an Artix-7 FPGA. Signed-off-by: Steffen Trumtrar --- Changes since v2: - don't force serial driver in Kconfig - remove MACH_HAS_LOWLEVEL_INIT - use (void __iomem *) in debug_ll.h - remove zynq_add_device inline function - use resource_size_t instead of void * - use __le32 consistently in zynq-flash-header.h - remove useless flash_header_start section arch/arm/Kconfig | 5 + arch/arm/Makefile | 2 + arch/arm/mach-zynq/Kconfig | 38 ++ arch/arm/mach-zynq/Makefile| 1 + arch/arm/mach-zynq/devices.c | 8 ++ arch/arm/mach-zynq/include/mach/barebox.lds.h | 8 ++ arch/arm/mach-zynq/include/mach/debug_ll.h | 37 ++ arch/arm/mach-zynq/include/mach/devices.h | 13 ++ .../arm/mach-zynq/include/mach/zynq-flash-header.h | 38 ++ arch/arm/mach-zynq/include/mach/zynq7000-regs.h| 132 + arch/arm/mach-zynq/zynq.c | 56 + include/asm-generic/barebox.lds.h | 3 +- 12 files changed, 340 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-zynq/Kconfig create mode 100644 arch/arm/mach-zynq/Makefile create mode 100644 arch/arm/mach-zynq/devices.c create mode 100644 arch/arm/mach-zynq/include/mach/barebox.lds.h create mode 100644 arch/arm/mach-zynq/include/mach/debug_ll.h create mode 100644 arch/arm/mach-zynq/include/mach/devices.h create mode 100644 arch/arm/mach-zynq/include/mach/zynq-flash-header.h create mode 100644 arch/arm/mach-zynq/include/mach/zynq7000-regs.h create mode 100644 arch/arm/mach-zynq/zynq.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 28332ec..8431fa8 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -110,6 +110,10 @@ config ARCH_TEGRA select CPU_ARM926T select HAS_DEBUG_LL +config ARCH_ZYNQ + bool "Xilinx Zynq-based boards" + select HAS_DEBUG_LL + endchoice source arch/arm/cpu/Kconfig @@ -126,6 +130,7 @@ source arch/arm/mach-pxa/Kconfig source arch/arm/mach-samsung/Kconfig source arch/arm/mach-versatile/Kconfig source arch/arm/mach-tegra/Kconfig +source arch/arm/mach-zynq/Kconfig config ARM_ASM_UNIFIED bool diff --git a/arch/arm/Makefile b/arch/arm/Makefile index fcb2969..ceb45dc 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -64,6 +64,7 @@ machine-$(CONFIG_ARCH_PXA):= pxa machine-$(CONFIG_ARCH_SAMSUNG) := samsung machine-$(CONFIG_ARCH_VERSATILE) := versatile machine-$(CONFIG_ARCH_TEGRA) := tegra +machine-$(CONFIG_ARCH_ZYNQ):= zynq # Board directory name. This list is sorted alphanumerically # by CONFIG_* macro name. @@ -157,6 +158,7 @@ board-$(CONFIG_MACH_SABRELITE) := freescale-mx6-sabrelite board-$(CONFIG_MACH_TX53) := karo-tx53 board-$(CONFIG_MACH_GUF_VINCELL) := guf-vincell board-$(CONFIG_MACH_EFIKA_MX_SMARTBOOK):= efika-mx-smartbook +board-$(CONFIG_MACH_ZEDBOARD) := avnet-zedboard machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y)) diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig new file mode 100644 index 000..5bbd648 --- /dev/null +++ b/arch/arm/mach-zynq/Kconfig @@ -0,0 +1,38 @@ +if ARCH_ZYNQ + +config ARCH_TEXT_BASE + hex + default 0x1ff0 if MACH_ZEDBOARD + +config ZYNQ_DEBUG_LL_UART_BASE + hex + default 0xe0001000 if MACH_ZEDBOARD + +config BOARDINFO + default "ZedBoard" if MACH_ZEDBOARD + +choice + prompt "Xilinx Zynq type board" + +config ARCH_ZYNQ7000 + bool "Zynq-7000" + select CPU_V7 + select CLKDEV_LOOKUP + select COMMON_CLK + select ARM_SMP_TWD + +endchoice + +if ARCH_ZYNQ7000 + +choice + prompt "Zynq-7000 Board Type" + +config MACH_ZEDBOARD + bool "Avnet Zynq-7000 ZedBoard" + select DRIVER_SERIAL_CADENCE + +endchoice +endif + +endif diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile new file mode 100644 index 000..459c957 --- /dev/null +++ b/arch/arm/mach-zynq/Makefile @@ -0,0 +1 @@ +obj-y += zynq.o devices.o clk-zynq7000.o diff --git a/arch/arm/mach-zynq/devices.c b/arch/arm/mach-zynq/devices.c new file mode 100644 index 000..777bb87 --- /dev/null +++ b/arch/arm/mach-zynq/devices.c @@ -0,0 +1,8 @@ +#include +#include +#include + +struct device_d *zynq_add_uart(resource_size_t base, int id) +{ + return add_generic_device("cadence-uart", id, NULL, base, 0x1000, IORESOURCE_MEM, NULL); +} diff --git a/arch/arm/mach-zynq/include/mach/barebox.lds.h b/arch/arm/mach-zynq/include/mach/barebox.lds.h new file mode 100644 index 00
[PATCH v3 2/5] ARM: zynq: Add new architecture zynq
Add basic support for the Xilinx Zynq-7000 EPP architecture. The Zynq-7000 is an embedded processing platform that combines a Cortex A9 dualcore MPSoC with an Artix-7 FPGA. Signed-off-by: Steffen Trumtrar --- Changes since v2: - don't force serial driver in Kconfig - remove MACH_HAS_LOWLEVEL_INIT - use (void __iomem *) in debug_ll.h - remove zynq_add_device inline function - use resource_size_t instead of void * - use __le32 consistently in zynq-flash-header.h - remove useless flash_header_start section arch/arm/Kconfig | 5 + arch/arm/Makefile | 2 + arch/arm/mach-zynq/Kconfig | 38 ++ arch/arm/mach-zynq/Makefile| 1 + arch/arm/mach-zynq/devices.c | 8 ++ arch/arm/mach-zynq/include/mach/barebox.lds.h | 8 ++ arch/arm/mach-zynq/include/mach/debug_ll.h | 37 ++ arch/arm/mach-zynq/include/mach/devices.h | 13 ++ .../arm/mach-zynq/include/mach/zynq-flash-header.h | 38 ++ arch/arm/mach-zynq/include/mach/zynq7000-regs.h| 132 + arch/arm/mach-zynq/zynq.c | 56 + include/asm-generic/barebox.lds.h | 3 +- 12 files changed, 340 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-zynq/Kconfig create mode 100644 arch/arm/mach-zynq/Makefile create mode 100644 arch/arm/mach-zynq/devices.c create mode 100644 arch/arm/mach-zynq/include/mach/barebox.lds.h create mode 100644 arch/arm/mach-zynq/include/mach/debug_ll.h create mode 100644 arch/arm/mach-zynq/include/mach/devices.h create mode 100644 arch/arm/mach-zynq/include/mach/zynq-flash-header.h create mode 100644 arch/arm/mach-zynq/include/mach/zynq7000-regs.h create mode 100644 arch/arm/mach-zynq/zynq.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 28332ec..8431fa8 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -110,6 +110,10 @@ config ARCH_TEGRA select CPU_ARM926T select HAS_DEBUG_LL +config ARCH_ZYNQ + bool "Xilinx Zynq-based boards" + select HAS_DEBUG_LL + endchoice source arch/arm/cpu/Kconfig @@ -126,6 +130,7 @@ source arch/arm/mach-pxa/Kconfig source arch/arm/mach-samsung/Kconfig source arch/arm/mach-versatile/Kconfig source arch/arm/mach-tegra/Kconfig +source arch/arm/mach-zynq/Kconfig config ARM_ASM_UNIFIED bool diff --git a/arch/arm/Makefile b/arch/arm/Makefile index fcb2969..ceb45dc 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -64,6 +64,7 @@ machine-$(CONFIG_ARCH_PXA):= pxa machine-$(CONFIG_ARCH_SAMSUNG) := samsung machine-$(CONFIG_ARCH_VERSATILE) := versatile machine-$(CONFIG_ARCH_TEGRA) := tegra +machine-$(CONFIG_ARCH_ZYNQ):= zynq # Board directory name. This list is sorted alphanumerically # by CONFIG_* macro name. @@ -157,6 +158,7 @@ board-$(CONFIG_MACH_SABRELITE) := freescale-mx6-sabrelite board-$(CONFIG_MACH_TX53) := karo-tx53 board-$(CONFIG_MACH_GUF_VINCELL) := guf-vincell board-$(CONFIG_MACH_EFIKA_MX_SMARTBOOK):= efika-mx-smartbook +board-$(CONFIG_MACH_ZEDBOARD) := avnet-zedboard machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y)) diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig new file mode 100644 index 000..5bbd648 --- /dev/null +++ b/arch/arm/mach-zynq/Kconfig @@ -0,0 +1,38 @@ +if ARCH_ZYNQ + +config ARCH_TEXT_BASE + hex + default 0x1ff0 if MACH_ZEDBOARD + +config ZYNQ_DEBUG_LL_UART_BASE + hex + default 0xe0001000 if MACH_ZEDBOARD + +config BOARDINFO + default "ZedBoard" if MACH_ZEDBOARD + +choice + prompt "Xilinx Zynq type board" + +config ARCH_ZYNQ7000 + bool "Zynq-7000" + select CPU_V7 + select CLKDEV_LOOKUP + select COMMON_CLK + select ARM_SMP_TWD + +endchoice + +if ARCH_ZYNQ7000 + +choice + prompt "Zynq-7000 Board Type" + +config MACH_ZEDBOARD + bool "Avnet Zynq-7000 ZedBoard" + select DRIVER_SERIAL_CADENCE + +endchoice +endif + +endif diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile new file mode 100644 index 000..459c957 --- /dev/null +++ b/arch/arm/mach-zynq/Makefile @@ -0,0 +1 @@ +obj-y += zynq.o devices.o clk-zynq7000.o diff --git a/arch/arm/mach-zynq/devices.c b/arch/arm/mach-zynq/devices.c new file mode 100644 index 000..777bb87 --- /dev/null +++ b/arch/arm/mach-zynq/devices.c @@ -0,0 +1,8 @@ +#include +#include +#include + +struct device_d *zynq_add_uart(resource_size_t base, int id) +{ + return add_generic_device("cadence-uart", id, NULL, base, 0x1000, IORESOURCE_MEM, NULL); +} diff --git a/arch/arm/mach-zynq/include/mach/barebox.lds.h b/arch/arm/mach-zynq/include/mach/barebox.lds.h new file mode 100644 index 00