blob: 34b63920e272ef0321ad5bee525ec80e22f4d567 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
2 * File: arch/blackfin/mach-bf533/ezkit.c
Simon Arlottd2d50aa2007-06-11 15:31:30 +08003 * Based on: Original Work
Bryan Wu1394f032007-05-06 14:50:22 -07004 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created: 2005
7 * Description:
8 *
9 * Modified: Robin Getz <rgetz@blackfin.uclinux.org> - Named the boards
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/device.h>
32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h>
35#include <linux/spi/spi.h>
36#include <linux/spi/flash.h>
37#include <linux/usb_isp1362.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080038#include <linux/pata_platform.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080039#include <linux/irq.h>
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080040#include <asm/dma.h>
Bryan Wu1394f032007-05-06 14:50:22 -070041#include <asm/bfin5xx_spi.h>
42
43/*
44 * Name the Board for the /proc/cpuinfo
45 */
Mike Frysinger066954a2007-10-21 22:36:06 +080046const char bfin_board_name[] = "ADDS-BF533-EZKIT";
Bryan Wu1394f032007-05-06 14:50:22 -070047
48#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
49static struct platform_device rtc_device = {
50 .name = "rtc-bfin",
51 .id = -1,
52};
53#endif
54
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080055#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
56static struct platform_device bfin_fb_adv7393_device = {
57 .name = "bfin-adv7393",
58};
59#endif
60
Bryan Wu1394f032007-05-06 14:50:22 -070061/*
62 * USB-LAN EzExtender board
63 * Driver needs to know address, irq and flag pin.
64 */
65#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
66static struct resource smc91x_resources[] = {
67 {
68 .name = "smc91x-regs",
69 .start = 0x20310300,
70 .end = 0x20310300 + 16,
71 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080072 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070073 .start = IRQ_PF9,
74 .end = IRQ_PF9,
75 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
76 },
77};
78static struct platform_device smc91x_device = {
79 .name = "smc91x",
80 .id = 0,
81 .num_resources = ARRAY_SIZE(smc91x_resources),
82 .resource = smc91x_resources,
83};
84#endif
85
86#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
87/* all SPI peripherals info goes here */
88
89#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
90static struct mtd_partition bfin_spi_flash_partitions[] = {
91 {
92 .name = "bootloader",
93 .size = 0x00020000,
94 .offset = 0,
95 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080096 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070097 .name = "kernel",
98 .size = 0xe0000,
99 .offset = 0x20000
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800100 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700101 .name = "file system",
102 .size = 0x700000,
103 .offset = 0x00100000,
104 }
105};
106
107static struct flash_platform_data bfin_spi_flash_data = {
108 .name = "m25p80",
109 .parts = bfin_spi_flash_partitions,
110 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
111 .type = "m25p64",
112};
113
114/* SPI flash chip (m25p64) */
115static struct bfin5xx_spi_chip spi_flash_chip_info = {
116 .enable_dma = 0, /* use dma transfer with this chip*/
117 .bits_per_word = 8,
118};
119#endif
120
121#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
122/* SPI ADC chip */
123static struct bfin5xx_spi_chip spi_adc_chip_info = {
124 .enable_dma = 1, /* use dma transfer with this chip*/
125 .bits_per_word = 16,
126};
127#endif
128
129#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
130static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
131 .enable_dma = 0,
132 .bits_per_word = 16,
133};
134#endif
135
136static struct spi_board_info bfin_spi_board_info[] __initdata = {
137#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
138 {
139 /* the modalias must be the same as spi device driver name */
140 .modalias = "m25p80", /* Name of spi_driver for this device */
141 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800142 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700143 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
144 .platform_data = &bfin_spi_flash_data,
145 .controller_data = &spi_flash_chip_info,
146 .mode = SPI_MODE_3,
147 },
148#endif
149
150#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
151 {
152 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
153 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800154 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700155 .chip_select = 1, /* Framework chip select. */
156 .platform_data = NULL, /* No spi_driver specific config */
157 .controller_data = &spi_adc_chip_info,
158 },
159#endif
160
161#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
162 {
163 .modalias = "ad1836-spi",
164 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800165 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700166 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
167 .controller_data = &ad1836_spi_chip_info,
168 },
169#endif
170};
171
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800172/* SPI (0) */
173static struct resource bfin_spi0_resource[] = {
174 [0] = {
175 .start = SPI0_REGBASE,
176 .end = SPI0_REGBASE + 0xFF,
177 .flags = IORESOURCE_MEM,
178 },
179 [1] = {
180 .start = CH_SPI,
181 .end = CH_SPI,
182 .flags = IORESOURCE_IRQ,
183 }
184};
185
Bryan Wu1394f032007-05-06 14:50:22 -0700186/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800187static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700188 .num_chipselect = 8,
189 .enable_dma = 1, /* master has the ability to do dma transfer */
190};
191
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800192static struct platform_device bfin_spi0_device = {
193 .name = "bfin-spi",
194 .id = 0, /* Bus number */
195 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
196 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700197 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800198 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700199 },
200};
201#endif /* spi master and devices */
202
203#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
204static struct resource bfin_uart_resources[] = {
205 {
206 .start = 0xFFC00400,
207 .end = 0xFFC004FF,
208 .flags = IORESOURCE_MEM,
209 },
210};
211
212static struct platform_device bfin_uart_device = {
213 .name = "bfin-uart",
214 .id = 1,
215 .num_resources = ARRAY_SIZE(bfin_uart_resources),
216 .resource = bfin_uart_resources,
217};
218#endif
219
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800220#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
221#define PATA_INT 55
222
223static struct pata_platform_info bfin_pata_platform_data = {
224 .ioport_shift = 1,
225 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
226};
227
228static struct resource bfin_pata_resources[] = {
229 {
230 .start = 0x20314020,
231 .end = 0x2031403F,
232 .flags = IORESOURCE_MEM,
233 },
234 {
235 .start = 0x2031401C,
236 .end = 0x2031401F,
237 .flags = IORESOURCE_MEM,
238 },
239 {
240 .start = PATA_INT,
241 .end = PATA_INT,
242 .flags = IORESOURCE_IRQ,
243 },
244};
245
246static struct platform_device bfin_pata_device = {
247 .name = "pata_platform",
248 .id = -1,
249 .num_resources = ARRAY_SIZE(bfin_pata_resources),
250 .resource = bfin_pata_resources,
251 .dev = {
252 .platform_data = &bfin_pata_platform_data,
253 }
254};
255#endif
256
Bryan Wu1394f032007-05-06 14:50:22 -0700257static struct platform_device *ezkit_devices[] __initdata = {
258#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
259 &smc91x_device,
260#endif
261
262#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800263 &bfin_spi0_device,
264#endif
265
266#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
267 &bfin_fb_adv7393_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700268#endif
269
270#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
271 &rtc_device,
272#endif
273
274#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
275 &bfin_uart_device,
276#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800277
278#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
279 &bfin_pata_device,
280#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700281};
282
283static int __init ezkit_init(void)
284{
285 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
286 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
287#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
288 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
289#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800290
291#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
292 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
293#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700294 return 0;
295}
296
297arch_initcall(ezkit_init);