blob: d3017e53686bdbba56c7aac3d7000d5d119fc946 [file] [log] [blame]
Mike Frysinger0a290592007-05-21 18:09:21 +08001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Copyright 2004-2007 Analog Devices Inc.
3 * 2005 National ICT Australia (NICTA)
4 * Aidan Williams <aidan@nicta.com.au>
Mike Frysinger0a290592007-05-21 18:09:21 +08005 *
Robin Getz96f10502009-09-24 14:11:24 +00006 * Thanks to Jamey Hicks.
Mike Frysinger0a290592007-05-21 18:09:21 +08007 *
Robin Getz96f10502009-09-24 14:11:24 +00008 * Only SMSC91C1111 was registered, may do more later.
Mike Frysinger0a290592007-05-21 18:09:21 +08009 *
Robin Getz96f10502009-09-24 14:11:24 +000010 * Licensed under the GPL-2
Mike Frysinger0a290592007-05-21 18:09:21 +080011 */
12
13#include <linux/device.h>
14#include <linux/platform_device.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080015#include <linux/irq.h>
Mike Frysinger0a290592007-05-21 18:09:21 +080016
Mike Frysinger066954a2007-10-21 22:36:06 +080017const char bfin_board_name[] = "Tepla-BF561";
Mike Frysinger0a290592007-05-21 18:09:21 +080018
19/*
20 * Driver needs to know address, irq and flag pin.
21 */
22static struct resource smc91x_resources[] = {
23 {
24 .start = 0x2C000300,
25 .end = 0x2C000320,
26 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080027 }, {
Mike Frysinger0a290592007-05-21 18:09:21 +080028 .start = IRQ_PROG_INTB,
29 .end = IRQ_PROG_INTB,
30 .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080031 }, {
Mike Frysinger0a290592007-05-21 18:09:21 +080032 .start = IRQ_PF7,
33 .end = IRQ_PF7,
34 .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL,
35 },
36};
37
38static struct platform_device smc91x_device = {
39 .name = "smc91x",
40 .id = 0,
41 .num_resources = ARRAY_SIZE(smc91x_resources),
42 .resource = smc91x_resources,
43};
44
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +000045#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
46#ifdef CONFIG_SERIAL_BFIN_UART0
47static struct resource bfin_uart0_resources[] = {
48 {
49 .start = BFIN_UART_THR,
50 .end = BFIN_UART_GCTL+2,
51 .flags = IORESOURCE_MEM,
52 },
53 {
54 .start = IRQ_UART_RX,
55 .end = IRQ_UART_RX+1,
56 .flags = IORESOURCE_IRQ,
57 },
58 {
59 .start = IRQ_UART_ERROR,
60 .end = IRQ_UART_ERROR,
61 .flags = IORESOURCE_IRQ,
62 },
63 {
64 .start = CH_UART_TX,
65 .end = CH_UART_TX,
66 .flags = IORESOURCE_DMA,
67 },
68 {
69 .start = CH_UART_RX,
70 .end = CH_UART_RX,
71 .flags = IORESOURCE_DMA,
72 },
73};
74
75unsigned short bfin_uart0_peripherals[] = {
76 P_UART0_TX, P_UART0_RX, 0
77};
78
79static struct platform_device bfin_uart0_device = {
80 .name = "bfin-uart",
81 .id = 0,
82 .num_resources = ARRAY_SIZE(bfin_uart0_resources),
83 .resource = bfin_uart0_resources,
84 .dev = {
85 .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
86 },
87};
88#endif
89#endif
90
Graf Yang42bd8bc2009-01-07 23:14:39 +080091#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
92#ifdef CONFIG_BFIN_SIR0
93static struct resource bfin_sir0_resources[] = {
94 {
95 .start = 0xFFC00400,
96 .end = 0xFFC004FF,
97 .flags = IORESOURCE_MEM,
98 },
99 {
100 .start = IRQ_UART0_RX,
101 .end = IRQ_UART0_RX+1,
102 .flags = IORESOURCE_IRQ,
103 },
104 {
105 .start = CH_UART0_RX,
106 .end = CH_UART0_RX+1,
107 .flags = IORESOURCE_DMA,
108 },
109};
110
111static struct platform_device bfin_sir0_device = {
112 .name = "bfin_sir",
113 .id = 0,
114 .num_resources = ARRAY_SIZE(bfin_sir0_resources),
115 .resource = bfin_sir0_resources,
116};
117#endif
118#endif
119
Mike Frysinger0a290592007-05-21 18:09:21 +0800120static struct platform_device *tepla_devices[] __initdata = {
121 &smc91x_device,
Sonic Zhang6bd1fbe2009-09-09 10:46:19 +0000122
123#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
124#ifdef CONFIG_SERIAL_BFIN_UART0
125 &bfin_uart0_device,
126#endif
127#endif
128
Graf Yang42bd8bc2009-01-07 23:14:39 +0800129#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
130#ifdef CONFIG_BFIN_SIR0
131 &bfin_sir0_device,
132#endif
133#endif
Mike Frysinger0a290592007-05-21 18:09:21 +0800134};
135
136static int __init tepla_init(void)
137{
Harvey Harrisonb85d8582008-04-23 09:39:01 +0800138 printk(KERN_INFO "%s(): registering device resources\n", __func__);
Mike Frysinger0a290592007-05-21 18:09:21 +0800139 return platform_add_devices(tepla_devices, ARRAY_SIZE(tepla_devices));
140}
141
142arch_initcall(tepla_init);
Sonic Zhangc13ce9f2009-09-23 09:37:46 +0000143
144static struct platform_device *tepla_early_devices[] __initdata = {
145#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
146#ifdef CONFIG_SERIAL_BFIN_UART0
147 &bfin_uart0_device,
148#endif
149#endif
150};
151
152void __init native_machine_early_platform_add_devices(void)
153{
154 printk(KERN_INFO "register early platform devices\n");
155 early_platform_add_devices(tepla_early_devices,
156 ARRAY_SIZE(tepla_early_devices));
157}