From 073b6ff3b94c4737c91c45ed0f0c4d40cf1cb1c8 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 18 Apr 2008 22:43:09 +0100 Subject: RealView: Move the EB GIC definitions to the board file This is in preparation for the RealView PB11MPCore and PB1176 patches which have different base addresses for the GIC. Signed-off-by: Catalin Marinas --- include/asm-arm/arch-realview/board-eb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/asm-arm/arch-realview/board-eb.h') diff --git a/include/asm-arm/arch-realview/board-eb.h b/include/asm-arm/arch-realview/board-eb.h index 3e437b7f425..cacfdbbc2e4 100644 --- a/include/asm-arm/arch-realview/board-eb.h +++ b/include/asm-arm/arch-realview/board-eb.h @@ -26,6 +26,9 @@ /* * RealView EB + ARM11MPCore peripheral addresses */ +#define REALVIEW_EB_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */ +#define REALVIEW_EB_GIC_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */ + #ifdef CONFIG_REALVIEW_EB_ARM11MP_REVB #define REALVIEW_EB11MP_SCU_BASE 0x10100000 /* SCU registers */ #define REALVIEW_EB11MP_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */ -- cgit v1.2.3 From a44ddfd5bf5354281eebd0f0ae0d6dcf8818fc5c Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 18 Apr 2008 22:43:10 +0100 Subject: RealView: Move the flash definitions out of platform.h This patch moves the patch definitions into board-eb.h and realview_eb.c (from core.c) as they are different on the PB11MPCore and PB1176 platforms. Signed-off-by: Catalin Marinas --- arch/arm/mach-realview/core.c | 15 +++++++-------- arch/arm/mach-realview/core.h | 1 + arch/arm/mach-realview/realview_eb.c | 7 ++++++- include/asm-arm/arch-realview/board-eb.h | 3 +++ include/asm-arm/arch-realview/platform.h | 3 --- 5 files changed, 17 insertions(+), 12 deletions(-) (limited to 'include/asm-arm/arch-realview/board-eb.h') diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 98aefc9f4df..f3cf5712091 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c @@ -109,22 +109,21 @@ static struct flash_platform_data realview_flash_data = { .set_vpp = realview_flash_set_vpp, }; -static struct resource realview_flash_resource = { - .start = REALVIEW_FLASH_BASE, - .end = REALVIEW_FLASH_BASE + REALVIEW_FLASH_SIZE, - .flags = IORESOURCE_MEM, -}; - struct platform_device realview_flash_device = { .name = "armflash", .id = 0, .dev = { .platform_data = &realview_flash_data, }, - .num_resources = 1, - .resource = &realview_flash_resource, }; +int realview_flash_register(struct resource *res, u32 num) +{ + realview_flash_device.resource = res; + realview_flash_device.num_resources = num; + return platform_device_register(&realview_flash_device); +} + static struct resource realview_i2c_resource = { .start = REALVIEW_I2C_BASE, .end = REALVIEW_I2C_BASE + SZ_4K - 1, diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h index 492a14c0d60..6fcaeae16db 100644 --- a/arch/arm/mach-realview/core.h +++ b/arch/arm/mach-realview/core.h @@ -58,5 +58,6 @@ extern unsigned int twd_size; extern void realview_leds_event(led_event_t ledevt); extern void realview_timer_init(unsigned int timer_irq); +extern int realview_flash_register(struct resource *res, u32 num); #endif diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index 6848e518299..860e3ca833e 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c @@ -223,6 +223,11 @@ static struct amba_device *amba_devs[] __initdata = { /* * RealView EB platform devices */ +static struct resource realview_eb_flash_resource = { + .start = REALVIEW_EB_FLASH_BASE, + .end = REALVIEW_EB_FLASH_BASE + REALVIEW_EB_FLASH_SIZE - 1, + .flags = IORESOURCE_MEM, +}; static struct resource realview_eb_eth_resources[] = { [0] = { @@ -362,7 +367,7 @@ static void __init realview_eb_init(void) clk_register(&realview_clcd_clk); - platform_device_register(&realview_flash_device); + realview_flash_register(&realview_eb_flash_resource, 1); platform_device_register(&realview_i2c_device); eth_device_register(); diff --git a/include/asm-arm/arch-realview/board-eb.h b/include/asm-arm/arch-realview/board-eb.h index cacfdbbc2e4..8adb81e7d1b 100644 --- a/include/asm-arm/arch-realview/board-eb.h +++ b/include/asm-arm/arch-realview/board-eb.h @@ -29,6 +29,9 @@ #define REALVIEW_EB_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */ #define REALVIEW_EB_GIC_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */ +#define REALVIEW_EB_FLASH_BASE 0x40000000 +#define REALVIEW_EB_FLASH_SIZE SZ_64M + #ifdef CONFIG_REALVIEW_EB_ARM11MP_REVB #define REALVIEW_EB11MP_SCU_BASE 0x10100000 /* SCU registers */ #define REALVIEW_EB11MP_GIC_CPU_BASE 0x10100100 /* Generic interrupt controller CPU interface */ diff --git a/include/asm-arm/arch-realview/platform.h b/include/asm-arm/arch-realview/platform.h index 5ff6c8b303b..08d6f05ce0a 100644 --- a/include/asm-arm/arch-realview/platform.h +++ b/include/asm-arm/arch-realview/platform.h @@ -32,9 +32,6 @@ #define REALVIEW_SSRAM_BASE /* REALVIEW_SSMC_BASE ? */ #define REALVIEW_SSRAM_SIZE SZ_2M -#define REALVIEW_FLASH_BASE 0x40000000 -#define REALVIEW_FLASH_SIZE SZ_64M - /* * SDRAM */ -- cgit v1.2.3 From 80192735e4b01a2e4d437699f2e9b5b93dfab13c Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 18 Apr 2008 22:43:11 +0100 Subject: RealView: Move the timer definitions into the EB specific files This patch moves the timer definitions from platform.h into board-eb.h as they are different on PB11MPCore and PB1176. It also adds timerX_va_base variables in core.c which are set by the realview_eb_timer_init function before invoking realview_timer_init. Signed-off-by: Catalin Marinas --- arch/arm/mach-realview/core.c | 38 ++++++++++++++++---------------- arch/arm/mach-realview/core.h | 4 ++++ arch/arm/mach-realview/realview_eb.c | 13 +++++++---- include/asm-arm/arch-realview/board-eb.h | 2 ++ include/asm-arm/arch-realview/platform.h | 2 -- 5 files changed, 34 insertions(+), 25 deletions(-) (limited to 'include/asm-arm/arch-realview/board-eb.h') diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index f3cf5712091..131990d196f 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c @@ -444,10 +444,10 @@ void realview_leds_event(led_event_t ledevt) /* * Where is the timer (VA)? */ -#define TIMER0_VA_BASE __io_address(REALVIEW_TIMER0_1_BASE) -#define TIMER1_VA_BASE (__io_address(REALVIEW_TIMER0_1_BASE) + 0x20) -#define TIMER2_VA_BASE __io_address(REALVIEW_TIMER2_3_BASE) -#define TIMER3_VA_BASE (__io_address(REALVIEW_TIMER2_3_BASE) + 0x20) +void __iomem *timer0_va_base; +void __iomem *timer1_va_base; +void __iomem *timer2_va_base; +void __iomem *timer3_va_base; /* * How long is the timer interval? @@ -474,7 +474,7 @@ static void timer_set_mode(enum clock_event_mode mode, switch(mode) { case CLOCK_EVT_MODE_PERIODIC: - writel(TIMER_RELOAD, TIMER0_VA_BASE + TIMER_LOAD); + writel(TIMER_RELOAD, timer0_va_base + TIMER_LOAD); ctrl = TIMER_CTRL_PERIODIC; ctrl |= TIMER_CTRL_32BIT | TIMER_CTRL_IE | TIMER_CTRL_ENABLE; @@ -490,16 +490,16 @@ static void timer_set_mode(enum clock_event_mode mode, ctrl = 0; } - writel(ctrl, TIMER0_VA_BASE + TIMER_CTRL); + writel(ctrl, timer0_va_base + TIMER_CTRL); } static int timer_set_next_event(unsigned long evt, struct clock_event_device *unused) { - unsigned long ctrl = readl(TIMER0_VA_BASE + TIMER_CTRL); + unsigned long ctrl = readl(timer0_va_base + TIMER_CTRL); - writel(evt, TIMER0_VA_BASE + TIMER_LOAD); - writel(ctrl | TIMER_CTRL_ENABLE, TIMER0_VA_BASE + TIMER_CTRL); + writel(evt, timer0_va_base + TIMER_LOAD); + writel(ctrl | TIMER_CTRL_ENABLE, timer0_va_base + TIMER_CTRL); return 0; } @@ -535,7 +535,7 @@ static irqreturn_t realview_timer_interrupt(int irq, void *dev_id) struct clock_event_device *evt = &timer0_clockevent; /* clear the interrupt */ - writel(1, TIMER0_VA_BASE + TIMER_INTCLR); + writel(1, timer0_va_base + TIMER_INTCLR); evt->event_handler(evt); @@ -550,7 +550,7 @@ static struct irqaction realview_timer_irq = { static cycle_t realview_get_cycles(void) { - return ~readl(TIMER3_VA_BASE + TIMER_VALUE); + return ~readl(timer3_va_base + TIMER_VALUE); } static struct clocksource clocksource_realview = { @@ -565,11 +565,11 @@ static struct clocksource clocksource_realview = { static void __init realview_clocksource_init(void) { /* setup timer 0 as free-running clocksource */ - writel(0, TIMER3_VA_BASE + TIMER_CTRL); - writel(0xffffffff, TIMER3_VA_BASE + TIMER_LOAD); - writel(0xffffffff, TIMER3_VA_BASE + TIMER_VALUE); + writel(0, timer3_va_base + TIMER_CTRL); + writel(0xffffffff, timer3_va_base + TIMER_LOAD); + writel(0xffffffff, timer3_va_base + TIMER_VALUE); writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC, - TIMER3_VA_BASE + TIMER_CTRL); + timer3_va_base + TIMER_CTRL); clocksource_realview.mult = clocksource_khz2mult(1000, clocksource_realview.shift); @@ -606,10 +606,10 @@ void __init realview_timer_init(unsigned int timer_irq) /* * Initialise to a known state (all timers off) */ - writel(0, TIMER0_VA_BASE + TIMER_CTRL); - writel(0, TIMER1_VA_BASE + TIMER_CTRL); - writel(0, TIMER2_VA_BASE + TIMER_CTRL); - writel(0, TIMER3_VA_BASE + TIMER_CTRL); + writel(0, timer0_va_base + TIMER_CTRL); + writel(0, timer1_va_base + TIMER_CTRL); + writel(0, timer2_va_base + TIMER_CTRL); + writel(0, timer3_va_base + TIMER_CTRL); /* * Make irqs happen for the system timer diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h index 6fcaeae16db..33dbbb41a66 100644 --- a/arch/arm/mach-realview/core.h +++ b/arch/arm/mach-realview/core.h @@ -55,6 +55,10 @@ extern void __iomem *gic_cpu_base_addr; extern void __iomem *twd_base_addr; extern unsigned int twd_size; #endif +extern void __iomem *timer0_va_base; +extern void __iomem *timer1_va_base; +extern void __iomem *timer2_va_base; +extern void __iomem *timer3_va_base; extern void realview_leds_event(led_event_t ledevt); extern void realview_timer_init(unsigned int timer_irq); diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index 860e3ca833e..c5e5f07b5f5 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c @@ -66,13 +66,13 @@ static struct map_desc realview_eb_io_desc[] __initdata = { .length = SZ_4K, .type = MT_DEVICE, }, { - .virtual = IO_ADDRESS(REALVIEW_TIMER0_1_BASE), - .pfn = __phys_to_pfn(REALVIEW_TIMER0_1_BASE), + .virtual = IO_ADDRESS(REALVIEW_EB_TIMER0_1_BASE), + .pfn = __phys_to_pfn(REALVIEW_EB_TIMER0_1_BASE), .length = SZ_4K, .type = MT_DEVICE, }, { - .virtual = IO_ADDRESS(REALVIEW_TIMER2_3_BASE), - .pfn = __phys_to_pfn(REALVIEW_TIMER2_3_BASE), + .virtual = IO_ADDRESS(REALVIEW_EB_TIMER2_3_BASE), + .pfn = __phys_to_pfn(REALVIEW_EB_TIMER2_3_BASE), .length = SZ_4K, .type = MT_DEVICE, }, @@ -337,6 +337,11 @@ static void __init realview_eb_timer_init(void) { unsigned int timer_irq; + timer0_va_base = __io_address(REALVIEW_EB_TIMER0_1_BASE); + timer1_va_base = __io_address(REALVIEW_EB_TIMER0_1_BASE) + 0x20; + timer2_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE); + timer3_va_base = __io_address(REALVIEW_EB_TIMER2_3_BASE) + 0x20; + if (core_tile_eb11mp()) { #ifdef CONFIG_LOCAL_TIMERS twd_base_addr = __io_address(REALVIEW_EB11MP_TWD_BASE); diff --git a/include/asm-arm/arch-realview/board-eb.h b/include/asm-arm/arch-realview/board-eb.h index 8adb81e7d1b..142d77a72f3 100644 --- a/include/asm-arm/arch-realview/board-eb.h +++ b/include/asm-arm/arch-realview/board-eb.h @@ -26,6 +26,8 @@ /* * RealView EB + ARM11MPCore peripheral addresses */ +#define REALVIEW_EB_TIMER0_1_BASE 0x10011000 /* Timer 0 and 1 */ +#define REALVIEW_EB_TIMER2_3_BASE 0x10012000 /* Timer 2 and 3 */ #define REALVIEW_EB_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */ #define REALVIEW_EB_GIC_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */ diff --git a/include/asm-arm/arch-realview/platform.h b/include/asm-arm/arch-realview/platform.h index 08d6f05ce0a..7aa78a5ebc8 100644 --- a/include/asm-arm/arch-realview/platform.h +++ b/include/asm-arm/arch-realview/platform.h @@ -190,8 +190,6 @@ #define REALVIEW_SCI_BASE 0x1000E000 /* Smart card controller */ /* Reserved 0x1000F000 */ #define REALVIEW_WATCHDOG_BASE 0x10010000 /* watchdog interface */ -#define REALVIEW_TIMER0_1_BASE 0x10011000 /* Timer 0 and 1 */ -#define REALVIEW_TIMER2_3_BASE 0x10012000 /* Timer 2 and 3 */ #define REALVIEW_GPIO0_BASE 0x10013000 /* GPIO port 0 */ #define REALVIEW_GPIO1_BASE 0x10014000 /* GPIO port 1 */ #define REALVIEW_GPIO2_BASE 0x10015000 /* GPIO port 2 */ -- cgit v1.2.3 From 9a386f0651d06002a0468ce4d0e15aaf7c316a3c Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 18 Apr 2008 22:43:11 +0100 Subject: RealView: Move the UART definitions to EB specific files Since the PB1176 has different UART base addresses, this patch moves the definitions form platorm.h to board-eb.h. It also modifies uncompress.h to detect the platform type at run-time. Signed-off-by: Catalin Marinas --- arch/arm/mach-realview/realview_eb.c | 32 +++++++++++++++--------------- include/asm-arm/arch-realview/board-eb.h | 4 ++++ include/asm-arm/arch-realview/platform.h | 4 ---- include/asm-arm/arch-realview/uncompress.h | 32 ++++++++++++++++++++++-------- 4 files changed, 44 insertions(+), 28 deletions(-) (limited to 'include/asm-arm/arch-realview/board-eb.h') diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index c5e5f07b5f5..f970c9fb155 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c @@ -78,8 +78,8 @@ static struct map_desc realview_eb_io_desc[] __initdata = { }, #ifdef CONFIG_DEBUG_LL { - .virtual = IO_ADDRESS(REALVIEW_UART0_BASE), - .pfn = __phys_to_pfn(REALVIEW_UART0_BASE), + .virtual = IO_ADDRESS(REALVIEW_EB_UART0_BASE), + .pfn = __phys_to_pfn(REALVIEW_EB_UART0_BASE), .length = SZ_4K, .type = MT_DEVICE, } @@ -164,14 +164,14 @@ static void __init realview_eb_map_io(void) */ #define SCI_IRQ { IRQ_EB_SCI, NO_IRQ } #define SCI_DMA { 7, 6 } -#define UART0_IRQ { IRQ_EB_UART0, NO_IRQ } -#define UART0_DMA { 15, 14 } -#define UART1_IRQ { IRQ_EB_UART1, NO_IRQ } -#define UART1_DMA { 13, 12 } -#define UART2_IRQ { IRQ_EB_UART2, NO_IRQ } -#define UART2_DMA { 11, 10 } -#define UART3_IRQ { IRQ_EB_UART3, NO_IRQ } -#define UART3_DMA { 0x86, 0x87 } +#define EB_UART0_IRQ { IRQ_EB_UART0, NO_IRQ } +#define EB_UART0_DMA { 15, 14 } +#define EB_UART1_IRQ { IRQ_EB_UART1, NO_IRQ } +#define EB_UART1_DMA { 13, 12 } +#define EB_UART2_IRQ { IRQ_EB_UART2, NO_IRQ } +#define EB_UART2_DMA { 11, 10 } +#define EB_UART3_IRQ { IRQ_EB_UART3, NO_IRQ } +#define EB_UART3_DMA { 0x86, 0x87 } #define SSP_IRQ { IRQ_EB_SSP, NO_IRQ } #define SSP_DMA { 9, 8 } @@ -180,7 +180,7 @@ AMBA_DEVICE(aaci, "fpga:04", AACI, NULL); AMBA_DEVICE(mmc0, "fpga:05", MMCI0, &realview_mmc0_plat_data); AMBA_DEVICE(kmi0, "fpga:06", KMI0, NULL); AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL); -AMBA_DEVICE(uart3, "fpga:09", UART3, NULL); +AMBA_DEVICE(uart3, "fpga:09", EB_UART3, NULL); /* DevChip Primecells */ AMBA_DEVICE(smc, "dev:00", SMC, NULL); @@ -193,9 +193,9 @@ AMBA_DEVICE(gpio1, "dev:e5", GPIO1, NULL); AMBA_DEVICE(gpio2, "dev:e6", GPIO2, NULL); AMBA_DEVICE(rtc, "dev:e8", RTC, NULL); AMBA_DEVICE(sci0, "dev:f0", SCI, NULL); -AMBA_DEVICE(uart0, "dev:f1", UART0, NULL); -AMBA_DEVICE(uart1, "dev:f2", UART1, NULL); -AMBA_DEVICE(uart2, "dev:f3", UART2, NULL); +AMBA_DEVICE(uart0, "dev:f1", EB_UART0, NULL); +AMBA_DEVICE(uart1, "dev:f2", EB_UART1, NULL); +AMBA_DEVICE(uart2, "dev:f3", EB_UART2, NULL); AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL); static struct amba_device *amba_devs[] __initdata = { @@ -388,8 +388,8 @@ static void __init realview_eb_init(void) MACHINE_START(REALVIEW_EB, "ARM-RealView EB") /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ - .phys_io = REALVIEW_UART0_BASE, - .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc, + .phys_io = REALVIEW_EB_UART0_BASE, + .io_pg_offst = (IO_ADDRESS(REALVIEW_EB_UART0_BASE) >> 18) & 0xfffc, .boot_params = 0x00000100, .map_io = realview_eb_map_io, .init_irq = gic_init_irq, diff --git a/include/asm-arm/arch-realview/board-eb.h b/include/asm-arm/arch-realview/board-eb.h index 142d77a72f3..565bb937ac8 100644 --- a/include/asm-arm/arch-realview/board-eb.h +++ b/include/asm-arm/arch-realview/board-eb.h @@ -26,6 +26,10 @@ /* * RealView EB + ARM11MPCore peripheral addresses */ +#define REALVIEW_EB_UART0_BASE 0x10009000 /* UART 0 */ +#define REALVIEW_EB_UART1_BASE 0x1000A000 /* UART 1 */ +#define REALVIEW_EB_UART2_BASE 0x1000B000 /* UART 2 */ +#define REALVIEW_EB_UART3_BASE 0x1000C000 /* UART 3 */ #define REALVIEW_EB_TIMER0_1_BASE 0x10011000 /* Timer 0 and 1 */ #define REALVIEW_EB_TIMER2_3_BASE 0x10012000 /* Timer 2 and 3 */ #define REALVIEW_EB_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */ diff --git a/include/asm-arm/arch-realview/platform.h b/include/asm-arm/arch-realview/platform.h index 7aa78a5ebc8..d18fb128ed9 100644 --- a/include/asm-arm/arch-realview/platform.h +++ b/include/asm-arm/arch-realview/platform.h @@ -182,10 +182,6 @@ #define REALVIEW_KMI0_BASE 0x10006000 /* KMI interface */ #define REALVIEW_KMI1_BASE 0x10007000 /* KMI 2nd interface */ #define REALVIEW_CHAR_LCD_BASE 0x10008000 /* Character LCD */ -#define REALVIEW_UART0_BASE 0x10009000 /* UART 0 */ -#define REALVIEW_UART1_BASE 0x1000A000 /* UART 1 */ -#define REALVIEW_UART2_BASE 0x1000B000 /* UART 2 */ -#define REALVIEW_UART3_BASE 0x1000C000 /* UART 3 */ #define REALVIEW_SSP_BASE 0x1000D000 /* Synchronous Serial Port */ #define REALVIEW_SCI_BASE 0x1000E000 /* Smart card controller */ /* Reserved 0x1000F000 */ diff --git a/include/asm-arm/arch-realview/uncompress.h b/include/asm-arm/arch-realview/uncompress.h index 3d5c2db07a2..9b790a7e782 100644 --- a/include/asm-arm/arch-realview/uncompress.h +++ b/include/asm-arm/arch-realview/uncompress.h @@ -18,28 +18,44 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include +#include -#include +#include -#define AMBA_UART_DR (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x00)) -#define AMBA_UART_LCRH (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x2c)) -#define AMBA_UART_CR (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x30)) -#define AMBA_UART_FR (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x18)) +#define AMBA_UART_DR(base) (*(volatile unsigned char *)((base) + 0x00)) +#define AMBA_UART_LCRH(base) (*(volatile unsigned char *)((base) + 0x2c)) +#define AMBA_UART_CR(base) (*(volatile unsigned char *)((base) + 0x30)) +#define AMBA_UART_FR(base) (*(volatile unsigned char *)((base) + 0x18)) + +/* + * Return the UART base address + */ +static inline unsigned long get_uart_base(void) +{ + if (machine_is_realview_eb()) + return REALVIEW_EB_UART0_BASE; + else + return 0; +} /* * This does not append a newline */ static inline void putc(int c) { - while (AMBA_UART_FR & (1 << 5)) + unsigned long base = get_uart_base(); + + while (AMBA_UART_FR(base) & (1 << 5)) barrier(); - AMBA_UART_DR = c; + AMBA_UART_DR(base) = c; } static inline void flush(void) { - while (AMBA_UART_FR & (1 << 3)) + unsigned long base = get_uart_base(); + + while (AMBA_UART_FR(base) & (1 << 3)) barrier(); } -- cgit v1.2.3 From 393538e6d2ea1afe42c4ae9382cc78ed51a479f9 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Fri, 18 Apr 2008 22:43:11 +0100 Subject: RealView: Move more device address definitions to board-eb.h The upcoming PB11MPCore and PB1176 have different memory maps and some of the definitions in platform.h are no longer common. This patch moves them to the board-eb.h file and updates their usage in realview_eb.c. Signed-off-by: Catalin Marinas --- arch/arm/mach-realview/realview_eb.c | 42 ++++++++++++++++---------------- include/asm-arm/arch-realview/board-eb.h | 8 ++++++ include/asm-arm/arch-realview/platform.h | 16 +----------- 3 files changed, 30 insertions(+), 36 deletions(-) (limited to 'include/asm-arm/arch-realview/board-eb.h') diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c index f970c9fb155..247b5562047 100644 --- a/arch/arm/mach-realview/realview_eb.c +++ b/arch/arm/mach-realview/realview_eb.c @@ -136,12 +136,12 @@ static void __init realview_eb_map_io(void) /* * These devices are connected directly to the multi-layer AHB switch */ -#define SMC_IRQ { NO_IRQ, NO_IRQ } -#define SMC_DMA { 0, 0 } +#define EB_SMC_IRQ { NO_IRQ, NO_IRQ } +#define EB_SMC_DMA { 0, 0 } #define MPMC_IRQ { NO_IRQ, NO_IRQ } #define MPMC_DMA { 0, 0 } -#define CLCD_IRQ { IRQ_EB_CLCD, NO_IRQ } -#define CLCD_DMA { 0, 0 } +#define EB_CLCD_IRQ { IRQ_EB_CLCD, NO_IRQ } +#define EB_CLCD_DMA { 0, 0 } #define DMAC_IRQ { IRQ_EB_DMA, NO_IRQ } #define DMAC_DMA { 0, 0 } @@ -150,14 +150,14 @@ static void __init realview_eb_map_io(void) */ #define SCTL_IRQ { NO_IRQ, NO_IRQ } #define SCTL_DMA { 0, 0 } -#define WATCHDOG_IRQ { IRQ_EB_WDOG, NO_IRQ } -#define WATCHDOG_DMA { 0, 0 } -#define GPIO0_IRQ { IRQ_EB_GPIO0, NO_IRQ } -#define GPIO0_DMA { 0, 0 } +#define EB_WATCHDOG_IRQ { IRQ_EB_WDOG, NO_IRQ } +#define EB_WATCHDOG_DMA { 0, 0 } +#define EB_GPIO0_IRQ { IRQ_EB_GPIO0, NO_IRQ } +#define EB_GPIO0_DMA { 0, 0 } #define GPIO1_IRQ { IRQ_EB_GPIO1, NO_IRQ } #define GPIO1_DMA { 0, 0 } -#define RTC_IRQ { IRQ_EB_RTC, NO_IRQ } -#define RTC_DMA { 0, 0 } +#define EB_RTC_IRQ { IRQ_EB_RTC, NO_IRQ } +#define EB_RTC_DMA { 0, 0 } /* * These devices are connected via the DMA APB bridge @@ -172,8 +172,8 @@ static void __init realview_eb_map_io(void) #define EB_UART2_DMA { 11, 10 } #define EB_UART3_IRQ { IRQ_EB_UART3, NO_IRQ } #define EB_UART3_DMA { 0x86, 0x87 } -#define SSP_IRQ { IRQ_EB_SSP, NO_IRQ } -#define SSP_DMA { 9, 8 } +#define EB_SSP_IRQ { IRQ_EB_SSP, NO_IRQ } +#define EB_SSP_DMA { 9, 8 } /* FPGA Primecells */ AMBA_DEVICE(aaci, "fpga:04", AACI, NULL); @@ -183,20 +183,20 @@ AMBA_DEVICE(kmi1, "fpga:07", KMI1, NULL); AMBA_DEVICE(uart3, "fpga:09", EB_UART3, NULL); /* DevChip Primecells */ -AMBA_DEVICE(smc, "dev:00", SMC, NULL); -AMBA_DEVICE(clcd, "dev:20", CLCD, &clcd_plat_data); +AMBA_DEVICE(smc, "dev:00", EB_SMC, NULL); +AMBA_DEVICE(clcd, "dev:20", EB_CLCD, &clcd_plat_data); AMBA_DEVICE(dmac, "dev:30", DMAC, NULL); AMBA_DEVICE(sctl, "dev:e0", SCTL, NULL); -AMBA_DEVICE(wdog, "dev:e1", WATCHDOG, NULL); -AMBA_DEVICE(gpio0, "dev:e4", GPIO0, NULL); +AMBA_DEVICE(wdog, "dev:e1", EB_WATCHDOG, NULL); +AMBA_DEVICE(gpio0, "dev:e4", EB_GPIO0, NULL); AMBA_DEVICE(gpio1, "dev:e5", GPIO1, NULL); AMBA_DEVICE(gpio2, "dev:e6", GPIO2, NULL); -AMBA_DEVICE(rtc, "dev:e8", RTC, NULL); +AMBA_DEVICE(rtc, "dev:e8", EB_RTC, NULL); AMBA_DEVICE(sci0, "dev:f0", SCI, NULL); AMBA_DEVICE(uart0, "dev:f1", EB_UART0, NULL); AMBA_DEVICE(uart1, "dev:f2", EB_UART1, NULL); AMBA_DEVICE(uart2, "dev:f3", EB_UART2, NULL); -AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL); +AMBA_DEVICE(ssp0, "dev:f4", EB_SSP, NULL); static struct amba_device *amba_devs[] __initdata = { &dmac_device, @@ -231,8 +231,8 @@ static struct resource realview_eb_flash_resource = { static struct resource realview_eb_eth_resources[] = { [0] = { - .start = REALVIEW_ETH_BASE, - .end = REALVIEW_ETH_BASE + SZ_64K - 1, + .start = REALVIEW_EB_ETH_BASE, + .end = REALVIEW_EB_ETH_BASE + SZ_64K - 1, .flags = IORESOURCE_MEM, }, [1] = { @@ -254,7 +254,7 @@ static struct platform_device realview_eb_eth_device = { */ static int eth_device_register(void) { - void __iomem *eth_addr = ioremap(REALVIEW_ETH_BASE, SZ_4K); + void __iomem *eth_addr = ioremap(REALVIEW_EB_ETH_BASE, SZ_4K); u32 idrev; if (!eth_addr) diff --git a/include/asm-arm/arch-realview/board-eb.h b/include/asm-arm/arch-realview/board-eb.h index 565bb937ac8..206f7a75288 100644 --- a/include/asm-arm/arch-realview/board-eb.h +++ b/include/asm-arm/arch-realview/board-eb.h @@ -30,13 +30,21 @@ #define REALVIEW_EB_UART1_BASE 0x1000A000 /* UART 1 */ #define REALVIEW_EB_UART2_BASE 0x1000B000 /* UART 2 */ #define REALVIEW_EB_UART3_BASE 0x1000C000 /* UART 3 */ +#define REALVIEW_EB_SSP_BASE 0x1000D000 /* Synchronous Serial Port */ +#define REALVIEW_EB_WATCHDOG_BASE 0x10010000 /* watchdog interface */ #define REALVIEW_EB_TIMER0_1_BASE 0x10011000 /* Timer 0 and 1 */ #define REALVIEW_EB_TIMER2_3_BASE 0x10012000 /* Timer 2 and 3 */ +#define REALVIEW_EB_GPIO0_BASE 0x10013000 /* GPIO port 0 */ +#define REALVIEW_EB_RTC_BASE 0x10017000 /* Real Time Clock */ +#define REALVIEW_EB_CLCD_BASE 0x10020000 /* CLCD */ #define REALVIEW_EB_GIC_CPU_BASE 0x10040000 /* Generic interrupt controller CPU interface */ #define REALVIEW_EB_GIC_DIST_BASE 0x10041000 /* Generic interrupt controller distributor */ +#define REALVIEW_EB_SMC_BASE 0x10080000 /* Static memory controller */ #define REALVIEW_EB_FLASH_BASE 0x40000000 #define REALVIEW_EB_FLASH_SIZE SZ_64M +#define REALVIEW_EB_ETH_BASE 0x4E000000 /* Ethernet */ +#define REALVIEW_EB_USB_BASE 0x4F000000 /* USB */ #ifdef CONFIG_REALVIEW_EB_ARM11MP_REVB #define REALVIEW_EB11MP_SCU_BASE 0x10100000 /* SCU registers */ diff --git a/include/asm-arm/arch-realview/platform.h b/include/asm-arm/arch-realview/platform.h index d18fb128ed9..424c0aaf46a 100644 --- a/include/asm-arm/arch-realview/platform.h +++ b/include/asm-arm/arch-realview/platform.h @@ -172,34 +172,20 @@ #define REALVIEW_INTREG_CARDINSERT 0x03 /* Signal insertion of MMC card */ /* - * REALVIEW peripheral addresses + * RealView common peripheral addresses */ #define REALVIEW_SCTL_BASE 0x10001000 /* System controller */ #define REALVIEW_I2C_BASE 0x10002000 /* I2C control */ - /* Reserved 0x10003000 */ #define REALVIEW_AACI_BASE 0x10004000 /* Audio */ #define REALVIEW_MMCI0_BASE 0x10005000 /* MMC interface */ #define REALVIEW_KMI0_BASE 0x10006000 /* KMI interface */ #define REALVIEW_KMI1_BASE 0x10007000 /* KMI 2nd interface */ #define REALVIEW_CHAR_LCD_BASE 0x10008000 /* Character LCD */ -#define REALVIEW_SSP_BASE 0x1000D000 /* Synchronous Serial Port */ #define REALVIEW_SCI_BASE 0x1000E000 /* Smart card controller */ - /* Reserved 0x1000F000 */ -#define REALVIEW_WATCHDOG_BASE 0x10010000 /* watchdog interface */ -#define REALVIEW_GPIO0_BASE 0x10013000 /* GPIO port 0 */ #define REALVIEW_GPIO1_BASE 0x10014000 /* GPIO port 1 */ #define REALVIEW_GPIO2_BASE 0x10015000 /* GPIO port 2 */ - /* Reserved 0x10016000 */ -#define REALVIEW_RTC_BASE 0x10017000 /* Real Time Clock */ #define REALVIEW_DMC_BASE 0x10018000 /* DMC configuration */ -#define REALVIEW_PCI_CORE_BASE 0x10019000 /* PCI configuration */ - /* Reserved 0x1001A000 - 0x1001FFFF */ -#define REALVIEW_CLCD_BASE 0x10020000 /* CLCD */ #define REALVIEW_DMAC_BASE 0x10030000 /* DMA controller */ -#define REALVIEW_SMC_BASE 0x10080000 /* SMC */ - /* Reserved 0x10090000 - 0x100EFFFF */ - -#define REALVIEW_ETH_BASE 0x4E000000 /* Ethernet */ /* PCI space */ #define REALVIEW_PCI_BASE 0x41000000 /* PCI Interface */ -- cgit v1.2.3