Javier Herrero | ab472a0 | 2007-10-29 16:14:44 +0800 | [diff] [blame] | 1 | /* |
| 2 | * File: arch/blackfin/mach-bf533/H8606.c |
| 3 | * Based on: arch/blackfin/mach-bf533/stamp.c |
| 4 | * Author: Javier Herrero <jherrero@hvsistemas.es> |
| 5 | * |
| 6 | * Created: 2007 |
| 7 | * Description: Board Info File for the HV Sistemas H8606 board |
| 8 | * |
| 9 | * Modified: |
| 10 | * Copyright 2005 National ICT Australia (NICTA) |
| 11 | * Copyright 2004-2006 Analog Devices Inc |
| 12 | * Copyright 2007 HV Sistemas S.L. |
| 13 | * |
| 14 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
| 15 | * |
| 16 | * This program is free software; you can redistribute it and/or modify |
| 17 | * it under the terms of the GNU General Public License as published by |
| 18 | * the Free Software Foundation; either version 2 of the License, or |
| 19 | * (at your option) any later version. |
| 20 | * |
| 21 | * This program is distributed in the hope that it will be useful, |
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 24 | * GNU General Public License for more details. |
| 25 | * |
| 26 | * You should have received a copy of the GNU General Public License |
| 27 | * along with this program; if not, see the file COPYING, or write |
| 28 | * to the Free Software Foundation, Inc., |
| 29 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 30 | */ |
| 31 | |
| 32 | #include <linux/device.h> |
| 33 | #include <linux/platform_device.h> |
| 34 | #include <linux/mtd/mtd.h> |
| 35 | #include <linux/mtd/partitions.h> |
| 36 | #include <linux/spi/spi.h> |
| 37 | #include <linux/spi/flash.h> |
| 38 | #if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) |
| 39 | #include <linux/usb_isp1362.h> |
| 40 | #endif |
| 41 | #include <linux/pata_platform.h> |
| 42 | #include <linux/irq.h> |
| 43 | #include <asm/dma.h> |
| 44 | #include <asm/bfin5xx_spi.h> |
| 45 | #include <asm/reboot.h> |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame^] | 46 | #include <asm/portmux.h> |
Javier Herrero | ab472a0 | 2007-10-29 16:14:44 +0800 | [diff] [blame] | 47 | |
| 48 | /* |
| 49 | * Name the Board for the /proc/cpuinfo |
| 50 | */ |
| 51 | const char bfin_board_name[] = "HV Sistemas H8606"; |
| 52 | |
| 53 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_BFIN_MODULE) |
| 54 | static struct platform_device rtc_device = { |
| 55 | .name = "rtc-bfin", |
| 56 | .id = -1, |
| 57 | }; |
| 58 | #endif |
| 59 | |
| 60 | /* |
| 61 | * Driver needs to know address, irq and flag pin. |
| 62 | */ |
| 63 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 64 | static struct resource dm9000_resources[] = { |
| 65 | [0] = { |
| 66 | .start = 0x20300000, |
| 67 | .end = 0x20300000 + 8, |
| 68 | .flags = IORESOURCE_MEM, |
| 69 | }, |
| 70 | [1] = { |
| 71 | .start = IRQ_PF10, |
| 72 | .end = IRQ_PF10, |
| 73 | .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE), |
| 74 | }, |
| 75 | }; |
| 76 | |
| 77 | static struct platform_device dm9000_device = { |
| 78 | .id = 0, |
| 79 | .name = "dm9000", |
| 80 | .resource = dm9000_resources, |
| 81 | .num_resources = ARRAY_SIZE(dm9000_resources), |
| 82 | }; |
| 83 | #endif |
| 84 | |
| 85 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 86 | static struct resource smc91x_resources[] = { |
| 87 | { |
| 88 | .name = "smc91x-regs", |
| 89 | .start = 0x20300300, |
| 90 | .end = 0x20300300 + 16, |
| 91 | .flags = IORESOURCE_MEM, |
| 92 | }, { |
| 93 | .start = IRQ_PROG_INTB, |
| 94 | .end = IRQ_PROG_INTB, |
| 95 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 96 | }, { |
| 97 | /* |
| 98 | * denotes the flag pin and is used directly if |
| 99 | * CONFIG_IRQCHIP_DEMUX_GPIO is defined. |
| 100 | */ |
| 101 | .start = IRQ_PF7, |
| 102 | .end = IRQ_PF7, |
| 103 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 104 | }, |
| 105 | }; |
| 106 | |
| 107 | static struct platform_device smc91x_device = { |
| 108 | .name = "smc91x", |
| 109 | .id = 0, |
| 110 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 111 | .resource = smc91x_resources, |
| 112 | }; |
| 113 | #endif |
| 114 | |
| 115 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 116 | static struct resource net2272_bfin_resources[] = { |
| 117 | { |
| 118 | .start = 0x20300000, |
| 119 | .end = 0x20300000 + 0x100, |
| 120 | .flags = IORESOURCE_MEM, |
| 121 | }, { |
| 122 | .start = IRQ_PF10, |
| 123 | .end = IRQ_PF10, |
| 124 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 125 | }, |
| 126 | }; |
| 127 | |
| 128 | static struct platform_device net2272_bfin_device = { |
| 129 | .name = "net2272", |
| 130 | .id = -1, |
| 131 | .num_resources = ARRAY_SIZE(net2272_bfin_resources), |
| 132 | .resource = net2272_bfin_resources, |
| 133 | }; |
| 134 | #endif |
| 135 | |
| 136 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 137 | /* all SPI peripherals info goes here */ |
| 138 | |
| 139 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 140 | static struct mtd_partition bfin_spi_flash_partitions[] = { |
| 141 | { |
| 142 | .name = "bootloader", |
| 143 | .size = 0x00060000, |
| 144 | .offset = 0, |
| 145 | .mask_flags = MTD_CAP_ROM |
| 146 | }, { |
| 147 | .name = "kernel", |
| 148 | .size = 0x100000, |
| 149 | .offset = 0x60000 |
| 150 | }, { |
| 151 | .name = "file system", |
| 152 | .size = 0x6a0000, |
| 153 | .offset = 0x00160000, |
| 154 | } |
| 155 | }; |
| 156 | |
| 157 | static struct flash_platform_data bfin_spi_flash_data = { |
| 158 | .name = "m25p80", |
| 159 | .parts = bfin_spi_flash_partitions, |
| 160 | .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), |
| 161 | .type = "m25p64", |
| 162 | }; |
| 163 | |
| 164 | /* SPI flash chip (m25p64) */ |
| 165 | static struct bfin5xx_spi_chip spi_flash_chip_info = { |
| 166 | .enable_dma = 0, /* use dma transfer with this chip*/ |
| 167 | .bits_per_word = 8, |
| 168 | }; |
| 169 | #endif |
| 170 | |
| 171 | #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 172 | /* SPI ADC chip */ |
| 173 | static struct bfin5xx_spi_chip spi_adc_chip_info = { |
| 174 | .ctl_reg = 0x1000, |
| 175 | .enable_dma = 1, /* use dma transfer with this chip*/ |
| 176 | .bits_per_word = 16, |
| 177 | }; |
| 178 | #endif |
| 179 | |
| 180 | #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 181 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { |
| 182 | .ctl_reg = 0x1000, |
| 183 | .enable_dma = 0, |
| 184 | .bits_per_word = 16, |
| 185 | }; |
| 186 | #endif |
| 187 | |
| 188 | #if defined(CONFIG_PBX) |
| 189 | static struct bfin5xx_spi_chip spi_si3xxx_chip_info = { |
| 190 | .ctl_reg = 0x1c04, |
| 191 | .enable_dma = 0, |
| 192 | .bits_per_word = 8, |
| 193 | .cs_change_per_word = 1, |
| 194 | }; |
| 195 | #endif |
| 196 | |
| 197 | /* Notice: for blackfin, the speed_hz is the value of register |
| 198 | * SPI_BAUD, not the real baudrate */ |
| 199 | static struct spi_board_info bfin_spi_board_info[] __initdata = { |
| 200 | #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE) |
| 201 | { |
| 202 | /* the modalias must be the same as spi device driver name */ |
| 203 | .modalias = "m25p80", /* Name of spi_driver for this device */ |
| 204 | /* this value is the baudrate divisor */ |
| 205 | .max_speed_hz = 50000000, /* actual baudrate is SCLK/(2xspeed_hz) */ |
| 206 | .bus_num = 0, /* Framework bus number */ |
| 207 | .chip_select = 2, /* Framework chip select. On STAMP537 it is SPISSEL2*/ |
| 208 | .platform_data = &bfin_spi_flash_data, |
| 209 | .controller_data = &spi_flash_chip_info, |
| 210 | .mode = SPI_MODE_3, |
| 211 | }, |
| 212 | #endif |
| 213 | |
| 214 | #if defined(CONFIG_SPI_ADC_BF533) || defined(CONFIG_SPI_ADC_BF533_MODULE) |
| 215 | { |
| 216 | .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ |
| 217 | .max_speed_hz = 4, /* actual baudrate is SCLK/(2xspeed_hz) */ |
| 218 | .bus_num = 1, /* Framework bus number */ |
| 219 | .chip_select = 1, /* Framework chip select. */ |
| 220 | .platform_data = NULL, /* No spi_driver specific config */ |
| 221 | .controller_data = &spi_adc_chip_info, |
| 222 | }, |
| 223 | #endif |
| 224 | |
| 225 | #if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) |
| 226 | { |
| 227 | .modalias = "ad1836-spi", |
| 228 | .max_speed_hz = 16, |
| 229 | .bus_num = 1, |
| 230 | .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT, |
| 231 | .controller_data = &ad1836_spi_chip_info, |
| 232 | }, |
| 233 | #endif |
| 234 | |
| 235 | #if defined(CONFIG_PBX) |
| 236 | { |
| 237 | .modalias = "fxs-spi", |
| 238 | .max_speed_hz = 4, |
| 239 | .bus_num = 1, |
| 240 | .chip_select = 3, |
| 241 | .controller_data = &spi_si3xxx_chip_info, |
| 242 | }, |
| 243 | |
| 244 | { |
| 245 | .modalias = "fxo-spi", |
| 246 | .max_speed_hz = 4, |
| 247 | .bus_num = 1, |
| 248 | .chip_select = 2, |
| 249 | .controller_data = &spi_si3xxx_chip_info, |
| 250 | }, |
| 251 | #endif |
| 252 | }; |
| 253 | |
| 254 | /* SPI (0) */ |
| 255 | static struct resource bfin_spi0_resource[] = { |
| 256 | [0] = { |
| 257 | .start = SPI0_REGBASE, |
| 258 | .end = SPI0_REGBASE + 0xFF, |
| 259 | .flags = IORESOURCE_MEM, |
| 260 | }, |
| 261 | [1] = { |
| 262 | .start = CH_SPI, |
| 263 | .end = CH_SPI, |
| 264 | .flags = IORESOURCE_IRQ, |
| 265 | } |
| 266 | }; |
| 267 | |
| 268 | |
| 269 | /* SPI controller data */ |
| 270 | static struct bfin5xx_spi_master bfin_spi0_info = { |
| 271 | .num_chipselect = 8, |
| 272 | .enable_dma = 1, /* master has the ability to do dma transfer */ |
Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame^] | 273 | .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, |
Javier Herrero | ab472a0 | 2007-10-29 16:14:44 +0800 | [diff] [blame] | 274 | }; |
| 275 | |
| 276 | static struct platform_device bfin_spi0_device = { |
| 277 | .name = "bfin-spi", |
| 278 | .id = 0, /* Bus number */ |
| 279 | .num_resources = ARRAY_SIZE(bfin_spi0_resource), |
| 280 | .resource = bfin_spi0_resource, |
| 281 | .dev = { |
| 282 | .platform_data = &bfin_spi0_info, /* Passed to driver */ |
| 283 | }, |
| 284 | }; |
| 285 | #endif /* spi master and devices */ |
| 286 | |
| 287 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) |
| 288 | static struct platform_device bfin_fb_device = { |
| 289 | .name = "bf537-fb", |
| 290 | }; |
| 291 | #endif |
| 292 | |
| 293 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 294 | static struct resource bfin_uart_resources[] = { |
| 295 | { |
| 296 | .start = 0xFFC00400, |
| 297 | .end = 0xFFC004FF, |
| 298 | .flags = IORESOURCE_MEM, |
| 299 | }, |
| 300 | }; |
| 301 | |
| 302 | static struct platform_device bfin_uart_device = { |
| 303 | .name = "bfin-uart", |
| 304 | .id = 1, |
| 305 | .num_resources = ARRAY_SIZE(bfin_uart_resources), |
| 306 | .resource = bfin_uart_resources, |
| 307 | }; |
| 308 | #endif |
| 309 | |
| 310 | static struct platform_device *stamp_devices[] __initdata = { |
| 311 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) |
| 312 | &rtc_device, |
| 313 | #endif |
| 314 | |
| 315 | #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE) |
| 316 | &dm9000_device, |
| 317 | #endif |
| 318 | |
| 319 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 320 | &smc91x_device, |
| 321 | #endif |
| 322 | |
| 323 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) |
| 324 | &net2272_bfin_device, |
| 325 | #endif |
| 326 | |
| 327 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 328 | &bfin_spi0_device, |
| 329 | #endif |
| 330 | |
| 331 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) |
| 332 | &bfin_uart_device, |
| 333 | #endif |
| 334 | }; |
| 335 | |
| 336 | static int __init H8606_init(void) |
| 337 | { |
| 338 | printk(KERN_INFO "HV Sistemas H8606 board support by http://www.hvsistemas.com\n"); |
| 339 | printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__); |
| 340 | platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); |
| 341 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) |
| 342 | spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); |
| 343 | #endif |
| 344 | return 0; |
| 345 | } |
| 346 | |
| 347 | arch_initcall(H8606_init); |