RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / arch / blackfin / mach-bf561 / boards / ezkit.c
blob9720b5c307ab58c82c0d5b55342b3769b959d52c
1 /*
2 * File: arch/blackfin/mach-bf561/ezkit.c
3 * Based on:
4 * Author:
6 * Created:
7 * Description:
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
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.
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.
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
30 #include <linux/device.h>
31 #include <linux/platform_device.h>
32 #include <linux/spi/spi.h>
33 #include <asm/irq.h>
34 #include <asm/bfin5xx_spi.h>
35 #include <linux/interrupt.h>
36 #include <linux/irq.h>
39 * Name the Board for the /proc/cpuinfo
41 char *bfin_board_name = "ADDS-BF561-EZKIT";
43 #define ISP1761_BASE 0x2C0F0000
44 #define ISP1761_IRQ IRQ_PF10
46 #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
47 static struct resource bfin_isp1761_resources[] = {
48 [0] = {
49 .name = "isp1761-regs",
50 .start = ISP1761_BASE + 0x00000000,
51 .end = ISP1761_BASE + 0x000fffff,
52 .flags = IORESOURCE_MEM,
54 [1] = {
55 .start = ISP1761_IRQ,
56 .end = ISP1761_IRQ,
57 .flags = IORESOURCE_IRQ,
61 static struct platform_device bfin_isp1761_device = {
62 .name = "isp1761",
63 .id = 0,
64 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
65 .resource = bfin_isp1761_resources,
68 static struct platform_device *bfin_isp1761_devices[] = {
69 &bfin_isp1761_device,
72 int __init bfin_isp1761_init(void)
74 unsigned int num_devices=ARRAY_SIZE(bfin_isp1761_devices);
76 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
77 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
79 return platform_add_devices(bfin_isp1761_devices, num_devices);
82 void __exit bfin_isp1761_exit(void)
84 platform_device_unregister(&bfin_isp1761_device);
87 arch_initcall(bfin_isp1761_init);
88 #endif
91 * USB-LAN EzExtender board
92 * Driver needs to know address, irq and flag pin.
94 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
95 static struct resource smc91x_resources[] = {
97 .name = "smc91x-regs",
98 .start = 0x2C010300,
99 .end = 0x2C010300 + 16,
100 .flags = IORESOURCE_MEM,
103 .start = IRQ_PF9,
104 .end = IRQ_PF9,
105 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
109 static struct platform_device smc91x_device = {
110 .name = "smc91x",
111 .id = 0,
112 .num_resources = ARRAY_SIZE(smc91x_resources),
113 .resource = smc91x_resources,
115 #endif
117 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
118 static struct resource bfin_uart_resources[] = {
120 .start = 0xFFC00400,
121 .end = 0xFFC004FF,
122 .flags = IORESOURCE_MEM,
126 static struct platform_device bfin_uart_device = {
127 .name = "bfin-uart",
128 .id = 1,
129 .num_resources = ARRAY_SIZE(bfin_uart_resources),
130 .resource = bfin_uart_resources,
132 #endif
134 #ifdef CONFIG_SPI_BFIN
135 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
136 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
137 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
138 .enable_dma = 0,
139 .bits_per_word = 16,
141 #endif
142 #endif
144 /* SPI controller data */
145 static struct bfin5xx_spi_master spi_bfin_master_info = {
146 .num_chipselect = 8,
147 .enable_dma = 1, /* master has the ability to do dma transfer */
150 static struct platform_device spi_bfin_master_device = {
151 .name = "bfin-spi-master",
152 .id = 1, /* Bus number */
153 .dev = {
154 .platform_data = &spi_bfin_master_info, /* Passed to driver */
158 static struct spi_board_info bfin_spi_board_info[] __initdata = {
159 #if defined(CONFIG_SND_BLACKFIN_AD1836) \
160 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
162 .modalias = "ad1836-spi",
163 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
164 .bus_num = 1,
165 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
166 .controller_data = &ad1836_spi_chip_info,
168 #endif
171 static struct platform_device *ezkit_devices[] __initdata = {
172 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
173 &smc91x_device,
174 #endif
175 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
176 &spi_bfin_master_device,
177 #endif
178 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
179 &bfin_uart_device,
180 #endif
183 static int __init ezkit_init(void)
185 int ret;
187 printk(KERN_INFO "%s(): registering device resources\n", __func__);
189 ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
190 if (ret < 0)
191 return ret;
193 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
194 bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12));
195 SSYNC();
196 #endif
198 return spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
201 arch_initcall(ezkit_init);