diff options
| author | wanzongshun <mcuos.com@gmail.com> | 2009-07-23 03:51:46 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-07-23 05:24:30 -0400 |
| commit | c16d5d5657294e782d505efd00bbf2452d6aa0ca (patch) | |
| tree | 9b694920c2ed4b247feb8f20bc23da2094f4a033 | |
| parent | b48147663b2582bfb91a2bf39f9d1ffe8f209122 (diff) | |
[ARM] 5618/1: Add spi resource define for w90p910 spi driver
Add spi resource define for w90p910 spi driver.
Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
| -rw-r--r-- | arch/arm/mach-w90x900/mach-w90p910evb.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/arm/mach-w90x900/mach-w90p910evb.c b/arch/arm/mach-w90x900/mach-w90p910evb.c index 2e56d84c6323..3e3a267b2dde 100644 --- a/arch/arm/mach-w90x900/mach-w90p910evb.c +++ b/arch/arm/mach-w90x900/mach-w90p910evb.c | |||
| @@ -20,7 +20,13 @@ | |||
| 20 | #include <linux/timer.h> | 20 | #include <linux/timer.h> |
| 21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
| 22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
| 23 | |||
| 23 | #include <linux/mtd/physmap.h> | 24 | #include <linux/mtd/physmap.h> |
| 25 | #include <linux/mtd/mtd.h> | ||
| 26 | #include <linux/mtd/partitions.h> | ||
| 27 | |||
| 28 | #include <linux/spi/spi.h> | ||
| 29 | #include <linux/spi/flash.h> | ||
| 24 | 30 | ||
| 25 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
| 26 | #include <asm/mach/map.h> | 32 | #include <asm/mach/map.h> |
| @@ -35,6 +41,8 @@ | |||
| 35 | 41 | ||
| 36 | #define W90P910_FLASH_BASE 0xA0000000 | 42 | #define W90P910_FLASH_BASE 0xA0000000 |
| 37 | #define W90P910_FLASH_SIZE 0x400000 | 43 | #define W90P910_FLASH_SIZE 0x400000 |
| 44 | #define SPIOFFSET 0x200 | ||
| 45 | #define SPIOREG_SIZE 0x100 | ||
| 38 | 46 | ||
| 39 | static struct mtd_partition w90p910_flash_partitions[] = { | 47 | static struct mtd_partition w90p910_flash_partitions[] = { |
| 40 | { | 48 | { |
| @@ -282,6 +290,56 @@ static struct platform_device w90p910_device_emc = { | |||
| 282 | } | 290 | } |
| 283 | }; | 291 | }; |
| 284 | 292 | ||
| 293 | /* SPI device */ | ||
| 294 | |||
| 295 | static struct resource w90p910_spi_resource[] = { | ||
| 296 | [0] = { | ||
| 297 | .start = W90X900_PA_I2C + SPIOFFSET, | ||
| 298 | .end = W90X900_PA_I2C + SPIOFFSET + SPIOREG_SIZE - 1, | ||
| 299 | .flags = IORESOURCE_MEM, | ||
| 300 | }, | ||
| 301 | [1] = { | ||
| 302 | .start = IRQ_SSP, | ||
| 303 | .end = IRQ_SSP, | ||
| 304 | .flags = IORESOURCE_IRQ, | ||
| 305 | } | ||
| 306 | }; | ||
| 307 | |||
| 308 | static struct platform_device w90p910_device_spi = { | ||
| 309 | .name = "w90p910-spi", | ||
| 310 | .id = -1, | ||
| 311 | .num_resources = ARRAY_SIZE(w90p910_spi_resource), | ||
| 312 | .resource = w90p910_spi_resource, | ||
| 313 | }; | ||
| 314 | |||
| 315 | /* spi device, spi flash info */ | ||
| 316 | |||
| 317 | static struct mtd_partition w90p910_spi_flash_partitions[] = { | ||
| 318 | { | ||
| 319 | .name = "bootloader(spi)", | ||
| 320 | .size = 0x0100000, | ||
| 321 | .offset = 0, | ||
| 322 | }, | ||
| 323 | }; | ||
| 324 | |||
| 325 | static struct flash_platform_data w90p910_spi_flash_data = { | ||
| 326 | .name = "m25p80", | ||
| 327 | .parts = w90p910_spi_flash_partitions, | ||
| 328 | .nr_parts = ARRAY_SIZE(w90p910_spi_flash_partitions), | ||
| 329 | .type = "w25x16", | ||
| 330 | }; | ||
| 331 | |||
| 332 | static struct spi_board_info w90p910_spi_board_info[] __initdata = { | ||
| 333 | { | ||
| 334 | .modalias = "m25p80", | ||
| 335 | .max_speed_hz = 20000000, | ||
| 336 | .bus_num = 0, | ||
| 337 | .chip_select = 1, | ||
| 338 | .platform_data = &w90p910_spi_flash_data, | ||
| 339 | .mode = SPI_MODE_0, | ||
| 340 | }, | ||
| 341 | }; | ||
| 342 | |||
| 285 | static struct map_desc w90p910_iodesc[] __initdata = { | 343 | static struct map_desc w90p910_iodesc[] __initdata = { |
| 286 | }; | 344 | }; |
| 287 | 345 | ||
| @@ -298,6 +356,7 @@ static struct platform_device *w90p910evb_dev[] __initdata = { | |||
| 298 | &w90x900_device_usbgadget, | 356 | &w90x900_device_usbgadget, |
| 299 | &w90p910_device_fmi, | 357 | &w90p910_device_fmi, |
| 300 | &w90p910_device_emc, | 358 | &w90p910_device_emc, |
| 359 | &w90p910_device_spi, | ||
| 301 | }; | 360 | }; |
| 302 | 361 | ||
| 303 | static void __init w90p910evb_map_io(void) | 362 | static void __init w90p910evb_map_io(void) |
| @@ -309,6 +368,8 @@ static void __init w90p910evb_map_io(void) | |||
| 309 | static void __init w90p910evb_init(void) | 368 | static void __init w90p910evb_init(void) |
| 310 | { | 369 | { |
| 311 | platform_add_devices(w90p910evb_dev, ARRAY_SIZE(w90p910evb_dev)); | 370 | platform_add_devices(w90p910evb_dev, ARRAY_SIZE(w90p910evb_dev)); |
| 371 | spi_register_board_info(w90p910_spi_board_info, | ||
| 372 | ARRAY_SIZE(w90p910_spi_board_info)); | ||
| 312 | } | 373 | } |
| 313 | 374 | ||
| 314 | MACHINE_START(W90P910EVB, "W90P910EVB") | 375 | MACHINE_START(W90P910EVB, "W90P910EVB") |
