blob: 724191da20a249a8f1f66c60cfba7b190f5f6074 [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>
35#include <asm/bfin5xx_spi.h>
Bryan Wu1394f032007-05-06 14:50:22 -070036
37/*
38 * Name the Board for the /proc/cpuinfo
39 */
40char *bfin_board_name = "ADDS-BF561-EZKIT";
41
Michael Hennerich140a9ae2007-05-21 18:09:13 +080042#define ISP1761_BASE 0x2C0F0000
43#define ISP1761_IRQ IRQ_PF10
44
45#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
46static struct resource bfin_isp1761_resources[] = {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080047 {
Michael Hennerich140a9ae2007-05-21 18:09:13 +080048 .name = "isp1761-regs",
49 .start = ISP1761_BASE + 0x00000000,
50 .end = ISP1761_BASE + 0x000fffff,
51 .flags = IORESOURCE_MEM,
52 },
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080053 {
Michael Hennerich140a9ae2007-05-21 18:09:13 +080054 .start = ISP1761_IRQ,
55 .end = ISP1761_IRQ,
56 .flags = IORESOURCE_IRQ,
57 },
58};
59
60static struct platform_device bfin_isp1761_device = {
61 .name = "isp1761",
62 .id = 0,
63 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
64 .resource = bfin_isp1761_resources,
65};
66
67static struct platform_device *bfin_isp1761_devices[] = {
68 &bfin_isp1761_device,
69};
70
71int __init bfin_isp1761_init(void)
72{
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080073 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
Michael Hennerich140a9ae2007-05-21 18:09:13 +080074
75 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
76 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
77
78 return platform_add_devices(bfin_isp1761_devices, num_devices);
79}
80
81void __exit bfin_isp1761_exit(void)
82{
83 platform_device_unregister(&bfin_isp1761_device);
84}
85
86arch_initcall(bfin_isp1761_init);
87#endif
88
Bryan Wu1394f032007-05-06 14:50:22 -070089/*
90 * USB-LAN EzExtender board
91 * Driver needs to know address, irq and flag pin.
92 */
93#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
94static struct resource smc91x_resources[] = {
95 {
96 .name = "smc91x-regs",
97 .start = 0x2C010300,
98 .end = 0x2C010300 + 16,
99 .flags = IORESOURCE_MEM,
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800100 }, {
Bryan Wu1394f032007-05-06 14:50:22 -0700101
102 .start = IRQ_PF9,
103 .end = IRQ_PF9,
104 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
105 },
106};
107
108static struct platform_device smc91x_device = {
109 .name = "smc91x",
110 .id = 0,
111 .num_resources = ARRAY_SIZE(smc91x_resources),
112 .resource = smc91x_resources,
113};
114#endif
115
116#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
117static struct resource bfin_uart_resources[] = {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800118 {
119 .start = 0xFFC00400,
120 .end = 0xFFC004FF,
121 .flags = IORESOURCE_MEM,
122 },
Bryan Wu1394f032007-05-06 14:50:22 -0700123};
124
125static struct platform_device bfin_uart_device = {
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800126 .name = "bfin-uart",
127 .id = 1,
128 .num_resources = ARRAY_SIZE(bfin_uart_resources),
129 .resource = bfin_uart_resources,
Bryan Wu1394f032007-05-06 14:50:22 -0700130};
131#endif
132
133#ifdef CONFIG_SPI_BFIN
134#if defined(CONFIG_SND_BLACKFIN_AD1836) \
135 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
136static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
137 .enable_dma = 0,
138 .bits_per_word = 16,
139};
140#endif
141#endif
142
143/* SPI controller data */
144static struct bfin5xx_spi_master spi_bfin_master_info = {
145 .num_chipselect = 8,
146 .enable_dma = 1, /* master has the ability to do dma transfer */
147};
148
149static struct platform_device spi_bfin_master_device = {
150 .name = "bfin-spi-master",
151 .id = 1, /* Bus number */
152 .dev = {
153 .platform_data = &spi_bfin_master_info, /* Passed to driver */
154 },
155};
156
157static struct spi_board_info bfin_spi_board_info[] __initdata = {
158#if defined(CONFIG_SND_BLACKFIN_AD1836) \
159 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
160 {
161 .modalias = "ad1836-spi",
162 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
163 .bus_num = 1,
164 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
165 .controller_data = &ad1836_spi_chip_info,
166 },
167#endif
168};
169
170static struct platform_device *ezkit_devices[] __initdata = {
171#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
172 &smc91x_device,
173#endif
174#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
175 &spi_bfin_master_device,
176#endif
177#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800178 &bfin_uart_device,
Bryan Wu1394f032007-05-06 14:50:22 -0700179#endif
180};
181
182static int __init ezkit_init(void)
183{
184 int ret;
185
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800186 printk(KERN_INFO "%s(): registering device resources\n", __func__);
187
188 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
Bryan Wu1394f032007-05-06 14:50:22 -0700189 if (ret < 0)
190 return ret;
Mike Frysingerc0fc5252007-05-21 18:09:25 +0800191
192#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
193 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
194 SSYNC();
195#endif
196
197 return spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
Bryan Wu1394f032007-05-06 14:50:22 -0700198}
199
200arch_initcall(ezkit_init);