From 8daba86d8095803de5d7e94893522ad9e7833788 Mon Sep 17 00:00:00 2001 From: lhh Date: Wed, 20 Oct 2010 20:09:28 +0800 Subject: [PATCH] add rk29 io.c and board.h --- arch/arm/mach-rk29/Makefile | 2 +- arch/arm/mach-rk29/board-rk29sdk.c | 40 ++---------------- arch/arm/mach-rk29/include/mach/board.h | 22 ++++++++++ arch/arm/mach-rk29/include/mach/rk29_iomap.h | 3 +- arch/arm/mach-rk29/io.c | 44 ++++++++++++++++++++ 5 files changed, 72 insertions(+), 39 deletions(-) create mode 100644 arch/arm/mach-rk29/include/mach/board.h create mode 100644 arch/arm/mach-rk29/io.c diff --git a/arch/arm/mach-rk29/Makefile b/arch/arm/mach-rk29/Makefile index 7e5236b09498..ad969989dba7 100644 --- a/arch/arm/mach-rk29/Makefile +++ b/arch/arm/mach-rk29/Makefile @@ -1,2 +1,2 @@ -obj-y += timer.o +obj-y += timer.o io.o obj-$(CONFIG_MACH_RK29SDK) += board-rk29sdk.o diff --git a/arch/arm/mach-rk29/board-rk29sdk.c b/arch/arm/mach-rk29/board-rk29sdk.c index 6ee0dd5fd9ed..62b627302b2a 100644 --- a/arch/arm/mach-rk29/board-rk29sdk.c +++ b/arch/arm/mach-rk29/board-rk29sdk.c @@ -1,4 +1,4 @@ -/* linux/arch/arm/mach-rk29/board-rk29.c +/* arch/arm/mach-rk29/board-rk29.c * * Copyright (C) 2010 ROCKCHIP, Inc. * @@ -32,7 +32,7 @@ #include #include - +#include #include @@ -40,40 +40,6 @@ extern struct sys_timer rk29_timer; - -//IOÓ³É䷽ʽÃèÊö £¬Ã¿¸öΪһ¶ÎÏßÐÔÁ¬ÐøÓ³Éä -static struct map_desc rk29_io_desc[] __initdata = { - - { - .virtual = RK29_GICCPU_BASE, - .pfn = __phys_to_pfn(RK29_GICCPU_PHYS), - .length = RK29_GICCPU_SIZE, - .type = MT_DEVICE - }, - - { - .virtual = RK29_GICPERI_BASE, - .pfn = __phys_to_pfn(RK29_GICPERI_PHYS), - .length = RK29_GICPERI_SIZE, - .type = MT_DEVICE - }, - - { - .virtual = RK29_NANDC_BASE, - .pfn = __phys_to_pfn(RK29_NANDC_PHYS), - .length = RK29_NANDC_SIZE, - .type = MT_DEVICE - }, - - { - .virtual = RK29_DDRC_BASE, - .pfn = __phys_to_pfn(RK29_DDRC_PHYS), - .length = RK29_DDRC_SIZE, - .type = MT_DEVICE - }, - -}; - static void __init rk29_gic_init_irq(void) { gic_dist_init(0, RK29_GICPERI_BASE, 32); @@ -93,7 +59,7 @@ static void __init machine_rk29_board_init(void) static void __init machine_rk29_mapio(void) { - iotable_init(rk29_io_desc, ARRAY_SIZE(rk29_io_desc)); + rk29_map_common_io(); //rk29_clock_init(); //rk29_iomux_init(); } diff --git a/arch/arm/mach-rk29/include/mach/board.h b/arch/arm/mach-rk29/include/mach/board.h new file mode 100644 index 000000000000..0126051ef85e --- /dev/null +++ b/arch/arm/mach-rk29/include/mach/board.h @@ -0,0 +1,22 @@ +/* arch/arm/mach-rk29/include/mach/board.h + * + * Copyright (C) 2010 ROCKCHIP, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#ifndef __ASM_ARCH_RK29_BOARD_H +#define __ASM_ARCH_RK29_BOARD_H + +#include + +void __init rk29_map_common_io(void); + +#endif \ No newline at end of file diff --git a/arch/arm/mach-rk29/include/mach/rk29_iomap.h b/arch/arm/mach-rk29/include/mach/rk29_iomap.h index 274e5efa2223..a8d39b827d4d 100644 --- a/arch/arm/mach-rk29/include/mach/rk29_iomap.h +++ b/arch/arm/mach-rk29/include/mach/rk29_iomap.h @@ -126,8 +126,9 @@ #define RK29_TIMER0_BASE (RK29_ADDR_BASE1+0x38000) #define RK29_TIMER0_PHYS 0x20038000 #define RK29_TIMER0_SIZE SZ_8K +#define RK29_TIMER1_BASE (RK29_ADDR_BASE1+0x3A000) #define RK29_TIMER1_PHYS 0x2003A000 -#define RK29_TIMER0_SIZE SZ_8K +#define RK29_TIMER1_SIZE SZ_8K #define RK29_GPIO4_PHYS 0x2003C000 #define RK29_GPIO4_SIZE SZ_8K #define RK29_GPIO6_PHYS 0x2003E000 diff --git a/arch/arm/mach-rk29/io.c b/arch/arm/mach-rk29/io.c new file mode 100644 index 000000000000..8fd8840c44b5 --- /dev/null +++ b/arch/arm/mach-rk29/io.c @@ -0,0 +1,44 @@ +/* arch/arm/mach-rk29/io.c + * + * Copyright (C) 2010 ROCKCHIP, 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. + * + */ + +#include +#include +#include + +#include +#include +#include +#include + +#define RK29_DEVICE(name) { \ + .virtual = (unsigned long) RK29_##name##_BASE, \ + .pfn = __phys_to_pfn(RK29_##name##_PHYS), \ + .length = RK29_##name##_SIZE, \ + .type = MT_DEVICE_NONSHARED, \ + } + +static struct map_desc rk29_io_desc[] __initdata = { + RK29_DEVICE(GICCPU), + RK29_DEVICE(GICPERI), + RK29_DEVICE(TIMER0), + RK29_DEVICE(TIMER1), + RK29_DEVICE(DDRC), + RK29_DEVICE(UART1), +}; + +void __init rk29_map_common_io(void) +{ + iotable_init(rk29_io_desc, ARRAY_SIZE(rk29_io_desc)); +} \ No newline at end of file -- 2.34.1