]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - arch/blackfin/mach-bf533/boards/ezkit.c
Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
[mirror_ubuntu-jammy-kernel.git] / arch / blackfin / mach-bf533 / boards / ezkit.c
1 /*
2 * File: arch/blackfin/mach-bf533/ezkit.c
3 * Based on: Original Work
4 * 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>
38 #include <linux/pata_platform.h>
39 #include <linux/irq.h>
40 #include <asm/dma.h>
41 #include <asm/bfin5xx_spi.h>
42
43 /*
44 * Name the Board for the /proc/cpuinfo
45 */
46 char *bfin_board_name = "ADDS-BF533-EZKIT";
47
48 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
49 static struct platform_device rtc_device = {
50 .name = "rtc-bfin",
51 .id = -1,
52 };
53 #endif
54
55 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
56 static struct platform_device bfin_fb_adv7393_device = {
57 .name = "bfin-adv7393",
58 };
59 #endif
60
61 /*
62 * USB-LAN EzExtender board
63 * Driver needs to know address, irq and flag pin.
64 */
65 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
66 static struct resource smc91x_resources[] = {
67 {
68 .name = "smc91x-regs",
69 .start = 0x20310300,
70 .end = 0x20310300 + 16,
71 .flags = IORESOURCE_MEM,
72 }, {
73 .start = IRQ_PF9,
74 .end = IRQ_PF9,
75 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
76 },
77 };
78 static struct platform_device smc91x_device = {
79 .name = "smc91x",
80 .id = 0,
81 .num_resources = ARRAY_SIZE(smc91x_resources),
82 .resource = smc91x_resources,
83 };
84 #endif
85
86 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
87 /* all SPI peripherals info goes here */
88
89 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
90 static struct mtd_partition bfin_spi_flash_partitions[] = {
91 {
92 .name = "bootloader",
93 .size = 0x00020000,
94 .offset = 0,
95 .mask_flags = MTD_CAP_ROM
96 }, {
97 .name = "kernel",
98 .size = 0xe0000,
99 .offset = 0x20000
100 }, {
101 .name = "file system",
102 .size = 0x700000,
103 .offset = 0x00100000,
104 }
105 };
106
107 static struct flash_platform_data bfin_spi_flash_data = {
108 .name = "m25p80",
109 .parts = bfin_spi_flash_partitions,
110 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
111 .type = "m25p64",
112 };
113
114 /* SPI flash chip (m25p64) */
115 static struct bfin5xx_spi_chip spi_flash_chip_info = {
116 .enable_dma = 0, /* use dma transfer with this chip*/
117 .bits_per_word = 8,
118 };
119 #endif
120
121 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
122 /* SPI ADC chip */
123 static struct bfin5xx_spi_chip spi_adc_chip_info = {
124 .enable_dma = 1, /* use dma transfer with this chip*/
125 .bits_per_word = 16,
126 };
127 #endif
128
129 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
130 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
131 .enable_dma = 0,
132 .bits_per_word = 16,
133 };
134 #endif
135
136 static struct spi_board_info bfin_spi_board_info[] __initdata = {
137 #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
138 {
139 /* the modalias must be the same as spi device driver name */
140 .modalias = "m25p80", /* Name of spi_driver for this device */
141 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
142 .bus_num = 0, /* Framework bus number */
143 .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/
144 .platform_data = &bfin_spi_flash_data,
145 .controller_data = &spi_flash_chip_info,
146 .mode = SPI_MODE_3,
147 },
148 #endif
149
150 #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE)
151 {
152 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
153 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
154 .bus_num = 0, /* Framework bus number */
155 .chip_select = 1, /* Framework chip select. */
156 .platform_data = NULL, /* No spi_driver specific config */
157 .controller_data = &spi_adc_chip_info,
158 },
159 #endif
160
161 #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
162 {
163 .modalias = "ad1836-spi",
164 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
165 .bus_num = 0,
166 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
167 .controller_data = &ad1836_spi_chip_info,
168 },
169 #endif
170 };
171
172 /* SPI (0) */
173 static struct resource bfin_spi0_resource[] = {
174 [0] = {
175 .start = SPI0_REGBASE,
176 .end = SPI0_REGBASE + 0xFF,
177 .flags = IORESOURCE_MEM,
178 },
179 [1] = {
180 .start = CH_SPI,
181 .end = CH_SPI,
182 .flags = IORESOURCE_IRQ,
183 }
184 };
185
186 /* SPI controller data */
187 static struct bfin5xx_spi_master bfin_spi0_info = {
188 .num_chipselect = 8,
189 .enable_dma = 1, /* master has the ability to do dma transfer */
190 };
191
192 static struct platform_device bfin_spi0_device = {
193 .name = "bfin-spi",
194 .id = 0, /* Bus number */
195 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
196 .resource = bfin_spi0_resource,
197 .dev = {
198 .platform_data = &bfin_spi0_info, /* Passed to driver */
199 },
200 };
201 #endif /* spi master and devices */
202
203 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
204 static struct resource bfin_uart_resources[] = {
205 {
206 .start = 0xFFC00400,
207 .end = 0xFFC004FF,
208 .flags = IORESOURCE_MEM,
209 },
210 };
211
212 static struct platform_device bfin_uart_device = {
213 .name = "bfin-uart",
214 .id = 1,
215 .num_resources = ARRAY_SIZE(bfin_uart_resources),
216 .resource = bfin_uart_resources,
217 };
218 #endif
219
220 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
221 #define PATA_INT 55
222
223 static struct pata_platform_info bfin_pata_platform_data = {
224 .ioport_shift = 1,
225 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
226 };
227
228 static struct resource bfin_pata_resources[] = {
229 {
230 .start = 0x20314020,
231 .end = 0x2031403F,
232 .flags = IORESOURCE_MEM,
233 },
234 {
235 .start = 0x2031401C,
236 .end = 0x2031401F,
237 .flags = IORESOURCE_MEM,
238 },
239 {
240 .start = PATA_INT,
241 .end = PATA_INT,
242 .flags = IORESOURCE_IRQ,
243 },
244 };
245
246 static struct platform_device bfin_pata_device = {
247 .name = "pata_platform",
248 .id = -1,
249 .num_resources = ARRAY_SIZE(bfin_pata_resources),
250 .resource = bfin_pata_resources,
251 .dev = {
252 .platform_data = &bfin_pata_platform_data,
253 }
254 };
255 #endif
256
257 static struct platform_device *ezkit_devices[] __initdata = {
258 #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
259 &smc91x_device,
260 #endif
261
262 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
263 &bfin_spi0_device,
264 #endif
265
266 #if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
267 &bfin_fb_adv7393_device,
268 #endif
269
270 #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
271 &rtc_device,
272 #endif
273
274 #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
275 &bfin_uart_device,
276 #endif
277
278 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
279 &bfin_pata_device,
280 #endif
281 };
282
283 static int __init ezkit_init(void)
284 {
285 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
286 platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
287 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
288 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
289 #endif
290
291 #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
292 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
293 #endif
294 return 0;
295 }
296
297 arch_initcall(ezkit_init);