| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* | 
| Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 2 |  * Copyright 2004-2009 Analog Devices Inc. | 
 | 3 |  *                2005 National ICT Australia (NICTA) | 
 | 4 |  *                      Aidan Williams <aidan@nicta.com.au> | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 5 |  * | 
| Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 6 |  * Licensed under the GPL-2 or later. | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 7 |  */ | 
 | 8 |  | 
 | 9 | #include <linux/device.h> | 
| Mike Frysinger | 43f73fe | 2007-12-24 19:35:35 +0800 | [diff] [blame] | 10 | #include <linux/etherdevice.h> | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 11 | #include <linux/platform_device.h> | 
 | 12 | #include <linux/mtd/mtd.h> | 
 | 13 | #include <linux/mtd/partitions.h> | 
 | 14 | #include <linux/spi/spi.h> | 
 | 15 | #include <linux/spi/flash.h> | 
| Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 16 | #include <linux/irq.h> | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 17 | #include <asm/dma.h> | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 18 | #include <asm/bfin5xx_spi.h> | 
| Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 19 | #include <asm/portmux.h> | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 20 |  | 
 | 21 | #include <linux/spi/ad7877.h> | 
 | 22 |  | 
 | 23 | /* | 
 | 24 |  * Name the Board for the /proc/cpuinfo | 
 | 25 |  */ | 
| Mike Frysinger | fe85cad | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 26 | const char bfin_board_name[] = "ADI PNAV-1.0"; | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 27 |  | 
 | 28 | /* | 
 | 29 |  *  Driver needs to know address, irq and flag pin. | 
 | 30 |  */ | 
 | 31 |  | 
 | 32 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) | 
 | 33 | static struct resource bfin_pcmcia_cf_resources[] = { | 
 | 34 | 	{ | 
 | 35 | 		.start = 0x20310000, /* IO PORT */ | 
 | 36 | 		.end = 0x20312000, | 
 | 37 | 		.flags = IORESOURCE_MEM, | 
| Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 38 | 	}, { | 
| Simon Arlott | d2d50aa | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 39 | 		.start = 0x20311000, /* Attribute Memory */ | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 40 | 		.end = 0x20311FFF, | 
 | 41 | 		.flags = IORESOURCE_MEM, | 
| Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 42 | 	}, { | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 43 | 		.start = IRQ_PF4, | 
 | 44 | 		.end = IRQ_PF4, | 
 | 45 | 		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | 
| Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 46 | 	}, { | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 47 | 		.start = 6, /* Card Detect PF6 */ | 
 | 48 | 		.end = 6, | 
 | 49 | 		.flags = IORESOURCE_IRQ, | 
 | 50 | 	}, | 
 | 51 | }; | 
 | 52 |  | 
 | 53 | static struct platform_device bfin_pcmcia_cf_device = { | 
 | 54 | 	.name = "bfin_cf_pcmcia", | 
 | 55 | 	.id = -1, | 
 | 56 | 	.num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources), | 
 | 57 | 	.resource = bfin_pcmcia_cf_resources, | 
 | 58 | }; | 
 | 59 | #endif | 
 | 60 |  | 
 | 61 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) | 
 | 62 | static struct platform_device rtc_device = { | 
 | 63 | 	.name = "rtc-bfin", | 
 | 64 | 	.id   = -1, | 
 | 65 | }; | 
 | 66 | #endif | 
 | 67 |  | 
 | 68 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) | 
| Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 69 | #include <linux/smc91x.h> | 
 | 70 |  | 
 | 71 | static struct smc91x_platdata smc91x_info = { | 
 | 72 | 	.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, | 
 | 73 | 	.leda = RPC_LED_100_10, | 
 | 74 | 	.ledb = RPC_LED_TX_RX, | 
 | 75 | }; | 
 | 76 |  | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 77 | static struct resource smc91x_resources[] = { | 
 | 78 | 	{ | 
 | 79 | 		.name = "smc91x-regs", | 
 | 80 | 		.start = 0x20300300, | 
 | 81 | 		.end = 0x20300300 + 16, | 
 | 82 | 		.flags = IORESOURCE_MEM, | 
| Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 83 | 	}, { | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 84 |  | 
 | 85 | 		.start = IRQ_PF7, | 
 | 86 | 		.end = IRQ_PF7, | 
 | 87 | 		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | 
 | 88 | 	}, | 
 | 89 | }; | 
 | 90 | static struct platform_device smc91x_device = { | 
 | 91 | 	.name = "smc91x", | 
 | 92 | 	.id = 0, | 
 | 93 | 	.num_resources = ARRAY_SIZE(smc91x_resources), | 
 | 94 | 	.resource = smc91x_resources, | 
| Michael Hennerich | 61f09b5 | 2009-07-24 08:48:31 +0000 | [diff] [blame] | 95 | 	.dev	= { | 
 | 96 | 		.platform_data	= &smc91x_info, | 
 | 97 | 	}, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 98 | }; | 
 | 99 | #endif | 
 | 100 |  | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 101 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 
| Sonic Zhang | 02460d0 | 2010-06-11 10:44:22 +0000 | [diff] [blame] | 102 | #include <linux/bfin_mac.h> | 
 | 103 | static const unsigned short bfin_mac_peripherals[] = P_RMII0; | 
 | 104 |  | 
 | 105 | static struct bfin_phydev_platform_data bfin_phydev_data[] = { | 
 | 106 | 	{ | 
 | 107 | 		.addr = 1, | 
 | 108 | 		.irq = IRQ_MAC_PHYINT, | 
 | 109 | 	}, | 
 | 110 | }; | 
 | 111 |  | 
 | 112 | static struct bfin_mii_bus_platform_data bfin_mii_bus_data = { | 
 | 113 | 	.phydev_number = 1, | 
 | 114 | 	.phydev_data = bfin_phydev_data, | 
 | 115 | 	.phy_mode = PHY_INTERFACE_MODE_RMII, | 
 | 116 | 	.mac_peripherals = bfin_mac_peripherals, | 
 | 117 | }; | 
 | 118 |  | 
