Re: [PATCH] ARM: Xilinx: Adding zynq platform support

From: Barry Song
Date: Mon May 30 2011 - 05:48:00 EST


2011/5/26 Arnd Bergmann <arnd@xxxxxxxx>:
> On Wednesday 25 May 2011, Grant Likely wrote:
>>
>> As per discussion attached below. ÂPlease pull this tree adding device
>> tree support to ARM, plus some other minor device tree changes.
>
> Hi Grant and Linus,
>
> There is also the new Xilinx zynq subarchitecture pending that depends
> on this, see below. Should we also include that right away, in order
> to have an example for other platforms? I think the code is clean
> enough and it would be good to have.
>
> Â Â Â ÂArnd
>
> 8<---------
> From: Grant Likely <grant.likely@xxxxxxxxxxxx>
>
> The 1st board support is minimal to get a system up and running
> on the Xilinx platform.
>
> This platform reuses the clock implementation from plat-versatile, and
> it depends entirely on CONFIG_OF support. ÂThere is only one board
> support file which obtains all device information from a device tree
> dtb file which is passed to the kernel at boot time.
>
> Signed-off-by: Grant Likely <grant.likely@xxxxxxxxxxxx>
> [john.linn@xxxxxxxxxx: Reverted dependency on of_irq_domain patches]
> Signed-off-by: John Linn <john.linn@xxxxxxxxxx>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

is there a whole complete tree for zynq? i'd like to refer. thanks! as
i am moving csr prima2 to device tree, we need to change so many
codes. i hope we can follow what the way zynq is doing.

