Commit 438a22fe authored by Marc Zyngier's avatar Marc Zyngier Committed by Eric Miao

[ARM] pxa/zeus: Add support for mcp2515 CAN bus

Signed-off-by: default avatarMarc Zyngier <maz@misterjones.org>
Signed-off-by: default avatarEric Miao <eric.y.miao@gmail.com>
parent fcfdc67f
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
#define ZEUS_EXT1_GPIO(x) (ZEUS_EXT1_GPIO_BASE + (x)) #define ZEUS_EXT1_GPIO(x) (ZEUS_EXT1_GPIO_BASE + (x))
#define ZEUS_USER_GPIO(x) (ZEUS_USER_GPIO_BASE + (x)) #define ZEUS_USER_GPIO(x) (ZEUS_USER_GPIO_BASE + (x))
#define ZEUS_CAN_SHDN_GPIO ZEUS_EXT1_GPIO(2)
/* /*
* CPLD registers: * CPLD registers:
* Only 4 registers, but spreaded over a 32MB address space. * Only 4 registers, but spreaded over a 32MB address space.
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/pca953x.h> #include <linux/i2c/pca953x.h>
#include <linux/apm-emulation.h> #include <linux/apm-emulation.h>
#include <linux/can/platform/mcp251x.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
...@@ -387,11 +388,47 @@ static struct pxa2xx_spi_master pxa2xx_spi_ssp3_master_info = { ...@@ -387,11 +388,47 @@ static struct pxa2xx_spi_master pxa2xx_spi_ssp3_master_info = {
.enable_dma = 1, .enable_dma = 1,
}; };
static struct platform_device pxa2xx_spi_ssp3_device = { /* CAN bus on SPI */
.name = "pxa2xx-spi", static int zeus_mcp2515_setup(struct spi_device *sdev)
.id = 3, {
.dev = { int err;
.platform_data = &pxa2xx_spi_ssp3_master_info,
err = gpio_request(ZEUS_CAN_SHDN_GPIO, "CAN shutdown");
if (err)
return err;
err = gpio_direction_output(ZEUS_CAN_SHDN_GPIO, 1);
if (err) {
gpio_free(ZEUS_CAN_SHDN_GPIO);
return err;
}
return 0;
}
static int zeus_mcp2515_transceiver_enable(int enable)
{
gpio_set_value(ZEUS_CAN_SHDN_GPIO, !enable);
return 0;
}
static struct mcp251x_platform_data zeus_mcp2515_pdata = {
.oscillator_frequency = 16*1000*1000,
.model = CAN_MCP251X_MCP2515,
.board_specific_setup = zeus_mcp2515_setup,
.transceiver_enable = zeus_mcp2515_transceiver_enable,
.power_enable = zeus_mcp2515_transceiver_enable,
};
static struct spi_board_info zeus_spi_board_info[] = {
[0] = {
.modalias = "mcp251x",
.platform_data = &zeus_mcp2515_pdata,
.irq = gpio_to_irq(ZEUS_CAN_GPIO),
.max_speed_hz = 1*1000*1000,
.bus_num = 3,
.mode = SPI_MODE_0,
.chip_select = 0,
}, },
}; };
...@@ -476,7 +513,6 @@ static struct platform_device *zeus_devices[] __initdata = { ...@@ -476,7 +513,6 @@ static struct platform_device *zeus_devices[] __initdata = {
&zeus_dm9k0_device, &zeus_dm9k0_device,
&zeus_dm9k1_device, &zeus_dm9k1_device,
&zeus_sram_device, &zeus_sram_device,
&pxa2xx_spi_ssp3_device,
&zeus_leds_device, &zeus_leds_device,
&zeus_pcmcia_device, &zeus_pcmcia_device,
&zeus_max6369_device, &zeus_max6369_device,
...@@ -757,6 +793,11 @@ static mfp_cfg_t zeus_pin_config[] __initdata = { ...@@ -757,6 +793,11 @@ static mfp_cfg_t zeus_pin_config[] __initdata = {
GPIO104_CIF_DD_2, GPIO104_CIF_DD_2,
GPIO105_CIF_DD_1, GPIO105_CIF_DD_1,
GPIO81_SSP3_TXD,
GPIO82_SSP3_RXD,
GPIO83_SSP3_SFRM,
GPIO84_SSP3_SCLK,
GPIO48_nPOE, GPIO48_nPOE,
GPIO49_nPWE, GPIO49_nPWE,
GPIO50_nPIOR, GPIO50_nPIOR,
...@@ -811,6 +852,8 @@ static void __init zeus_init(void) ...@@ -811,6 +852,8 @@ static void __init zeus_init(void)
pxa_set_ac97_info(&zeus_ac97_info); pxa_set_ac97_info(&zeus_ac97_info);
pxa_set_i2c_info(NULL); pxa_set_i2c_info(NULL);
i2c_register_board_info(0, ARRAY_AND_SIZE(zeus_i2c_devices)); i2c_register_board_info(0, ARRAY_AND_SIZE(zeus_i2c_devices));
pxa2xx_set_spi_info(3, &pxa2xx_spi_ssp3_master_info);
spi_register_board_info(zeus_spi_board_info, ARRAY_SIZE(zeus_spi_board_info));
} }
static struct map_desc zeus_io_desc[] __initdata = { static struct map_desc zeus_io_desc[] __initdata = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment