blob: 6434ca216dd26566a00f22fdb24ea147763ffdf2 [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 Wu5d448dd2007-11-12 23:24:42 +080038#include <asm/portmux.h>
Bryan Wu1394f032007-05-06 14:50:22 -070039
40/*
41 * Name the Board for the /proc/cpuinfo
42 */
Mike Frysinger066954a2007-10-21 22:36:06 +080043const char bfin_board_name[] = "ADDS-BF561-EZKIT";
Bryan Wu1394f032007-05-06 14:50:22 -070044
Michael Hennerich140a9ae2007-05-21 18:09:13 +080045#define ISP1761_BASE 0x2C0F0000
46#define ISP1761_IRQ IRQ_PF10
47
48#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
49static struct resource bfin_isp1761_resources[] = {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080050 {
Michael Hennerich140a9ae2007-05-21 18:09:13 +080051 .name = "isp1761-regs",
52 .start = ISP1761_BASE + 0x00000000,
53 .end = ISP1761_BASE + 0x000fffff,
54 .flags = IORESOURCE_MEM,
55 },
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080056 {
Michael Hennerich140a9ae2007-05-21 18:09:13 +080057 .start = ISP1761_IRQ,
58 .end = ISP1761_IRQ,
59 .flags = IORESOURCE_IRQ,
60 },
61};
62
63static struct platform_device bfin_isp1761_device = {
64 .name = "isp1761",
65 .id = 0,
66 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
67 .resource = bfin_isp1761_resources,
68};
69
70static struct platform_device *bfin_isp1761_devices[] = {
71 &bfin_isp1761_device,
72};
73
74int __init bfin_isp1761_init(void)
75{
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080076 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
Michael Hennerich140a9ae2007-05-21 18:09:13 +080077
78 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
79 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
80
81 return platform_add_devices(bfin_isp1761_devices, num_devices);
82}
83
84void __exit bfin_isp1761_exit(void)
85{
86 platform_device_unregister(&bfin_isp1761_device);
87}
88
89arch_initcall(bfin_isp1761_init);
90#endif
91
Bryan Wu1394f032007-05-06 14:50:22 -070092/*
93 * USB-LAN EzExtender board
94 * Driver needs to know address, irq and flag pin.
95 */
96#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
97static struct resource smc91x_resources[] = {
98 {
99 .name = "smc91x-regs",
100 .start = 0x2C010300,
101 .end = 0x2C010300 + 16,
102 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800103 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700104
105 .start = IRQ_PF9,
106 .end = IRQ_PF9,
107 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
108 },
109};
110
111static struct platform_device smc91x_device = {
112 .name = "smc91x",
113 .id = 0,
114 .num_resources = ARRAY_SIZE(smc91x_resources),
115 .resource = smc91x_resources,
116};
117#endif
118
119#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
120static struct resource bfin_uart_resources[] = {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800121 {
122 .start = 0xFFC00400,
123 .end = 0xFFC004FF,
124 .flags = IORESOURCE_MEM,
125 },
Bryan Wu1394f032007-05-06 14:50:22 -0700126};
127
128static struct platform_device bfin_uart_device = {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800129 .name = "bfin-uart",
130 .id = 1,
131 .num_resources = ARRAY_SIZE(bfin_uart_resources),
132 .resource = bfin_uart_resources,
Bryan Wu1394f032007-05-06 14:50:22 -0700133};
134#endif
135
136#ifdef CONFIG_SPI_BFIN
137#if defined(CONFIG_SND_BLACKFIN_AD1836) \
138 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
139static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
140 .enable_dma = 0,
141 .bits_per_word = 16,
142};
143#endif
144#endif
145
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800146/* SPI (0) */
147static struct resource bfin_spi0_resource[] = {
148 [0] = {
149 .start = SPI0_REGBASE,
150 .end = SPI0_REGBASE + 0xFF,
151 .flags = IORESOURCE_MEM,
152 },
153 [1] = {
154 .start = CH_SPI,
155 .end = CH_SPI,
156 .flags = IORESOURCE_IRQ,
157 }
158};
159
Bryan Wu1394f032007-05-06 14:50:22 -0700160/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800161static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700162 .num_chipselect = 8,
163 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800164 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700165};
166
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800167static struct platform_device bfin_spi0_device = {
168 .name = "bfin-spi",
169 .id = 0, /* Bus number */
170 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
171 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700172 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800173 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700174 },
175};
176
177static struct spi_board_info bfin_spi_board_info[] __initdata = {
178#if defined(CONFIG_SND_BLACKFIN_AD1836) \
179 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
180 {
181 .modalias = "ad1836-spi",
182 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800183 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700184 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
185 .controller_data = &ad1836_spi_chip_info,
186 },
187#endif
188};
189
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800190#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
191#define PATA_INT 55
192
193static struct pata_platform_info bfin_pata_platform_data = {
194 .ioport_shift = 1,
195 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
196};
197
198static struct resource bfin_pata_resources[] = {
199 {
200 .start = 0x20314020,
201 .end = 0x2031403F,
202 .flags = IORESOURCE_MEM,
203 },
204 {
205 .start = 0x2031401C,
206 .end = 0x2031401F,
207 .flags = IORESOURCE_MEM,
208 },
209 {
210 .start = PATA_INT,
211 .end = PATA_INT,
212 .flags = IORESOURCE_IRQ,
213 },
214};
215
216static struct platform_device bfin_pata_device = {
217 .name = "pata_platform",
218 .id = -1,
219 .num_resources = ARRAY_SIZE(bfin_pata_resources),
220 .resource = bfin_pata_resources,
221 .dev = {
222 .platform_data = &bfin_pata_platform_data,
223 }
224};
225#endif
226
Bryan Wu1394f032007-05-06 14:50:22 -0700227static struct platform_device *ezkit_devices[] __initdata = {
228#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
229 &smc91x_device,
230#endif
231#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800232 &bfin_spi0_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700233#endif
234#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800235 &bfin_uart_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700236#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800237#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
238 &bfin_pata_device,
239#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700240};
241
242static int __init ezkit_init(void)
243{
244 int ret;
245
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800246 printk(KERN_INFO "%s(): registering device resources\n", __func__);
247
248 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wu1394f032007-05-06 14:50:22 -0700249 if (ret < 0)
250 return ret;
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800251
252#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
253 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
254 SSYNC();
255#endif
256
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800257#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
258 spi_register_board_info(bfin_spi_board_info,
259 ARRAY_SIZE(bfin_spi_board_info));
260#endif
261
262#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
263 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
264#endif
265 return 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700266}
267
268arch_initcall(ezkit_init);