blob: 57e14edca8b1bb75f38c486e19ebeebb9b104344 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
2 * File: arch/blackfin/mach-bf561/ezkit.c
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/device.h>
31#include <linux/platform_device.h>
32#include <linux/spi/spi.h>
Michael Hennerich140a9ae2007-05-21 18:09:13 +080033#include <linux/irq.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080034#include <linux/interrupt.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080035#include <linux/pata_platform.h>
36#include <asm/dma.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080037#include <asm/bfin5xx_spi.h>
Bryan Wu1394f032007-05-06 14:50:22 -070038
39/*
40 * Name the Board for the /proc/cpuinfo
41 */
42char *bfin_board_name = "ADDS-BF561-EZKIT";
43
Michael Hennerich140a9ae2007-05-21 18:09:13 +080044#define ISP1761_BASE 0x2C0F0000
45#define ISP1761_IRQ IRQ_PF10
46
47#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
48static struct resource bfin_isp1761_resources[] = {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080049 {
Michael Hennerich140a9ae2007-05-21 18:09:13 +080050 .name = "isp1761-regs",
51 .start = ISP1761_BASE + 0x00000000,
52 .end = ISP1761_BASE + 0x000fffff,
53 .flags = IORESOURCE_MEM,
54 },
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080055 {
Michael Hennerich140a9ae2007-05-21 18:09:13 +080056 .start = ISP1761_IRQ,
57 .end = ISP1761_IRQ,
58 .flags = IORESOURCE_IRQ,
59 },
60};
61
62static struct platform_device bfin_isp1761_device = {
63 .name = "isp1761",
64 .id = 0,
65 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
66 .resource = bfin_isp1761_resources,
67};
68
69static struct platform_device *bfin_isp1761_devices[] = {
70 &bfin_isp1761_device,
71};
72
73int __init bfin_isp1761_init(void)
74{
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080075 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
Michael Hennerich140a9ae2007-05-21 18:09:13 +080076
77 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
78 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
79
80 return platform_add_devices(bfin_isp1761_devices, num_devices);
81}
82
83void __exit bfin_isp1761_exit(void)
84{
85 platform_device_unregister(&bfin_isp1761_device);
86}
87
88arch_initcall(bfin_isp1761_init);
89#endif
90
Bryan Wu1394f032007-05-06 14:50:22 -070091/*
92 * USB-LAN EzExtender board
93 * Driver needs to know address, irq and flag pin.
94 */
95#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
96static struct resource smc91x_resources[] = {
97 {
98 .name = "smc91x-regs",
99 .start = 0x2C010300,
100 .end = 0x2C010300 + 16,
101 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800102 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700103
104 .start = IRQ_PF9,
105 .end = IRQ_PF9,
106 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
107 },
108};
109
110static struct platform_device smc91x_device = {
111 .name = "smc91x",
112 .id = 0,
113 .num_resources = ARRAY_SIZE(smc91x_resources),
114 .resource = smc91x_resources,
115};
116#endif
117
118#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
119static struct resource bfin_uart_resources[] = {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800120 {
121 .start = 0xFFC00400,
122 .end = 0xFFC004FF,
123 .flags = IORESOURCE_MEM,
124 },
Bryan Wu1394f032007-05-06 14:50:22 -0700125};
126
127static struct platform_device bfin_uart_device = {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800128 .name = "bfin-uart",
129 .id = 1,
130 .num_resources = ARRAY_SIZE(bfin_uart_resources),
131 .resource = bfin_uart_resources,
Bryan Wu1394f032007-05-06 14:50:22 -0700132};
133#endif
134
135#ifdef CONFIG_SPI_BFIN
136#if defined(CONFIG_SND_BLACKFIN_AD1836) \
137 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
138static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
139 .enable_dma = 0,
140 .bits_per_word = 16,
141};
142#endif
143#endif
144
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800145/* SPI (0) */
146static struct resource bfin_spi0_resource[] = {
147 [0] = {
148 .start = SPI0_REGBASE,
149 .end = SPI0_REGBASE + 0xFF,
150 .flags = IORESOURCE_MEM,
151 },
152 [1] = {
153 .start = CH_SPI,
154 .end = CH_SPI,
155 .flags = IORESOURCE_IRQ,
156 }
157};
158
Bryan Wu1394f032007-05-06 14:50:22 -0700159/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800160static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700161 .num_chipselect = 8,
162 .enable_dma = 1, /* master has the ability to do dma transfer */
163};
164
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800165static struct platform_device bfin_spi0_device = {
166 .name = "bfin-spi",
167 .id = 0, /* Bus number */
168 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
169 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700170 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800171 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700172 },
173};
174
175static struct spi_board_info bfin_spi_board_info[] __initdata = {
176#if defined(CONFIG_SND_BLACKFIN_AD1836) \
177 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
178 {
179 .modalias = "ad1836-spi",
180 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800181 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700182 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
183 .controller_data = &ad1836_spi_chip_info,
184 },
185#endif
186};
187
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800188#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
189#define PATA_INT 55
190
191static struct pata_platform_info bfin_pata_platform_data = {
192 .ioport_shift = 1,
193 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
194};
195
196static struct resource bfin_pata_resources[] = {
197 {
198 .start = 0x20314020,
199 .end = 0x2031403F,
200 .flags = IORESOURCE_MEM,
201 },
202 {
203 .start = 0x2031401C,
204 .end = 0x2031401F,
205 .flags = IORESOURCE_MEM,
206 },
207 {
208 .start = PATA_INT,
209 .end = PATA_INT,
210 .flags = IORESOURCE_IRQ,
211 },
212};
213
214static struct platform_device bfin_pata_device = {
215 .name = "pata_platform",
216 .id = -1,
217 .num_resources = ARRAY_SIZE(bfin_pata_resources),
218 .resource = bfin_pata_resources,
219 .dev = {
220 .platform_data = &bfin_pata_platform_data,
221 }
222};
223#endif
224
Bryan Wu1394f032007-05-06 14:50:22 -0700225static struct platform_device *ezkit_devices[] __initdata = {
226#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
227 &smc91x_device,
228#endif
229#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800230 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700231#endif
232#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800233 &bfin_uart_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700234#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800235#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
236 &bfin_pata_device,
237#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700238};
239
240static int __init ezkit_init(void)
241{
242 int ret;
243
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800244 printk(KERN_INFO "%s(): registering device resources\n", __func__);
245
246 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wu1394f032007-05-06 14:50:22 -0700247 if (ret < 0)
248 return ret;
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800249
250#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
251 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
252 SSYNC();
253#endif
254
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800255#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
256 spi_register_board_info(bfin_spi_board_info,
257 ARRAY_SIZE(bfin_spi_board_info));
258#endif
259
260#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
261 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
262#endif
263 return 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700264}
265
266arch_initcall(ezkit_init);