0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/init.h>
0010 #include <linux/kernel.h>
0011 #include <linux/platform_device.h>
0012 #include <bcm63xx_cpu.h>
0013
0014 static struct resource uart0_resources[] = {
0015 {
0016
0017 .flags = IORESOURCE_MEM,
0018 },
0019 {
0020
0021 .flags = IORESOURCE_IRQ,
0022 },
0023 };
0024
0025 static struct resource uart1_resources[] = {
0026 {
0027
0028 .flags = IORESOURCE_MEM,
0029 },
0030 {
0031
0032 .flags = IORESOURCE_IRQ,
0033 },
0034 };
0035
0036 static struct platform_device bcm63xx_uart_devices[] = {
0037 {
0038 .name = "bcm63xx_uart",
0039 .id = 0,
0040 .num_resources = ARRAY_SIZE(uart0_resources),
0041 .resource = uart0_resources,
0042 },
0043
0044 {
0045 .name = "bcm63xx_uart",
0046 .id = 1,
0047 .num_resources = ARRAY_SIZE(uart1_resources),
0048 .resource = uart1_resources,
0049 }
0050 };
0051
0052 int __init bcm63xx_uart_register(unsigned int id)
0053 {
0054 if (id >= ARRAY_SIZE(bcm63xx_uart_devices))
0055 return -ENODEV;
0056
0057 if (id == 1 && (!BCMCPU_IS_3368() && !BCMCPU_IS_6358() &&
0058 !BCMCPU_IS_6368()))
0059 return -ENODEV;
0060
0061 if (id == 0) {
0062 uart0_resources[0].start = bcm63xx_regset_address(RSET_UART0);
0063 uart0_resources[0].end = uart0_resources[0].start +
0064 RSET_UART_SIZE - 1;
0065 uart0_resources[1].start = bcm63xx_get_irq_number(IRQ_UART0);
0066 }
0067
0068 if (id == 1) {
0069 uart1_resources[0].start = bcm63xx_regset_address(RSET_UART1);
0070 uart1_resources[0].end = uart1_resources[0].start +
0071 RSET_UART_SIZE - 1;
0072 uart1_resources[1].start = bcm63xx_get_irq_number(IRQ_UART1);
0073 }
0074
0075 return platform_device_register(&bcm63xx_uart_devices[id]);
0076 }