Re: [PATCH v2 2/5] ARM: zynq: Add new architecture zynq

2013-03-19 Thread Jean-Christophe PLAGNIOL-VILLARD
On 10:21 Tue 19 Mar , 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 
> ---
>  arch/arm/Kconfig   |   5 +
>  arch/arm/Makefile  |   2 +
>  arch/arm/mach-zynq/Kconfig |  39 ++
>  arch/arm/mach-zynq/Makefile|   1 +
>  arch/arm/mach-zynq/devices.c   |  14 +++
>  arch/arm/mach-zynq/include/mach/barebox.lds.h  |   9 ++
>  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 |  40 +++
>  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, 350 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..3965ad4
> --- /dev/null
> +++ b/arch/arm/mach-zynq/Kconfig
> @@ -0,0 +1,39 @@
> +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 DRIVER_SERIAL_CADENCE
don't force it we may want NO serial support
> + 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 MACH_HAS_LOWLEVEL_INIT
???
> +
> +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..2bb3c92
> --- /dev/null
> +++ b/arch/arm/mach-zynq/devices.c
> @@ -0,0 +1,14 @@
> +#include 
> +#include 
> +#include 
> +
> +static inline struct device_d *zynq_add_device(char *name, int id, void 
> *base, int size, void *pdata)
> +{
> + return add_generic_device(name, id, NULL, (resource_size_t)base, size,
> +   IORESOURCE_MEM, pdata);
> +}
drop it useless
> +
> +struct device_d *z

Re: [PATCH v2 2/5] ARM: zynq: Add new architecture zynq

2013-03-19 Thread Steffen Trumtrar
On Tue, Mar 19, 2013 at 08:18:02AM -0500, Josh Cartwright wrote:
> On Tue, Mar 19, 2013 at 10:21:57AM +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 
> > ---
> [..]
> > 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..a0251cb
> > --- /dev/null
> > +++ b/arch/arm/mach-zynq/include/mach/zynq-flash-header.h
> > @@ -0,0 +1,40 @@
> > +#ifndef __MACH_FLASH_HEADER_H
> > +#define __MACH_FLASH_HEADER_H
> > +
> > +#include 
> > +
> > +#define __flash_header_start   __section(.flash_header_start)
> > +
> > +#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 {
> > +   uint32_t width_det;
> > +   uint32_t image_id;
> > +   uint32_t enc_stat;
> > +   uint32_t user;
> > +   uint32_t flash_offset;
> > +   uint32_t length;
> > +   uint32_t res0;
> > +   uint32_t start_of_exec;
> > +   uint32_t total_len;
> > +   uint32_t res1;
> > +   uint32_t checksum;
> > +   uint32_t res2;
> > +};
> 
> Did you disagree with my suggestion last time around of merging the
> flash_header and ps7reg_entry sections?  At the very least, it seems
> inconsistent that the zynq_reg_entrys have type __le32, and the members
> of zynq_flash_header are uint32_t (even though they have the same
> endianness requirement).

Actually, I seem to have missed that comment.
The types should be the same. Yes. I have to fix that.

> 
> I still maintain you should move the REG macro currently in the board
> flash_header.c here.
> 

Hm, ok. I will do that.

Regards,
Steffen

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH v2 2/5] ARM: zynq: Add new architecture zynq

2013-03-19 Thread Josh Cartwright
On Tue, Mar 19, 2013 at 10:21:57AM +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 
> ---
[..]
> 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..a0251cb
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/zynq-flash-header.h
> @@ -0,0 +1,40 @@
> +#ifndef __MACH_FLASH_HEADER_H
> +#define __MACH_FLASH_HEADER_H
> +
> +#include 
> +
> +#define __flash_header_start __section(.flash_header_start)
> +
> +#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 {
> + uint32_t width_det;
> + uint32_t image_id;
> + uint32_t enc_stat;
> + uint32_t user;
> + uint32_t flash_offset;
> + uint32_t length;
> + uint32_t res0;
> + uint32_t start_of_exec;
> + uint32_t total_len;
> + uint32_t res1;
> + uint32_t checksum;
> + uint32_t res2;
> +};

Did you disagree with my suggestion last time around of merging the
flash_header and ps7reg_entry sections?  At the very least, it seems
inconsistent that the zynq_reg_entrys have type __le32, and the members
of zynq_flash_header are uint32_t (even though they have the same
endianness requirement).

I still maintain you should move the REG macro currently in the board
flash_header.c here.

   Josh

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH v2 2/5] ARM: zynq: Add new architecture zynq

2013-03-19 Thread Josh Cartwright
On Tue, Mar 19, 2013 at 10:21:57AM +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 
[..]
> +static int zynq_init(void)
> +{
> + u32 val;
> +
> + dsb();
> + isb();
> + writel(0xDF0D, ZYNQ_SLCR_UNLOCK);
> + /* remap ocm high */
> + writel(0x000F, 0xf8000910);
> + /* mpcore.filtering_start_address */
> + writel(0x, 0xf8f00040);
> + /* mpcore.filtering_end_address */
> + writel(0xffe0, 0xf8f00044);
> + val = readl(0xf8f0);
> + val |= 0x2;
> + writel(val, 0xf8f0);
> + dmb();

Doh!  I should have read this before replying!  This is what I was
looking for!

I think this will work nicely.

Josh

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2 2/5] ARM: zynq: Add new architecture zynq

2013-03-19 Thread Steffen Trumtrar
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 
---
 arch/arm/Kconfig   |   5 +
 arch/arm/Makefile  |   2 +
 arch/arm/mach-zynq/Kconfig |  39 ++
 arch/arm/mach-zynq/Makefile|   1 +
 arch/arm/mach-zynq/devices.c   |  14 +++
 arch/arm/mach-zynq/include/mach/barebox.lds.h  |   9 ++
 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 |  40 +++
 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, 350 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..3965ad4
--- /dev/null
+++ b/arch/arm/mach-zynq/Kconfig
@@ -0,0 +1,39 @@
+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 DRIVER_SERIAL_CADENCE
+   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 MACH_HAS_LOWLEVEL_INIT
+
+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..2bb3c92
--- /dev/null
+++ b/arch/arm/mach-zynq/devices.c
@@ -0,0 +1,14 @@
+#include 
+#include 
+#include 
+
+static inline struct device_d *zynq_add_device(char *name, int id, void *base, 
int size, void *pdata)
+{
+   return add_generic_device(name, id, NULL, (resource_size_t)base, size,
+ IORESOURCE_MEM, pdata);
+}
+
+struct device_d *zynq_add_uart(void *base, int id)
+{
+   return zynq_add_device("cadence-uart", id, base, 0x1000, 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 000..674a4ac
--- /dev/null
+++ b/arch/arm/mach-zynq/include/mach/barebox.lds.h
@@ -0,0 +1,9 @@
+#define PR