• 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/stamp.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#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
38#include <linux/usb_isp1362.h>
39#endif
40#include <asm/irq.h>
41#include <asm/bfin5xx_spi.h>
42#include <linux/usb_sl811.h>
43
44#include <linux/spi/ad7877.h>
45
46/*
47 * Name the Board for the /proc/cpuinfo
48 */
49char *bfin_board_name = "PNAV-1.0";
50
51/*
52 *  Driver needs to know address, irq and flag pin.
53 */
54
55#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
56static struct resource bfin_pcmcia_cf_resources[] = {
57	{
58		.start = 0x20310000, /* IO PORT */
59		.end = 0x20312000,
60		.flags = IORESOURCE_MEM,
61	},{
62		.start = 0x20311000, /* Attribute Memory */
63		.end = 0x20311FFF,
64		.flags = IORESOURCE_MEM,
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
100		.start = IRQ_PF7,
101		.end = IRQ_PF7,
102		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
103	},
104};
105static struct platform_device smc91x_device = {
106	.name = "smc91x",
107	.id = 0,
108	.num_resources = ARRAY_SIZE(smc91x_resources),
109	.resource = smc91x_resources,
110};
111#endif
112
113#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
114static struct resource sl811_hcd_resources[] = {
115	{
116		.start = 0x20340000,
117		.end = 0x20340000,
118		.flags = IORESOURCE_MEM,
119	},{
120		.start = 0x20340004,
121		.end = 0x20340004,
122		.flags = IORESOURCE_MEM,
123	},{
124		.start = CONFIG_USB_SL811_BFIN_IRQ,
125		.end = CONFIG_USB_SL811_BFIN_IRQ,
126		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
127	},
128};
129
130#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
131void sl811_port_power(struct device *dev, int is_on)
132{
133	unsigned short mask = (1 << CONFIG_USB_SL811_BFIN_GPIO_VBUS);
134
135	bfin_write_PORT_FER(bfin_read_PORT_FER() & ~mask);
136	bfin_write_FIO_DIR(bfin_read_FIO_DIR() | mask);
137
138	if (is_on)
139		bfin_write_FIO_FLAG_S(mask);
140	else
141		bfin_write_FIO_FLAG_C(mask);
142}
143#endif
144
145static struct sl811_platform_data sl811_priv = {
146	.potpg = 10,
147	.power = 250,       /* == 500mA */
148#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
149	.port_power = &sl811_port_power,
150#endif
151};
152
153static struct platform_device sl811_hcd_device = {
154	.name = "sl811-hcd",
155	.id = 0,
156	.dev = {
157		.platform_data = &sl811_priv,
158	},
159	.num_resources = ARRAY_SIZE(sl811_hcd_resources),
160	.resource = sl811_hcd_resources,
161};
162#endif
163
164#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
165static struct resource isp1362_hcd_resources[] = {
166	{
167		.start = 0x20360000,
168		.end = 0x20360000,
169		.flags = IORESOURCE_MEM,
170	},{
171		.start = 0x20360004,
172		.end = 0x20360004,
173		.flags = IORESOURCE_MEM,
174	},{
175		.start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
176		.end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
177		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
178	},
179};
180
181static struct isp1362_platform_data isp1362_priv = {
182	.sel15Kres = 1,
183	.clknotstop = 0,
184	.oc_enable = 0,
185	.int_act_high = 0,
186	.int_edge_triggered = 0,
187	.remote_wakeup_connected = 0,
188	.no_power_switching = 1,
189	.power_switching_mode = 0,
190};
191
192static struct platform_device isp1362_hcd_device = {
193	.name = "isp1362-hcd",
194	.id = 0,
195	.dev = {
196		.platform_data = &isp1362_priv,
197	},
198	.num_resources = ARRAY_SIZE(isp1362_hcd_resources),
199	.resource = isp1362_hcd_resources,
200};
201#endif
202
203#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
204static struct platform_device bfin_mac_device = {
205	.name = "bfin_mac",
206};
207#endif
208
209#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
210static struct resource net2272_bfin_resources[] = {
211	{
212		.start = 0x20300000,
213		.end = 0x20300000 + 0x100,
214		.flags = IORESOURCE_MEM,
215	},{
216		.start = IRQ_PF7,
217		.end = IRQ_PF7,
218		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
219	},
220};
221
222static struct platform_device net2272_bfin_device = {
223	.name = "net2272",
224	.id = -1,
225	.num_resources = ARRAY_SIZE(net2272_bfin_resources),
226	.resource = net2272_bfin_resources,
227};
228#endif
229
230#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
231/* all SPI peripherals info goes here */
232
233#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
234static struct mtd_partition bfin_spi_flash_partitions[] = {
235	{
236		.name = "bootloader",
237		.size = 0x00020000,
238		.offset = 0,
239		.mask_flags = MTD_CAP_ROM
240	},{
241		.name = "kernel",
242		.size = 0xe0000,
243		.offset = 0x20000
244	},{
245		.name = "file system",
246		.size = 0x700000,
247		.offset = 0x00100000,
248	}
249};
250
251static struct flash_platform_data bfin_spi_flash_data = {
252	.name = "m25p80",
253	.parts = bfin_spi_flash_partitions,
254	.nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
255	.type = "m25p64",
256};
257
258/* SPI flash chip (m25p64) */
259static struct bfin5xx_spi_chip spi_flash_chip_info = {
260	.enable_dma = 0,         /* use dma transfer with this chip*/
261	.bits_per_word = 8,
262};
263#endif
264
265#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
266/* SPI ADC chip */
267static struct bfin5xx_spi_chip spi_adc_chip_info = {
268	.enable_dma = 1,         /* use dma transfer with this chip*/
269	.bits_per_word = 16,
270};
271#endif
272
273#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
274static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
275	.enable_dma = 0,
276	.bits_per_word = 16,
277};
278#endif
279
280#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
281static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
282	.enable_dma = 0,
283	.bits_per_word = 16,
284};
285#endif
286
287#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
288static struct bfin5xx_spi_chip spi_mmc_chip_info = {
289	.enable_dma = 1,
290	.bits_per_word = 8,
291};
292#endif
293
294#if defined(CONFIG_PBX)
295static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
296	.ctl_reg	= 0x4, /* send zero */
297	.enable_dma	= 0,
298	.bits_per_word	= 8,
299	.cs_change_per_word = 1,
300};
301#endif
302
303
304#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
305static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
306	.cs_change_per_word = 1,
307	.enable_dma = 0,
308	.bits_per_word = 16,
309};
310
311static const struct ad7877_platform_data bfin_ad7877_ts_info = {
312	.model			= 7877,
313	.vref_delay_usecs	= 50,	/* internal, no capacitor */
314	.x_plate_ohms		= 419,
315	.y_plate_ohms		= 486,
316	.pressure_max		= 1000,
317	.pressure_min		= 0,
318	.stopacq_polarity 	= 1,
319	.first_conversion_delay = 3,
320	.acquisition_time 	= 1,
321	.averaging 		= 1,
322	.pen_down_acc_interval 	= 1,
323};
324#endif
325
326static struct spi_board_info bfin_spi_board_info[] __initdata = {
327#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
328	{
329		/* the modalias must be the same as spi device driver name */
330		.modalias = "m25p80", /* Name of spi_driver for this device */
331		.max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
332		.bus_num = 1, /* Framework bus number */
333		.chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
334		.platform_data = &bfin_spi_flash_data,
335		.controller_data = &spi_flash_chip_info,
336		.mode = SPI_MODE_3,
337	},
338#endif
339
340#if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
341	{
342		.modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
343		.max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
344		.bus_num = 1, /* Framework bus number */
345		.chip_select = 1, /* Framework chip select. */
346		.platform_data = NULL, /* No spi_driver specific config */
347		.controller_data = &spi_adc_chip_info,
348	},
349#endif
350
351#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
352	{
353		.modalias = "ad1836-spi",
354		.max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
355		.bus_num = 1,
356		.chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
357		.controller_data = &ad1836_spi_chip_info,
358	},
359#endif
360#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
361	{
362		.modalias = "ad9960-spi",
363		.max_speed_hz = 10000000,     /* max spi clock (SCK) speed in HZ */
364		.bus_num = 1,
365		.chip_select = 1,
366		.controller_data = &ad9960_spi_chip_info,
367	},
368#endif
369#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
370	{
371		.modalias = "spi_mmc_dummy",
372		.max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
373		.bus_num = 1,
374		.chip_select = 7,
375		.platform_data = NULL,
376		.controller_data = &spi_mmc_chip_info,
377		.mode = SPI_MODE_3,
378	},
379	{
380		.modalias = "spi_mmc",
381		.max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
382		.bus_num = 1,
383		.chip_select = CONFIG_SPI_MMC_CS_CHAN,
384		.platform_data = NULL,
385		.controller_data = &spi_mmc_chip_info,
386		.mode = SPI_MODE_3,
387	},
388#endif
389#if defined(CONFIG_PBX)
390	{
391		.modalias	= "fxs-spi",
392		.max_speed_hz	= 12500000,     /* max spi clock (SCK) speed in HZ */
393		.bus_num	= 1,
394		.chip_select	= 3,
395		.controller_data= &spi_si3xxx_chip_info,
396		.mode = SPI_MODE_3,
397	},
398	{
399		.modalias	= "fxo-spi",
400		.max_speed_hz	= 12500000,     /* max spi clock (SCK) speed in HZ */
401		.bus_num	= 1,
402		.chip_select	= 2,
403		.controller_data= &spi_si3xxx_chip_info,
404		.mode = SPI_MODE_3,
405	},
406#endif
407#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
408{
409	.modalias		= "ad7877",
410	.platform_data		= &bfin_ad7877_ts_info,
411	.irq			= IRQ_PF2,
412	.max_speed_hz		= 12500000,     /* max spi clock (SCK) speed in HZ */
413	.bus_num		= 1,
414	.chip_select  		= 5,
415	.controller_data = &spi_ad7877_chip_info,
416},
417#endif
418
419};
420
421/* SPI controller data */
422static struct bfin5xx_spi_master spi_bfin_master_info = {
423	.num_chipselect = 8,
424	.enable_dma = 1,  /* master has the ability to do dma transfer */
425};
426
427static struct platform_device spi_bfin_master_device = {
428	.name = "bfin-spi-master",
429	.id = 1, /* Bus number */
430	.dev = {
431		.platform_data = &spi_bfin_master_info, /* Passed to driver */
432	},
433};
434#endif  /* spi master and devices */
435
436#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
437static struct platform_device bfin_fb_device = {
438	.name = "bf537-fb",
439};
440#endif
441
442#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
443static struct resource bfin_uart_resources[] = {
444	{
445		.start = 0xFFC00400,
446		.end = 0xFFC004FF,
447		.flags = IORESOURCE_MEM,
448	},{
449		.start = 0xFFC02000,
450		.end = 0xFFC020FF,
451		.flags = IORESOURCE_MEM,
452	},
453};
454
455static struct platform_device bfin_uart_device = {
456	.name = "bfin-uart",
457	.id = 1,
458	.num_resources = ARRAY_SIZE(bfin_uart_resources),
459	.resource = bfin_uart_resources,
460};
461#endif
462
463
464static struct platform_device *stamp_devices[] __initdata = {
465#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
466	&bfin_pcmcia_cf_device,
467#endif
468
469#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
470	&rtc_device,
471#endif
472
473#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
474	&sl811_hcd_device,
475#endif
476
477#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
478	&isp1362_hcd_device,
479#endif
480
481#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
482	&smc91x_device,
483#endif
484
485#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
486	&bfin_mac_device,
487#endif
488
489#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
490	&net2272_bfin_device,
491#endif
492
493#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
494	&spi_bfin_master_device,
495#endif
496
497#if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE)
498	&bfin_fb_device,
499#endif
500
501#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
502	&bfin_uart_device,
503#endif
504};
505
506static int __init stamp_init(void)
507{
508	printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
509	platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
510#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
511	spi_register_board_info(bfin_spi_board_info,
512				ARRAY_SIZE(bfin_spi_board_info));
513#endif
514	return 0;
515}
516
517arch_initcall(stamp_init);
518