From: 黄涛 Date: Tue, 7 Feb 2012 07:40:21 +0000 (+0800) Subject: rk30: add devices.c X-Git-Tag: firefly_0821_release~9595^2~176 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0b1610f141a3a4e6970c848598610727f65fa7d8;p=firefly-linux-kernel-4.4.55.git rk30: add devices.c --- diff --git a/arch/arm/mach-rk30/Makefile b/arch/arm/mach-rk30/Makefile index 80be9db8efb9..e58b689aebf4 100644 --- a/arch/arm/mach-rk30/Makefile +++ b/arch/arm/mach-rk30/Makefile @@ -1,8 +1,9 @@ obj-y += clock.o obj-y += common.o +obj-y += devices.o obj-y += io.o +obj-y += iomux.o obj-y += reset.o obj-y += timer.o -obj-y += iomux.o obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o obj-$(CONFIG_MACH_RK30_SDK) += board-rk30-sdk.o diff --git a/arch/arm/mach-rk30/devices.c b/arch/arm/mach-rk30/devices.c new file mode 100644 index 000000000000..69e7b09315d6 --- /dev/null +++ b/arch/arm/mach-rk30/devices.c @@ -0,0 +1,134 @@ +/* arch/arm/mach-rk30/devices.c + * + * Copyright (C) 2012 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 +#include + +#ifdef CONFIG_UART0_RK29 +static struct resource resources_uart0[] = { + { + .start = IRQ_UART0, + .end = IRQ_UART0, + .flags = IORESOURCE_IRQ, + }, + { + .start = RK30_UART0_PHYS, + .end = RK30_UART0_PHYS + RK30_UART0_SIZE - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device device_uart0 = { + .name = "rk_serial", + .id = 0, + .num_resources = ARRAY_SIZE(resources_uart0), + .resource = resources_uart0, +}; +#endif + +#ifdef CONFIG_UART1_RK29 +static struct resource resources_uart1[] = { + { + .start = IRQ_UART1, + .end = IRQ_UART1, + .flags = IORESOURCE_IRQ, + }, + { + .start = RK30_UART1_PHYS, + .end = RK30_UART1_PHYS + RK30_UART1_SIZE - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device device_uart1 = { + .name = "rk_serial", + .id = 1, + .num_resources = ARRAY_SIZE(resources_uart1), + .resource = resources_uart1, +}; +#endif + +#ifdef CONFIG_UART2_RK29 +static struct resource resources_uart2[] = { + { + .start = IRQ_UART2, + .end = IRQ_UART2, + .flags = IORESOURCE_IRQ, + }, + { + .start = RK30_UART2_PHYS, + .end = RK30_UART2_PHYS + RK30_UART2_SIZE - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device device_uart2 = { + .name = "rk_serial", + .id = 2, + .num_resources = ARRAY_SIZE(resources_uart2), + .resource = resources_uart2, +}; +#endif + +#ifdef CONFIG_UART3_RK29 +static struct resource resources_uart3[] = { + { + .start = IRQ_UART3, + .end = IRQ_UART3, + .flags = IORESOURCE_IRQ, + }, + { + .start = RK30_UART3_PHYS, + .end = RK30_UART3_PHYS + RK30_UART3_SIZE - 1, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device device_uart3 = { + .name = "rk_serial", + .id = 3, + .num_resources = ARRAY_SIZE(resources_uart3), + .resource = resources_uart3, +}; +#endif + +static void __init rk30_init_uart(void) +{ +#ifdef CONFIG_UART0_RK29 + platform_device_register(&device_uart0); +#endif +#ifdef CONFIG_UART1_RK29 + platform_device_register(&device_uart1); +#endif +#ifdef CONFIG_UART2_RK29 + platform_device_register(&device_uart2); +#endif +#ifdef CONFIG_UART3_RK29 + platform_device_register(&device_uart3); +#endif +} + +static int __init rk30_init_devices(void) +{ + rk30_init_uart(); + return 0; +} +arch_initcall(rk30_init_devices);