ARM: CSR: Adding CSR SiRFprimaII platform
cover ARM: CSR: Adding CSR SiRFprimaII platform
Changelogs:
-v3:
full DT file
delete all static mapping table in common.c
rename common.c to prima2.c
delete board file board_dt.c
split DEBUG_LL and L2 cache to seperate patch
-v2:
1. clock: use dev_id instead of con_id
2. Kconfig: delete ISA_DMA
3. irq: implement int controller based on DT
move to GENERIC_IRQ_CHIP framework
4. timer: implement timer based on DT
5. entry-macro.S: use get_irqnr_preamble to load the base address only once per IRQ exception.
6. others:
use readl_relaxed instead of __raw_readl
adjust Kconfig order for PRIMA2
use clk_get_sys instead of clk_get for system level clock use BUG_ON(IS_ERR(clk)) instead of BUG_ON(IS_ERR_OR_NULL(clk)); fix typo for CLOCK_TICK_RATE
("sirf,xxx", "sirf,prima2-xxx") instead of ("sirf,xxx") in dts
Note:
For L2 cache, if Rob's patch is merged, the whole file can be deleted
Barry Song (1):
ARM: CSR: mapping early DEBUG_LL uart
Binghua Duan (1):
ARM: CSR: Adding CSR SiRFprimaII board support
Rongjun Ying (1):
ARM: CSR: initilized L2 cache
Documentation/devicetree/bindings/arm/sirf.txt | 3 + arch/arm/Kconfig | 13 + arch/arm/Makefile | 1 + arch/arm/boot/dts/prima2-cb.dts | 423 +++++++++++++++++++ arch/arm/mach-prima2/Makefile | 7 + arch/arm/mach-prima2/Makefile.boot | 3 + arch/arm/mach-prima2/clock.c | 509 +++++++++++++++++++++++ arch/arm/mach-prima2/common.h | 26 ++ arch/arm/mach-prima2/include/mach/clkdev.h | 15 + arch/arm/mach-prima2/include/mach/debug-macro.S | 29 ++ arch/arm/mach-prima2/include/mach/entry-macro.S | 29 ++ arch/arm/mach-prima2/include/mach/hardware.h | 15 + arch/arm/mach-prima2/include/mach/io.h | 21 + arch/arm/mach-prima2/include/mach/irqs.h | 17 + arch/arm/mach-prima2/include/mach/map.h | 16 + arch/arm/mach-prima2/include/mach/memory.h | 21 + arch/arm/mach-prima2/include/mach/system.h | 29 ++ arch/arm/mach-prima2/include/mach/timex.h | 14 + arch/arm/mach-prima2/include/mach/uart.h | 23 + arch/arm/mach-prima2/include/mach/uncompress.h | 40 ++ arch/arm/mach-prima2/include/mach/vmalloc.h | 14 + arch/arm/mach-prima2/irq.c | 71 ++++ arch/arm/mach-prima2/l2x0.c | 59 +++ arch/arm/mach-prima2/lluart.c | 25 ++ arch/arm/mach-prima2/prima2.c | 40 ++ arch/arm/mach-prima2/rstc.c | 69 +++ arch/arm/mach-prima2/timer.c | 219 ++++++++++ arch/arm/mm/Kconfig | 2 +- 28 files changed, 1752 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/sirf.txt create mode 100644 arch/arm/boot/dts/prima2-cb.dts create mode 100644 arch/arm/mach-prima2/Makefile create mode 100644 arch/arm/mach-prima2/Makefile.boot create mode 100644 arch/arm/mach-prima2/clock.c create mode 100644 arch/arm/mach-prima2/common.h create mode 100644 arch/arm/mach-prima2/include/mach/clkdev.h create mode 100644 arch/arm/mach-prima2/include/mach/debug-macro.S create mode 100644 arch/arm/mach-prima2/include/mach/entry-macro.S create mode 100644 arch/arm/mach-prima2/include/mach/hardware.h create mode 100644 arch/arm/mach-prima2/include/mach/io.h create mode 100644 arch/arm/mach-prima2/include/mach/irqs.h create mode 100644 arch/arm/mach-prima2/include/mach/map.h create mode 100644 arch/arm/mach-prima2/include/mach/memory.h create mode 100644 arch/arm/mach-prima2/include/mach/system.h create mode 100644 arch/arm/mach-prima2/include/mach/timex.h create mode 100644 arch/arm/mach-prima2/include/mach/uart.h create mode 100644 arch/arm/mach-prima2/include/mach/uncompress.h create mode 100644 arch/arm/mach-prima2/include/mach/vmalloc.h create mode 100644 arch/arm/mach-prima2/irq.c create mode 100644 arch/arm/mach-prima2/l2x0.c create mode 100644 arch/arm/mach-prima2/lluart.c create mode 100644 arch/arm/mach-prima2/prima2.c create mode 100644 arch/arm/mach-prima2/rstc.c create mode 100644 arch/arm/mach-prima2/timer.c
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
From: Binghua Duan <[email protected]>
SiRFprimaII is the latest generation application processor from CSR?s Multifunction SoC product family. Designed around an ARM cortex A9 core, high-speed memory bus, advanced 3D accelerator and full-HD multi-format video decoder, SiRFprimaII is able to meet the needs of complicated applications for modern multifunction devices that require heavy concurrent applications and fluid user experience. Integrated with GPS baseband, analog and PMU, this new platform is designed to provide a cost effective solution for Automotive and Consumer markets.
This patch adds the basic support for this SoC and EVB board based on device tree. It is following the ZYNQ of Grant Likely in some degree.
--- Documentation/devicetree/bindings/arm/sirf.txt | 3 + arch/arm/Kconfig | 13 + arch/arm/Makefile | 1 + arch/arm/boot/dts/prima2-cb.dts | 423 +++++++++++++++++++ arch/arm/mach-prima2/Makefile | 5 + arch/arm/mach-prima2/Makefile.boot | 3 + arch/arm/mach-prima2/clock.c | 509 +++++++++++++++++++++++ arch/arm/mach-prima2/common.h | 26 ++ arch/arm/mach-prima2/include/mach/clkdev.h | 15 + arch/arm/mach-prima2/include/mach/debug-macro.S | 29 ++ arch/arm/mach-prima2/include/mach/entry-macro.S | 29 ++ arch/arm/mach-prima2/include/mach/hardware.h | 15 + arch/arm/mach-prima2/include/mach/io.h | 21 + arch/arm/mach-prima2/include/mach/irqs.h | 17 + arch/arm/mach-prima2/include/mach/map.h | 16 + arch/arm/mach-prima2/include/mach/memory.h | 21 + arch/arm/mach-prima2/include/mach/system.h | 29 ++ arch/arm/mach-prima2/include/mach/timex.h | 14 + arch/arm/mach-prima2/include/mach/uart.h | 23 + arch/arm/mach-prima2/include/mach/uncompress.h | 40 ++ arch/arm/mach-prima2/include/mach/vmalloc.h | 14 + arch/arm/mach-prima2/irq.c | 71 ++++ arch/arm/mach-prima2/prima2.c | 40 ++ arch/arm/mach-prima2/rstc.c | 69 +++ arch/arm/mach-prima2/timer.c | 219 ++++++++++ arch/arm/mm/Kconfig | 2 +- 26 files changed, 1666 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/sirf.txt create mode 100644 arch/arm/boot/dts/prima2-cb.dts create mode 100644 arch/arm/mach-prima2/Makefile create mode 100644 arch/arm/mach-prima2/Makefile.boot create mode 100644 arch/arm/mach-prima2/clock.c create mode 100644 arch/arm/mach-prima2/common.h create mode 100644 arch/arm/mach-prima2/include/mach/clkdev.h create mode 100644 arch/arm/mach-prima2/include/mach/debug-macro.S create mode 100644 arch/arm/mach-prima2/include/mach/entry-macro.S create mode 100644 arch/arm/mach-prima2/include/mach/hardware.h create mode 100644 arch/arm/mach-prima2/include/mach/io.h create mode 100644 arch/arm/mach-prima2/include/mach/irqs.h create mode 100644 arch/arm/mach-prima2/include/mach/map.h create mode 100644 arch/arm/mach-prima2/include/mach/memory.h create mode 100644 arch/arm/mach-prima2/include/mach/system.h create mode 100644 arch/arm/mach-prima2/include/mach/timex.h create mode 100644 arch/arm/mach-prima2/include/mach/uart.h create mode 100644 arch/arm/mach-prima2/include/mach/uncompress.h create mode 100644 arch/arm/mach-prima2/include/mach/vmalloc.h create mode 100644 arch/arm/mach-prima2/irq.c create mode 100644 arch/arm/mach-prima2/prima2.c create mode 100644 arch/arm/mach-prima2/rstc.c create mode 100644 arch/arm/mach-prima2/timer.c
Documentation/devicetree/bindings/arm/sirf.txt new file +3 -0
@@ -0,0 +1,3 @@ +prima2 "cb" evalutation board +Required root node properties: + - compatible = "sirf,prima2-cb", "sirf,prima2";
arch/arm/Kconfig +13 -0
@@ -879,6 +879,19 @@ config ARCH_VT8500 select HAVE_PWM help Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip. + +config ARCH_PRIMA2 + bool "CSR SiRFSoC PRIMA2 ARM Cortex A9 Platform" + select CPU_V7 + select GENERIC_TIME + select GENERIC_CLOCKEVENTS + select CLKDEV_LOOKUP + select GENERIC_IRQ_CHIP + select USE_OF + select ZONE_DMA + help + Support for CSR SiRFSoC ARM Cortex A9 Platform + endchoice #
arch/arm/Makefile +1 -0
@@ -169,6 +169,7 @@ machine-$(CONFIG_ARCH_OMAP3) := omap2 machine-$(CONFIG_ARCH_OMAP4) := omap2 machine-$(CONFIG_ARCH_ORION5X) := orion5x machine-$(CONFIG_ARCH_PNX4008) := pnx4008 +machine-$(CONFIG_ARCH_PRIMA2) := prima2 machine-$(CONFIG_ARCH_PXA) := pxa machine-$(CONFIG_ARCH_REALVIEW) := realview machine-$(CONFIG_ARCH_RPC) := rpc
arch/arm/boot/dts/prima2-cb.dts new file +423 -0
423 lines not on this page · raw message
arch/arm/mach-prima2/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +obj-y := timer.o +obj-y += irq.o +obj-y += clock.o +obj-y += rstc.o +obj-y += prima2.o
arch/arm/mach-prima2/Makefile.boot new file +3 -0
@@ -0,0 +1,3 @@ +zreladdr-y := 0x00008000 +params_phys-y := 0x00000100 +initrd_phys-y := 0x00800000
arch/arm/mach-prima2/clock.c new file +509 -0
509 lines not on this page · raw message
arch/arm/mach-prima2/common.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* This file contains common function prototypes to avoid externs in the c files. +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __MACH_PRIMA2_COMMON_H__ +#define __MACH_PRIMA2_COMMON_H__ + +#include <linux/init.h> +#include <asm/mach/time.h> + +extern struct sys_timer sirfsoc_timer; + +extern void __init sirfsoc_of_irq_init (void ); +extern void __init sirfsoc_of_clk_init (void ); + +#ifndef CONFIG_DEBUG_LL +static inline void sirfsoc_map_lluart (void ) {} +#else +extern void __init sirfsoc_map_lluart (void ); +#endif + +#endif
arch/arm/mach-prima2/include/mach/clkdev.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* arch/arm/mach-prima2/include/mach/clkdev.h +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __MACH_CLKDEV_H +#define __MACH_CLKDEV_H + +#define __clk_get (clk) ({ 1; }) +#define __clk_put (clk) do { } while (0) + +#endif
arch/arm/mach-prima2/include/mach/debug-macro.S new file +29 -0
@@ -0,0 +1,29 @@ +/* + * arch/arm/mach-prima2/include/mach/debug-macro.S + * + * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. + * + * Licensed under GPLv2 or later. + */ + +#include <mach/hardware.h> +#include <mach/uart.h> + + .macro addruart, rp, rv + ldr \rp, =SIRFSOC_UART1_PA_BASE @ physical + ldr \rv, =SIRFSOC_UART1_VA_BASE @ virtual + .endm + + .macro senduart,rd,rx + str \rd, [\rx, #SIRFSOC_UART_TXFIFO_DATA] + .endm + + .macro busyuart,rd,rx + .endm + + .macro waituart,rd,rx +1001: ldr \rd, [\rx, #SIRFSOC_UART_TXFIFO_STATUS] + tst \rd, #SIRFSOC_UART1_TXFIFO_EMPTY + beq 1001b + .endm +
arch/arm/mach-prima2/include/mach/entry-macro.S new file +29 -0
@@ -0,0 +1,29 @@ +/* + * arch/arm/mach-prima2/include/mach/entry-macro.S + * + * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. + * + * Licensed under GPLv2 or later. + */ + +#include <mach/hardware.h> + +#define SIRFSOC_INT_ID 0x38 + + .macro get_irqnr_preamble, base, tmp + ldr \base, =sirfsoc_intc_base + ldr \base, [\base] + .endm + + .macro get_irqnr_and_base, irqnr, irqstat, base, tmp + ldr \irqnr, [\base, #SIRFSOC_INT_ID] @ Get the highest priority irq + cmp \irqnr, #0x40 @ the irq num can't be larger than 0x3f + movges \irqnr, #0 + .endm + + .macro disable_fiq + .endm + + .macro arch_ret_to_user, tmp1, tmp2 + .endm +
arch/arm/mach-prima2/include/mach/hardware.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* arch/arm/mach-prima2/include/mach/hardware.h +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __MACH_HARDWARE_H__ +#define __MACH_HARDWARE_H__ + +#include <asm/sizes.h> +#include <mach/map.h> + +#endif
arch/arm/mach-prima2/include/mach/io.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* arch/arm/mach-prima2/include/mach/io.h +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __MACH_PRIMA2_IO_H +#define __MACH_PRIMA2_IO_H + +#define IO_SPACE_LIMIT 0xffffffff + +/* +* We don't actually have real ISA nor PCI buses, but there is so many +* drivers out there that might just work if we fake them... +*/ +#define __io (a) __typesafe_io(a) +#define __mem_pci (a) (a) + +#endif
arch/arm/mach-prima2/include/mach/irqs.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* arch/arm/mach-prima2/include/mach/irqs.h +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __ASM_ARCH_IRQS_H +#define __ASM_ARCH_IRQS_H + +#define SIRFSOC_INTENAL_IRQ_START 0 +#define SIRFSOC_INTENAL_IRQ_END 59 + +#define NR_IRQS 220 + +#endif
arch/arm/mach-prima2/include/mach/map.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* memory & I/O static mapping definitions for CSR SiRFprimaII +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __MACH_PRIMA2_MAP_H__ +#define __MACH_PRIMA2_MAP_H__ + +#include <mach/vmalloc.h> + +#define SIRFSOC_VA (x) (VMALLOC_END + ((x) & 0x00FFF000)) + +#endif
arch/arm/mach-prima2/include/mach/memory.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* arch/arm/mach-prima2/include/mach/memory.h +* +* Copyright (c) 2010 ? 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __ASM_ARCH_MEMORY_H +#define __ASM_ARCH_MEMORY_H + +#define PLAT_PHYS_OFFSET UL(0x00000000) + +/* +* Restrict DMA-able region to workaround silicon limitation. +* The limitation restricts buffers available for DMA to SD/MMC +* hardware to be below 256MB +*/ +#define ARM_DMA_ZONE_SIZE (SZ_256M) + +#endif
arch/arm/mach-prima2/include/mach/system.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* arch/arm/mach-prima2/include/mach/system.h +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __MACH_SYSTEM_H__ +#define __MACH_SYSTEM_H__ + +#include <linux/bitops.h> +#include <mach/hardware.h> + +#define SIRFSOC_SYS_RST_BIT BIT(31) + +extern void __iomem *sirfsoc_rstc_base; + +static inline void arch_idle (void ) +{ +cpu_do_idle (); +} + +static inline void arch_reset (char mode,const char *cmd) +{ +writel (SIRFSOC_SYS_RST_BIT , sirfsoc_rstc_base); +} + +#endif
arch/arm/mach-prima2/include/mach/timex.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* arch/arm/mach-prima2/include/mach/timex.h +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __MACH_TIMEX_H__ +#define __MACH_TIMEX_H__ + +#define CLOCK_TICK_RATE 1000000 + +#endif
arch/arm/mach-prima2/include/mach/uart.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* arch/arm/mach-prima2/include/mach/uart.h +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __MACH_PRIMA2_SIRFSOC_UART_H +#define __MACH_PRIMA2_SIRFSOC_UART_H + +/* UART-1: used as serial debug port */ +#define SIRFSOC_UART1_PA_BASE 0xb0060000 +#define SIRFSOC_UART1_VA_BASE SIRFSOC_VA(0x060000) +#define SIRFSOC_UART1_SIZE SZ_4K + +#define SIRFSOC_UART_TXFIFO_STATUS 0x0114 +#define SIRFSOC_UART_TXFIFO_DATA 0x0118 + +#define SIRFSOC_UART1_TXFIFO_FULL (1 << 5) +#define SIRFSOC_UART1_TXFIFO_EMPTY (1 << 6) + +#endif
arch/arm/mach-prima2/include/mach/uncompress.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* arch/arm/mach-prima2/include/mach/uncompress.h +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __ASM_ARCH_UNCOMPRESS_H +#define __ASM_ARCH_UNCOMPRESS_H + +#include <linux/io.h> +#include <mach/hardware.h> +#include <mach/uart.h> + +void arch_decomp_setup (void ) +{ +} + +#define arch_decomp_wdog () + +static __inline__void putc (char c) +{ +/* +* during kernel decompression, all mappings are flat: +* virt_addr == phys_addr +*/ +while (__raw_readl (SIRFSOC_UART1_PA_BASE +SIRFSOC_UART_TXFIFO_STATUS ) + &SIRFSOC_UART1_TXFIFO_FULL ) +barrier (); + +__raw_writel (c,SIRFSOC_UART1_PA_BASE +SIRFSOC_UART_TXFIFO_DATA ); +} + +static inline void flush (void ) +{ +} + +#endif +
arch/arm/mach-prima2/include/mach/vmalloc.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* arch/arm/ach-prima2/include/mach/vmalloc.h +* +* Copyright (c) 2010 ? 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __MACH_VMALLOC_H +#define __MACH_VMALLOC_H + +#define VMALLOC_END 0xFEC00000 + +#endif
arch/arm/mach-prima2/irq.c new file +71 -0
71 lines not on this page · raw message
arch/arm/mach-prima2/prima2.c new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Defines machines for CSR SiRFprimaII +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#include <linux/init.h> +#include <linux/kernel.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <linux/of.h> +#include <linux/of_platform.h> +#include "common.h" + +static struct of_device_id sirfsoc_of_bus_ids[]__initdata = { + { .compatible ="simple-bus" , }, + {}, +}; + +void __init sirfsoc_mach_init (void ) +{ +of_platform_bus_probe (NULL , sirfsoc_of_bus_ids,NULL ); +} + +static const char *prima2cb_dt_match[]__initdata = { +"sirf,prima2-cb" , +NULL +}; + +MACHINE_START (PRIMA2_EVB ,"prima2cb" ) + .boot_params = 0x00000100, + .init_early = sirfsoc_of_clk_init, + .map_io = sirfsoc_map_lluart, + .init_irq = sirfsoc_of_irq_init, + .timer = &sirfsoc_timer, + .init_machine = sirfsoc_mach_init, + .dt_compat = prima2cb_dt_match, +MACHINE_END
arch/arm/mach-prima2/rstc.c new file +69 -0
69 lines not on this page · raw message
arch/arm/mach-prima2/timer.c new file +219 -0
219 lines not on this page · raw message
arch/arm/mm/Kconfig +1 -1
@@ -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_PRIMA2 default y select OUTER_CACHE select OUTER_CACHE_SYNC
Signature · 6 lines
1.7.1 Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our [email protected]/blog
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 6 lines · Barry Song
arch/arm/mach-prima2/timer.c new file +6
-0+static int sirfsoc_timer_set_next_event (unsigned long delta, +struct clock_event_device *ce) +{ +unsigned long now, next; + +writel_relaxed (SIRFSOC_TIMER_LATCH_BIT , sirfsoc_timer_base +SIRFSOC_TIMER_LATCH );
arch/arm/mach-prima2/timer.c line 89
Quoted 10 lines
arch/arm/mach-prima2/timer.c new file +10
-0+ now =readl_relaxed (sirfsoc_timer_base +SIRFSOC_TIMER_LATCHED_LO ); +do { + next = now + delta; +writel_relaxed (next, sirfsoc_timer_base +SIRFSOC_TIMER_MATCH_0 ); +writel_relaxed (SIRFSOC_TIMER_LATCH_BIT , sirfsoc_timer_base +SIRFSOC_TIMER_LATCH ); + now =readl_relaxed (sirfsoc_timer_base +SIRFSOC_TIMER_LATCHED_LO ); + }while ((next - now) > delta); + +return 0 ; +}
Please have a look at any of the callsites of clockevents_program_event() in kernel/time/. You'll notice that they loop in some fashion should your set_next_event() return -ETIME.
As there is the possibility that if you can't program the event (because it has already passed) then it is likely that there is some work which needs to be done before the next event is set. So the repeat logic should stay in the common code and not be duplicated in each platform.
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
2011/7/6 Russell King - ARM Linux <[email protected]>:
Quoted 13 lines · Barry Song
Quoted 12 lines
(quoted diff) +12
-0+static int sirfsoc_timer_set_next_event(unsigned long delta, + ? ? struct clock_event_device *ce) +{ + ? ? unsigned long now, next; + + ? ? writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH); + ? ? now = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO); + ? ? do { + ? ? ? ? ? ? next = now + delta; + ? ? ? ? ? ? writel_relaxed(next, sirfsoc_timer_base + SIRFSOC_TIMER_MATCH_0); + ? ? ? ? ? ? writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base + SIRFSOC_TIMER_LATCH); + ? ? ? ? ? ? now = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
Quoted 8 lines
arch/arm/mach-prima2/clock.c line 73
Quoted 4 lines
+ ? ? } while ((next - now) > delta);
arch/arm/mach-prima2/clock.c new file +3
-0+ + ? ? return 0; +}Please have a look at any of the callsites of
clockevents_program_event()inkernel/time/. ?You'll notice that they loop in some fashion should yourset_next_event()return-ETIME.
ok. looks like the function can be fixed to:
static int sirfsoc_timer_set_next_event(unsigned long delta,
struct clock_event_device *ce)
{
unsigned long now, next;
writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base +
SIRFSOC_TIMER_LATCH);
now = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
next = now + delta;
writel_relaxed(next, sirfsoc_timer_base + SIRFSOC_TIMER_MATCH_0);
writel_relaxed(SIRFSOC_TIMER_LATCH_BIT, sirfsoc_timer_base +
SIRFSOC_TIMER_LATCH);
now = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_LATCHED_LO);
return next - now > delta ? -ETIME : 0;
}Quoted 11 lines
As there is the possibility that if you can't program the event (because it has already passed) then it is likely that there is some work which needs to be done before the next event is set. ?So the repeat logic should stay in the common code and not be duplicated in each platform.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
In reply to Barry SongQuoted 14 lines · Barry Song
From: Binghua Duan <[email protected]>
SiRFprimaII is the latest generation application processor from CSR?s Multifunction SoC product family. Designed around an ARM cortex A9 core, high-speed memory bus, advanced 3D accelerator and full-HD multi-format video decoder, SiRFprimaII is able to meet the needs of complicated applications for modern multifunction devices that require heavy concurrent applications and fluid user experience. Integrated with GPS baseband, analog and PMU, this new platform is designed to provide a cost effective solution for Automotive and Consumer markets.
This patch adds the basic support for this SoC and EVB board based on device tree. It is following the ZYNQ of Grant Likely in some degree.
Quoted 7 lines
Signed-off-by Binghua Duan <[email protected]>Signed-off-by Rongjun Ying <[email protected]>Signed-off-by Zhiwu Song <[email protected]>Signed-off-by Yuping Luo <[email protected]>Signed-off-by Bin Shi <[email protected]>Signed-off-by Huayi Li <[email protected]>Signed-off-by Barry Song <[email protected]>
I think this is good for 3.1, but there are still a few things about the device tree file could be improved.
Quoted 26 lines
arch/arm/boot/dts/prima2-cb.dts new file +26
-0+ axi { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x40000000 0x40000000 0x80000000>; + + sirfsoc-iobus { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x40000000 0x40000000 0x80000000>; + + l2-cache-controller at 0x80040000 { + compatible = "arm,pl310-cache"; + reg = <0x80040000 0x1000>; + interrupts = <59>; + }; + + intc: interrupt-controller at 0x80020000 { + #interrupt-cells = <1>; + interrupt-controller; + compatible = "sirf,prima2-intc"; + reg = <0x80020000 0x1000>; + }; + + sys-iobg {
arch/arm/boot/dts/prima2-cb.dts line 70
Quoted 10 lines
arch/arm/boot/dts/prima2-cb.dts new file +10
-0+ compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x88000000 0x88000000 0x40000>; + + clock-controller at 0x88000000 { + compatible = "sirf,prima2-clkc"; + reg = <0x88000000 0x1000>; + interrupts = <3>; + };
The axi bus and the sirfsoc-iobus seem to be identical in their scope, so it's probably enough to model one of them.
I would normally recommend defining the ranges so that addresses are local to the respective bus, like
axi {
ranges = <0 0x40000000 0x80000000>;
sys-iobg {
ranges = <0 0x48000000 0x40000>;
clock-controller at 0x88000000 {
compatible = "sirf,prima2-clkc";
reg = <0 0x1000>;
}
reset-controller at 0x88010000 {
compatible = "sirf,prima2-rstc";
reg = <0x10000 0x1000>;
};
}
}Quoted 21 lines
arch/arm/boot/dts/prima2-cb.dts new file +21
-0+ disp-iobg { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x90010000 0x90010000 0x30000>; + + display at 0x90010000 { + compatible = "sirf,prima2-lcd"; + reg = <0x90010000 0x20000>; + interrupts = <30>; + }; + + vpp at 0x90020000 { + compatible = "sirf,prima2-vpp"; + reg = <0x90020000 0x10000>; + interrupts = <31>; + }; + }; + + graphics-iobg { + compatible = "simple-bus";
arch/arm/boot/dts/prima2-cb.dts line 121
Quoted 10 lines
arch/arm/boot/dts/prima2-cb.dts new file +10
-0+ #address-cells = <1>; + #size-cells = <1>; + ranges = <0x98000000 0x98000000 0x8000000>; + + graphics at 0x98000000 { + compatible = "sirf,prima2-graphics"; + reg = <0x98000000 0x8000000>; + interrupts = <6>; + }; + };
Are the display and graphics units CSR developments? If the GPU is in fact licensed from someone else (powervr, arm, ...), you should probably list the actual name of the device.
arch/arm/boot/dts/prima2-cb.dts line 134
Quoted 12 lines
arch/arm/boot/dts/prima2-cb.dts new file +12
-0+ multimedia-iobg { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0xa0000000 0xa0000000 0x8000000>; + + multimedia at 0xa0000000 { + compatible = "sirf,prima2-multimedia"; + reg = <0xa0000000 0x8000000>; + interrupts = <5>; + }; + };
"multimedia" sounds like a too generic term. What does this do?
Quoted 10 lines
arch/arm/boot/dts/prima2-cb.dts new file +10
-0+ uart0: uart at 0xb0050000 { + cell-index = <0>; + compatible = "sirf,prima2-uart"; + reg = <0xb0050000 0x10000>; + interrupts = <17>; + }; + + uart1: uart at 0xb0060000 { + cell-index = <1>; + compatible = "sirf,prima2-uart";
arch/arm/boot/dts/prima2-cb.dts line 204
Quoted 10 lines
arch/arm/boot/dts/prima2-cb.dts new file +10
-0+ reg = <0xb0060000 0x10000>; + interrupts = <18>; + }; + + uart2: uart at 0xb0070000 { + cell-index = <2>; + compatible = "sirf,prima2-uart"; + reg = <0xb0070000 0x10000>; + interrupts = <19>; + };
Are these proprietary uarts, or are they compatible to 8250 and the like? You might want to set a clock-frequency property as of_serial.c uses.
Quoted 14 lines
arch/arm/boot/dts/prima2-cb.dts new file +14
-0+ rtc-iobg { + compatible = "sirf,prima2-rtciobg", "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x80030000 0x10000>; + + gpsrtc at 0x1000 { + compatible = "sirf,prima2-gpsrtc"; + reg = <0x1000 0x1000>; + interrupts = <55 56 57>; + }; + + sysrtc at 0x2000 { + compatible = "sirf,prima2-sysrtc";
arch/arm/boot/dts/prima2-cb.dts line 389
Quoted 10 lines
arch/arm/boot/dts/prima2-cb.dts new file +10
-0+ reg = <0x2000 0x1000>; + interrupts = <52 53 54>; + }; + + pwrc at 0x3000 { + compatible = "sirf,prima2-pwrc"; + reg = <0x3000 0x1000>; + interrupts = <32>; + }; + };
Are these rtc implementations related? From the register layout, I would guess that they are supposed to be used by the same driver, so it's probably a good idea to add a "compatible" property with a common name for all three.
Quoted 7 lines
arch/arm/boot/dts/prima2-cb.dts new file +7
-0+ uus-iobg { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0xb8000000 0xb8000000 0x40000>; + + usb0: usb at 0xb00E0000 {
arch/arm/boot/dts/prima2-cb.dts line 407
Quoted 10 lines
arch/arm/boot/dts/prima2-cb.dts new file +10
-0+ compatible = "sirf,prima2-usb"; + reg = <0xb8000000 0x10000>; + interrupts = <10>; + }; + + usb1: usb at 0xb00f0000 { + compatible = "sirf,prima2-usb"; + reg = <0xb8010000 0x10000>; + interrupts = <11>; + };
Is the usb implementation compatible to an existing one? Many SoCs use one of ehci, ohci or musb. If that's the case, you should look at the respective bindings.
arch/arm/boot/dts/prima2-cb.dts line 413
Quoted 5 lines
arch/arm/boot/dts/prima2-cb.dts new file +5
-0+ sata at 0xb00f0000 { + compatible = "sirf,prima2-sata"; + reg = <0xb8020000 0x10000>; + interrupts = <37>; + };
Same thing here. Most sata controllers are compatible to some standard implementation.
arch/arm/boot/dts/prima2-cb.dts line 423
Quoted 9 lines
arch/arm/boot/dts/prima2-cb.dts new file +9
-0+ security at 0xb00f0000 { + compatible = "sirf,prima2-security"; + reg = <0xb8030000 0x10000>; + interrupts = <42>; + }; + }; + }; + }; +};
Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Hi Arnd,
thanks.
2011/7/6 Arnd Bergmann <[email protected]>:
Quoted 60 lines · Barry Song
Quoted 14 lines
From: Binghua Duan <[email protected]>
SiRFprimaII is the latest generation application processor from CSR?s Multifunction SoC product family. Designed around an ARM cortex A9 core, high-speed memory bus, advanced 3D accelerator and full-HD multi-format video decoder, SiRFprimaII is able to meet the needs of complicated applications for modern multifunction devices that require heavy concurrent applications and fluid user experience. Integrated with GPS baseband, analog and PMU, this new platform is designed to provide a cost effective solution for Automotive and Consumer markets.
This patch adds the basic support for this SoC and EVB board based on device tree. It is following the ZYNQ of Grant Likely in some degree.
Quoted 7 lines
Signed-off-by Binghua Duan <[email protected]>Signed-off-by Rongjun Ying <[email protected]>Signed-off-by Zhiwu Song <[email protected]>Signed-off-by Yuping Luo <[email protected]>Signed-off-by Bin Shi <[email protected]>Signed-off-by Huayi Li <[email protected]>Signed-off-by Barry Song <[email protected]>Reviewed-by Arnd Bergmann <[email protected]>I think this is good for 3.1, but there are still a few things about the device tree file could be improved.
Quoted 32 lines
+ ? ? axi {
+ ? ? ? ? ? ? compatible = "simple-bus";
+ ? ? ? ? ? ? #address-cells = <1>;
+ ? ? ? ? ? ? #size-cells = <1>;
+ ? ? ? ? ? ? ranges = <0x400000000x400000000x80000000>;(quoted diff) +27
-0+ + ? ? ? ? ? ? sirfsoc-iobus { + ? ? ? ? ? ? ? ? ? ? compatible = "simple-bus"; + ? ? ? ? ? ? ? ? ? ? #address-cells = <1>; + ? ? ? ? ? ? ? ? ? ? #size-cells = <1>; + ? ? ? ? ? ? ? ? ? ? ranges = <0x40000000 0x40000000 0x80000000>; + + ? ? ? ? ? ? ? ? ? ? l2-cache-controller at 0x80040000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "arm,pl310-cache"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0x80040000 0x1000>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <59>; + ? ? ? ? ? ? ? ? ? ? }; + + ? ? ? ? ? ? ? ? ? ? intc: interrupt-controller at 0x80020000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? #interrupt-cells = <1>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupt-controller; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-intc"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0x80020000 0x1000>; + ? ? ? ? ? ? ? ? ? ? }; + + ? ? ? ? ? ? ? ? ? ? sys-iobg { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "simple-bus"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? #address-cells = <1>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? #size-cells = <1>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ranges = <0x88000000 0x88000000 0x40000>; + + ? ? ? ? ? ? ? ? ? ? ? ? ? ? clock-controller at 0x88000000 {
Quoted 8 lines
Quoted 4 lines
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-clkc";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0x880000000x1000>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <3>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? };The axi bus and the sirfsoc-iobus seem to be identical in their scope, so it's probably enough to model one of them.
ok.
Quoted 14 lines
I would normally recommend defining the ranges so that addresses are local to the respective bus, like
? ? ? ?axi {
? ? ? ? ? ? ? ?ranges = <00x400000000x80000000>;? ? ? ? ? ? ? ?sys-iobg {
? ? ? ? ? ? ? ? ? ? ? ?ranges = <00x480000000x40000>; ? ? ? ? ? ? ? ? ? ? ? ?clock-controller at0x88000000{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-clkc"; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <00x1000>;
? ? ? ? ? ? ? ? ? ? ? ?}
Quoted 6 lines
? ? ? ? ? ? ? ? ? ? ? ?reset-controller at
0x88010000{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-rstc"; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0x100000x1000>; ? ? ? ? ? ? ? ? ? ? ? ?};
? ? ? ? ? ? ? ?}
? ? ? ?}
i am not sure whether it make us a little more difficult to know the real address at first glance.we will need to calculate. all addresses are 1:1 mapped in this chip. bus map can work even though we only give "ranges;" without real "ranges = <0x....>;".
i also find i missed grant's comment about deleting "0x" after "@" in this patch.
Quoted 29 lines
Quoted 29 lines
+ ? ? ? ? ? ? ? ? ? ? disp-iobg {
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "simple-bus";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? #address-cells = <1>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? #size-cells = <1>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ranges = <0x900100000x900100000x30000>;(quoted diff) +22
-0+ + ? ? ? ? ? ? ? ? ? ? ? ? ? ? display at 0x90010000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-lcd"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0x90010000 0x20000>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <30>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? }; + + ? ? ? ? ? ? ? ? ? ? ? ? ? ? vpp at 0x90020000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-vpp"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0x90020000 0x10000>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <31>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? }; + ? ? ? ? ? ? ? ? ? ? }; + + ? ? ? ? ? ? ? ? ? ? graphics-iobg { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "simple-bus"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? #address-cells = <1>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? #size-cells = <1>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ranges = <0x98000000 0x98000000 0x8000000>; + + ? ? ? ? ? ? ? ? ? ? ? ? ? ? graphics at 0x98000000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-graphics";
Quoted 8 lines
Quoted 4 lines
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <
0x980000000x8000000>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <6>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? };
+ ? ? ? ? ? ? ? ? ? ? };Are the display and graphics units CSR developments? If the GPU is in fact licensed from someone else (powervr, arm, ...), you should probably list the actual name of the device.
GPU is powervr sgx 531, so could we define compatible as "powervr,sgx531"?
Quoted 14 lines
Quoted 13 lines
+ ? ? ? ? ? ? ? ? ? ? multimedia-iobg {
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "simple-bus";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? #address-cells = <1>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? #size-cells = <1>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ranges = <0xa00000000xa00000000x8000000>; +
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? multimedia at0xa0000000{
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-multimedia";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0xa00000000x8000000>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <5>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? };
+ ? ? ? ? ? ? ? ? ? ? };
Quoted 1 line
"multimedia" sounds like a too generic term. What does this do?
video decoding.
Quoted 17 lines
Quoted 17 lines
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? uart0: uart at
0xb0050000{
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cell-index = <0>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-uart";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0xb00500000x10000>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <17>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? };(quoted diff) +10
-0+ + ? ? ? ? ? ? ? ? ? ? ? ? ? ? uart1: uart at 0xb0060000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cell-index = <1>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-uart"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0xb0060000 0x10000>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <18>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? }; + + ? ? ? ? ? ? ? ? ? ? ? ? ? ? uart2: uart at 0xb0070000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cell-index = <2>;
Quoted 8 lines
Quoted 4 lines
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-uart";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0xb00700000x10000>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <19>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? };Are these proprietary uarts, or are they compatible to 8250 and the like? You might want to set a clock-frequency property as
of_serial.cuses.
it is not compatible with 8250 .
Quoted 22 lines
Quoted 22 lines
+ ? ? ? ? ? ? ? ? ? ? rtc-iobg {
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-rtciobg", "simple-bus";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? #address-cells = <1>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? #size-cells = <1>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0x800300000x10000>;(quoted diff) +16
-0+ + ? ? ? ? ? ? ? ? ? ? ? ? ? ? gpsrtc at 0x1000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-gpsrtc"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0x1000 0x1000>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <55 56 57>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? }; + + ? ? ? ? ? ? ? ? ? ? ? ? ? ? sysrtc at 0x2000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-sysrtc"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0x2000 0x1000>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <52 53 54>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? }; + + ? ? ? ? ? ? ? ? ? ? ? ? ? ? pwrc at 0x3000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-pwrc"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0x3000 0x1000>;
Quoted 8 lines
Quoted 3 lines
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <32>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? };
+ ? ? ? ? ? ? ? ? ? ? };Are these rtc implementations related? From the register layout, I would guess that they are supposed to be used by the same driver, so it's probably a good idea to add a "compatible" property with a common name for all three.
in fact, because they are slow, they can't be accessed by mapped address directly, the only common point they have is we need to access them through mapped address in rtc-iobg indirectly just like we access i2c/spi/nand devices.
they are three different devices with different purpose and register layout in fact.
Quoted 23 lines
Quoted 8 lines
+ ? ? ? ? ? ? ? ? ? ? uus-iobg {
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "simple-bus";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? #address-cells = <1>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? #size-cells = <1>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ranges = <0xb80000000xb80000000x40000>;(quoted diff) +2
-0+ + ? ? ? ? ? ? ? ? ? ? ? ? ? ? usb0: usb at 0xb00E0000 {Review
Quoted 10 lines
(quoted diff) +10
-0+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-usb"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0xb8000000 0x10000>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <10>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? }; + + ? ? ? ? ? ? ? ? ? ? ? ? ? ? usb1: usb at 0xb00f0000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-usb"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0xb8010000 0x10000>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <11>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? };Is the usb implementation compatible to an existing one? Many SoCs use one of ehci, ohci or musb. If that's the case, you should look at the respective bindings.
Quoted 8 lines
Quoted 5 lines
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? sata at
0xb00f0000{
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-sata";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0xb80200000x10000>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <37>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? };Same thing here. Most sata controllers are compatible to some standard implementation.
ok. i see :-). let me have some check with ic guys and send v4 with these fixes.
Quoted 11 lines
Quoted 10 lines
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? security at
0xb00f0000{
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-security";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0xb80300000x10000>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <42>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? };
+ ? ? ? ? ? ? ? ? ? ? };
+ ? ? ? ? ? ? };
+ ? ? };
+};
Quoted 6 lines
? ? ? ?Arnd
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss at lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
Thanks
barry
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 20 lines · Barry Song
Quoted 19 lines
I would normally recommend defining the ranges so that addresses are local to the respective bus, like
axi { ranges = <0 0x40000000 0x80000000>; sys-iobg { ranges = <0 0x48000000 0x40000>; clock-controller at 0x88000000 { compatible = "sirf,prima2-clkc"; reg = <0 0x1000>; } reset-controller at 0x88010000 { compatible = "sirf,prima2-rstc"; reg = <0x10000 0x1000>; }; } }
Quoted 4 lines
i am not sure whether it make us a little more difficult to know the real address at first glance.we will need to calculate. all addresses are 1:1 mapped in this chip. bus map can work even though we only give "ranges;" without real "ranges = <0x....>;".
So each iobg still passes down the entire 32-bit address?
Note that you never have to do the calculation in the driver source, of_iomap and the resource logic both take care of this.
There are multiple ways to handle this, and an empty ranges property usually works fine, but I find that less readable.
Another way to handle these is to have a separate range for each child bus, as in arch/powerpc/boot/dts/gef_ppc9a.dts
To stay in the example, this would mean doing something like
axi {
#address-cells = <2>;
#size-cells = <1>;
ranges = <0 0 0x80000000 0x08000000 // axi devices
1 0 0x88000000 0x08000000 // sys-iobg
2 0 0x90000000 0x00010000 // mem-iobg
3 0 0x90010000 0x07fe0000 // disp-iobg
... >;
l2-cache-controller at 80040000 {
compatible = "arm,pl310-cache";
reg = <0 0x40000 0x1000>;
interrupts = <59>;
};
sys-iobg {
#address-cells = <1>;
#size-cells = <1>;
ranges = <1 0 0 0x40000>;
clock-controller at 88000000 {
compatible = "sirf,prima2-clkc";
reg = <0 0x1000>;
}
reset-controller at 88010000 {
compatible = "sirf,prima2-rstc";
reg = <0x10000 0x1000>;
};
}
}Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
arch/arm/boot/dts/prima2-cb.dts new file +9
-0+ + graphics-iobg { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x98000000 0x98000000 0x8000000>; + + graphics at 0x98000000 { + compatible = "sirf,prima2-graphics";Quoted 8 lines
arch/arm/boot/dts/prima2-cb.dts line 121
Quoted 4 lines
arch/arm/boot/dts/prima2-cb.dts new file +4
-0+ reg = <0x98000000 0x8000000>; + interrupts = <6>; + }; + };Are the display and graphics units CSR developments? If the GPU is in fact licensed from someone else (powervr, arm, ...), you should probably list the actual name of the device.
Quoted 1 line
GPU is powervr sgx 531, so could we define compatible as "powervr,sgx531"?
Probably yes. You should have a look if there are already bindings for this that define other attributes. Also, if there is any customization inside of the chip, you should have another more specific identifier that makes it possible that this is the version that csr has modified.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
arch/arm/boot/dts/prima2-cb.dts new file +12
-0+ multimedia-iobg { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0xa0000000 0xa0000000 0x8000000>; + + multimedia at 0xa0000000 { + compatible = "sirf,prima2-multimedia"; + reg = <0xa0000000 0x8000000>; + interrupts = <5>; + }; + };
Quoted 3 lines
Quoted 1 line
"multimedia" sounds like a too generic term. What does this do?
video decoding.
sirf,prima2-video-codec is probably better than, but if anyone has other suggestions, you could use something else.
Quoted 5 lines
Quoted 3 lines
Are these proprietary uarts, or are they compatible to 8250 and the like? You might want to set a clock-frequency property as
of_serial.cuses.it is not compatible with 8250 .
ok
Quoted 5 lines
Quoted 4 lines
Are these rtc implementations related? From the register layout, I would guess that they are supposed to be used by the same driver, so it's probably a good idea to add a "compatible" property with a common name for all three.
Quoted 7 lines
in fact, because they are slow, they can't be accessed by mapped address directly, the only common point they have is we need to access them through mapped address in rtc-iobg indirectly just like we access i2c/spi/nand devices.
they are three different devices with different purpose and register layout in fact.
Ok.
Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
2011/7/6 Arnd Bergmann <[email protected]>:
Quoted 22 lines · Barry Song
Quoted 21 lines
Quoted 20 lines
I would normally recommend defining the ranges so that addresses are local to the respective bus, like
? ? ? ?axi {
? ? ? ? ? ? ? ?ranges = <00x400000000x80000000>;? ? ? ? ? ? ? ?sys-iobg {
? ? ? ? ? ? ? ? ? ? ? ?ranges = <00x480000000x40000>; ? ? ? ? ? ? ? ? ? ? ? ?clock-controller at0x88000000{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-clkc"; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <00x1000>;
? ? ? ? ? ? ? ? ? ? ? ?}? ? ? ? ? ? ? ? ? ? ? ?reset-controller at
0x88010000{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-rstc"; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0x100000x1000>; ? ? ? ? ? ? ? ? ? ? ? ?};
? ? ? ? ? ? ? ?}
? ? ? ?}
Quoted 6 lines
Quoted 4 lines
i am not sure whether it make us a little more difficult to know the real address at first glance.we will need to calculate. all addresses are 1:1 mapped in this chip. bus map can work even though we only give "ranges;" without real "ranges = <0x....>;".
So each iobg still passes down the entire 32-bit address?
yes. each iobg is basically transparent for address transferring. ranges = <0x40000000 0x40000000 0x80000000>; should be ok.
Quoted 116 lines
Note that you never have to do the calculation in the driver source,
of_iomapand the resource logic both take care of this.There are multiple ways to handle this, and an empty ranges property usually works fine, but I find that less readable.
Another way to handle these is to have a separate range for each child bus, as in
arch/powerpc/boot/dts/gef_ppc9a.dtsTo stay in the example, this would mean doing something like
? ? ? ?axi {
? ? ? ? ? ? ? ?#address-cells = <2>;
? ? ? ? ? ? ? ?#size-cells = <1>;? ? ? ? ? ? ? ?ranges = <0 0
0x800000000x08000000// axi devices ? ? ? ? ? ? ? ? ? ? ? ? ?1 00x880000000x08000000// sys-iobg ? ? ? ? ? ? ? ? ? ? ? ? ?2 00x900000000x00010000// mem-iobg ? ? ? ? ? ? ? ? ? ? ? ? ?3 00x900100000x07fe0000// disp-iobg ? ? ? ? ? ? ? ? ? ? ? ? ?... >;? ? ? ? ? ? ? ?l2-cache-controller at 80040000 { ? ? ? ? ? ? ? ? ? ? ? ?compatible = "arm,pl310-cache"; ? ? ? ? ? ? ? ? ? ? ? ?reg = <0
0x400000x1000>; ? ? ? ? ? ? ? ? ? ? ? ?interrupts = <59>;
? ? ? ? ? ? ? ?};? ? ? ? ? ? ? ?sys-iobg {
? ? ? ? ? ? ? ? ? ? ? ?#address-cells = <1>;
? ? ? ? ? ? ? ? ? ? ? ?#size-cells = <1>;
? ? ? ? ? ? ? ? ? ? ? ?ranges = <1 0 00x40000>;
? ? ? ? ? ? ? ? ? ? ? ?clock-controller at 88000000 { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-clkc"; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <00x1000>;
? ? ? ? ? ? ? ? ? ? ? ?}? ? ? ? ? ? ? ? ? ? ? ?reset-controller at 88010000 { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-rstc"; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <
0x100000x1000>; ? ? ? ? ? ? ? ? ? ? ? ?};
? ? ? ? ? ? ? ?}
? ? ? ?}Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
(quoted diff) +9
-0+ + ? ? ? ? ? ? ? ? ? ? graphics-iobg { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "simple-bus"; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? #address-cells = <1>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? #size-cells = <1>; + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ranges = <0x98000000 0x98000000 0x8000000>; + + ? ? ? ? ? ? ? ? ? ? ? ? ? ? graphics at 0x98000000 { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-graphics";Quoted 8 lines
Quoted 4 lines
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <
0x980000000x8000000>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <6>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? };
+ ? ? ? ? ? ? ? ? ? ? };Are the display and graphics units CSR developments? If the GPU is in fact licensed from someone else (powervr, arm, ...), you should probably list the actual name of the device.
Quoted 1 line
GPU is powervr sgx 531, so could we define compatible as "powervr,sgx531"?
Probably yes. You should have a look if there are already bindings for this that define other attributes. Also, if there is any customization inside of the chip, you should have another more specific identifier that makes it possible that this is the version that csr has modified.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
+ ? ? ? ? ? ? ? ? ? ? multimedia-iobg {
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "simple-bus";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? #address-cells = <1>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? #size-cells = <1>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ranges = <0xa00000000xa00000000x8000000>; +
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? multimedia at0xa0000000{
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? compatible = "sirf,prima2-multimedia";
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reg = <0xa00000000x8000000>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? interrupts = <5>;
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? };
+ ? ? ? ? ? ? ? ? ? ? };Quoted 3 lines
Quoted 1 line
"multimedia" sounds like a too generic term. What does this do?
?video decoding.
sirf,prima2-video-codec is probably better than, but if anyone has other suggestions, you could use something else.
Quoted 5 lines
Quoted 3 lines
Are these proprietary uarts, or are they compatible to 8250 and the like? You might want to set a clock-frequency property as
of_serial.cuses.it is not compatible with 8250 .
ok
Quoted 5 lines
Quoted 4 lines
Are these rtc implementations related? From the register layout, I would guess that they are supposed to be used by the same driver, so it's probably a good idea to add a "compatible" property with a common name for all three.
Quoted 7 lines
in fact, because they are slow, they can't be accessed by mapped address directly, the only common point they have is we need to access them through mapped address in rtc-iobg indirectly just like we access i2c/spi/nand devices.
they are three different devices with different purpose and register layout in fact.
Ok.
? ? ? ?Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
In reply to Barry SongQuoted 8 lines · Barry Song
arch/arm/mach-prima2/include/mach/io.h new file +2
-0@@ -0,0 +1,21 @@ +/* +* arch/arm/mach-prima2/include/mach/io.h
arch/arm/mach-prima2/include/mach/io.h line 12
Quoted 10 lines
arch/arm/mach-prima2/include/mach/io.h new file +10
-0+* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __MACH_PRIMA2_IO_H +#define __MACH_PRIMA2_IO_H + +#define IO_SPACE_LIMIT 0xffffffff
Can folk please start putting comments in their io.h file explaining their choice for this definition? Looking through the existing files, it is almost impossible to infer the reason the value was picked, which makes future maintanence a headache.
IO_SPACE_LIMIT sets the upper bound for the PCI/ISA style IO accessor macros (inb, et.al.)
My guidance is:
1. If you have no support for ISA/PCI/PC card drivers, then set this to zero to prevent ISA/PCI drivers reserving IO port space. You should be able to leave __io() set to __typesafe_io() without risking any ISA driver stamping on memory as those drivers should no longer successfully initialize with this set to zero.
2. If you have MMIO-mapped IO space (eg, a PCI bridge which forwards MMIO accesses in a window to PCI IO space) or equivalent, then set this to the size of the window, or 64K-1. Explain this.
3. If you have MMIO-mapped IO space which is scattered (eg, multiple PC cards with their IO space individually mapped as separate 64K blocks) then explain this and set it to 0xffffffff for the time being.
In any case, having the chosen value documented, and if it is for specific devices on the board, documenting that too, would really help.
I shall be making this change to asm/io.h shortly:
#include <mach/io.h>
+/*
+ * This is the limit of PCI/ISA/PC card IO space, which is by default
+ * 64K if we have PC card, PCI or ISA support. Otherwise, default to
+ * zero to prevent ISA/PCI drivers claiming IO space (and potentially
+ * oopsing.)
+ *
+ * Only set this larger if you really need inb() et.al. to operate over
+ * a larger address space (eg, for multiple MMIO-mapped PC card sockets
+ * as found on SA11x0 and PXA.)
+ */
+#ifndef IO_SPACE_LIMIT
+#if defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD) +#define IO_SPACE_LIMIT ((resource_size_t)0xffff)
+#else
+#define IO_SPACE_LIMIT ((resource_size_t)0)
+#endif
+#endif
Thanks.
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 12 lines · Russell King - ARM Linux
arch/arm/mach-
Quoted 6 lines · Barry Song
arch/arm/mach- renamed from arch/arm/mach-prima2/include/mach/io.h +5
-0+ +#ifndef __MACH_PRIMA2_IO_H +#define __MACH_PRIMA2_IO_H + +#define IO_SPACE_LIMIT 0xffffffffCan folk please start putting comments in their
io.hfile explaining their choice for this definition? Looking through the existing files, it is almost impossible to infer the reason the value was picked, which makes future maintanence a headache.
I had the same comment for one of the earlier versions of the patch set, but we agreed that I'd come up with a way to remove this at a later stage for all platforms that don't have PC-style PIO.
Right now, the only platforms that use a value other than 0xffffffff are ones that actually have PCI and set it to 0xffff.
Quoted 11 lines
IO_SPACE_LIMITsets the upper bound for the PCI/ISA style IO accessor macros (inb, et.al.)My guidance is:
1. If you have no support for ISA/PCI/PC card drivers, then set this to zero to prevent ISA/PCI drivers reserving IO port space. You should be able to leave
__io()set to__typesafe_io()without risking any ISA driver stamping on memory as those drivers should no longer successfully initialize with this set to zero.
Quoted 8 lines
2. If you have MMIO-mapped IO space (eg, a PCI bridge which forwards MMIO accesses in a window to PCI IO space) or equivalent, then set this to the size of the window, or 64K-1. Explain this.
3. If you have MMIO-mapped IO space which is scattered (eg, multiple PC cards with their IO space individually mapped as separate 64K blocks) then explain this and set it to
0xfffffffffor the time being.
Sounds good.
Quoted 11 lines
I shall be making this change to
asm/io.hshortly:#include <
mach/io.h>(quoted diff) +7
-0+/* + * This is the limit of PCI/ISA/PC card IO space, which is by default + * 64K if we have PC card, PCI or ISA support. Otherwise, default to + * zero to prevent ISA/PCI drivers claiming IO space (and potentially + * oopsing.) + * + * Only set this larger if you really need inb() et.al. to operate over
Review
Quoted 10 lines
(quoted diff) +10
-0+ * a larger address space (eg, for multiple MMIO-mapped PC card sockets + * as found on SA11x0 and PXA.) + */ +#ifndef IO_SPACE_LIMIT +#if defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD) +#define IO_SPACE_LIMIT ((resource_size_t)0xffff) +#else +#define IO_SPACE_LIMIT ((resource_size_t)0) +#endif +#endif
Good idea. The related change that I want to do is to conditionalize all drivers that require PC-style I/O on the respective bus they use, so we can also remove the __io macro for platforms that don't need it and catch all drivers using inb/outb at compile time.
To do that, I'm working on a patch set that splits the 8250 driver into separate parts for platform drivers (mostly MMIO) and ISA drivers (mostly PIO), since that seems to be the only driver that we need on non-PIO platforms that uses inb/outb directly.
Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 4 lines · Arnd Bergmann
Good idea. The related change that I want to do is to conditionalize all drivers that require PC-style I/O on the respective bus they use, so we can also remove the
__iomacro for platforms that don't need it and catch all drivers using inb/outb at compile time.
And what about those which use ioport_map() and ioread/write ?
The approach of setting IO_SPACE_LIMIT to zero makes those harmless even if inb/outb are provided.
Quoted 5 lines
To do that, I'm working on a patch set that splits the 8250 driver into separate parts for platform drivers (mostly MMIO) and ISA drivers (mostly PIO), since that seems to be the only driver that we need on non-PIO platforms that uses inb/outb directly.
I don't really see the point of that given the ioread/iowrite et.al. semantics.
And note that ioread/iowrite are unsupportable on some ARM platforms with ISA because of weird addressing techniques (and that renders PATA unsupportable on those platforms, while the old IDE stuff can continue to work with CF cards.)
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 7 lines · Russell King - ARM Linux
Quoted 4 lines · Arnd Bergmann
Good idea. The related change that I want to do is to conditionalize all drivers that require PC-style I/O on the respective bus they use, so we can also remove the
__iomacro for platforms that don't need it and catch all drivers using inb/outb at compile time.And what about those which use
ioport_map()and ioread/write ?
ioport_map should return an error if IO_SPACE_LIMIT is zero. I also tried just forcing a link error by not providing any ioport_map in that case, which didn't cause major problems in my tests. If that works for the general case, I'd prefer that option.
If we have no drivers using ioport_map, ioread/iowrite automatically becomes a non-issue.
Quoted 2 lines
The approach of setting
IO_SPACE_LIMITto zero makes those harmless even if inb/outb are provided.
I'm not arguing against setting IO_SPACE_LIMIT to zero, I just want to do more on top of that. There are numerous drivers that we are able to enable on non-PIO machines that clearly cannot work because they depend on a bus that's not there. This includes stuff like gameport, pcmcia, or various rtc.
Quoted 6 lines
Quoted 5 lines
To do that, I'm working on a patch set that splits the 8250 driver into separate parts for platform drivers (mostly MMIO) and ISA drivers (mostly PIO), since that seems to be the only driver that we need on non-PIO platforms that uses inb/outb directly.
Quoted 7 lines
I don't really see the point of that given the ioread/iowrite et.al. semantics.
And note that ioread/iowrite are unsupportable on some ARM platforms with ISA because of weird addressing techniques (and that renders PATA unsupportable on those platforms, while the old IDE stuff can continue to work with CF cards.)
Different issue, but I'm sure that they are supportable. What we ended up doing on the PCIe bus in one of the Cell blades was to encode special regions in the __iomem token returned from pci_iomap that would trigger indirect access in iowrite32. For the simple case where all buses use the same weird addressing, the regular CONFIG_GENERIC_IOMAP support should be enough already.
Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 7 lines · Arnd Bergmann
Quoted 4 lines · Russell King - ARM Linux
And note that ioread/iowrite are unsupportable on some ARM platforms with ISA because of weird addressing techniques (and that renders PATA unsupportable on those platforms, while the old IDE stuff can continue to work with CF cards.)
Different issue, but I'm sure that they are supportable.
Ha, you've no idea what kind of messed up ideas hardware people come up with then. Take this - this is real hardware which I've had Linux running on continuously for the last 13 years. Here is the /proc/ioports:
0000-000f : pcmcia_socket0
0000-000f : pcmcia0.0
0000-0007 : ide-cs
000e-000e : ide-cs0220-0238 : am79c961
0220-0237 : eth0
0278-027f : reserved
02f8-02ff : serial
0300-030f : pcmcia_socket1
0300-030f : pcmcia1.0
0378-037a : parport0
03bc-03be : reserved
03e0-03e1 : i82365
03f8-03ff : serial
ISA devices have either 8 data lines or 16 data lines.
1) If the device has 8 data lines, then it is accessible on physical addresses ISA_BASE + (ioport << 2).
2) If the device has 16 data lines, then:
a) for an ISA device which transfers 8-bit accesses on the low byte lane, registers are accessible at ISA_BASE + ((ioport & ~1) << 1). For even ioports, use a byte access. For odd ioports, use a word access.
b) for an ISA Device which transfers even 8-bit accesses on the low byte lane and odd 8-bit accesses on the high byte lane, registers are accessible at ISA_BASE + ((ioport & ~1) << 1) + (ioport & 1).
(PCs sort this out via the IOCS16 signal, which is not connected in this example.)
c) for 16-bit accesses, these are always naturally aligned, so these registers are accessible at ISA_BASE + ((ioport & ~1) << 1).
So, let's look at some examples. Serial ports (standard 16550A)@ISA bus address 0x2f8 and 0x3f8. So, the translation from ISA address to bus offset is:
0x2f8 => 0xbe0 0x3f8 => 0xfe0 0x2f9 => 0xbe4 0x3f9 => 0xfe4 0x2fa => 0xbe8 0x3fa => 0xfe8 etc.
The PCMCIA controller is a standard i82365 at the standard ISA address of 0x3e0. This has the following translation:
0x3e0 => 0x7c0(b) 0x3e1 => 0x7c0(w)
An inserted PCMCIA card may require:
0x100 => 0x200(b) 0x101 => 0x200(w) or 0x201(b) 0x102 => 0x204(b) 0x103 => 0x204(w) or 0x205(b)
So, if you do an ioport_map() to convert from the ISA address to a bus specific address, and _then_ add the device specific offset, you end up with information lost, and you no longer know how to manipulate the cookie into the correct bus address and access type.
The alternative is you keep the returned ioport cookie the same as the ISA address, and do all the conversion in ioread/iowrite - that's even more horrible than how it's already doing because then you need to know if its real MMIO or IO, and whether it's an 8 bit IO device, 16-bit low byte lane IO device, or a 16-bit both byte lane IO device. Plus whether the MMIO is in the broken PCMCIA controller IO space (CPU address bit 11 missing and CPU address bit 19 mapped to two bus address bits...)
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 4 lines · Russell King - ARM Linux
Ha, you've no idea what kind of messed up ideas hardware people come up with then. Take this - this is real hardware which I've had Linux running on continuously for the last 13 years. Here is the
/proc/ioports:
< skipped lots of interesting information about how messed up the hardware can be>
Quoted 5 lines
So, if you do an
ioport_map()to convert from the ISA address to a bus specific address, and then add the device specific offset, you end up with information lost, and you no longer know how to manipulate the cookie into the correct bus address and access type.
Quoted 8 lines
The alternative is you keep the returned ioport cookie the same as the ISA address, and do all the conversion in ioread/iowrite - that's even more horrible than how it's already doing because then you need to know if its real MMIO or IO, and whether it's an 8 bit IO device, 16-bit low byte lane IO device, or a 16-bit both byte lane IO device. Plus whether the MMIO is in the broken PCMCIA controller IO space (CPU address bit 11 missing and CPU address bit 19 mapped to two bus address bits...)
Well, first of all, I never suggested converting drivers to use iowrite, you brought that up. So as long as the 16-bit ISA driver keep using inb/outb, an iowrite implementation would not need to bother about this specific problem and don't even need a private iowrite implementation but instead move that platform over to use CONFIG_GENERIC_IOMAP.
What lib/iomap.c does is indeed to look at the address, by default it assumes that __iomem tokens below 0x10000 are IO ports, while larger values are MMIO addresses. This appears to work fine on x86, and AFAICT, it should still work with both the botched PIO mapping (minus the 16-bit devices) and the botched MMIO mapping, since both will just end up calling the fixups in arch/arm/mach-ebsa110/io.c.
The only problem you will hit is when there are ISA devices with MMIO addresses below 0x40000, which is impossible on PCs but perhaps not on arbitrarily incompatible ISA buses.
Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
In reply to Arnd BergmannQuoted 6 lines · Arnd Bergmann
I had the same comment for one of the earlier versions of the patch set, but we agreed that I'd come up with a way to remove this at a later stage for all platforms that don't have PC-style PIO.
Right now, the only platforms that use a value other than
0xffffffffare ones that actually have PCI and set it to0xffff.
As I point out, you can't use that as a reason to work out why the macro is being set. Various platforms have it set to 0xffffffff, and use the PCI/ISA IO accessor with virtual memory addresses provided by (eg) the PCMCIA subsystem - SA11x0 and PXA come to mind on that.
The problem there is that we can't just change the thing because there is that constant thorn known as cs89x0.c, which also uses these macros, and that driver has never been properly updated (it contains _lots_ of platform specific hacks in it.) Changing the base address for the PCI/ISA IO accessor on those platforms is likely to completely break at least this driver.
Plus there are is at least one platform which sets it to 0xffff yet doesn't appear to have PCI selected (VT8500). So I don't think we can even use the 64K-1 value to infer anything about the platform.
This is why we need the reasoning behind the value for this macro documented.
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
In reply to Arnd BergmannQuoted 2 lines · Arnd Bergmann
Right now, the only platforms that use a value other than
0xffffffffare ones that actually have PCI and set it to0xffff.
Note that those platforms using soc_common need to have their inb() et.al. defined to be compatible with readb() et.al. as soc_common ioremaps the IO resource and passes that into the PCMCIA layer as the per-socket IO offset.
The alternative is to rip that out, and use fixed mappings and fixed per-SoC IO offsets.
So, I think as part of this idea, we should - for the time being - default IO_SPACE_LIMIT to 0xffffffff if PCMCIA_SOC_COMMON is enabled in any way. The plus side is that we get that condition documented, and so can do something about it later.
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 9 lines · Russell King - ARM Linux
Quoted 2 lines · Arnd Bergmann
Right now, the only platforms that use a value other than
0xffffffffare ones that actually have PCI and set it to0xffff.Note that those platforms using
soc_commonneed to have theirinb()et.al. defined to be compatible withreadb()et.al. assoc_commonioremaps the IO resource and passes that into the PCMCIA layer as the per-socket IO offset.
Quoted 7 lines
The alternative is to rip that out, and use fixed mappings and fixed per-SoC IO offsets.
So, I think as part of this idea, we should - for the time being - default
IO_SPACE_LIMITto0xffffffffifPCMCIA_SOC_COMMONis enabled in any way. The plus side is that we get that condition documented, and so can do something about it later.
Ok, sounds good.
Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
In reply to Arnd BergmannQuoted 19 lines · Arnd Bergmann
Quoted 18 lines · Russell King - ARM Linux
I shall be making this change to
asm/io.hshortly:#include <
mach/io.h>(quoted diff) +14
-0+/* + * This is the limit of PCI/ISA/PC card IO space, which is by default + * 64K if we have PC card, PCI or ISA support. Otherwise, default to + * zero to prevent ISA/PCI drivers claiming IO space (and potentially + * oopsing.) + * + * Only set this larger if you really need inb() et.al. to operate over + * a larger address space (eg, for multiple MMIO-mapped PC card sockets + * as found on SA11x0 and PXA.) + */ +#ifndef IO_SPACE_LIMIT +#if defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD) +#define IO_SPACE_LIMIT ((resource_size_t)0xffff) +#else
Quoted 8 lines
arch/arm/mach-prima2/common.h line 26
Quoted 3 lines
arch/arm/mach-prima2/common.h new file +3
-0+#define IO_SPACE_LIMIT ((resource_size_t)0) +#endif +#endif Good idea. The related change that I want to do is to conditionalize all drivers that require PC-style I/O on the respective bus they use, so we can also remove the
__iomacro for platforms that don't need it and catch all drivers using inb/outb at compile time.
In the spirit of removing as much machine specific and globally used defines (see my patch series removing a bunch of mach/memory.h instances), I'd like to see a solution that would make IO_SPACE_LIMIT into a variable, or having the same definition with a fixed mapping, for as many SOCs as possible.
Nicolas
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 5 lines · Nicolas Pitre
In the spirit of removing as much machine specific and globally used defines (see my patch series removing a bunch of
mach/memory.hinstances), I'd like to see a solution that would makeIO_SPACE_LIMITinto a variable, or having the same definition with a fixed mapping, for as many SOCs as possible.
In theory it should be possible to have it defined as 64K across everything. ISTR that you were against that with SA1100 platforms because of the PCMCIA problem though...
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 10 lines · On Wednesday 06 July 2011 19:42:48 Russell King - ARM Linux wrote:
Quoted 5 lines · Nicolas Pitre
In the spirit of removing as much machine specific and globally used defines (see my patch series removing a bunch of
mach/memory.hinstances), I'd like to see a solution that would makeIO_SPACE_LIMITinto a variable, or having the same definition with a fixed mapping, for as many SOCs as possible.In theory it should be possible to have it defined as 64K across everything. ISTR that you were against that with SA1100 platforms because of the PCMCIA problem though...
If the problem is only with a few platforms, my preference would be to hardcode this to 64k or 0, and leave the platforms that require something else out of the common zImage for now.
For all platforms that only need the 64k window and don't have any of other special needs, I would also like to hardcode the virtual address window eventually, so that inb/outb can still be a single instruction.
Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · On Wednesday 06 July 2011 19:42:48 Russell King - ARM Linux wrote:
Quoted 5 lines · Nicolas Pitre
In the spirit of removing as much machine specific and globally used defines (see my patch series removing a bunch of
mach/memory.hinstances), I'd like to see a solution that would makeIO_SPACE_LIMITinto a variable, or having the same definition with a fixed mapping, for as many SOCs as possible.In theory it should be possible to have it defined as 64K across everything. ISTR that you were against that with SA1100 platforms because of the PCMCIA problem though...
Quoted 8 lines
If the problem is only with a few platforms, my preference would be to hardcode this to 64k or 0, and leave the platforms that require something else out of the common zImage for now.
For all platforms that only need the 64k window and don't have any of other special needs, I would also like to hardcode the virtual address window eventually, so that inb/outb can still be a single instruction.
I would say that hardcoding the virtual mapping is probably the first thing to do. That would certainly simplify the rest of the kernel.
Nicolas
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 5 lines · Nicolas Pitre
Quoted 4 lines · Arnd Bergmann
If the problem is only with a few platforms, my preference would be to hardcode this to 64k or 0, and leave the platforms that require something else out of the common zImage for now.
Quoted 7 lines
Quoted 4 lines
For all platforms that only need the 64k window and don't have any of other special needs, I would also like to hardcode the virtual address window eventually, so that inb/outb can still be a single instruction.
I would say that hardcoding the virtual mapping is probably the first thing to do. That would certainly simplify the rest of the kernel.
We _used_ to hard-code that mapping, but it became painful to supply that information into soc_common, which isn't supposed to be ARM specific.
So going back to hard-coded mappings is a backwards step - essentially reintroducing one problem which was already solved to resolve a different problem.
That isn't progress, that's merely changing one resolution for another.
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 18 lines · Russell King - ARM Linux
Quoted 5 lines · Nicolas Pitre
Quoted 4 lines · Arnd Bergmann
If the problem is only with a few platforms, my preference would be to hardcode this to 64k or 0, and leave the platforms that require something else out of the common zImage for now.
Quoted 7 lines
Quoted 4 lines
For all platforms that only need the 64k window and don't have any of other special needs, I would also like to hardcode the virtual address window eventually, so that inb/outb can still be a single instruction.
I would say that hardcoding the virtual mapping is probably the first thing to do. That would certainly simplify the rest of the kernel.
We _used_ to hard-code that mapping, but it became painful to supply that information into
soc_common, which isn't supposed to be ARM specific.
Quoted 5 lines
So going back to hard-coded mappings is a backwards step - essentially reintroducing one problem which was already solved to resolve a different problem.
That isn't progress, that's merely changing one resolution for another.
Let's simply let the problematic cases RIP then. Maybe those PCMCIA equipped ARM board will get out of commission eventually.
Nicolas
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
In reply to Russell King - ARM LinuxQuoted 10 lines · Russell King - ARM Linux
Quoted 5 lines · Nicolas Pitre
In the spirit of removing as much machine specific and globally used defines (see my patch series removing a bunch of
mach/memory.hinstances), I'd like to see a solution that would makeIO_SPACE_LIMITinto a variable, or having the same definition with a fixed mapping, for as many SOCs as possible.In theory it should be possible to have it defined as 64K across everything. ISTR that you were against that with SA1100 platforms because of the PCMCIA problem though...
To be honest, if I was against it, the reasons have long been swapped out of my brain. And since those machines with pretenses of ISA-type buses are fading away in terms of actual users, I don't really mind if they are not consolidated. As long as those machines with PCI or none of it can rely on shared definitions that should be good enough.
Nicolas
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
In reply to Nicolas PitreQuoted 10 lines · Nicolas Pitre
Quoted 4 lines
Good idea. The related change that I want to do is to conditionalize all drivers that require PC-style I/O on the respective bus they use, so we can also remove the
__iomacro for platforms that don't need it and catch all drivers using inb/outb at compile time.In the spirit of removing as much machine specific and globally used defines (see my patch series removing a bunch of
mach/memory.hinstances), I'd like to see a solution that would makeIO_SPACE_LIMITinto a variable, or having the same definition with a fixed mapping, for as many SOCs as possible.
I think we don't need to make it a variable as long as we don't need to support all platforms together in one kernel. Any combinations of recent platforms should be fine the way that Russell suggested (0xffff if PCI/ISA/PCMCIA is enabled at compile-time, 0 otherwise).
Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
In reply to Russell King - ARM Linux2011/7/6 Russell King - ARM Linux <[email protected]>:
Quoted 60 lines · Barry Song
Quoted 8 lines
arch/arm/mach-prima2/include/mach/io.h new file +2
-0@@ -0,0 +1,21 @@ +/* +* arch/arm/mach-prima2/include/mach/io.h arch/arm/mach-prima2/include/mach/io.h line 12
Quoted 10 lines
arch/arm/mach-prima2/include/mach/io.h new file +10
-0+* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef __MACH_PRIMA2_IO_H +#define __MACH_PRIMA2_IO_H + +#define IO_SPACE_LIMIT 0xffffffffCan folk please start putting comments in their
io.hfile explaining their choice for this definition? ?Looking through the existing files, it is almost impossible to infer the reason the value was picked, which makes future maintanence a headache.
IO_SPACE_LIMITsets the upper bound for the PCI/ISA style IO accessor macros (inb, et.al.)My guidance is:
1. If you have no support for ISA/PCI/PC card drivers, then set this to ? zero to prevent ISA/PCI drivers reserving IO port space. ?You should ? be able to leave
__io()set to__typesafe_io()without risking any ? ISA driver stamping on memory as those drivers should no longer ? successfully initialize with this set to zero.2. If you have MMIO-mapped IO space (eg, a PCI bridge which forwards ? MMIO accesses in a window to PCI IO space) or equivalent, then set ? this to the size of the window, or 64K-1. ?Explain this.
3. If you have MMIO-mapped IO space which is scattered (eg, multiple ? PC cards with their IO space individually mapped as separate 64K ? blocks) then explain this and set it to
0xfffffffffor the time ? being.In any case, having the chosen value documented, and if it is for specific devices on the board, documenting that too, would really help.
I shall be making this change to
asm/io.hshortly:?#include <
mach/io.h>(quoted diff) +7
-0+/* + * This is the limit of PCI/ISA/PC card IO space, which is by default + * 64K if we have PC card, PCI or ISA support. ?Otherwise, default to + * zero to prevent ISA/PCI drivers claiming IO space (and potentially + * oopsing.) + * + * Only set this larger if you really need inb() et.al. to operate over
Review
Quoted 10 lines
(quoted diff) +10
-0+ * a larger address space (eg, for multiple MMIO-mapped PC card sockets + * as found on SA11x0 and PXA.) + */ +#ifndef IO_SPACE_LIMIT +#if defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD) +#define IO_SPACE_LIMIT ((resource_size_t)0xffff) +#else +#define IO_SPACE_LIMIT ((resource_size_t)0) +#endif +#endif
if you define that in asm/io.h as you said:
#ifndef IO_SPACE_LIMIT
#if defined(PCMCIA_SOC_COMMON)
#define IO_SPACE_LIMIT ((resource_size_t)0xffffffff)
#else
#if defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD) #define IO_SPACE_LIMIT ((resource_size_t)0xffff)
#else
#define IO_SPACE_LIMIT ((resource_size_t)0)
#endif
#endif
#endif
i'd like to delete IO_SPACE_LIMIT in my io.h.
otherwise, i'd like to try "#define IO_SPACE_LIMIT ((resource_size_t)0)" in my io.h since i have no real CONFIG_PCI/ISA/PCCARD/PCMCIA_SOC_COMMON.
Quoted 8 lines
Thanks.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 14 lines · Barry Song
if you define that in
asm/io.has you said:#ifndef
IO_SPACE_LIMIT
#ifdefined(PCMCIA_SOC_COMMON)
#defineIO_SPACE_LIMIT((resource_size_t)0xffffffff)
#else
#ifdefined(CONFIG_PCI)||defined(CONFIG_ISA)||defined(CONFIG_PCCARD)#defineIO_SPACE_LIMIT((resource_size_t)0xffff)
#else
#defineIO_SPACE_LIMIT((resource_size_t)0)
#endif
#endif
#endif
Quoted 5 lines
i'd like to delete
IO_SPACE_LIMITin myio.h.otherwise, i'd like to try "#define
IO_SPACE_LIMIT((resource_size_t)0)" in myio.hsince i have no real CONFIG_PCI/ISA/PCCARD/PCMCIA_SOC_COMMON.
Thanks - stopping the 0xffffffff madness in new platforms is great.
If you also omit the definition for __io() and set NO_IOPORT in your Kconfig, you should also end up with inb() et.al. undefined by asm/io.h, which should cause build-time failures if an ISA/PCI/PCMCIA driver attempts to build.
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 15 lines · On Wednesday 06 July 2011 21:10:00 Russell King - ARM Linux wrote:
Quoted 14 lines · Barry Song
if you define that in
asm/io.has you said:#ifndef
IO_SPACE_LIMIT
#ifdefined(PCMCIA_SOC_COMMON)
#defineIO_SPACE_LIMIT((resource_size_t)0xffffffff)
#else
#ifdefined(CONFIG_PCI)||defined(CONFIG_ISA)||defined(CONFIG_PCCARD)#defineIO_SPACE_LIMIT((resource_size_t)0xffff)
#else
#defineIO_SPACE_LIMIT((resource_size_t)0)
#endif
#endif
#endif
Quoted 7 lines
Quoted 5 lines
i'd like to delete
IO_SPACE_LIMITin myio.h.otherwise, i'd like to try "#define
IO_SPACE_LIMIT((resource_size_t)0)" in myio.hsince i have no real CONFIG_PCI/ISA/PCCARD/PCMCIA_SOC_COMMON.Thanks - stopping the
0xffffffffmadness in new platforms is great.
FWIW, I've double-checked the Xilinx zynq platform that I've already queued up for 3.1: this one defines IO_SPACE_LIMIT to 0xffff because PCI support will get merged later, so that's fine.
Quoted 4 lines
If you also omit the definition for
__io()and setNO_IOPORTin yourKconfig, you should also end up withinb()et.al. undefined byasm/io.h, which should cause build-time failures if an ISA/PCI/PCMCIA driver attempts to build.
Just as a follow-up, this is what I was referring to in the other sub-thread. Setting NO_IOPORT and removing __io does work for a lot of things today, but breaks randconfig builds left and right. I want to clean that up by adding 'depends on HAS_IOPORT' at the correct places and then switch all platforms that don't need it to remove __io.
Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 5 lines · Arnd Bergmann
Just as a follow-up, this is what I was referring to in the other sub-thread. Setting
NO_IOPORTand removing__iodoes work for a lot of things today, but breaks randconfig builds left and right. I want to clean that up by adding 'depends onHAS_IOPORT' at the correct places and then switch all platforms that don't need it to remove__io.
It's not that easy. NO_IOPORT was brought in by Viro to work around various platforms which broke - such as RiscPC. Viro was well aware of that platform, and we had a discussion about it.
The conclusion (I think) was that NO_IOPORT was to prevent ioport_map() et.al. on platforms which couldn't provide a sane definition - eg:
(11 Feb 2007)...
19:50 < rmk> inb(port) | inb(port + 1) << 8 is not identical to addr = ioport_map(port); readb(addr) | readb(addr + 1) 19:51 < rmk> inb(port) | inb(port + 1) << 8 _is_ identical to addr = ioport_map(port); readb(addr) | readb(addr + (1 << 2)) 19:53 < rmk> inw(port) | inw(port + 2) equates to addr = ioport_map(port); readw(addr) | readw(addr + (2 << 2))
So, while the above referred to platform uses inb etc, it sets NO_IOPORT to stop the devres breakage, which in turn disables HAS_IOPORT.
So, HAS_IOPORT does not mean the ISA/PCI accessors are not provided. It means there will be no devres support for it and ioport_map() is probably missing.
I've added Viro to this thread in case he'd like to correct me (if he remembers the background to HAS_IOPORT/NO_IOPORT etc.)
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 23 lines · On Wednesday 06 July 2011 22:50:59 Russell King - ARM Linux wrote:
Quoted 5 lines · Arnd Bergmann
Just as a follow-up, this is what I was referring to in the other sub-thread. Setting
NO_IOPORTand removing__iodoes work for a lot of things today, but breaks randconfig builds left and right. I want to clean that up by adding 'depends onHAS_IOPORT' at the correct places and then switch all platforms that don't need it to remove__io.It's not that easy.
NO_IOPORTwas brought in by Viro to work around various platforms which broke - such as RiscPC. Viro was well aware of that platform, and we had a discussion about it.The conclusion (I think) was that
NO_IOPORTwas to preventioport_map()et.al. on platforms which couldn't provide a sane definition - eg:(11 Feb 2007)...
19:50 < rmk> inb(port) | inb(port + 1) << 8 is not identical to addr = ioport_map(port); readb(addr) | readb(addr + 1) 19:51 < rmk> inb(port) | inb(port + 1) << 8 is identical to addr = ioport_map(port); readb(addr) | readb(addr + (1 << 2)) 19:53 < rmk> inw(port) | inw(port + 2) equates to addr = ioport_map(port); readw(addr) | readw(addr + (2 << 2))So, while the above referred to platform uses inb etc, it sets
NO_IOPORTto stop the devres breakage, which in turn disablesHAS_IOPORT.
Quoted 6 lines
So,
HAS_IOPORTdoes not mean the ISA/PCI accessors are not provided. It means there will be no devres support for it andioport_map()is probably missing.I've added Viro to this thread in case he'd like to correct me (if he remembers the background to HAS_IOPORT/NO_IOPORT etc.)
Thanks for the exact reference. You've mentioned this before and I tried to find the discussion but couldn't.
I understand that the original meaning of NO_IOPORT/HAS_IOPORT is very limited, and I would like to extend it in a way to allow both the scenario with inb/outb but without ioport_map and the case where you have no PIO space at all.
CONFIG_HAS_IOPORT is nice in that it mirrors CONFIG_HAS_IOMEM for readl/writel, so my preferred solution would be to repurpose that symbol to mean that inb/outb are available, while introducing a new symbol to mean that ioport_map is also available, e.g. CONFIG_HAS_IOPORT_MAP for the cases where we now use CONFIG_HAS_IOPORT.
Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
In reply to Arnd Bergmann2011/7/7 Arnd Bergmann <[email protected]>:
Quoted 22 lines · On Wednesday 06 July 2011 21:10:00 Russell King - ARM Linux wrote:
Quoted 21 lines · Barry Song
Quoted 19 lines
if you define that in
asm/io.has you said:#ifndef
IO_SPACE_LIMIT
#ifdefined(PCMCIA_SOC_COMMON)
#define ?IO_SPACE_LIMIT ((resource_size_t)0xffffffff)
#else
#ifdefined(CONFIG_PCI)||defined(CONFIG_ISA)||defined(CONFIG_PCCARD)#defineIO_SPACE_LIMIT((resource_size_t)0xffff)
#else
#defineIO_SPACE_LIMIT((resource_size_t)0)
#endif
#endif
#endifi'd like to delete
IO_SPACE_LIMITin myio.h.otherwise, i'd like to try "#define
IO_SPACE_LIMIT((resource_size_t)0)" in myio.hsince i have no real CONFIG_PCI/ISA/PCCARD/PCMCIA_SOC_COMMON.
Quoted 5 lines
Quoted 1 line
Thanks - stopping the
0xffffffffmadness in new platforms is great.FWIW, I've double-checked the Xilinx zynq platform that I've already queued up for 3.1: this one defines
IO_SPACE_LIMITto0xffffbecause PCI support will get merged later, so that's fine.
as far as i know, zynq still has some static mapping tables and board file board_dt.c. as you have reviewed csr platform very carefully, i guess those can get fixed in zynq later too :-)
xilinx zynq and csr prima2 should be the pioneering two new SoCs to move to DT in arm for the moment. at least, these two things can try to get same.
Quoted 14 lines
Quoted 5 lines
If you also omit the definition for
__io()and setNO_IOPORTin yourKconfig, you should also end up withinb()et.al. undefined byasm/io.h, which should cause build-time failures if an ISA/PCI/PCMCIA driver attempts to build.Just as a follow-up, this is what I was referring to in the other sub-thread. Setting
NO_IOPORTand removing__iodoes work for a lot of things today, but breaks randconfig builds left and right. I want to clean that up by adding 'depends onHAS_IOPORT' at the correct places and then switch all platforms that don't need it to remove__io.? ? ? ?Arnd
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 10 lines · Barry Song
Quoted 3 lines
FWIW, I've double-checked the Xilinx zynq platform that I've already queued up for 3.1: this one defines
IO_SPACE_LIMITto0xffffbecause PCI support will get merged later, so that's fine.as far as i know, zynq still has some static mapping tables and board file
board_dt.c. as you have reviewed csr platform very carefully, i guess those can get fixed in zynq later too :-)
xilinx zynq and csr prima2 should be the pioneering two new SoCs to move to DT in arm for the moment. at least, these two things can try to get same.
Good point. I'm not planning to change the initial xilinx code, since it's already in the tree, but I'd like to apply the patch below to make it do the same as prima2 in this regard.
John, can you ack this patch?
For the iotable, it would also be good to remove that from zynq, but it's harder to do for me when I can't test it. I'll try to split out the serial setup, and I'd hope that John can do the others along the lines of what you have done in sirfprima2.
8<----
Subject: [PATCH] ARM: Xilinx: merge board file into main platform code
The zynq platform will never have board files other than the device tree one, so there is no point splitting it from common.c.
This makes the code more compact.
--- arch/arm/mach-zynq/board_dt.c | 37 ------------------------------------- arch/arm/mach-zynq/common.c | 22 +++++++++++++++++++--- arch/arm/mach-zynq/common.h | 5 ----- 3 files changed, 19 insertions(+), 45 deletions(-)
arch/arm/mach-zynq/board_dt.c +0 -37
@@ -1,37 +0,0 @@ -/* -* 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
arch/arm/mach-zynq/common.c +19 -3
@@ -21,8 +21,11 @@#include <linux/clk.h> #include <linux/of_irq.h> #include <linux/of_platform.h> +#include <linux/of.h> +#include <asm/mach/arch.h> #include <asm/mach/map.h> +#include <asm/mach-types.h> #include <asm/page.h> #include <asm/hardware/gic.h> #include <asm/hardware/cache-l2x0.h>
@@ -40,7 +43,7 @@ static struct of_device_id zynq_of_bus_ids[] __initdata = {* xilinx_init_machine() - System specific initialization, intended to be * called from board specific initialization. */ -void __init xilinx_init_machine (void ) +static void __init xilinx_init_machine (void ) {#ifdef CONFIG_CACHE_L2X0 /*
@@ -55,7 +58,7 @@ void __init xilinx_init_machine(void)/** * xilinx_irq_init() - Interrupt controller initialization for the GIC. */ -void __init xilinx_irq_init (void ) +static void __init xilinx_irq_init (void ) {gic_init (0 ,29 ,SCU_GIC_DIST_BASE ,SCU_GIC_CPU_BASE ); }
@@ -96,7 +99,20 @@ static struct map_desc io_desc[] __initdata = {/** * xilinx_map_io() - Create memory mappings needed for early I/O. */ -void __init xilinx_map_io (void ) +static void __init xilinx_map_io (void ) {iotable_init (io_desc,ARRAY_SIZE (io_desc)); } + +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
arch/arm/mach-zynq/common.h +0 -5
@@ -17,13 +17,8 @@#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
Signature · 1 line
1.7.4.1
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · Barry Song
Quoted 3 lines
FWIW, I've double-checked the Xilinx zynq platform that I've already queued up for 3.1: this one defines
IO_SPACE_LIMITto0xffffbecause PCI support will get merged later, so that's fine.as far as i know, zynq still has some static mapping tables and board file
board_dt.c. as you have reviewed csr platform very carefully, i guess those can get fixed in zynq later too :-)
xilinx zynq and csr prima2 should be the pioneering two new SoCs to move to DT in arm for the moment. at least, these two things can try to get same.
Quoted 4 lines
Good point. I'm not planning to change the initial xilinx code, since it's already in the tree, but I'd like to apply the patch below to make it do the same as prima2 in this regard.
John, can you ack this patch?
How similar are prima2 and zynq after this patch and a diff between their two subdirectories? Are there any differences which can be eliminated? Is there any commonality which can be factored out from the two? Should the two be occupying separate mach directories?
I think this is something we need to pay attention to now.
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 7 lines · Russell King - ARM Linux
Quoted 4 lines · Arnd Bergmann
Good point. I'm not planning to change the initial xilinx code, since it's already in the tree, but I'd like to apply the patch below to make it do the same as prima2 in this regard.
John, can you ack this patch?
Quoted 6 lines
How similar are prima2 and zynq after this patch and a diff between their two subdirectories? Are there any differences which can be eliminated? Is there any commonality which can be factored out from the two? Should the two be occupying separate mach directories?
I think this is something we need to pay attention to now.
Right. Both platforms currently contain setup code for l2x0, which we can remove after Rob Herring's patch gets in. This is all I can see in the actual source files, everything else is really setting up the individual hardware.
The majority of the prima2 code is now the clock setup, which will get changed again once we have the common clock framework. I assume that most of the code in there becomes obselete at that point, but intentionally stayed out of the whole clk discussion.
The sys_timer implementation is still present in both, but completely distinct as far as I can tell. I think the long-term plan is to move those to drivers/clocksource.
What's left then are basically the headers. There is significant room for consolidation there, and I think most of them have been looked at by people before or are currently being worked on. Below is the complete diff between the headers of the two platforms as they are being proposed now.
Arnd
---
clkdev.h | 27 ++++++++++++++++++++++----- debug-macro.S | 53 ++++++++++++++++++++++++++++++----------------------- entry-macro.S | 43 ++++++++++++++++++++++--------------------- hardware.h | 17 ++++++++++------- io.h | 33 +++++++++++++++++++++++++-------- irqs.h | 24 ++++++++++++++---------- map.h | 16 ---------------- memory.h | 27 ++++++++++++++------------- system.h | 23 +++++++++++------------ timex.h | 19 ++++++++++++++----- uart.h | 32 +++++++++++++++++--------------- uncompress.h | 49 ++++++++++++++++++++++++++++++------------------- vmalloc.h | 20 +++++++++++++------- zynq_soc.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 14 files changed, 270 insertions(+), 161 deletions(-)
arm/mach-zynq/include/mach/clkdev.h renamed from arm/mach-prima2/include/mach/clkdev.h +22 -5
@@ -1,13 +1,30 @@/* -* arch/arm/mach-prima2/include/mach/clkdev.h +* arch/arm/mach-zynq/include/mach/clkdev.h * -* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* 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. * -* Licensed under GPLv2 or later. */ -#ifndef __MACH_CLKDEV_H -#define __MACH_CLKDEV_H +#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)
arm/mach-zynq/include/mach/debug-macro.S renamed from arm/mach-prima2/include/mach/debug-macro.S +30 -23
59 lines not on this page · raw message
arm/mach-zynq/include/mach/entry-macro.S renamed from arm/mach-prima2/include/mach/entry-macro.S +22 -21
51 lines not on this page · raw message
arm/mach-zynq/include/mach/hardware.h renamed from arm/mach-prima2/include/mach/hardware.h +10 -7
@@ -1,15 +1,18 @@ -/* -* arch/arm/mach-prima2/include/mach/hardware.h +/* arch/arm/mach-zynq/include/mach/hardware.h * -* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* Copyright (C) 2011 Xilinx * -* Licensed under GPLv2 or later. +* 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__ -#include <asm/sizes.h> -#include <mach/map.h> -#endif
arm/mach-zynq/include/mach/io.h renamed from arm/mach-prima2/include/mach/io.h +25 -8
@@ -1,16 +1,33 @@ -/* -* arch/arm/mach-prima2/include/mach/io.h +/* arch/arm/mach-zynq/include/mach/io.h * -* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* Copyright (C) 2011 Xilinx * -* Licensed under GPLv2 or later. +* 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_PRIMA2_IO_H -#define __MACH_PRIMA2_IO_H +#ifndef __MACH_IO_H__ +#define __MACH_IO_H__ + +/* Allow IO space to be anywhere in the memory */ + +#define IO_SPACE_LIMIT 0xffff -#define IO_SPACE_LIMIT ((resource_size_t)0) +/* 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 __mem_pci (a) (a) +#define __io (a) __typesafe_io(a) +#define __mem_pci (a) (a)#endif
arm/mach-zynq/include/mach/irqs.h renamed from arm/mach-prima2/include/mach/irqs.h +14 -10
@@ -1,17 +1,21 @@ -/* -* arch/arm/mach-prima2/include/mach/irqs.h +/* arch/arm/mach-zynq/include/mach/irqs.h * -* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* Copyright (C) 2011 Xilinx * -* Licensed under GPLv2 or later. +* 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 __ASM_ARCH_IRQS_H -#define __ASM_ARCH_IRQS_H - -#define SIRFSOC_INTENAL_IRQ_START 0 -#define SIRFSOC_INTENAL_IRQ_END 59 +#ifndef __MACH_IRQS_H +#define __MACH_IRQS_H -#define NR_IRQS 220 +#define ARCH_NR_GPIOS 118 +#define NR_IRQS (128 + ARCH_NR_GPIOS)#endif
arm/mach-zynq/include/mach/map.h renamed from arm/mach-prima2/include/mach/map.h +0 -16
@@ -1,16 +0,0 @@ -/* -* memory & I/O static mapping definitions for CSR SiRFprimaII -* -* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. -* -* Licensed under GPLv2 or later. -*/ - -#ifndef __MACH_PRIMA2_MAP_H__ -#define __MACH_PRIMA2_MAP_H__ - -#include <mach/vmalloc.h> - -#define SIRFSOC_VA (x) (VMALLOC_END + ((x) & 0x00FFF000)) - -#endif
arm/mach-zynq/include/mach/memory.h renamed from arm/mach-prima2/include/mach/memory.h +14 -13
@@ -1,21 +1,22 @@ -/* -* arch/arm/mach-prima2/include/mach/memory.h +/* arch/arm/mach-zynq/include/mach/memory.h * -* Copyright (c) 2010 ??? 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* Copyright (C) 2011 Xilinx * -* Licensed under GPLv2 or later. +* 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 __ASM_ARCH_MEMORY_H -#define __ASM_ARCH_MEMORY_H +#ifndef __MACH_MEMORY_H__ +#define __MACH_MEMORY_H__ -#define PLAT_PHYS_OFFSET UL(0x00000000) +#include <asm/sizes.h> -/* -* Restrict DMA-able region to workaround silicon limitation. -* The limitation restricts buffers available for DMA to SD/MMC -* hardware to be below 256MB -*/ -#define ARM_DMA_ZONE_SIZE (SZ_256M) +#define PLAT_PHYS_OFFSET UL(0x0)#endif
arm/mach-zynq/include/mach/system.h renamed from arm/mach-prima2/include/mach/system.h +11 -12
@@ -1,21 +1,20 @@ -/* -* arch/arm/mach-prima2/include/mach/system.h +/* arch/arm/mach-zynq/include/mach/system.h * -* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* Copyright (C) 2011 Xilinx * -* Licensed under GPLv2 or later. +* 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__ -#include <linux/bitops.h> -#include <mach/hardware.h> - -#define SIRFSOC_SYS_RST_BIT BIT(31) - -extern void __iomem *sirfsoc_rstc_base; -static inline void arch_idle (void ) {cpu_do_idle ();
@@ -23,7 +22,7 @@static inline void arch_reset (char mode,const char *cmd) { -writel (SIRFSOC_SYS_RST_BIT , sirfsoc_rstc_base); +/* Add architecture specific reset processing here */ }#endif
arm/mach-zynq/include/mach/timex.h renamed from arm/mach-prima2/include/mach/timex.h +14 -5
@@ -1,14 +1,23 @@ -/* -* arch/arm/mach-prima2/include/mach/timex.h +/* arch/arm/mach-zynq/include/mach/timex.h * -* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* Copyright (C) 2011 Xilinx * -* Licensed under GPLv2 or later. +* 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__ -#define CLOCK_TICK_RATE 1000000 +/* 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
arm/mach-zynq/include/mach/uart.h renamed from arm/mach-prima2/include/mach/uart.h +17 -15
@@ -1,23 +1,25 @@ -/* -* arch/arm/mach-prima2/include/mach/uart.h +/* arch/arm/mach-zynq/include/mach/uart.h * -* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* Copyright (C) 2011 Xilinx * -* Licensed under GPLv2 or later. +* 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_PRIMA2_SIRFSOC_UART_H -#define __MACH_PRIMA2_SIRFSOC_UART_H - -/* UART-1: used as serial debug port */ -#define SIRFSOC_UART1_PA_BASE 0xb0060000 -#define SIRFSOC_UART1_VA_BASE SIRFSOC_VA(0x060000) -#define SIRFSOC_UART1_SIZE SZ_4K +#ifndef __MACH_UART_H__ +#define __MACH_UART_H__ -#define SIRFSOC_UART_TXFIFO_STATUS 0x0114 -#define SIRFSOC_UART_TXFIFO_DATA 0x0118 +#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 SIRFSOC_UART1_TXFIFO_FULL (1 << 5) -#define SIRFSOC_UART1_TXFIFO_EMPTY (1 << 6) +#define UART_SR_TXFULL 0x00000010/* TX FIFO full */ +#define UART_SR_TXEMPTY 0x00000008/* TX FIFO empty */ #endif
arm/mach-zynq/include/mach/uncompress.h renamed from arm/mach-prima2/include/mach/uncompress.h +30 -19
70 lines not on this page · raw message
arm/mach-zynq/include/mach/vmalloc.h renamed from arm/mach-prima2/include/mach/vmalloc.h +13 -7
@@ -1,14 +1,20 @@ -/* -* arch/arm/ach-prima2/include/mach/vmalloc.h +/* arch/arm/mach-zynq/include/mach/vmalloc.h * -* Copyright (c) 2010 ??? 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* Copyright (C) 2011 Xilinx * -* Licensed under GPLv2 or later. +* 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 +#ifndef __MACH_VMALLOC_H__ +#define __MACH_VMALLOC_H__ -#define VMALLOC_END 0xFEC00000 +#define VMALLOC_END 0xE0000000UL#endif
arm/mach-zynq/include/mach/zynq_soc.h renamed from arm/mach-prima2/include/mach/zynq_soc.h +48 -0
48 lines not on this page · raw message
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 5 lines · Arnd Bergmann
What's left then are basically the headers. There is significant room for consolidation there, and I think most of them have been looked at by people before or are currently being worked on. Below is the complete diff between the headers of the two platforms as they are being proposed now.
Thanks for that. diff -w might be a good idea on these to eliminate changes due to whitespace differences. It has found one thing which should be fixed...
Quoted 19 lines
diff -urN
arch/arm/mach-prima2/include/mach/vmalloc.harch/arm/mach-zynq/include/mach/vmalloc.harm/mach-zynq/include/mach/vmalloc.h renamed from arm/mach-prima2/include/mach/vmalloc.h +9
-4@@ -1,14 +1,20 @@ -/* -* arch/arm/ach-prima2/include/mach/vmalloc.h +/* arch/arm/mach-zynq/include/mach/vmalloc.h * -* Copyright (c) 2010 ??? 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* Copyright (C) 2011 Xilinx * -* Licensed under GPLv2 or later. +* 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
arm/mach-zynq/include/mach/vmalloc.h line 18
Quoted 10 lines
arm/mach-zynq/include/mach/vmalloc.h renamed from arm/mach-prima2/include/mach/vmalloc.h +4
-3+* GNU General Public License for more details. */ -#ifndef __MACH_VMALLOC_H -#define __MACH_VMALLOC_H +#ifndef __MACH_VMALLOC_H__ +#define __MACH_VMALLOC_H__ -#define VMALLOC_END 0xFEC00000 +#define VMALLOC_END 0xE0000000UL
Prima2 should add a UL suffix to VMALLOC_END to ensure that it is properly typed.
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
2011/7/7 Russell King - ARM Linux <[email protected]>:
Quoted 38 lines · Arnd Bergmann
Quoted 5 lines
What's left then are basically the headers. There is significant room for consolidation there, and I think most of them have been looked at by people before or are currently being worked on. Below is the complete diff between the headers of the two platforms as they are being proposed now.
Thanks for that. ?diff -w might be a good idea on these to eliminate changes due to whitespace differences. ?It has found one thing which should be fixed...
Quoted 27 lines
diff -urN
arch/arm/mach-prima2/include/mach/vmalloc.harch/arm/mach-zynq/include/mach/vmalloc.harm/mach-zynq/include/mach/vmalloc.h 2011-07-07 13:22:07.000000000 +0000 renamed from arm/mach-prima2/include/mach/vmalloc.h ? ? ? 2011-07-07 13:21:41.000000000 +0000 +1
-2@@ -1,14 +1,20 @@ -/* - * arch/arm/ach-prima2/include/mach/vmalloc.h +/* arch/arm/mach-zynq/include/mach/vmalloc.h? *
- * Copyright (c) 2010 ? 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
+ * ?Copyright (C) 2011 Xilinx
? *
- * Licensed under GPLv2 or later.
+ * 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.
? */arm/mach-zynq/include/mach/vmalloc.h 2011-07-07 13:22:07.000000000 +0000 renamed from arm/mach-prima2/include/mach/vmalloc.h ? ? ? 2011-07-07 13:21:41.000000000 +0000 +2
-2-#ifndef __MACH_VMALLOC_H -#define __MACH_VMALLOC_H +#ifndef __MACH_VMALLOC_H__ +#define __MACH_VMALLOC_H__
Quoted 5 lines
arm/mach-zynq/include/mach/vmalloc.h 2011-07-07 13:22:07.000000000 +0000
Quoted 2 lines
arm/mach-zynq/include/mach/vmalloc.h 2011-07-07 13:22:07.000000000 +0000 renamed from arm/mach-prima2/include/mach/vmalloc.h ? ? ? 2011-07-07 13:21:41.000000000 +0000 +1
-1-#define VMALLOC_END ?0xFEC00000 +#define VMALLOC_END ? ? ? 0xE0000000ULPrima2 should add a UL suffix to
VMALLOC_ENDto ensure that it is properly typed.
simply adding a UL suffix will make compiling fail since arch/arm/kernel/debug.S will refer to the macro calculating virtual address of SIRFSOC_UART1_VA_BASE and UL is not legal in asm.
samsung has one way to handle this:
plat-samsung/include/plat/map-base.h
#define S3C_ADDR_BASE 0xF6000000
#ifndef __ASSEMBLY__
#define S3C_ADDR(x) ((void __iomem __force *)S3C_ADDR_BASE + (x))
#else
#define S3C_ADDR(x) (S3C_ADDR_BASE + (x))
#endif
#define S3C_VA_UART S3C_ADDR(0x01000000) /* UART */
mach-s5pc100/include/mach/debug-macro.S:
.macro addruart, rp, rv
ldr \rp, = S3C_PA_UART
ldr \rv, = S3C_VA_UART
#if CONFIG_DEBUG_S3C_UART != 0
add \rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
add \rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)#endif
.endm
Samsung hasn't UL for S3C_ADDR_BASE in asm context, so its arch/arm/kernel/debug.S can compile. in C context, "(void __iomem __force *)" works to force the right type.
To fix my problem, i might simply give the direct address to SIRFSOC_UART1_VA_BASE:
#define SIRFSOC_UART1_VA_BASE 0xFEC60000
instead of
#define SIRFSOC_UART1_VA_BASE SIRFSOC_VA(0x060000)
Quoted 1 line
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 3 lines · Barry Song
simply adding a UL suffix will make compiling fail since
arch/arm/kernel/debug.Swill refer to the macro calculating virtual address ofSIRFSOC_UART1_VA_BASEand UL is not legal in asm.
A solution for VMALLOC_END would be to include linux/const.h and use _AC(value, UL). I think you're the only one who bases their IO addressing off VMALLOC_END.
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 8 lines · Russell King - ARM Linux
Quoted 3 lines · Barry Song
simply adding a UL suffix will make compiling fail since
arch/arm/kernel/debug.Swill refer to the macro calculating virtual address ofSIRFSOC_UART1_VA_BASEand UL is not legal in asm.A solution for
VMALLOC_ENDwould be to includelinux/const.hand use_AC(value, UL). I think you're the only one who bases their IO addressing offVMALLOC_END.
This is also a bad idea to use VMALLOC_END like that since this is another per-architecture constant which is targetted for a global removal.
Nicolas
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 7 lines · Nicolas Pitre
Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Barry Song
simply adding a UL suffix will make compiling fail since
arch/arm/kernel/debug.Swill refer to the macro calculating virtual address ofSIRFSOC_UART1_VA_BASEand UL is not legal in asm.
Quoted 7 lines
Quoted 3 lines
A solution for
VMALLOC_ENDwould be to includelinux/const.hand use_AC(value, UL). I think you're the only one who bases their IO addressing offVMALLOC_END.This is also a bad idea to use
VMALLOC_ENDlike that since this is another per-architecture constant which is targetted for a global removal.
Let's get the story straight and avoid confusion...
Using _AC(value, UL) is not a bad idea, nor is adding UL as a suffix for VMALLOC_END. Basing IO addresses off VMALLOC_END is questionable, but we have to have some value for this.
Rather than trying to convert everything to a variable, I think some effort needs to be spent trying to keep this as a constant. We've grown too much to have lots of variances in the kernel memory layout and we really should be trying to standardize on this stuff.
Part of that is helped with your patch for the StrongARM cache flushing. We just need to take that further.
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 12 lines · Russell King - ARM Linux
Quoted 11 lines · Nicolas Pitre
Quoted 8 lines · Russell King - ARM Linux
Quoted 3 lines · Barry Song
simply adding a UL suffix will make compiling fail since
arch/arm/kernel/debug.Swill refer to the macro calculating virtual address ofSIRFSOC_UART1_VA_BASEand UL is not legal in asm.A solution for
VMALLOC_ENDwould be to includelinux/const.hand use_AC(value, UL). I think you're the only one who bases their IO addressing offVMALLOC_END.
Quoted 8 lines
Quoted 3 lines
This is also a bad idea to use
VMALLOC_ENDlike that since this is another per-architecture constant which is targetted for a global removal.Let's get the story straight and avoid confusion...
Using
_AC(value, UL)is not a bad idea, nor is adding UL as a suffix forVMALLOC_END.
Absolutely.
Quoted 2 lines
Basing IO addresses off
VMALLOC_ENDis questionable, but we have to have some value for this.
Exact. I just wouldn't want to see VMALLOC_END even more entangled into SOC specific mappings.
Quoted 4 lines
Rather than trying to convert everything to a variable, I think some effort needs to be spent trying to keep this as a constant. We've grown too much to have lots of variances in the kernel memory layout and we really should be trying to standardize on this stuff.
Indeed. The VMALLOC_END case is possibly different as we were trying to find a way to adjust it automatically at run time which would be one thing less for platforms to care about. Having a globally fixed value for it would also solve the multiple definition problem. But some machines have a large set of IO mappings while some others have a small one, so having a one size fits all solution here might be suboptimal.
Nicolas
PATCH 1/3 ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 7 lines · On Friday 08 July 2011 20:09:29 Nicolas Pitre wrote:
Indeed. The
VMALLOC_ENDcase is possibly different as we were trying to find a way to adjust it automatically at run time which would be one thing less for platforms to care about. Having a globally fixed value for it would also solve the multiple definition problem. But some machines have a large set of IO mappings while some others have a small one, so having a one size fits all solution here might be suboptimal.
Is everything between VMALLOC_END and 0xfeffffff guaranteed to come from iotable_init? If so, we could perhaps turn it into a variable that gets initialized to 0xfeffffff and decreased by iotable_init to be just below the lowest address that has actually been mapped.
Obviously, anything that derives values from VMALLOC_END at compile time would need to change, too.
Arnd
dynamic VMALLOC_END, was Re: [PATCH 1/3] ARM: CSR: Adding CSR SiRFprimaII board support
Quoted 9 lines · Arnd Bergmann
Quoted 7 lines · On Friday 08 July 2011 20:09:29 Nicolas Pitre wrote:
Indeed. The
VMALLOC_ENDcase is possibly different as we were trying to find a way to adjust it automatically at run time which would be one thing less for platforms to care about. Having a globally fixed value for it would also solve the multiple definition problem. But some machines have a large set of IO mappings while some others have a small one, so having a one size fits all solution here might be suboptimal.
Quoted 7 lines
Is everything between
VMALLOC_ENDand0xfeffffffguaranteed to come fromiotable_init? If so, we could perhaps turn it into a variable that gets initialized to0xfeffffffand decreased byiotable_initto be just below the lowest address that has actually been mapped.Obviously, anything that derives values from
VMALLOC_ENDat compile time would need to change, too.
You then have a catch22 situation, because one thing that gets derived from VMALLOC_END is the highmem threshold, and that has to be determined before iotable_init can be used. And having a fixed highmem threshold is not any better than a globally fixed VMALLOC_END of course.
Nicolas
PATCH 2/3 ARM: CSR: mapping early DEBUG_LL uart
In reply to Barry Song--- arch/arm/mach-prima2/Makefile | 1 + arch/arm/mach-prima2/lluart.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-prima2/lluart.c
arch/arm/mach-prima2/Makefile +1 -0
@@ -3,3 +3,4 @@ obj-y += irq.o obj-y += clock.o obj-y += rstc.o obj-y += prima2.o +obj-$(CONFIG_DEBUG_LL) += lluart.o
arch/arm/mach-prima2/lluart.c new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Static memory mapping for DEBUG_LL +* +* Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. +* +* Licensed under GPLv2 or later. +*/ + +#include <linux/kernel.h> +#include <asm/page.h> +#include <asm/mach/map.h> +#include <mach/map.h> +#include <mach/uart.h> + +void __init sirfsoc_map_lluart (void ) +{ +struct map_desc sirfsoc_lluart_map = { + .virtual =SIRFSOC_UART1_VA_BASE , + .pfn =__phys_to_pfn (SIRFSOC_UART1_PA_BASE ), + .length =SIRFSOC_UART1_SIZE , + .type =MT_DEVICE , + }; + +iotable_init (&sirfsoc_lluart_map,1 ); +}
Signature · 6 lines
1.7.1 Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
PATCH 2/3 ARM: CSR: mapping early DEBUG_LL uart
Quoted 1 line · Barry Song
Signed-off-by Barry Song <[email protected]>
Surely this should be part of the first patch, which won't build without this one if DEBUG_LL is enabled?
PATCH 2/3 ARM: CSR: mapping early DEBUG_LL uart
hi Russell,
2011/7/6 Russell King - ARM Linux <[email protected]>:
Quoted 5 lines · Barry Song
Quoted 1 line
Signed-off-by Barry Song <[email protected]>Surely this should be part of the first patch, which won't build without this one if
DEBUG_LLis enabled?
i guess that can get fixed by:
static void __init sirfsoc_map_io(void)
{
sirfsoc_map_lluart();
}MACHINE_START(PRIMA2_EVB, "prima2cb")
...
.map_io = sirfsoc_map_io,
...MACHINE_END
Quoted 6 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thanks
barry
PATCH 2/3 ARM: CSR: mapping early DEBUG_LL uart
2011/7/6 Barry Song <[email protected]>:
Quoted 10 lines
hi Russell,
2011/7/6 Russell King - ARM Linux <[email protected]>:
Quoted 5 lines · Barry Song
Quoted 1 line
Signed-off-by Barry Song <[email protected]>Surely this should be part of the first patch, which won't build without this one if
DEBUG_LLis enabled?i guess that can get fixed by:
oh. no, it can't be fixed by any way....
Quoted 22 lines
static void
__initsirfsoc_map_io(void)
{
? ? ? ?sirfsoc_map_lluart();
}
MACHINE_START(PRIMA2_EVB, "prima2cb")
? ? ?...
? ? ? .map_io ? ? ? ? =sirfsoc_map_io,
? ? ?...MACHINE_ENDQuoted 6 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernelThanks
barry
PATCH 2/3 ARM: CSR: mapping early DEBUG_LL uart
In reply to Barry SongQuoted 16 lines · Barry Song
hi Russell,
2011/7/6 Russell King - ARM Linux <[email protected]>:
Quoted 5 lines · Barry Song
Quoted 1 line
Signed-off-by Barry Song <[email protected]>Surely this should be part of the first patch, which won't build without this one if
DEBUG_LLis enabled?i guess that can get fixed by:
static void
__initsirfsoc_map_io(void){ sirfsoc_map_lluart(); }
Quoted 5 lines
MACHINE_START(PRIMA2_EVB, "prima2cb")... .map_io = sirfsoc_map_io, ...
MACHINE_END
That doesn't really change anything. If you build the first patch without the second patch with DEBUG_LL enabled, you'll get a build failure because sirfsoc_map_lluart is not defined.
Either omit the .map_io initializer in the first patch and add it in the second patch, or combine the two patches together.
PATCH 2/3 ARM: CSR: mapping early DEBUG_LL uart
Hi Russell,
Thanks.
2011/7/6 Russell King - ARM Linux <[email protected]>:
Quoted 23 lines · Barry Song
Quoted 16 lines
hi Russell,
2011/7/6 Russell King - ARM Linux <[email protected]>:
Quoted 5 lines · Barry Song
Quoted 1 line
Signed-off-by Barry Song <[email protected]>Surely this should be part of the first patch, which won't build without this one if
DEBUG_LLis enabled?i guess that can get fixed by:
static void
__initsirfsoc_map_io(void)
{
? ? ? ?sirfsoc_map_lluart();
}Quoted 5 lines
MACHINE_START(PRIMA2_EVB, "prima2cb")
? ? ? ...
? ? ? ?.map_io ? ? ? ? =sirfsoc_map_io,
? ? ? ...MACHINE_END
Quoted 6 lines
That doesn't really change anything. ?If you build the first patch without the second patch with
DEBUG_LLenabled, you'll get a build failure becausesirfsoc_map_lluartis not defined.Either omit the .map_io initializer in the first patch and add it in the second patch, or combine the two patches together.
real. thanks! to keep this as a separate patch as required in earlier thread, i will omit the .map_io initializer in the first patch.
Quoted 1 line
barry
PATCH 2/3 ARM: CSR: mapping early DEBUG_LL uart
In reply to Barry SongQuoted 6 lines · Barry Song
Signed-off-by Barry Song <[email protected]>--- arch/arm/mach-prima2/Makefile | 1 + arch/arm/mach-prima2/lluart.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-prima2/lluart.c
PATCH 3/3 ARM: CSR: initilized L2 cache
In reply to Barry SongFrom: Rongjun Ying <[email protected]>
--- arch/arm/mach-prima2/Makefile | 1 + arch/arm/mach-prima2/l2x0.c | 59 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-prima2/l2x0.c
arch/arm/mach-prima2/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-y += clock.o obj-y += rstc.o obj-y += prima2.o obj-$(CONFIG_DEBUG_LL) += lluart.o +obj-$(CONFIG_CACHE_L2X0) += l2x0.o
arch/arm/mach-prima2/l2x0.c new file +59 -0
59 lines not on this page · raw message
Signature · 6 lines
1.7.1 Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
PATCH 3/3 ARM: CSR: initilized L2 cache
Quoted 4 lines · Barry Song
From: Rongjun Ying <[email protected]>
Signed-off-by Rongjun Ying <[email protected]>Signed-off-by Barry Song <[email protected]>