blob: b2369558d803be815c24aa898776a403626a3e38 [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>
Bryan Wu5d448dd2007-11-12 23:24:42 +080042#include <asm/portmux.h>
Bryan Wu1394f032007-05-06 14:50:22 -070043
44/*
45 * Name the Board for the /proc/cpuinfo
46 */
Mike Frysinger066954a2007-10-21 22:36:06 +080047const char bfin_board_name[] = "ADDS-BF533-EZKIT";
Bryan Wu1394f032007-05-06 14:50:22 -070048
49#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
50static struct platform_device rtc_device = {
51 .name = "rtc-bfin",
52 .id = -1,
53};
54#endif
55
Bryan Wuc6c4d7b2007-10-11 01:20:06 +080056#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
57static struct platform_device bfin_fb_adv7393_device = {
58 .name = "bfin-adv7393",
59};
60#endif
61
Bryan Wu1394f032007-05-06 14:50:22 -070062/*
63 * USB-LAN EzExtender board
64 * Driver needs to know address, irq and flag pin.
65 */
66#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
67static struct resource smc91x_resources[] = {
68 {
69 .name = "smc91x-regs",
70 .start = 0x20310300,
71 .end = 0x20310300 + 16,
72 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080073 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070074 .start = IRQ_PF9,
75 .end = IRQ_PF9,
76 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
77 },
78};
79static struct platform_device smc91x_device = {
80 .name = "smc91x",
81 .id = 0,
82 .num_resources = ARRAY_SIZE(smc91x_resources),
83 .resource = smc91x_resources,
84};
85#endif
86
87#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
88/* all SPI peripherals info goes here */
89
90#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
91static struct mtd_partition bfin_spi_flash_partitions[] = {
92 {
93 .name = "bootloader",
94 .size = 0x00020000,
95 .offset = 0,
96 .mask_flags = MTD_CAP_ROM
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080097 }, {
Bryan Wu1394f032007-05-06 14:50:22 -070098 .name = "kernel",
99 .size = 0xe0000,
100 .offset = 0x20000
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800101 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700102 .name = "file system",
103 .size = 0x700000,
104 .offset = 0x00100000,
105 }
106};
107
108static struct flash_platform_data bfin_spi_flash_data = {
109 .name = "m25p80",
110 .parts = bfin_spi_flash_partitions,
111 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
112 .type = "m25p64",
113};
114
115/* SPI flash chip (m25p64) */
116static struct bfin5xx_spi_chip spi_flash_chip_info = {
117 .enable_dma = 0, /* use dma transfer with this chip*/
118 .bits_per_word = 8,
119};
120#endif
121
122#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
123/* SPI ADC chip */
124static struct bfin5xx_spi_chip spi_adc_chip_info = {
125 .enable_dma = 1, /* use dma transfer with this chip*/
126 .bits_per_word = 16,
127};
128#endif
129
130#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
131static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
132 .enable_dma = 0,
133 .bits_per_word = 16,
134};
135#endif
136
137static struct spi_board_info bfin_spi_board_info[] __initdata = {
138#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
139 {
140 /* the modalias must be the same as spi device driver name */
141 .modalias = "m25p80", /* Name of spi_driver for this device */
142 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800143 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700144 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
145 .platform_data = &bfin_spi_flash_data,
146 .controller_data = &spi_flash_chip_info,
147 .mode = SPI_MODE_3,
148 },
149#endif
150
151#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
152 {
153 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
154 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800155 .bus_num = 0, /* Framework bus number */
Bryan Wu1394f032007-05-06 14:50:22 -0700156 .chip_select = 1, /* Framework chip select. */
157 .platform_data = NULL, /* No spi_driver specific config */
158 .controller_data = &spi_adc_chip_info,
159 },
160#endif
161
162#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
163 {
164 .modalias = "ad1836-spi",
165 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800166 .bus_num = 0,
Bryan Wu1394f032007-05-06 14:50:22 -0700167 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
168 .controller_data = &ad1836_spi_chip_info,
169 },
170#endif
171};
172
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800173/* SPI (0) */
174static struct resource bfin_spi0_resource[] = {
175 [0] = {
176 .start = SPI0_REGBASE,
177 .end = SPI0_REGBASE + 0xFF,
178 .flags = IORESOURCE_MEM,
179 },
180 [1] = {
181 .start = CH_SPI,
182 .end = CH_SPI,
183 .flags = IORESOURCE_IRQ,
184 }
185};
186
Bryan Wu1394f032007-05-06 14:50:22 -0700187/* SPI controller data */
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800188static struct bfin5xx_spi_master bfin_spi0_info = {
Bryan Wu1394f032007-05-06 14:50:22 -0700189 .num_chipselect = 8,
190 .enable_dma = 1, /* master has the ability to do dma transfer */
Bryan Wu5d448dd2007-11-12 23:24:42 +0800191 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
Bryan Wu1394f032007-05-06 14:50:22 -0700192};
193
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800194static struct platform_device bfin_spi0_device = {
195 .name = "bfin-spi",
196 .id = 0, /* Bus number */
197 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
198 .resource = bfin_spi0_resource,
Bryan Wu1394f032007-05-06 14:50:22 -0700199 .dev = {
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800200 .platform_data = &bfin_spi0_info, /* Passed to driver */
Bryan Wu1394f032007-05-06 14:50:22 -0700201 },
202};
203#endif /* spi master and devices */
204
205#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
206static struct resource bfin_uart_resources[] = {
207 {
208 .start = 0xFFC00400,
209 .end = 0xFFC004FF,
210 .flags = IORESOURCE_MEM,
211 },
212};
213
214static struct platform_device bfin_uart_device = {
215 .name = "bfin-uart",
216 .id = 1,
217 .num_resources = ARRAY_SIZE(bfin_uart_resources),
218 .resource = bfin_uart_resources,
219};
220#endif
221
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800222#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
223#define PATA_INT 55
224
225static struct pata_platform_info bfin_pata_platform_data = {
226 .ioport_shift = 1,
227 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
228};
229
230static struct resource bfin_pata_resources[] = {
231 {
232 .start = 0x20314020,
233 .end = 0x2031403F,
234 .flags = IORESOURCE_MEM,
235 },
236 {
237 .start = 0x2031401C,
238 .end = 0x2031401F,
239 .flags = IORESOURCE_MEM,
240 },
241 {
242 .start = PATA_INT,
243 .end = PATA_INT,
244 .flags = IORESOURCE_IRQ,
245 },
246};
247
248static struct platform_device bfin_pata_device = {
249 .name = "pata_platform",
250 .id = -1,
251 .num_resources = ARRAY_SIZE(bfin_pata_resources),
252 .resource = bfin_pata_resources,
253 .dev = {
254 .platform_data = &bfin_pata_platform_data,
255 }
256};
257#endif
258
Bryan Wu1394f032007-05-06 14:50:22 -0700259static struct platform_device *ezkit_devices[] __initdata = {
260#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
261 &smc91x_device,
262#endif
263
264#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800265 &bfin_spi0_device,
266#endif
267
268#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
269 &bfin_fb_adv7393_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700270#endif
271
272#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
273 &rtc_device,
274#endif
275
276#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
277 &bfin_uart_device,
278#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800279
280#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
281 &bfin_pata_device,
282#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700283};
284
285static int __init ezkit_init(void)
286{
287 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
288 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
289#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
290 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
291#endif
Bryan Wuc6c4d7b2007-10-11 01:20:06 +0800292
293#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
294 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
295#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700296 return 0;
297}
298
299arch_initcall(ezkit_init);