| Graf Yang | 6531962 | 2009-02-04 16:49:45 +0800 | [diff] [blame] | 119 | static struct platform_device bfin_mii_bus = { | 
 | 120 | 	.name = "bfin_mii_bus", | 
| Sonic Zhang | 02460d0 | 2010-06-11 10:44:22 +0000 | [diff] [blame] | 121 | 	.dev = { | 
 | 122 | 		.platform_data = &bfin_mii_bus_data, | 
 | 123 | 	} | 
| Graf Yang | 6531962 | 2009-02-04 16:49:45 +0800 | [diff] [blame] | 124 | }; | 
 | 125 |  | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 126 | static struct platform_device bfin_mac_device = { | 
 | 127 | 	.name = "bfin_mac", | 
| Sonic Zhang | 02460d0 | 2010-06-11 10:44:22 +0000 | [diff] [blame] | 128 | 	.dev = { | 
 | 129 | 		.platform_data = &bfin_mii_bus, | 
 | 130 | 	} | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 131 | }; | 
 | 132 | #endif | 
 | 133 |  | 
 | 134 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) | 
 | 135 | static struct resource net2272_bfin_resources[] = { | 
 | 136 | 	{ | 
 | 137 | 		.start = 0x20300000, | 
 | 138 | 		.end = 0x20300000 + 0x100, | 
 | 139 | 		.flags = IORESOURCE_MEM, | 
| Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 140 | 	}, { | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 141 | 		.start = IRQ_PF7, | 
 | 142 | 		.end = IRQ_PF7, | 
 | 143 | 		.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | 
 | 144 | 	}, | 
 | 145 | }; | 
 | 146 |  | 
 | 147 | static struct platform_device net2272_bfin_device = { | 
 | 148 | 	.name = "net2272", | 
 | 149 | 	.id = -1, | 
 | 150 | 	.num_resources = ARRAY_SIZE(net2272_bfin_resources), | 
 | 151 | 	.resource = net2272_bfin_resources, | 
 | 152 | }; | 
 | 153 | #endif | 
 | 154 |  | 
 | 155 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | 
 | 156 | /* all SPI peripherals info goes here */ | 
 | 157 |  | 
 | 158 | #if defined(CONFIG_MTD_M25P80) \ | 
 | 159 | 	|| defined(CONFIG_MTD_M25P80_MODULE) | 
 | 160 | static struct mtd_partition bfin_spi_flash_partitions[] = { | 
 | 161 | 	{ | 
| Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 162 | 		.name = "bootloader(spi)", | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 163 | 		.size = 0x00020000, | 
 | 164 | 		.offset = 0, | 
 | 165 | 		.mask_flags = MTD_CAP_ROM | 
| Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 166 | 	}, { | 
| Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 167 | 		.name = "linux kernel(spi)", | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 168 | 		.size = 0xe0000, | 
 | 169 | 		.offset = 0x20000 | 
| Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 170 | 	}, { | 
| Robin Getz | aa58297 | 2008-08-05 17:47:29 +0800 | [diff] [blame] | 171 | 		.name = "file system(spi)", | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 172 | 		.size = 0x700000, | 
 | 173 | 		.offset = 0x00100000, | 
 | 174 | 	} | 
 | 175 | }; | 
 | 176 |  | 
 | 177 | static struct flash_platform_data bfin_spi_flash_data = { | 
 | 178 | 	.name = "m25p80", | 
 | 179 | 	.parts = bfin_spi_flash_partitions, | 
 | 180 | 	.nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions), | 
 | 181 | 	.type = "m25p64", | 
 | 182 | }; | 
 | 183 |  | 
 | 184 | /* SPI flash chip (m25p64) */ | 
 | 185 | static struct bfin5xx_spi_chip spi_flash_chip_info = { | 
 | 186 | 	.enable_dma = 0,         /* use dma transfer with this chip*/ | 
 | 187 | 	.bits_per_word = 8, | 
 | 188 | }; | 
 | 189 | #endif | 
 | 190 |  | 
| Mike Frysinger | a261eec | 2009-05-20 14:05:36 +0000 | [diff] [blame] | 191 | #if defined(CONFIG_BFIN_SPI_ADC) \ | 
 | 192 | 	|| defined(CONFIG_BFIN_SPI_ADC_MODULE) | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 193 | /* SPI ADC chip */ | 
 | 194 | static struct bfin5xx_spi_chip spi_adc_chip_info = { | 
 | 195 | 	.enable_dma = 1,         /* use dma transfer with this chip*/ | 
 | 196 | 	.bits_per_word = 16, | 
 | 197 | }; | 
 | 198 | #endif | 
 | 199 |  | 
| Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 200 | #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \ | 
 | 201 | 	|| defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE) | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 202 | static struct bfin5xx_spi_chip ad1836_spi_chip_info = { | 
 | 203 | 	.enable_dma = 0, | 
 | 204 | 	.bits_per_word = 16, | 
 | 205 | }; | 
 | 206 | #endif | 
 | 207 |  | 
| Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 208 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) | 
 | 209 | static struct bfin5xx_spi_chip mmc_spi_chip_info = { | 
 | 210 | 	.enable_dma = 0, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 211 | 	.bits_per_word = 8, | 
 | 212 | }; | 
 | 213 | #endif | 
 | 214 |  | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 215 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) | 
 | 216 | static struct bfin5xx_spi_chip spi_ad7877_chip_info = { | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 217 | 	.enable_dma = 0, | 
 | 218 | 	.bits_per_word = 16, | 
 | 219 | }; | 
 | 220 |  | 
 | 221 | static const struct ad7877_platform_data bfin_ad7877_ts_info = { | 
 | 222 | 	.model			= 7877, | 
 | 223 | 	.vref_delay_usecs	= 50,	/* internal, no capacitor */ | 
 | 224 | 	.x_plate_ohms		= 419, | 
 | 225 | 	.y_plate_ohms		= 486, | 
 | 226 | 	.pressure_max		= 1000, | 
 | 227 | 	.pressure_min		= 0, | 
 | 228 | 	.stopacq_polarity 	= 1, | 
 | 229 | 	.first_conversion_delay = 3, | 
 | 230 | 	.acquisition_time 	= 1, | 
 | 231 | 	.averaging 		= 1, | 
 | 232 | 	.pen_down_acc_interval 	= 1, | 
 | 233 | }; | 
 | 234 | #endif | 
 | 235 |  | 
 | 236 | static struct spi_board_info bfin_spi_board_info[] __initdata = { | 
 | 237 | #if defined(CONFIG_MTD_M25P80) \ | 
 | 238 | 	|| defined(CONFIG_MTD_M25P80_MODULE) | 
 | 239 | 	{ | 
 | 240 | 		/* the modalias must be the same as spi device driver name */ | 
 | 241 | 		.modalias = "m25p80", /* Name of spi_driver for this device */ | 
 | 242 | 		.max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */ | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 243 | 		.bus_num = 0, /* Framework bus number */ | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 244 | 		.chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/ | 
 | 245 | 		.platform_data = &bfin_spi_flash_data, | 
 | 246 | 		.controller_data = &spi_flash_chip_info, | 
 | 247 | 		.mode = SPI_MODE_3, | 
 | 248 | 	}, | 
 | 249 | #endif | 
 | 250 |  | 
| Mike Frysinger | a261eec | 2009-05-20 14:05:36 +0000 | [diff] [blame] | 251 | #if defined(CONFIG_BFIN_SPI_ADC) \ | 
 | 252 | 	|| defined(CONFIG_BFIN_SPI_ADC_MODULE) | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 253 | 	{ | 
 | 254 | 		.modalias = "bfin_spi_adc", /* Name of spi_driver for this device */ | 
 | 255 | 		.max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */ | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 256 | 		.bus_num = 0, /* Framework bus number */ | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 257 | 		.chip_select = 1, /* Framework chip select. */ | 
 | 258 | 		.platform_data = NULL, /* No spi_driver specific config */ | 
 | 259 | 		.controller_data = &spi_adc_chip_info, | 
 | 260 | 	}, | 
 | 261 | #endif | 
 | 262 |  | 
| Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 263 | #if defined(CONFIG_SND_BF5XX_SOC_AD183X) \ | 
 | 264 | 	|| defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE) | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 265 | 	{ | 
| Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 266 | 		.modalias = "ad183x", | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 267 | 		.max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */ | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 268 | 		.bus_num = 0, | 
| Barry Song | 7ba8006 | 2010-01-28 09:37:21 +0000 | [diff] [blame] | 269 | 		.chip_select = 4, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 270 | 		.controller_data = &ad1836_spi_chip_info, | 
 | 271 | 	}, | 
 | 272 | #endif | 
| Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 273 | #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE) | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 274 | 	{ | 
| Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 275 | 		.modalias = "mmc_spi", | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 276 | 		.max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */ | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 277 | 		.bus_num = 0, | 
| Michael Hennerich | f3f704d | 2009-03-06 00:27:57 +0800 | [diff] [blame] | 278 | 		.chip_select = 5, | 
 | 279 | 		.controller_data = &mmc_spi_chip_info, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 280 | 		.mode = SPI_MODE_3, | 
 | 281 | 	}, | 
 | 282 | #endif | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 283 | #if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE) | 
 | 284 | { | 
 | 285 | 	.modalias		= "ad7877", | 
 | 286 | 	.platform_data		= &bfin_ad7877_ts_info, | 
 | 287 | 	.irq			= IRQ_PF2, | 
 | 288 | 	.max_speed_hz		= 12500000,     /* max spi clock (SCK) speed in HZ */ | 
| Michael Hennerich | c7d4896 | 2007-11-15 21:33:31 +0800 | [diff] [blame] | 289 | 	.bus_num		= 0, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 290 | 	.chip_select  		= 5, | 
 | 291 | 	.controller_data = &spi_ad7877_chip_info, | 
 | 292 | }, | 
 | 293 | #endif | 
 | 294 |  | 
 | 295 | }; | 
 | 296 |  | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 297 | /* SPI (0) */ | 
 | 298 | static struct resource bfin_spi0_resource[] = { | 
 | 299 | 	[0] = { | 
 | 300 | 		.start = SPI0_REGBASE, | 
 | 301 | 		.end   = SPI0_REGBASE + 0xFF, | 
 | 302 | 		.flags = IORESOURCE_MEM, | 
 | 303 | 		}, | 
 | 304 | 	[1] = { | 
 | 305 | 		.start = CH_SPI, | 
 | 306 | 		.end   = CH_SPI, | 
| Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 307 | 		.flags = IORESOURCE_DMA, | 
 | 308 | 	}, | 
 | 309 | 	[2] = { | 
 | 310 | 		.start = IRQ_SPI, | 
 | 311 | 		.end   = IRQ_SPI, | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 312 | 		.flags = IORESOURCE_IRQ, | 
| Yi Li | 5312269 | 2009-06-05 12:11:11 +0000 | [diff] [blame] | 313 | 	}, | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 314 | }; | 
 | 315 |  | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 316 | /* SPI controller data */ | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 317 | static struct bfin5xx_spi_master bfin_spi0_info = { | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 318 | 	.num_chipselect = 8, | 
 | 319 | 	.enable_dma = 1,  /* master has the ability to do dma transfer */ | 
| Bryan Wu | 5d448dd | 2007-11-12 23:24:42 +0800 | [diff] [blame] | 320 | 	.pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 321 | }; | 
 | 322 |  | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 323 | static struct platform_device bfin_spi0_device = { | 
 | 324 | 	.name = "bfin-spi", | 
 | 325 | 	.id = 0, /* Bus number */ | 
 | 326 | 	.num_resources = ARRAY_SIZE(bfin_spi0_resource), | 
 | 327 | 	.resource = bfin_spi0_resource, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 328 | 	.dev = { | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 329 | 		.platform_data = &bfin_spi0_info, /* Passed to driver */ | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 330 | 	}, | 
 | 331 | }; | 
 | 332 | #endif  /* spi master and devices */ | 
 | 333 |  | 
 | 334 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) | 
 | 335 | static struct platform_device bfin_fb_device = { | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 336 | 	.name = "bf537-lq035", | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 337 | }; | 
 | 338 | #endif | 
 | 339 |  | 
 | 340 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) | 
| Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 341 | #ifdef CONFIG_SERIAL_BFIN_UART0 | 
 | 342 | static struct resource bfin_uart0_resources[] = { | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 343 | 	{ | 
| Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 344 | 		.start = UART0_THR, | 
 | 345 | 		.end = UART0_GCTL+2, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 346 | 		.flags = IORESOURCE_MEM, | 
| Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 347 | 	}, | 
 | 348 | 	{ | 
 | 349 | 		.start = IRQ_UART0_RX, | 
 | 350 | 		.end = IRQ_UART0_RX+1, | 
 | 351 | 		.flags = IORESOURCE_IRQ, | 
 | 352 | 	}, | 
 | 353 | 	{ | 
 | 354 | 		.start = IRQ_UART0_ERROR, | 
 | 355 | 		.end = IRQ_UART0_ERROR, | 
 | 356 | 		.flags = IORESOURCE_IRQ, | 
 | 357 | 	}, | 
 | 358 | 	{ | 
 | 359 | 		.start = CH_UART0_TX, | 
 | 360 | 		.end = CH_UART0_TX, | 
 | 361 | 		.flags = IORESOURCE_DMA, | 
 | 362 | 	}, | 
 | 363 | 	{ | 
 | 364 | 		.start = CH_UART0_RX, | 
 | 365 | 		.end = CH_UART0_RX, | 
 | 366 | 		.flags = IORESOURCE_DMA, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 367 | 	}, | 
 | 368 | }; | 
 | 369 |  | 
