diff options
author | Mika Westerberg <mika.westerberg@iki.fi> | 2010-05-11 10:34:54 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-05-13 07:19:52 -0400 |
commit | 4fec9978822a66b25f5645eb20c115034a18cfd1 (patch) | |
tree | fc6c064697704c5a86e2f6c7ac9ae77f60cbd80d /arch/arm/mach-ep93xx/core.c | |
parent | 99e6a23adfadc2da2006f3715c4332c3bf502c07 (diff) |
ARM: 6124/1: ep93xx: SPI driver platform support code
This patch adds platform side support code for the EP93xx SPI
driver. This includes clock, resources and muxing. There is a new
function: ep93xx_register_spi() which can be used by board support
code to register new SPI devices for the board.
This patch depends on patch
5998/1 ep93xx: added chip revision reading function
Cc: Ryan Mallon <ryan@bluewatersys.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Martin Guy <martinwguy@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-ep93xx/core.c')
-rw-r--r-- | arch/arm/mach-ep93xx/core.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c index 8d3f77e9fa86..9092677f63eb 100644 --- a/arch/arm/mach-ep93xx/core.c +++ b/arch/arm/mach-ep93xx/core.c | |||
@@ -31,10 +31,12 @@ | |||
31 | #include <linux/amba/serial.h> | 31 | #include <linux/amba/serial.h> |
32 | #include <linux/i2c.h> | 32 | #include <linux/i2c.h> |
33 | #include <linux/i2c-gpio.h> | 33 | #include <linux/i2c-gpio.h> |
34 | #include <linux/spi/spi.h> | ||
34 | 35 | ||
35 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
36 | #include <mach/fb.h> | 37 | #include <mach/fb.h> |
37 | #include <mach/ep93xx_keypad.h> | 38 | #include <mach/ep93xx_keypad.h> |
39 | #include <mach/ep93xx_spi.h> | ||
38 | 40 | ||
39 | #include <asm/mach/map.h> | 41 | #include <asm/mach/map.h> |
40 | #include <asm/mach/time.h> | 42 | #include <asm/mach/time.h> |
@@ -430,6 +432,56 @@ void __init ep93xx_register_i2c(struct i2c_gpio_platform_data *data, | |||
430 | platform_device_register(&ep93xx_i2c_device); | 432 | platform_device_register(&ep93xx_i2c_device); |
431 | } | 433 | } |
432 | 434 | ||
435 | /************************************************************************* | ||
436 | * EP93xx SPI peripheral handling | ||
437 | *************************************************************************/ | ||
438 | static struct ep93xx_spi_info ep93xx_spi_master_data; | ||
439 | |||
440 | static struct resource ep93xx_spi_resources[] = { | ||
441 | { | ||
442 | .start = EP93XX_SPI_PHYS_BASE, | ||
443 | .end = EP93XX_SPI_PHYS_BASE + 0x18 - 1, | ||
444 | .flags = IORESOURCE_MEM, | ||
445 | }, | ||
446 | { | ||
447 | .start = IRQ_EP93XX_SSP, | ||
448 | .end = IRQ_EP93XX_SSP, | ||
449 | .flags = IORESOURCE_IRQ, | ||
450 | }, | ||
451 | }; | ||
452 | |||
453 | static struct platform_device ep93xx_spi_device = { | ||
454 | .name = "ep93xx-spi", | ||
455 | .id = 0, | ||
456 | .dev = { | ||
457 | .platform_data = &ep93xx_spi_master_data, | ||
458 | }, | ||
459 | .num_resources = ARRAY_SIZE(ep93xx_spi_resources), | ||
460 | .resource = ep93xx_spi_resources, | ||
461 | }; | ||
462 | |||
463 | /** | ||
464 | * ep93xx_register_spi() - registers spi platform device | ||
465 | * @info: ep93xx board specific spi master info (__initdata) | ||
466 | * @devices: SPI devices to register (__initdata) | ||
467 | * @num: number of SPI devices to register | ||
468 | * | ||
469 | * This function registers platform device for the EP93xx SPI controller and | ||
470 | * also makes sure that SPI pins are muxed so that I2S is not using those pins. | ||
471 | */ | ||
472 | void __init ep93xx_register_spi(struct ep93xx_spi_info *info, | ||
473 | struct spi_board_info *devices, int num) | ||
474 | { | ||
475 | /* | ||
476 | * When SPI is used, we need to make sure that I2S is muxed off from | ||
477 | * SPI pins. | ||
478 | */ | ||
479 | ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_I2SONSSP); | ||
480 | |||
481 | ep93xx_spi_master_data = *info; | ||
482 | spi_register_board_info(devices, num); | ||
483 | platform_device_register(&ep93xx_spi_device); | ||
484 | } | ||
433 | 485 | ||
434 | /************************************************************************* | 486 | /************************************************************************* |
435 | * EP93xx LEDs | 487 | * EP93xx LEDs |