diff options
author | Marc Zyngier <maz@misterjones.org> | 2010-02-18 15:33:02 -0500 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-03-01 18:40:59 -0500 |
commit | 438a22fe26c3fdeb422d92072523d5b35d849dc3 (patch) | |
tree | 673252b9d7a5adb89a2787ae195d618f5108e137 /arch/arm/mach-pxa | |
parent | fcfdc67ff2b104355683f7264a6559a0cc360646 (diff) |
[ARM] pxa/zeus: Add support for mcp2515 CAN bus
Signed-off-by: Marc Zyngier <maz@misterjones.org>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/include/mach/zeus.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/zeus.c | 55 |
2 files changed, 51 insertions, 6 deletions
diff --git a/arch/arm/mach-pxa/include/mach/zeus.h b/arch/arm/mach-pxa/include/mach/zeus.h index 89e4fb58e5fb..6e119976003e 100644 --- a/arch/arm/mach-pxa/include/mach/zeus.h +++ b/arch/arm/mach-pxa/include/mach/zeus.h | |||
@@ -58,6 +58,8 @@ | |||
58 | #define ZEUS_EXT1_GPIO(x) (ZEUS_EXT1_GPIO_BASE + (x)) | 58 | #define ZEUS_EXT1_GPIO(x) (ZEUS_EXT1_GPIO_BASE + (x)) |
59 | #define ZEUS_USER_GPIO(x) (ZEUS_USER_GPIO_BASE + (x)) | 59 | #define ZEUS_USER_GPIO(x) (ZEUS_USER_GPIO_BASE + (x)) |
60 | 60 | ||
61 | #define ZEUS_CAN_SHDN_GPIO ZEUS_EXT1_GPIO(2) | ||
62 | |||
61 | /* | 63 | /* |
62 | * CPLD registers: | 64 | * CPLD registers: |
63 | * Only 4 registers, but spreaded over a 32MB address space. | 65 | * Only 4 registers, but spreaded over a 32MB address space. |
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c index 9ba8fccd98ff..39896d883584 100644 --- a/arch/arm/mach-pxa/zeus.c +++ b/arch/arm/mach-pxa/zeus.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/i2c/pca953x.h> | 27 | #include <linux/i2c/pca953x.h> |
28 | #include <linux/apm-emulation.h> | 28 | #include <linux/apm-emulation.h> |
29 | #include <linux/can/platform/mcp251x.h> | ||
29 | 30 | ||
30 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
31 | #include <asm/mach/arch.h> | 32 | #include <asm/mach/arch.h> |
@@ -387,11 +388,47 @@ static struct pxa2xx_spi_master pxa2xx_spi_ssp3_master_info = { | |||
387 | .enable_dma = 1, | 388 | .enable_dma = 1, |
388 | }; | 389 | }; |
389 | 390 | ||
390 | static struct platform_device pxa2xx_spi_ssp3_device = { | 391 | /* CAN bus on SPI */ |
391 | .name = "pxa2xx-spi", | 392 | static int zeus_mcp2515_setup(struct spi_device *sdev) |
392 | .id = 3, | 393 | { |
393 | .dev = { | 394 | int err; |
394 | .platform_data = &pxa2xx_spi_ssp3_master_info, | 395 | |
396 | err = gpio_request(ZEUS_CAN_SHDN_GPIO, "CAN shutdown"); | ||
397 | if (err) | ||
398 | return err; | ||
399 | |||
400 | err = gpio_direction_output(ZEUS_CAN_SHDN_GPIO, 1); | ||
401 | if (err) { | ||
402 | gpio_free(ZEUS_CAN_SHDN_GPIO); | ||
403 | return err; | ||
404 | } | ||
405 | |||
406 | return 0; | ||
407 | } | ||
408 | |||
409 | static int zeus_mcp2515_transceiver_enable(int enable) | ||
410 | { | ||
411 | gpio_set_value(ZEUS_CAN_SHDN_GPIO, !enable); | ||
412 | return 0; | ||
413 | } | ||
414 | |||
415 | static struct mcp251x_platform_data zeus_mcp2515_pdata = { | ||
416 | .oscillator_frequency = 16*1000*1000, | ||
417 | .model = CAN_MCP251X_MCP2515, | ||
418 | .board_specific_setup = zeus_mcp2515_setup, | ||
419 | .transceiver_enable = zeus_mcp2515_transceiver_enable, | ||
420 | .power_enable = zeus_mcp2515_transceiver_enable, | ||
421 | }; | ||
422 | |||
423 | static struct spi_board_info zeus_spi_board_info[] = { | ||
424 | [0] = { | ||
425 | .modalias = "mcp251x", | ||
426 | .platform_data = &zeus_mcp2515_pdata, | ||
427 | .irq = gpio_to_irq(ZEUS_CAN_GPIO), | ||
428 | .max_speed_hz = 1*1000*1000, | ||
429 | .bus_num = 3, | ||
430 | .mode = SPI_MODE_0, | ||
431 | .chip_select = 0, | ||
395 | }, | 432 | }, |
396 | }; | 433 | }; |
397 | 434 | ||
@@ -476,7 +513,6 @@ static struct platform_device *zeus_devices[] __initdata = { | |||
476 | &zeus_dm9k0_device, | 513 | &zeus_dm9k0_device, |
477 | &zeus_dm9k1_device, | 514 | &zeus_dm9k1_device, |
478 | &zeus_sram_device, | 515 | &zeus_sram_device, |
479 | &pxa2xx_spi_ssp3_device, | ||
480 | &zeus_leds_device, | 516 | &zeus_leds_device, |
481 | &zeus_pcmcia_device, | 517 | &zeus_pcmcia_device, |
482 | &zeus_max6369_device, | 518 | &zeus_max6369_device, |
@@ -757,6 +793,11 @@ static mfp_cfg_t zeus_pin_config[] __initdata = { | |||
757 | GPIO104_CIF_DD_2, | 793 | GPIO104_CIF_DD_2, |
758 | GPIO105_CIF_DD_1, | 794 | GPIO105_CIF_DD_1, |
759 | 795 | ||
796 | GPIO81_SSP3_TXD, | ||
797 | GPIO82_SSP3_RXD, | ||
798 | GPIO83_SSP3_SFRM, | ||
799 | GPIO84_SSP3_SCLK, | ||
800 | |||
760 | GPIO48_nPOE, | 801 | GPIO48_nPOE, |
761 | GPIO49_nPWE, | 802 | GPIO49_nPWE, |
762 | GPIO50_nPIOR, | 803 | GPIO50_nPIOR, |
@@ -811,6 +852,8 @@ static void __init zeus_init(void) | |||
811 | pxa_set_ac97_info(&zeus_ac97_info); | 852 | pxa_set_ac97_info(&zeus_ac97_info); |
812 | pxa_set_i2c_info(NULL); | 853 | pxa_set_i2c_info(NULL); |
813 | i2c_register_board_info(0, ARRAY_AND_SIZE(zeus_i2c_devices)); | 854 | i2c_register_board_info(0, ARRAY_AND_SIZE(zeus_i2c_devices)); |
855 | pxa2xx_set_spi_info(3, &pxa2xx_spi_ssp3_master_info); | ||
856 | spi_register_board_info(zeus_spi_board_info, ARRAY_SIZE(zeus_spi_board_info)); | ||
814 | } | 857 | } |
815 | 858 | ||
816 | static struct map_desc zeus_io_desc[] __initdata = { | 859 | static struct map_desc zeus_io_desc[] __initdata = { |