| Mike Frysinger | a8b1988 | 2010-11-24 09:23:04 +0000 | [diff] [blame] | 370 | static unsigned short bfin_uart0_peripherals[] = { | 
| Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 371 | 	P_UART0_TX, P_UART0_RX, 0 | 
 | 372 | }; | 
 | 373 |  | 
 | 374 | static struct platform_device bfin_uart0_device = { | 
 | 375 | 	.name = "bfin-uart", | 
 | 376 | 	.id = 0, | 
 | 377 | 	.num_resources = ARRAY_SIZE(bfin_uart0_resources), | 
 | 378 | 	.resource = bfin_uart0_resources, | 
 | 379 | 	.dev = { | 
 | 380 | 		.platform_data = &bfin_uart0_peripherals, /* Passed to driver */ | 
 | 381 | 	}, | 
 | 382 | }; | 
 | 383 | #endif | 
 | 384 | #ifdef CONFIG_SERIAL_BFIN_UART1 | 
 | 385 | static struct resource bfin_uart1_resources[] = { | 
 | 386 | 	{ | 
 | 387 | 		.start = UART1_THR, | 
 | 388 | 		.end = UART1_GCTL+2, | 
 | 389 | 		.flags = IORESOURCE_MEM, | 
 | 390 | 	}, | 
 | 391 | 	{ | 
 | 392 | 		.start = IRQ_UART1_RX, | 
 | 393 | 		.end = IRQ_UART1_RX+1, | 
 | 394 | 		.flags = IORESOURCE_IRQ, | 
 | 395 | 	}, | 
 | 396 | 	{ | 
 | 397 | 		.start = IRQ_UART1_ERROR, | 
 | 398 | 		.end = IRQ_UART1_ERROR, | 
 | 399 | 		.flags = IORESOURCE_IRQ, | 
 | 400 | 	}, | 
 | 401 | 	{ | 
 | 402 | 		.start = CH_UART1_TX, | 
 | 403 | 		.end = CH_UART1_TX, | 
 | 404 | 		.flags = IORESOURCE_DMA, | 
 | 405 | 	}, | 
 | 406 | 	{ | 
 | 407 | 		.start = CH_UART1_RX, | 
 | 408 | 		.end = CH_UART1_RX, | 
 | 409 | 		.flags = IORESOURCE_DMA, | 
 | 410 | 	}, | 
 | 411 | }; | 
 | 412 |  | 
| Mike Frysinger | a8b1988 | 2010-11-24 09:23:04 +0000 | [diff] [blame] | 413 | static unsigned short bfin_uart1_peripherals[] = { | 
| Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 414 | 	P_UART1_TX, P_UART1_RX, 0 | 
 | 415 | }; | 
 | 416 |  | 
 | 417 | static struct platform_device bfin_uart1_device = { | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 418 | 	.name = "bfin-uart", | 
 | 419 | 	.id = 1, | 
| Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 420 | 	.num_resources = ARRAY_SIZE(bfin_uart1_resources), | 
 | 421 | 	.resource = bfin_uart1_resources, | 
 | 422 | 	.dev = { | 
 | 423 | 		.platform_data = &bfin_uart1_peripherals, /* Passed to driver */ | 
 | 424 | 	}, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 425 | }; | 
 | 426 | #endif | 
| Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 427 | #endif | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 428 |  | 
| Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 429 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) | 
| Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 430 | #ifdef CONFIG_BFIN_SIR0 | 
| Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 431 | static struct resource bfin_sir0_resources[] = { | 
| Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 432 | 	{ | 
 | 433 | 		.start = 0xFFC00400, | 
 | 434 | 		.end = 0xFFC004FF, | 
 | 435 | 		.flags = IORESOURCE_MEM, | 
 | 436 | 	}, | 
| Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 437 | 	{ | 
 | 438 | 		.start = IRQ_UART0_RX, | 
 | 439 | 		.end = IRQ_UART0_RX+1, | 
 | 440 | 		.flags = IORESOURCE_IRQ, | 
 | 441 | 	}, | 
 | 442 | 	{ | 
 | 443 | 		.start = CH_UART0_RX, | 
 | 444 | 		.end = CH_UART0_RX+1, | 
 | 445 | 		.flags = IORESOURCE_DMA, | 
 | 446 | 	}, | 
 | 447 | }; | 
 | 448 |  | 
 | 449 | static struct platform_device bfin_sir0_device = { | 
 | 450 | 	.name = "bfin_sir", | 
 | 451 | 	.id = 0, | 
 | 452 | 	.num_resources = ARRAY_SIZE(bfin_sir0_resources), | 
 | 453 | 	.resource = bfin_sir0_resources, | 
 | 454 | }; | 
| Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 455 | #endif | 
 | 456 | #ifdef CONFIG_BFIN_SIR1 | 
| Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 457 | static struct resource bfin_sir1_resources[] = { | 
| Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 458 | 	{ | 
 | 459 | 		.start = 0xFFC02000, | 
 | 460 | 		.end = 0xFFC020FF, | 
 | 461 | 		.flags = IORESOURCE_MEM, | 
 | 462 | 	}, | 
| Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 463 | 	{ | 
 | 464 | 		.start = IRQ_UART1_RX, | 
 | 465 | 		.end = IRQ_UART1_RX+1, | 
 | 466 | 		.flags = IORESOURCE_IRQ, | 
 | 467 | 	}, | 
 | 468 | 	{ | 
 | 469 | 		.start = CH_UART1_RX, | 
 | 470 | 		.end = CH_UART1_RX+1, | 
 | 471 | 		.flags = IORESOURCE_DMA, | 
 | 472 | 	}, | 
| Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 473 | }; | 
 | 474 |  | 
| Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 475 | static struct platform_device bfin_sir1_device = { | 
| Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 476 | 	.name = "bfin_sir", | 
| Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 477 | 	.id = 1, | 
 | 478 | 	.num_resources = ARRAY_SIZE(bfin_sir1_resources), | 
 | 479 | 	.resource = bfin_sir1_resources, | 
| Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 480 | }; | 
 | 481 | #endif | 
| Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 482 | #endif | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 483 |  | 
 | 484 | static struct platform_device *stamp_devices[] __initdata = { | 
 | 485 | #if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) | 
 | 486 | 	&bfin_pcmcia_cf_device, | 
 | 487 | #endif | 
 | 488 |  | 
 | 489 | #if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) | 
 | 490 | 	&rtc_device, | 
 | 491 | #endif | 
 | 492 |  | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 493 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) | 
 | 494 | 	&smc91x_device, | 
 | 495 | #endif | 
 | 496 |  | 
 | 497 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | 
| Graf Yang | 6531962 | 2009-02-04 16:49:45 +0800 | [diff] [blame] | 498 | 	&bfin_mii_bus, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 499 | 	&bfin_mac_device, | 
 | 500 | #endif | 
 | 501 |  | 
 | 502 | #if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE) | 
 | 503 | 	&net2272_bfin_device, | 
 | 504 | #endif | 
 | 505 |  | 
 | 506 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | 
| Bryan Wu | c6c4d7b | 2007-10-11 01:20:06 +0800 | [diff] [blame] | 507 | 	&bfin_spi0_device, | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 508 | #endif | 
 | 509 |  | 
 | 510 | #if defined(CONFIG_FB_BF537_LQ035) || defined(CONFIG_FB_BF537_LQ035_MODULE) | 
 | 511 | 	&bfin_fb_device, | 
 | 512 | #endif | 
 | 513 |  | 
 | 514 | #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) | 
