• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/linux/linux-2.6/arch/blackfin/mach-bf537/boards/
1/*
2 * File:         arch/blackfin/mach-bf537/boards/generic_board.c
3 * Based on:     arch/blackfin/mach-bf533/boards/ezkit.c
4 * Author:       Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
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>
38#include <asm/irq.h>
39#include <asm/bfin5xx_spi.h>
40#include <linux/usb_sl811.h>
41
42/*
43 * Name the Board for the /proc/cpuinfo
44 */
45char *bfin_board_name = "UNKNOWN BOARD";
46
47/*
48 *  Driver needs to know address, irq and flag pin.
49 */
50
51#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
52static struct resource bfin_pcmcia_cf_resources[] = {
53	{
54		.start = 0x20310000, /* IO PORT */
55		.end = 0x20312000,
56		.flags = IORESOURCE_MEM,
57	},{
58		.start = 0x20311000, /* Attribute Memory */
59		.end = 0x20311FFF,
60		.flags = IORESOURCE_MEM,
61	},{
62		.start = IRQ_PROG_INTA,
63		.end = IRQ_PROG_INTA,
64		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
65	},{
66		.start = IRQ_PF4,
67		.end = IRQ_PF4,
68		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
69	},{
70		.start = 6, /* Card Detect PF6 */
71		.end = 6,
72		.flags = IORESOURCE_IRQ,
73	},
74};
75
76static struct platform_device bfin_pcmcia_cf_device = {
77	.name = "bfin_cf_pcmcia",
78	.id = -1,
79	.num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
80	.resource = bfin_pcmcia_cf_resources,
81};
82#endif
83
84#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
85static struct platform_device rtc_device = {
86	.name = "rtc-bfin",
87	.id   = -1,
88};
89#endif
90
91#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
92static struct resource smc91x_resources[] = {
93	{
94		.name = "smc91x-regs",
95		.start = 0x20300300,
96		.end = 0x20300300 + 16,
97		.flags = IORESOURCE_MEM,
98	},{
99		.start = IRQ_PROG_INTB,
100		.end = IRQ_PROG_INTB,
101		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
102	},{
103		/*
104		 *  denotes the flag pin and is used directly if
105		 *  CONFIG_IRQCHIP_DEMUX_GPIO is defined.
106		 */
107		.start = IRQ_PF7,
108		.end = IRQ_PF7,
109		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
110	},
111};
112static struct platform_device smc91x_device = {
113	.name = "smc91x",
114	.id = 0,
115	.num_resources = ARRAY_SIZE(smc91x_resources),
116	.resource = smc91x_resources,
117};
118#endif
119
120#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
121static struct resource sl811_hcd_resources[] = {
122	{
123		.start = 0x20340000,
124		.end = 0x20340000,
125		.flags = IORESOURCE_MEM,
126	},{
127		.start = 0x20340004,
128		.end = 0x20340004,
129		.flags = IORESOURCE_MEM,
130	},{
131		.start = IRQ_PROG_INTA,
132		.end = IRQ_PROG_INTA,
133		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
134	},{
135		.start = IRQ_PF0 + CONFIG_USB_SL811_BFIN_GPIO,
136		.end = IRQ_PF0 + CONFIG_USB_SL811_BFIN_GPIO,
137		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
138	},
139};
140
141#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
142void sl811_port_power(struct device *dev, int is_on)
143{
144	unsigned short mask = (1<<CONFIG_USB_SL811_BFIN_GPIO_VBUS);
145
146	bfin_write_PORT_FER(bfin_read_PORT_FER() & ~mask);
147	bfin_write_FIO_DIR(bfin_read_FIO_DIR() | mask);
148
149	if (is_on)
150		bfin_write_FIO_FLAG_S(mask);
151	else
152		bfin_write_FIO_FLAG_C(mask);
153}
154#endif
155
156static struct sl811_platform_data sl811_priv = {
157	.potpg = 10,
158	.power = 250,		/* == 500mA */
159#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
160	.port_power = &sl811_port_power,
161#endif
162};
163
164static struct platform_device sl811_hcd_device = {
165	.name = "sl811-hcd",
166	.id = 0,
167	.dev = {
168		.platform_data = &sl811_priv,
169	},
170	.num_resources = ARRAY_SIZE(sl811_hcd_resources),
171	.resource = sl811_hcd_resources,
172};
173
174#endif
175
176#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
177static struct resource isp1362_hcd_resources[] = {
178	{
179		.start = 0x20360000,
180		.end = 0x20360000,
181		.flags = IORESOURCE_MEM,
182	},{
183		.start = 0x20360004,
184		.end = 0x20360004,
185		.flags = IORESOURCE_MEM,
186	},{
187		.start = IRQ_PROG_INTA,
188		.end = IRQ_PROG_INTA,
189		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
190	},{
191		.start = IRQ_PF0 + CONFIG_USB_ISP1362_BFIN_GPIO,
192		.end = IRQ_PF0 + CONFIG_USB_ISP1362_BFIN_GPIO,
193		.flags = IORESOURCE_IRQ,
194	},
195};
196
197static struct isp1362_platform_data isp1362_priv = {
198	.sel15Kres = 1,
199	.clknotstop = 0,
200	.oc_enable = 0,
201	.int_act_high = 0,
202	.int_edge_triggered = 0,
203	.remote_wakeup_connected = 0,
204	.no_power_switching = 1,
205	.power_switching_mode = 0,
206};
207
208static struct platform_device isp1362_hcd_device = {
209	.name = "isp1362-hcd",
210	.id = 0,
211	.dev = {
212		.platform_data = &isp1362_priv,
213	},
214	.num_resources = ARRAY_SIZE(isp1362_hcd_resources),
215	.resource = isp1362_hcd_resources,
216};
217#endif
218
219#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
220static struct platform_device bfin_mac_device = {
221	.name = "bfin_mac",
222};
223#endif
224
225#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
226static struct resource net2272_bfin_resources[] = {
227	{
228		.start = 0x20300000,
229		.end = 0x20300000 + 0x100,
230		.flags = IORESOURCE_MEM,
231	},{
232		.start = IRQ_PF7,
233		.end = IRQ_PF7,
234		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
235	},
236};
237
238static struct platform_device net2272_bfin_device = {
239	.name = "net2272",
240	.id = -1,
241	.num_resources = ARRAY_SIZE(net2272_bfin_resources),
242	.resource = net2272_bfin_resources,
243};
244#endif
245
246#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
247/* all SPI peripherals info goes here */
248
249#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
250static struct mtd_partition bfin_spi_flash_partitions[] = {
251	{
252		.name = "bootloader",
253		.size = 0x00020000,
254		.offset = 0,
255		.mask_flags = MTD_CAP_ROM
256	},{
257		.name = "kernel",
258		.size = 0xe0000,
259		.offset = 0x20000
260	},{
261		.name = "file system",
262		.size = 0x700000,
263		.offset = 0x00100000,
264	}
265};
266
267static struct flash_platform_data bfin_spi_flash_data = {
268	.name = "m25p80",
269	.parts = bfin_spi_flash_partitions,
270	.nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
271	.type = "m25p64",
272};
273
274/* SPI flash chip (m25p64) */
275static struct bfin5xx_spi_chip spi_flash_chip_info = {
276	.enable_dma = 0,         /* use dma transfer with this chip*/
277	.bits_per_word = 8,
278};
279#endif
280
281#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
282/* SPI ADC chip */
283static struct bfin5xx_spi_chip spi_adc_chip_info = {
284	.enable_dma = 1,         /* use dma transfer with this chip*/
285	.bits_per_word = 16,
286};
287#endif
288
289#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
290static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
291	.enable_dma = 0,
292	.bits_per_word = 16,
293};
294#endif
295
296#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
297static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
298	.enable_dma = 0,
299	.bits_per_word = 16,
300};
301#endif
302
303static struct spi_board_info bfin_spi_board_info[] __initdata = {
304#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
305	{
306		/* the modalias must be the same as spi device driver name */
307		.modalias = "m25p80", /* Name of spi_driver for this device */
308		.max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
309		.bus_num = 1, /* Framework bus number */
310		.chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL1*/
311		.platform_data = &bfin_spi_flash_data,
312		.controller_data = &spi_flash_chip_info,
313		.mode = SPI_MODE_3,
314	},
315#endif
316
317#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
318	{
319		.modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
320		.max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
321		.bus_num = 1, /* Framework bus number */
322		.chip_select = 1, /* Framework chip select. */
323		.platform_data = NULL, /* No spi_driver specific config */
324		.controller_data = &spi_adc_chip_info,
325	},
326#endif
327
328#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
329	{
330		.modalias = "ad1836-spi",
331		.max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
332		.bus_num = 1,
333		.chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
334		.controller_data = &ad1836_spi_chip_info,
335	},
336#endif
337
338#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
339	{
340		.modalias = "ad9960-spi",
341		.max_speed_hz = 10000000,     /* max spi clock (SCK) speed in HZ */
342		.bus_num = 1,
343		.chip_select = 1,
344		.controller_data = &ad9960_spi_chip_info,
345	},
346#endif
347};
348
349/* SPI controller data */
350static struct bfin5xx_spi_master spi_bfin_master_info = {
351	.num_chipselect = 8,
352	.enable_dma = 1,  /* master has the ability to do dma transfer */
353};
354
355static struct platform_device spi_bfin_master_device = {
356	.name = "bfin-spi-master",
357	.id = 1, /* Bus number */
358	.dev = {
359		.platform_data = &spi_bfin_master_info, /* Passed to driver */
360	},
361};
362#endif  /* spi master and devices */
363
364#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
365static struct platform_device bfin_fb_device = {
366	.name = "bf537-fb",
367};
368#endif
369
370#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
371static struct resource bfin_uart_resources[] = {
372	{
373		.start = 0xFFC00400,
374		.end = 0xFFC004FF,
375		.flags = IORESOURCE_MEM,
376	},{
377		.start = 0xFFC02000,
378		.end = 0xFFC020FF,
379		.flags = IORESOURCE_MEM,
380	},
381};
382
383static struct platform_device bfin_uart_device = {
384	.name = "bfin-uart",
385	.id = 1,
386	.num_resources = ARRAY_SIZE(bfin_uart_resources),
387	.resource = bfin_uart_resources,
388};
389#endif
390
391static struct platform_device *stamp_devices[] __initdata = {
392#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
393	&rtc_device,
394#endif
395
396#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
397	&bfin_pcmcia_cf_device,
398#endif
399
400#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
401	&sl811_hcd_device,
402#endif
403
404#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
405	&isp1362_hcd_device,
406#endif
407
408#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
409	&smc91x_device,
410#endif
411
412#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
413	&bfin_mac_device,
414#endif
415
416#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
417	&net2272_bfin_device,
418#endif
419
420#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
421	&spi_bfin_master_device,
422#endif
423
424#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
425	&bfin_fb_device,
426#endif
427
428#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
429	&bfin_uart_device,
430#endif
431};
432
433static int __init stamp_init(void)
434{
435	printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
436	platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
437#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
438	spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
439#endif
440	return 0;
441}
442
443arch_initcall(stamp_init);
444