Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
| 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 Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 33 | #include <linux/irq.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 34 | #include <linux/interrupt.h> |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame^] | 35 | #include <linux/pata_platform.h> |
| 36 | #include <asm/dma.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 37 | #include <asm/bfin5xx_spi.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 38 | |
| 39 | /* |
| 40 | * Name the Board for the /proc/cpuinfo |
| 41 | */ |
| 42 | char *bfin_board_name = "ADDS-BF561-EZKIT"; |
| 43 | |
Michael Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 44 | #define ISP1761_BASE 0x2C0F0000 |
| 45 | #define ISP1761_IRQ IRQ_PF10 |
| 46 | |
| 47 | #if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE) |
| 48 | static struct resource bfin_isp1761_resources[] = { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 49 | { |
Michael Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 50 | .name = "isp1761-regs", |
| 51 | .start = ISP1761_BASE + 0x00000000, |
| 52 | .end = ISP1761_BASE + 0x000fffff, |
| 53 | .flags = IORESOURCE_MEM, |
| 54 | }, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 55 | { |
Michael Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 56 | .start = ISP1761_IRQ, |
| 57 | .end = ISP1761_IRQ, |
| 58 | .flags = IORESOURCE_IRQ, |
| 59 | }, |
| 60 | }; |
| 61 | |
| 62 | static struct platform_device bfin_isp1761_device = { |
| 63 | .name = "isp1761", |
| 64 | .id = 0, |
| 65 | .num_resources = ARRAY_SIZE(bfin_isp1761_resources), |
| 66 | .resource = bfin_isp1761_resources, |
| 67 | }; |
| 68 | |
| 69 | static struct platform_device *bfin_isp1761_devices[] = { |
| 70 | &bfin_isp1761_device, |
| 71 | }; |
| 72 | |
| 73 | int __init bfin_isp1761_init(void) |
| 74 | { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 75 | unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices); |
Michael Hennerich | 140a9ae | 2007-05-21 18:09:13 +0800 | [diff] [blame] | 76 | |
| 77 | printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__); |
| 78 | set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING); |
| 79 | |
| 80 | return platform_add_devices(bfin_isp1761_devices, num_devices); |
| 81 | } |
| 82 | |
| 83 | void __exit bfin_isp1761_exit(void) |
| 84 | { |
| 85 | platform_device_unregister(&bfin_isp1761_device); |
| 86 | } |
| 87 | |
| 88 | arch_initcall(bfin_isp1761_init); |
| 89 | #endif |
| 90 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 91 | /* |
| 92 | * USB-LAN EzExtender board |
| 93 | * Driver needs to know address, irq and flag pin. |
| 94 | */ |
| 95 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 96 | static struct resource smc91x_resources[] = { |
| 97 | { |
| 98 | .name = "smc91x-regs", |
| 99 | .start = 0x2C010300, |
| 100 | .end = 0x2C010300 + 16, |
| 101 | .flags = IORESOURCE_MEM, |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 102 | }, { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 103 | |
| 104 | .start = IRQ_PF9, |
| 105 | .end = IRQ_PF9, |
| 106 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 107 | }, |
| 108 | }; |
| 109 | |
| 110 | static struct platform_device smc91x_device = { |
| 111 | .name = "smc91x", |
| 112 | .id = 0, |
| 113 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 114 | .resource = smc91x_resources, |
| 115 | }; |
| 116 | #endif |
| 117 | |
| 118 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 119 | static struct resource bfin_uart_resources[] = { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 120 | { |
| 121 | .start = 0xFFC00400, |
| 122 | .end = 0xFFC004FF, |
| 123 | .flags = IORESOURCE_MEM, |
| 124 | }, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 125 | }; |
| 126 | |
| 127 | static struct platform_device bfin_uart_device = { |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 128 | .name = "bfin-uart", |
| 129 | .id = 1, |
| 130 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 131 | .resource = bfin_uart_resources, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 132 | }; |
| 133 | #endif |
| 134 | |
| 135 | #ifdef CONFIG_SPI_BFIN |
| 136 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
| 137 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 138 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 139 | .enable_dma = 0, |
| 140 | .bits_per_word = 16, |
| 141 | }; |
| 142 | #endif |
| 143 | #endif |
| 144 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame^] | 145 | /* SPI (0) */ |
| 146 | static struct resource bfin_spi0_resource[] = { |
| 147 | [0] = { |
| 148 | .start = SPI0_REGBASE, |
| 149 | .end = SPI0_REGBASE + 0xFF, |
| 150 | .flags = IORESOURCE_MEM, |
| 151 | }, |
| 152 | [1] = { |
| 153 | .start = CH_SPI, |
| 154 | .end = CH_SPI, |
| 155 | .flags = IORESOURCE_IRQ, |
| 156 | } |
| 157 | }; |
| 158 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 159 | /* SPI controller data */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame^] | 160 | static struct bfin5xx_spi_master bfin_spi0_info = { |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 161 | .num_chipselect = 8, |
| 162 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
| 163 | }; |
| 164 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame^] | 165 | static struct platform_device bfin_spi0_device = { |
| 166 | .name = "bfin-spi", |
| 167 | .id = 0, /* Bus number */ |
| 168 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 169 | .resource = bfin_spi0_resource, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 170 | .dev = { |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame^] | 171 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 172 | }, |
| 173 | }; |
| 174 | |
| 175 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
| 176 | #if defined(CONFIG_SND_BLACKFIN_AD1836) \ |
| 177 | || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 178 | { |
| 179 | .modalias = "ad1836-spi", |
| 180 | .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame^] | 181 | .bus_num = 0, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 182 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, |
| 183 | .controller_data = &ad1836_spi_chip_info, |
| 184 | }, |
| 185 | #endif |
| 186 | }; |
| 187 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame^] | 188 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 189 | #define PATA_INT 55 |
| 190 | |
| 191 | static struct pata_platform_info bfin_pata_platform_data = { |
| 192 | .ioport_shift = 1, |
| 193 | .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, |
| 194 | }; |
| 195 | |
| 196 | static struct resource bfin_pata_resources[] = { |
| 197 | { |
| 198 | .start = 0x20314020, |
| 199 | .end = 0x2031403F, |
| 200 | .flags = IORESOURCE_MEM, |
| 201 | }, |
| 202 | { |
| 203 | .start = 0x2031401C, |
| 204 | .end = 0x2031401F, |
| 205 | .flags = IORESOURCE_MEM, |
| 206 | }, |
| 207 | { |
| 208 | .start = PATA_INT, |
| 209 | .end = PATA_INT, |
| 210 | .flags = IORESOURCE_IRQ, |
| 211 | }, |
| 212 | }; |
| 213 | |
| 214 | static struct platform_device bfin_pata_device = { |
| 215 | .name = "pata_platform", |
| 216 | .id = -1, |
| 217 | .num_resources = ARRAY_SIZE(bfin_pata_resources), |
| 218 | .resource = bfin_pata_resources, |
| 219 | .dev = { |
| 220 | .platform_data = &bfin_pata_platform_data, |
| 221 | } |
| 222 | }; |
| 223 | #endif |
| 224 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 225 | static struct platform_device *ezkit_devices[] __initdata = { |
| 226 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 227 | &smc91x_device, |
| 228 | #endif |
| 229 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame^] | 230 | &bfin_spi0_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 231 | #endif |
| 232 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 233 | &bfin_uart_device, |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 234 | #endif |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame^] | 235 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 236 | &bfin_pata_device, |
| 237 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 238 | }; |
| 239 | |
| 240 | static int __init ezkit_init(void) |
| 241 | { |
| 242 | int ret; |
| 243 | |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 244 | printk(KERN_INFO "%s(): registering device resources\n", __func__); |
| 245 | |
| 246 | ret = platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 247 | if (ret < 0) |
| 248 | return ret; |
Mike Frysinger | c0fc525 | 2007-05-21 18:09:25 +0800 | [diff] [blame] | 249 | |
| 250 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 251 | bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() | (1 << 12)); |
| 252 | SSYNC(); |
| 253 | #endif |
| 254 | |
Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame^] | 255 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 256 | spi_register_board_info(bfin_spi_board_info, |
| 257 | ARRAY_SIZE(bfin_spi_board_info)); |
| 258 | #endif |
| 259 | |
| 260 | #if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) |
| 261 | irq_desc[PATA_INT].status |= IRQ_NOAUTOEN; |
| 262 | #endif |
| 263 | return 0; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | arch_initcall(ezkit_init); |