> ---
> ÂDocumentation/devicetree/bindings/arm/xilinx.txt | Â Â7 +
> Âarch/arm/Kconfig                 |  14 +
> Âarch/arm/Makefile                Â|  Â2 +
> Âarch/arm/boot/dts/zynq-ep107.dts         |  52 ++++
> Âarch/arm/mach-zynq/Makefile           Â|  Â6 +
> Âarch/arm/mach-zynq/Makefile.boot         |  Â3 +
> Âarch/arm/mach-zynq/board_dt.c          Â|  37 +++
> Âarch/arm/mach-zynq/common.c           Â| Â102 ++++++++
> Âarch/arm/mach-zynq/common.h           Â|  29 ++
> Âarch/arm/mach-zynq/include/mach/clkdev.h     |  32 +++
> Âarch/arm/mach-zynq/include/mach/debug-macro.S Â Â| Â 36 +++
> Âarch/arm/mach-zynq/include/mach/entry-macro.S Â Â| Â 30 +++
> Âarch/arm/mach-zynq/include/mach/hardware.h    |  18 ++
> Âarch/arm/mach-zynq/include/mach/io.h       |  33 +++
> Âarch/arm/mach-zynq/include/mach/irqs.h      |  21 ++
> Âarch/arm/mach-zynq/include/mach/memory.h     |  22 ++
> Âarch/arm/mach-zynq/include/mach/system.h     |  28 ++
> Âarch/arm/mach-zynq/include/mach/timex.h     Â|  23 ++
> Âarch/arm/mach-zynq/include/mach/uart.h      |  25 ++
> Âarch/arm/mach-zynq/include/mach/uncompress.h   |  51 ++++
> Âarch/arm/mach-zynq/include/mach/vmalloc.h    Â|  20 ++
> Âarch/arm/mach-zynq/include/mach/zynq_soc.h    |  48 ++++
> Âarch/arm/mach-zynq/timer.c            | Â298 ++++++++++++++++++++++
> Âarch/arm/mm/Kconfig               Â|  Â2 +-
> Â24 files changed, 938 insertions(+), 1 deletions(-)
> Âcreate mode 100644 Documentation/devicetree/bindings/arm/xilinx.txt
> Âcreate mode 100644 arch/arm/boot/dts/zynq-ep107.dts
> Âcreate mode 100644 arch/arm/mach-zynq/Makefile
> Âcreate mode 100644 arch/arm/mach-zynq/Makefile.boot
> Âcreate mode 100644 arch/arm/mach-zynq/board_dt.c
> Âcreate mode 100644 arch/arm/mach-zynq/common.c
> Âcreate mode 100644 arch/arm/mach-zynq/common.h
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/clkdev.h
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/debug-macro.S
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/entry-macro.S
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/hardware.h
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/io.h
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/irqs.h
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/memory.h
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/system.h
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/timex.h
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/uart.h
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/uncompress.h
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/vmalloc.h
> Âcreate mode 100644 arch/arm/mach-zynq/include/mach/zynq_soc.h
> Âcreate mode 100644 arch/arm/mach-zynq/timer.c
>
> diff --git a/Documentation/devicetree/bindings/arm/xilinx.txt b/Documentation/devicetree/bindings/arm/xilinx.txt
> new file mode 100644
> index 0000000..6f1ed83
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/xilinx.txt
> @@ -0,0 +1,7 @@
> +Xilinx Zynq EP107 Emulation Platform board
> +
> +This board is an emulation platform for the Zynq product which is
> +based on an ARM Cortex A9 processor.
> +
> +Required root node properties:
> + Â Â- compatible = "xlnx,zynq-ep107";
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 3bc1a58..4a6bc50 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -887,6 +887,20 @@ config ARCH_VT8500
> Â Â Â Âselect HAVE_PWM
> Â Â Â Âhelp
> Â Â Â Â ÂSupport for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
> +
> +config ARCH_ZYNQ
> + Â Â Â bool "Xilinx Zynq ARM Cortex A9 Platform"
> + Â Â Â select CPU_V7
> + Â Â Â select GENERIC_TIME
> + Â Â Â select GENERIC_CLOCKEVENTS
> + Â Â Â select CLKDEV_LOOKUP
> + Â Â Â select ARM_GIC
> + Â Â Â select ARM_AMBA
> + Â Â Â select ICST
> + Â Â Â select USE_OF
> + Â Â Â help
> + Â Â Â Â Support for Xilinx Zynq ARM Cortex A9 Platform
> +
> Âendchoice
>
> Â#
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 25750bc..bfc3a5a 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -197,6 +197,7 @@ machine-$(CONFIG_MACH_SPEAR300) Â Â Â Â Â Â := spear3xx
> Âmachine-$(CONFIG_MACH_SPEAR310) Â Â Â Â Â Â Â Â:= spear3xx
> Âmachine-$(CONFIG_MACH_SPEAR320) Â Â Â Â Â Â Â Â:= spear3xx
> Âmachine-$(CONFIG_MACH_SPEAR600) Â Â Â Â Â Â Â Â:= spear6xx
> +machine-$(CONFIG_ARCH_ZYNQ) Â Â Â Â Â Â:= zynq
>
> Â# Platform directory name. ÂThis list is sorted alphanumerically
> Â# by CONFIG_* macro name.
> @@ -204,6 +205,7 @@ plat-$(CONFIG_ARCH_MXC) Â Â Â Â Â Â := mxc
> Âplat-$(CONFIG_ARCH_OMAP) Â Â Â := omap
> Âplat-$(CONFIG_ARCH_S3C64XX) Â Â:= samsung
> Âplat-$(CONFIG_ARCH_TCC_926) Â Â:= tcc
> +plat-$(CONFIG_ARCH_ZYNQ) Â Â Â := versatile
> Âplat-$(CONFIG_PLAT_IOP) Â Â Â Â Â Â Â Â:= iop
> Âplat-$(CONFIG_PLAT_NOMADIK) Â Â:= nomadik
> Âplat-$(CONFIG_PLAT_ORION) Â Â Â:= orion
> diff --git a/arch/arm/boot/dts/zynq-ep107.dts b/arch/arm/boot/dts/zynq-ep107.dts
> new file mode 100644
> index 0000000..37ca192
> --- /dev/null
> +++ b/arch/arm/boot/dts/zynq-ep107.dts
> @@ -0,0 +1,52 @@
> +/*
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +/dts-v1/;
> +/ {
> + Â Â Â model = "Xilinx Zynq EP107";
> + Â Â Â compatible = "xlnx,zynq-ep107";
> + Â Â Â #address-cells = <1>;
> + Â Â Â #size-cells = <1>;
> + Â Â Â interrupt-parent = <&intc>;
> +
> + Â Â Â memory {
> + Â Â Â Â Â Â Â device_type = "memory";
> + Â Â Â Â Â Â Â reg = <0x0 0x10000000>;
> + Â Â Â };
> +
> + Â Â Â chosen {
> + Â Â Â Â Â Â Â bootargs = "console=ttyPS0,9600 root=/dev/ram rw initrd=0x800000,8M earlyprintk";
> + Â Â Â Â Â Â Â linux,stdout-path = &uart0;
> + Â Â Â };
> +
> + Â Â Â amba {
> + Â Â Â Â Â Â Â compatible = "simple-bus";
> + Â Â Â Â Â Â Â #address-cells = <1>;
> + Â Â Â Â Â Â Â #size-cells = <1>;
> + Â Â Â Â Â Â Â ranges;
> +
> + Â Â Â Â Â Â Â intc: interrupt-controller@f8f01000 {
> + Â Â Â Â Â Â Â Â Â Â Â interrupt-controller;
> + Â Â Â Â Â Â Â Â Â Â Â compatible = "arm,gic";
> + Â Â Â Â Â Â Â Â Â Â Â reg = <0xF8F01000 0x1000>;
> + Â Â Â Â Â Â Â Â Â Â Â #interrupt-cells = <2>;
> + Â Â Â Â Â Â Â };
> +
> + Â Â Â Â Â Â Â uart0: uart@e0000000 {
> + Â Â Â Â Â Â Â Â Â Â Â compatible = "xlnx,xuartps";
> + Â Â Â Â Â Â Â Â Â Â Â reg = <0xE0000000 0x1000>;
> + Â Â Â Â Â Â Â Â Â Â Â interrupts = <59 0>;
> + Â Â Â Â Â Â Â Â Â Â Â clock = <50000000>;
> + Â Â Â Â Â Â Â };
> + Â Â Â };
> +};
> diff --git a/arch/arm/mach-zynq/Makefile b/arch/arm/mach-zynq/Makefile
> new file mode 100644
> index 0000000..c550c67
> --- /dev/null
> +++ b/arch/arm/mach-zynq/Makefile
> @@ -0,0 +1,6 @@
> +#
> +# Makefile for the linux kernel.
> +#
> +
> +# Common support
> +obj-y             Â:= common.o timer.o board_dt.o
> diff --git a/arch/arm/mach-zynq/Makefile.boot b/arch/arm/mach-zynq/Makefile.boot
> new file mode 100644
> index 0000000..67039c3
> --- /dev/null
> +++ b/arch/arm/mach-zynq/Makefile.boot
> @@ -0,0 +1,3 @@
> + Â zreladdr-y Â:= 0x00008000
> +params_phys-y Â:= 0x00000100
> +initrd_phys-y Â:= 0x00800000
> diff --git a/arch/arm/mach-zynq/board_dt.c b/arch/arm/mach-zynq/board_dt.c
> new file mode 100644
> index 0000000..5b4710d
> --- /dev/null
> +++ b/arch/arm/mach-zynq/board_dt.c
> @@ -0,0 +1,37 @@
> +/*
> + * This file contains code for boards with device tree support.
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * based on arch/arm/mach-realview/core.c
> + *
> + * ÂCopyright (C) 1999 - 2003 ARM Limited
> + * ÂCopyright (C) 2000 Deep Blue Solutions Ltd
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/of.h>
> +#include <asm/mach/arch.h>
> +#include <asm/mach-types.h>
> +#include "common.h"
> +
> +static const char *xilinx_dt_match[] = {
> + Â Â Â "xlnx,zynq-ep107",
> + Â Â Â NULL
> +};
> +
> +MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
> +    .map_io     = xilinx_map_io,
> +    .init_irq    = xilinx_irq_init,
> +    .init_machine  = xilinx_init_machine,
> +    .timer     Â= &xttcpss_sys_timer,
> +    .dt_compat   Â= xilinx_dt_match,
> +MACHINE_END
> diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
> new file mode 100644
> index 0000000..b3ac5c2
> --- /dev/null
> +++ b/arch/arm/mach-zynq/common.c
> @@ -0,0 +1,102 @@
> +/*
> + * This file contains common code that is intended to be used across
> + * boards so that it's not replicated.
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/cpumask.h>
> +#include <linux/platform_device.h>
> +#include <linux/clk.h>
> +#include <linux/of_irq.h>
> +#include <linux/of_platform.h>
> +
> +#include <asm/mach/map.h>
> +#include <asm/page.h>
> +#include <asm/hardware/gic.h>
> +#include <asm/hardware/cache-l2x0.h>
> +
> +#include <mach/zynq_soc.h>
> +#include <mach/clkdev.h>
> +#include "common.h"
> +
> +static struct of_device_id zynq_of_bus_ids[] __initdata = {
> + Â Â Â { .compatible = "simple-bus", },
> + Â Â Â {}
> +};
> +
> +/**
> + * xilinx_init_machine() - System specific initialization, intended to be
> + * Â Â Â Â Â Â Â Â Â Â Â Âcalled from board specific initialization.
> + */
> +void __init xilinx_init_machine(void)
> +{
> +#ifdef CONFIG_CACHE_L2X0
> + Â Â Â /*
> + Â Â Â Â* 64KB way size, 8-way associativity, parity disabled
> + Â Â Â Â*/
> + Â Â Â l2x0_init(PL310_L2CC_BASE, 0x02060000, 0xF0F0FFFF);
> +#endif
> +
> + Â Â Â of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
> +}
> +
> +/**
> + * xilinx_irq_init() - Interrupt controller initialization for the GIC.
> + */
> +void __init xilinx_irq_init(void)
> +{
> + Â Â Â gic_init(0, 29, SCU_GIC_DIST_BASE, SCU_GIC_CPU_BASE);
> +}
> +
> +/* The minimum devices needed to be mapped before the VM system is up and
> + * running include the GIC, UART and Timer Counter.
> + */
> +
> +static struct map_desc io_desc[] __initdata = {
> + Â Â Â {
> +        .virtual    Â= TTC0_VIRT,
> +        .pfn      Â= __phys_to_pfn(TTC0_PHYS),
> +        .length     = SZ_4K,
> +        .type      = MT_DEVICE,
> + Â Â Â }, {
> +        .virtual    Â= SCU_PERIPH_VIRT,
> +        .pfn      Â= __phys_to_pfn(SCU_PERIPH_PHYS),
> +        .length     = SZ_8K,
> +        .type      = MT_DEVICE,
> + Â Â Â }, {
> +        .virtual    Â= PL310_L2CC_VIRT,
> +        .pfn      Â= __phys_to_pfn(PL310_L2CC_PHYS),
> +        .length     = SZ_4K,
> +        .type      = MT_DEVICE,
> + Â Â Â },
> +
> +#ifdef CONFIG_DEBUG_LL
> + Â Â Â {
> +        .virtual    Â= UART0_VIRT,
> +        .pfn      Â= __phys_to_pfn(UART0_PHYS),
> +        .length     = SZ_4K,
> +        .type      = MT_DEVICE,
> + Â Â Â },
> +#endif
> +
> +};
> +
> +/**
> + * xilinx_map_io() - Create memory mappings needed for early I/O.
> + */
> +void __init xilinx_map_io(void)
> +{
> + Â Â Â iotable_init(io_desc, ARRAY_SIZE(io_desc));
> +}
> diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
> new file mode 100644
> index 0000000..bca2196
> --- /dev/null
> +++ b/arch/arm/mach-zynq/common.h
> @@ -0,0 +1,29 @@
> +/*
> + * This file contains common function prototypes to avoid externs
> + * in the c files.
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __MACH_ZYNQ_COMMON_H__
> +#define __MACH_ZYNQ_COMMON_H__
> +
> +#include <linux/init.h>
> +#include <asm/mach/time.h>
> +
> +extern void xilinx_init_machine(void);
> +extern void xilinx_irq_init(void);
> +extern void xilinx_map_io(void);
> +
> +extern struct sys_timer xttcpss_sys_timer;
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/include/mach/clkdev.h b/arch/arm/mach-zynq/include/mach/clkdev.h
> new file mode 100644
> index 0000000..c6e73d8
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/clkdev.h
> @@ -0,0 +1,32 @@
> +/*
> + * arch/arm/mach-zynq/include/mach/clkdev.h
> + *
> + * ÂCopyright (C) 2011 Xilinx, Inc.
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#ifndef __MACH_CLKDEV_H__
> +#define __MACH_CLKDEV_H__
> +
> +#include <plat/clock.h>
> +
> +struct clk {
> +    unsigned long      rate;
> +    const struct clk_ops  Â*ops;
> + Â Â Â const struct icst_params *params;
> +    void __iomem      Â*vcoreg;
> +};
> +
> +#define __clk_get(clk) ({ 1; })
> +#define __clk_put(clk) do { } while (0)
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/include/mach/debug-macro.S b/arch/arm/mach-zynq/include/mach/debug-macro.S
> new file mode 100644
> index 0000000..9f664d5
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/debug-macro.S
> @@ -0,0 +1,36 @@
> +/* arch/arm/mach-zynq/include/mach/debug-macro.S
> + *
> + * Debugging macro include header
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#include <mach/zynq_soc.h>
> +#include <mach/uart.h>
> +
> + Â Â Â Â Â Â Â .macro Âaddruart, rp, rv
> +        ldr   \rp, =LL_UART_PADDR   @ physical
> +        ldr   \rv, =LL_UART_VADDR   @ virtual
> + Â Â Â Â Â Â Â .endm
> +
> + Â Â Â Â Â Â Â .macro Âsenduart,rd,rx
> +        str   \rd, [\rx, #UART_FIFO_OFFSET]  @ TXDATA
> + Â Â Â Â Â Â Â .endm
> +
> + Â Â Â Â Â Â Â .macro Âwaituart,rd,rx
> + Â Â Â Â Â Â Â .endm
> +
> + Â Â Â Â Â Â Â .macro Âbusyuart,rd,rx
> +1002:     Âldr   \rd, [\rx, #UART_SR_OFFSET]   @ get status register
> +        tst   \rd, #UART_SR_TXFULL      Â@
> +        bne   1002b          @ wait if FIFO is full
> + Â Â Â Â Â Â Â .endm
> diff --git a/arch/arm/mach-zynq/include/mach/entry-macro.S b/arch/arm/mach-zynq/include/mach/entry-macro.S
> new file mode 100644
> index 0000000..3cfc01b
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/entry-macro.S
> @@ -0,0 +1,30 @@
> +/*
> + * arch/arm/mach-zynq/include/mach/entry-macro.S
> + *
> + * Low-level IRQ helper macros
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * based on arch/plat-mxc/include/mach/entry-macro.S
> + *
> + * ÂCopyright (C) 2007 Lennert Buytenhek <buytenh@xxxxxxxxxxxxxx>
> + * ÂCopyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#include <mach/hardware.h>
> +#include <asm/hardware/entry-macro-gic.S>
> +
> + Â Â Â Â Â Â Â .macro Âdisable_fiq
> + Â Â Â Â Â Â Â .endm
> +
> + Â Â Â Â Â Â Â .macro Âarch_ret_to_user, tmp1, tmp2
> + Â Â Â Â Â Â Â .endm
> diff --git a/arch/arm/mach-zynq/include/mach/hardware.h b/arch/arm/mach-zynq/include/mach/hardware.h
> new file mode 100644
> index 0000000..d558d8a
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/hardware.h
> @@ -0,0 +1,18 @@
> +/* arch/arm/mach-zynq/include/mach/hardware.h
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __MACH_HARDWARE_H__
> +#define __MACH_HARDWARE_H__
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/include/mach/io.h b/arch/arm/mach-zynq/include/mach/io.h
> new file mode 100644
> index 0000000..39d9885
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/io.h
> @@ -0,0 +1,33 @@
> +/* arch/arm/mach-zynq/include/mach/io.h
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __MACH_IO_H__
> +#define __MACH_IO_H__
> +
> +/* Allow IO space to be anywhere in the memory */
> +
> +#define IO_SPACE_LIMIT 0xffff
> +
> +/* IO address mapping macros, nothing special at this time but required */
> +
> +#ifdef __ASSEMBLER__
> +#define IOMEM(x) Â Â Â Â Â Â Â (x)
> +#else
> +#define IOMEM(x) Â Â Â Â Â Â Â ((void __force __iomem *)(x))
> +#endif
> +
> +#define __io(a) Â Â Â Â Â Â Â Â Â Â Â Â__typesafe_io(a)
> +#define __mem_pci(a) Â Â Â Â Â (a)
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/include/mach/irqs.h b/arch/arm/mach-zynq/include/mach/irqs.h
> new file mode 100644
> index 0000000..5fb04fd
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/irqs.h
> @@ -0,0 +1,21 @@
> +/* arch/arm/mach-zynq/include/mach/irqs.h
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __MACH_IRQS_H
> +#define __MACH_IRQS_H
> +
> +#define ARCH_NR_GPIOS Â118
> +#define NR_IRQS Â Â Â Â Â Â Â Â(128 + ARCH_NR_GPIOS)
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/include/mach/memory.h b/arch/arm/mach-zynq/include/mach/memory.h
> new file mode 100644
> index 0000000..35a9263
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/memory.h
> @@ -0,0 +1,22 @@
> +/* arch/arm/mach-zynq/include/mach/memory.h
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __MACH_MEMORY_H__
> +#define __MACH_MEMORY_H__
> +
> +#include <asm/sizes.h>
> +
> +#define PLAT_PHYS_OFFSET Â Â Â UL(0x0)
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/include/mach/system.h b/arch/arm/mach-zynq/include/mach/system.h
> new file mode 100644
> index 0000000..1b84d70
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/system.h
> @@ -0,0 +1,28 @@
> +/* arch/arm/mach-zynq/include/mach/system.h
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __MACH_SYSTEM_H__
> +#define __MACH_SYSTEM_H__
> +
> +static inline void arch_idle(void)
> +{
> + Â Â Â cpu_do_idle();
> +}
> +
> +static inline void arch_reset(char mode, const char *cmd)
> +{
> + Â Â Â /* Add architecture specific reset processing here */
> +}
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/include/mach/timex.h b/arch/arm/mach-zynq/include/mach/timex.h
> new file mode 100644
> index 0000000..6c0245e
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/timex.h
> @@ -0,0 +1,23 @@
> +/* arch/arm/mach-zynq/include/mach/timex.h
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __MACH_TIMEX_H__
> +#define __MACH_TIMEX_H__
> +
> +/* the following is needed for the system to build but will be removed
> + Â in the future, the value is not important but won't hurt
> +*/
> +#define CLOCK_TICK_RATE Â Â Â Â(100 * HZ)
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/include/mach/uart.h b/arch/arm/mach-zynq/include/mach/uart.h
> new file mode 100644
> index 0000000..5c47c97
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/uart.h
> @@ -0,0 +1,25 @@
> +/* arch/arm/mach-zynq/include/mach/uart.h
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __MACH_UART_H__
> +#define __MACH_UART_H__
> +
> +#define UART_CR_OFFSET Â Â Â Â 0x00 Â/* Control Register [8:0] */
> +#define UART_SR_OFFSET Â Â Â Â 0x2C Â/* Channel Status [11:0] */
> +#define UART_FIFO_OFFSET Â Â Â 0x30 Â/* FIFO [15:0] or [7:0] */
> +
> +#define UART_SR_TXFULL Â Â Â Â 0x00000010 Â Â Â/* TX FIFO full */
> +#define UART_SR_TXEMPTY Â Â Â Â Â Â Â Â0x00000008 Â Â Â/* TX FIFO empty */
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/include/mach/uncompress.h b/arch/arm/mach-zynq/include/mach/uncompress.h
> new file mode 100644
> index 0000000..af4e844
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/uncompress.h
> @@ -0,0 +1,51 @@
> +/* arch/arm/mach-zynq/include/mach/uncompress.h
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __MACH_UNCOMPRESS_H__
> +#define __MACH_UNCOMPRESS_H__
> +
> +#include <linux/io.h>
> +#include <asm/processor.h>
> +#include <mach/zynq_soc.h>
> +#include <mach/uart.h>
> +
> +void arch_decomp_setup(void)
> +{
> +}
> +
> +static inline void flush(void)
> +{
> + Â Â Â /*
> + Â Â Â Â* Wait while the FIFO is not empty
> + Â Â Â Â*/
> + Â Â Â while (!(__raw_readl(IOMEM(LL_UART_PADDR + UART_SR_OFFSET)) &
> + Â Â Â Â Â Â Â UART_SR_TXEMPTY))
> + Â Â Â Â Â Â Â cpu_relax();
> +}
> +
> +#define arch_decomp_wdog()
> +
> +static void putc(char ch)
> +{
> + Â Â Â /*
> + Â Â Â Â* Wait for room in the FIFO, then write the char into the FIFO
> + Â Â Â Â*/
> + Â Â Â while (__raw_readl(IOMEM(LL_UART_PADDR + UART_SR_OFFSET)) &
> + Â Â Â Â Â Â Â UART_SR_TXFULL)
> + Â Â Â Â Â Â Â cpu_relax();
> +
> + Â Â Â __raw_writel(ch, IOMEM(LL_UART_PADDR + UART_FIFO_OFFSET));
> +}
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/include/mach/vmalloc.h b/arch/arm/mach-zynq/include/mach/vmalloc.h
> new file mode 100644
> index 0000000..2398eff
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/vmalloc.h
> @@ -0,0 +1,20 @@
> +/* arch/arm/mach-zynq/include/mach/vmalloc.h
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __MACH_VMALLOC_H__
> +#define __MACH_VMALLOC_H__
> +
> +#define VMALLOC_END Â Â Â 0xE0000000UL
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/include/mach/zynq_soc.h b/arch/arm/mach-zynq/include/mach/zynq_soc.h
> new file mode 100644
> index 0000000..d0d3f8f
> --- /dev/null
> +++ b/arch/arm/mach-zynq/include/mach/zynq_soc.h
> @@ -0,0 +1,48 @@
> +/* arch/arm/mach-zynq/include/mach/zynq_soc.h
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef __MACH_XILINX_SOC_H__
> +#define __MACH_XILINX_SOC_H__
> +
> +#define PERIPHERAL_CLOCK_RATE Â Â Â Â Â2500000
> +
> +/* For now, all mappings are flat (physical = virtual)
> + */
> +#define UART0_PHYS Â Â Â Â Â Â Â Â Â Â 0xE0000000
> +#define UART0_VIRT Â Â Â Â Â Â Â Â Â Â UART0_PHYS
> +
> +#define TTC0_PHYS Â Â Â Â Â Â Â Â Â Â Â0xF8001000
> +#define TTC0_VIRT Â Â Â Â Â Â Â Â Â Â ÂTTC0_PHYS
> +
> +#define PL310_L2CC_PHYS Â Â Â Â Â Â Â Â Â Â Â Â0xF8F02000
> +#define PL310_L2CC_VIRT Â Â Â Â Â Â Â Â Â Â Â ÂPL310_L2CC_PHYS
> +
> +#define SCU_PERIPH_PHYS Â Â Â Â Â Â Â Â Â Â Â Â0xF8F00000
> +#define SCU_PERIPH_VIRT Â Â Â Â Â Â Â Â Â Â Â ÂSCU_PERIPH_PHYS
> +
> +/* The following are intended for the devices that are mapped early */
> +
> +#define TTC0_BASE Â Â Â Â Â Â Â Â Â Â ÂIOMEM(TTC0_VIRT)
> +#define SCU_PERIPH_BASE Â Â Â Â Â Â Â Â Â Â Â ÂIOMEM(SCU_PERIPH_VIRT)
> +#define SCU_GIC_CPU_BASE Â Â Â Â Â Â Â (SCU_PERIPH_BASE + 0x100)
> +#define SCU_GIC_DIST_BASE Â Â Â Â Â Â Â(SCU_PERIPH_BASE + 0x1000)
> +#define PL310_L2CC_BASE Â Â Â Â Â Â Â Â Â Â Â ÂIOMEM(PL310_L2CC_VIRT)
> +
> +/*
> + * Mandatory for CONFIG_LL_DEBUG, UART is mapped virtual = physical
> + */
> +#define LL_UART_PADDR ÂUART0_PHYS
> +#define LL_UART_VADDR ÂUART0_VIRT
> +
> +#endif
> diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c
> new file mode 100644
> index 0000000..c2c96cc
> --- /dev/null
> +++ b/arch/arm/mach-zynq/timer.c
> @@ -0,0 +1,298 @@
> +/*
> + * This file contains driver for the Xilinx PS Timer Counter IP.
> + *
> + * ÂCopyright (C) 2011 Xilinx
> + *
> + * based on arch/mips/kernel/time.c timer driver
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ÂSee the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/interrupt.h>
> +#include <linux/irq.h>
> +#include <linux/types.h>
> +#include <linux/clocksource.h>
> +#include <linux/clockchips.h>
> +#include <linux/io.h>
> +
> +#include <asm/mach/time.h>
> +#include <mach/zynq_soc.h>
> +#include "common.h"
> +
> +#define IRQ_TIMERCOUNTER0 Â Â Â42
> +
> +/*
> + * This driver configures the 2 16-bit count-up timers as follows:
> + *
> + * T1: Timer 1, clocksource for generic timekeeping
> + * T2: Timer 2, clockevent source for hrtimers
> + * T3: Timer 3, <unused>
> + *
> + * The input frequency to the timer module for emulation is 2.5MHz which is
> + * common to all the timer channels (T1, T2, and T3). With a pre-scaler of 32,
> + * the timers are clocked at 78.125KHz (12.8 us resolution).
> + *
> + * The input frequency to the timer module in silicon will be 200MHz. With the
> + * pre-scaler of 32, the timers are clocked at 6.25MHz (160ns resolution).
> + */
> +#define XTTCPSS_CLOCKSOURCE Â Â0 Â Â Â /* Timer 1 as a generic timekeeping */
> +#define XTTCPSS_CLOCKEVENT Â Â 1 Â Â Â /* Timer 2 as a clock event */
> +
> +#define XTTCPSS_TIMER_BASE Â Â Â Â Â Â TTC0_BASE
> +#define XTTCPCC_EVENT_TIMER_IRQ Â Â Â Â Â Â Â Â(IRQ_TIMERCOUNTER0 + 1)
> +/*
> + * Timer Register Offset Definitions of Timer 1, Increment base address by 4
> + * and use same offsets for Timer 2
> + */
> +#define XTTCPSS_CLK_CNTRL_OFFSET Â Â Â 0x00 /* Clock Control Reg, RW */
> +#define XTTCPSS_CNT_CNTRL_OFFSET Â Â Â 0x0C /* Counter Control Reg, RW */
> +#define XTTCPSS_COUNT_VAL_OFFSET Â Â Â 0x18 /* Counter Value Reg, RO */
> +#define XTTCPSS_INTR_VAL_OFFSET Â Â Â Â Â Â Â Â0x24 /* Interval Count Reg, RW */
> +#define XTTCPSS_MATCH_1_OFFSET Â Â Â Â 0x30 /* Match 1 Value Reg, RW */
> +#define XTTCPSS_MATCH_2_OFFSET Â Â Â Â 0x3C /* Match 2 Value Reg, RW */
> +#define XTTCPSS_MATCH_3_OFFSET Â Â Â Â 0x48 /* Match 3 Value Reg, RW */
> +#define XTTCPSS_ISR_OFFSET Â Â Â Â Â Â 0x54 /* Interrupt Status Reg, RO */
> +#define XTTCPSS_IER_OFFSET Â Â Â Â Â Â 0x60 /* Interrupt Enable Reg, RW */
> +
> +#define XTTCPSS_CNT_CNTRL_DISABLE_MASK 0x1
> +
> +/* Setup the timers to use pre-scaling */
> +
> +#define TIMER_RATE (PERIPHERAL_CLOCK_RATE / 32)
> +
> +/**
> + * struct xttcpss_timer - This definition defines local timer structure
> + *
> + * @base_addr: Base address of timer
> + **/
> +struct xttcpss_timer {
> + Â Â Â void __iomem *base_addr;
> +};
> +
> +static struct xttcpss_timer timers[2];
> +static struct clock_event_device xttcpss_clockevent;
> +
> +/**
> + * xttcpss_set_interval - Set the timer interval value
> + *
> + * @timer: Â Â Pointer to the timer instance
> + * @cycles: Â ÂTimer interval ticks
> + **/
> +static void xttcpss_set_interval(struct xttcpss_timer *timer,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â unsigned long cycles)
> +{
> + Â Â Â u32 ctrl_reg;
> +
> + Â Â Â /* Disable the counter, set the counter value Âand re-enable counter */
> + Â Â Â ctrl_reg = __raw_readl(timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
> + Â Â Â ctrl_reg |= XTTCPSS_CNT_CNTRL_DISABLE_MASK;
> + Â Â Â __raw_writel(ctrl_reg, timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
> +
> + Â Â Â __raw_writel(cycles, timer->base_addr + XTTCPSS_INTR_VAL_OFFSET);
> +
> + Â Â Â /* Reset the counter (0x10) so that it starts from 0, one-shot
> + Â Â Â Â Âmode makes this needed for timing to be right. */
> + Â Â Â ctrl_reg |= 0x10;
> + Â Â Â ctrl_reg &= ~XTTCPSS_CNT_CNTRL_DISABLE_MASK;
> + Â Â Â __raw_writel(ctrl_reg, timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
> +}
> +
> +/**
> + * xttcpss_clock_event_interrupt - Clock event timer interrupt handler
> + *
> + * @irq: Â Â Â IRQ number of the Timer
> + * @dev_id: Â Âvoid pointer to the xttcpss_timer instance
> + *
> + * returns: Always IRQ_HANDLED - success
> + **/
> +static irqreturn_t xttcpss_clock_event_interrupt(int irq, void *dev_id)
> +{
> + Â Â Â struct clock_event_device *evt = &xttcpss_clockevent;
> + Â Â Â struct xttcpss_timer *timer = dev_id;
> +
> + Â Â Â /* Acknowledge the interrupt and call event handler */
> + Â Â Â __raw_writel(__raw_readl(timer->base_addr + XTTCPSS_ISR_OFFSET),
> + Â Â Â Â Â Â Â Â Â Â Â timer->base_addr + XTTCPSS_ISR_OFFSET);
> +
> + Â Â Â evt->event_handler(evt);
> +
> + Â Â Â return IRQ_HANDLED;
> +}
> +
> +static struct irqaction event_timer_irq = {
> +    .name  = "xttcpss clockevent",
> + Â Â Â .flags Â= IRQF_DISABLED | IRQF_TIMER,
> + Â Â Â .handler = xttcpss_clock_event_interrupt,
> +};
> +
> +/**
> + * xttcpss_timer_hardware_init - Initialize the timer hardware
> + *
> + * Initialize the hardware to start the clock source, get the clock
> + * event timer ready to use, and hook up the interrupt.
> + **/
> +static void __init xttcpss_timer_hardware_init(void)
> +{
> + Â Â Â /* Setup the clock source counter to be an incrementing counter
> + Â Â Â Â* with no interrupt and it rolls over at 0xFFFF. Pre-scale
> + Â Â Â Â Âit by 32 also. Let it start running now.
> + Â Â Â Â*/
> + Â Â Â timers[XTTCPSS_CLOCKSOURCE].base_addr = XTTCPSS_TIMER_BASE;
> +
> + Â Â Â __raw_writel(0x0, timers[XTTCPSS_CLOCKSOURCE].base_addr +
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â XTTCPSS_IER_OFFSET);
> + Â Â Â __raw_writel(0x9, timers[XTTCPSS_CLOCKSOURCE].base_addr +
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â XTTCPSS_CLK_CNTRL_OFFSET);
> + Â Â Â __raw_writel(0x10, timers[XTTCPSS_CLOCKSOURCE].base_addr +
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â XTTCPSS_CNT_CNTRL_OFFSET);
> +
> + Â Â Â /* Setup the clock event timer to be an interval timer which
> + Â Â Â Â* is prescaled by 32 using the interval interrupt. Leave it
> + Â Â Â Â* disabled for now.
> + Â Â Â Â*/
> +
> + Â Â Â timers[XTTCPSS_CLOCKEVENT].base_addr = XTTCPSS_TIMER_BASE + 4;
> +
> + Â Â Â __raw_writel(0x23, timers[XTTCPSS_CLOCKEVENT].base_addr +
> + Â Â Â Â Â Â Â Â Â Â Â XTTCPSS_CNT_CNTRL_OFFSET);
> + Â Â Â __raw_writel(0x9, timers[XTTCPSS_CLOCKEVENT].base_addr +
> + Â Â Â Â Â Â Â Â Â Â Â XTTCPSS_CLK_CNTRL_OFFSET);
> + Â Â Â __raw_writel(0x1, timers[XTTCPSS_CLOCKEVENT].base_addr +
> + Â Â Â Â Â Â Â Â Â Â Â XTTCPSS_IER_OFFSET);
> +
> + Â Â Â /* Setup IRQ the clock event timer */
> + Â Â Â event_timer_irq.dev_id = &timers[XTTCPSS_CLOCKEVENT];
> + Â Â Â setup_irq(XTTCPCC_EVENT_TIMER_IRQ, &event_timer_irq);
> +}
> +
> +/**
> + * __raw_readl_cycles - Reads the timer counter register
> + *
> + * returns: Current timer counter register value
> + **/
> +static cycle_t __raw_readl_cycles(struct clocksource *cs)
> +{
> + Â Â Â struct xttcpss_timer *timer = &timers[XTTCPSS_CLOCKSOURCE];
> +
> + Â Â Â return (cycle_t)__raw_readl(timer->base_addr +
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â XTTCPSS_COUNT_VAL_OFFSET);
> +}
> +
> +
> +/*
> + * Instantiate and initialize the clock source structure
> + */
> +static struct clocksource clocksource_xttcpss = {
> +    .name      = "xttcpss_timer1",
> +    .rating     = 200,         Â/* Reasonable clock source */
> +    .read      = __raw_readl_cycles,
> +    .mask      = CLOCKSOURCE_MASK(16),
> +    .flags     Â= CLOCK_SOURCE_IS_CONTINUOUS,
> +};
> +
> +
> +/**
> + * xttcpss_set_next_event - Sets the time interval for next event
> + *
> + * @cycles: Â ÂTimer interval ticks
> + * @evt: Â Â Â Address of clock event instance
> + *
> + * returns: Always 0 - success
> + **/
> +static int xttcpss_set_next_event(unsigned long cycles,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â struct clock_event_device *evt)
> +{
> + Â Â Â struct xttcpss_timer *timer = &timers[XTTCPSS_CLOCKEVENT];
> +
> + Â Â Â xttcpss_set_interval(timer, cycles);
> + Â Â Â return 0;
> +}
> +
> +/**
> + * xttcpss_set_mode - Sets the mode of timer
> + *
> + * @mode: Â Â ÂMode to be set
> + * @evt: Â Â Â Address of clock event instance
> + **/
> +static void xttcpss_set_mode(enum clock_event_mode mode,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â struct clock_event_device *evt)
> +{
> + Â Â Â struct xttcpss_timer *timer = &timers[XTTCPSS_CLOCKEVENT];
> + Â Â Â u32 ctrl_reg;
> +
> + Â Â Â switch (mode) {
> + Â Â Â case CLOCK_EVT_MODE_PERIODIC:
> + Â Â Â Â Â Â Â xttcpss_set_interval(timer, TIMER_RATE / HZ);
> + Â Â Â Â Â Â Â break;
> + Â Â Â case CLOCK_EVT_MODE_ONESHOT:
> + Â Â Â case CLOCK_EVT_MODE_UNUSED:
> + Â Â Â case CLOCK_EVT_MODE_SHUTDOWN:
> + Â Â Â Â Â Â Â ctrl_reg = __raw_readl(timer->base_addr +
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â XTTCPSS_CNT_CNTRL_OFFSET);
> + Â Â Â Â Â Â Â ctrl_reg |= XTTCPSS_CNT_CNTRL_DISABLE_MASK;
> + Â Â Â Â Â Â Â __raw_writel(ctrl_reg,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
> + Â Â Â Â Â Â Â break;
> + Â Â Â case CLOCK_EVT_MODE_RESUME:
> + Â Â Â Â Â Â Â ctrl_reg = __raw_readl(timer->base_addr +
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â XTTCPSS_CNT_CNTRL_OFFSET);
> + Â Â Â Â Â Â Â ctrl_reg &= ~XTTCPSS_CNT_CNTRL_DISABLE_MASK;
> + Â Â Â Â Â Â Â __raw_writel(ctrl_reg,
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â timer->base_addr + XTTCPSS_CNT_CNTRL_OFFSET);
> + Â Â Â Â Â Â Â break;
> + Â Â Â }
> +}
> +
> +/*
> + * Instantiate and initialize the clock event structure
> + */
> +static struct clock_event_device xttcpss_clockevent = {
> +    .name      = "xttcpss_timer2",
> +    .features    = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
> + Â Â Â .set_next_event = xttcpss_set_next_event,
> +    .set_mode    = xttcpss_set_mode,
> +    .rating     = 200,
> +};
> +
> +/**
> + * xttcpss_timer_init - Initialize the timer
> + *
> + * Initializes the timer hardware and register the clock source and clock event
> + * timers with Linux kernal timer framework
> + **/
> +static void __init xttcpss_timer_init(void)
> +{
> + Â Â Â xttcpss_timer_hardware_init();
> + Â Â Â clocksource_register_hz(&clocksource_xttcpss, TIMER_RATE);
> +
> + Â Â Â /* Calculate the parameters to allow the clockevent to operate using
> + Â Â Â Â Âinteger math
> + Â Â Â */
> + Â Â Â clockevents_calc_mult_shift(&xttcpss_clockevent, TIMER_RATE, 4);
> +
> + Â Â Â xttcpss_clockevent.max_delta_ns =
> + Â Â Â Â Â Â Â clockevent_delta2ns(0xfffe, &xttcpss_clockevent);
> + Â Â Â xttcpss_clockevent.min_delta_ns =
> + Â Â Â Â Â Â Â clockevent_delta2ns(1, &xttcpss_clockevent);
> +
> + Â Â Â /* Indicate that clock event is on 1st CPU as SMP boot needs it */
> +
> + Â Â Â xttcpss_clockevent.cpumask = cpumask_of(0);
> + Â Â Â clockevents_register_device(&xttcpss_clockevent);
> +}
> +
> +/*
> + * Instantiate and initialize the system timer structure
> + */
> +struct sys_timer xttcpss_sys_timer = {
> +    .init      = xttcpss_timer_init,
> +};
> diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
> index 0074b8d..f046982 100644
> --- a/arch/arm/mm/Kconfig
> +++ b/arch/arm/mm/Kconfig
> @@ -821,7 +821,7 @@ config CACHE_L2X0
> Â Â Â Âdepends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \
> Â Â Â Â Â Â Â Â Â REALVIEW_EB_A9MP || SOC_IMX35 || SOC_IMX31 || MACH_REALVIEW_PBX || \
> Â Â Â Â Â Â Â Â Â ARCH_NOMADIK || ARCH_OMAP4 || ARCH_EXYNOS4 || ARCH_TEGRA || \
> - Â Â Â Â Â Â Â Â ÂARCH_U8500 || ARCH_VEXPRESS_CA9X4 || ARCH_SHMOBILE
> + Â Â Â Â Â Â Â Â ÂARCH_U8500 || ARCH_VEXPRESS_CA9X4 || ARCH_SHMOBILE || ARCH_ZYNQ
> Â Â Â Âdefault y
> Â Â Â Âselect OUTER_CACHE
> Â Â Â Âselect OUTER_CACHE_SYNC
> --
> 1.7.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/