mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
rk30: add devices.c
This commit is contained in:
@@ -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
|
||||
|
||||
134
arch/arm/mach-rk30/devices.c
Normal file
134
arch/arm/mach-rk30/devices.c
Normal file
@@ -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 <linux/fs.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <asm/pmu.h>
|
||||
#include <mach/irqs.h>
|
||||
#include <mach/board.h>
|
||||
|
||||
#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);
|
||||
Reference in New Issue
Block a user