| Sonic Zhang | 6bd1fbe | 2009-09-09 10:46:19 +0000 | [diff] [blame] | 515 | #ifdef CONFIG_SERIAL_BFIN_UART0 | 
 | 516 | 	&bfin_uart0_device, | 
 | 517 | #endif | 
 | 518 | #ifdef CONFIG_SERIAL_BFIN_UART1 | 
 | 519 | 	&bfin_uart1_device, | 
 | 520 | #endif | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 521 | #endif | 
| Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 522 |  | 
 | 523 | #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE) | 
| Graf Yang | 42bd8bc | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 524 | #ifdef CONFIG_BFIN_SIR0 | 
 | 525 | 	&bfin_sir0_device, | 
 | 526 | #endif | 
 | 527 | #ifdef CONFIG_BFIN_SIR1 | 
 | 528 | 	&bfin_sir1_device, | 
 | 529 | #endif | 
| Graf Yang | 5be36d2 | 2008-04-25 03:09:15 +0800 | [diff] [blame] | 530 | #endif | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 531 | }; | 
 | 532 |  | 
| Mike Frysinger | 7f6678c | 2009-02-04 16:49:45 +0800 | [diff] [blame] | 533 | static int __init pnav_init(void) | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 534 | { | 
| Harvey Harrison | b85d858 | 2008-04-23 09:39:01 +0800 | [diff] [blame] | 535 | 	printk(KERN_INFO "%s(): registering device resources\n", __func__); | 
| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 536 | 	platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); | 
 | 537 | #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) | 
 | 538 | 	spi_register_board_info(bfin_spi_board_info, | 
 | 539 | 				ARRAY_SIZE(bfin_spi_board_info)); | 
 | 540 | #endif | 
 | 541 | 	return 0; | 
 | 542 | } | 
 | 543 |  | 
| Mike Frysinger | 7f6678c | 2009-02-04 16:49:45 +0800 | [diff] [blame] | 544 | arch_initcall(pnav_init); | 
| Mike Frysinger | 137b152 | 2007-11-22 16:07:03 +0800 | [diff] [blame] | 545 |  | 
| Sonic Zhang | c13ce9f | 2009-09-23 09:37:46 +0000 | [diff] [blame] | 546 | static struct platform_device *stamp_early_devices[] __initdata = { | 
 | 547 | #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK) | 
 | 548 | #ifdef CONFIG_SERIAL_BFIN_UART0 | 
 | 549 | 	&bfin_uart0_device, | 
 | 550 | #endif | 
 | 551 | #ifdef CONFIG_SERIAL_BFIN_UART1 | 
 | 552 | 	&bfin_uart1_device, | 
 | 553 | #endif | 
 | 554 | #endif | 
 | 555 | }; | 
 | 556 |  | 
 | 557 | void __init native_machine_early_platform_add_devices(void) | 
 | 558 | { | 
 | 559 | 	printk(KERN_INFO "register early platform devices\n"); | 
 | 560 | 	early_platform_add_devices(stamp_early_devices, | 
 | 561 | 		ARRAY_SIZE(stamp_early_devices)); | 
 | 562 | } | 
 | 563 |  | 
| Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 564 | void bfin_get_ether_addr(char *addr) | 
| Mike Frysinger | 137b152 | 2007-11-22 16:07:03 +0800 | [diff] [blame] | 565 | { | 
 | 566 | 	random_ether_addr(addr); | 
 | 567 | 	printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__); | 
 | 568 | } | 
| Mike Frysinger | 9862cc5 | 2007-11-15 21:21:20 +0800 | [diff] [blame] | 569 | EXPORT_SYMBOL(bfin_get_ether_addr); |