summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2014-03-13 16:54:13 +0100
committerStefan Agner <stefan.agner@toradex.com>2014-03-14 09:31:04 +0100
commit3e1069e08d3f3eb2f0155239410410354a1794b5 (patch)
tree85ed47ccfdda49f31a04f7b9aebc413657335bda
parentc78ce82e0e2be5745f5577f053458c12dc3b8263 (diff)
colibri_vf: conditional platform data for CAN MCP251X
The Colibri Evaluation Board V3.1a has a on-board SPI CAN controller MCP251X. This patch adds platform data for this device. However, to have CAN support, some configuration have to be enabled: CONFIG_CAN CONFIG_CAN_RAW CONFIG_CAN_BCM CONFIG_CAN_DEV Plus support for the SPI device itself: CONFIG_CAN_MCP251X
-rw-r--r--arch/arm/mach-mvf/board-colibri_vf.c29
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mvf.h6
2 files changed, 34 insertions, 1 deletions
diff --git a/arch/arm/mach-mvf/board-colibri_vf.c b/arch/arm/mach-mvf/board-colibri_vf.c
index b85c42c3c91e..f5a5a054e2a5 100644
--- a/arch/arm/mach-mvf/board-colibri_vf.c
+++ b/arch/arm/mach-mvf/board-colibri_vf.c
@@ -43,6 +43,7 @@
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
#include <linux/input/fusion_F0710A.h>
+#include <linux/can/platform/mcp251x.h>
#include <sound/pcm.h>
#include <mach/common.h>
@@ -104,6 +105,9 @@ static iomux_v3_cfg_t mvf600_pads[] = {
MVF600_PAD86_PTD7__DSPI1_SOUT,
MVF600_PAD87_PTD8__DSPI1_SCK,
+ /* GPIO for CAN Interrupt */
+ MVF600_PAD43_PTB21__CAN_INT,
+
/* FEC1: Ethernet */
MVF600_PAD0_PTA6__RMII_CLKOUT,
MVF600_PAD54_PTC9__RMII1_MDC,
@@ -404,8 +408,28 @@ static struct spi_mvf_chip spidev_chip_info = {
.dt = 0,
};
+#if defined(CONFIG_CAN_MCP251X)
+#define CAN_INTERRUPT_GPIO 43 /* active low interrupt (MCP2515 nINT) */
+
+static struct mcp251x_platform_data mcp251x_pdata = {
+ .board_specific_setup = NULL,
+ .oscillator_frequency = 16000000,
+ .power_enable = NULL,
+ .transceiver_enable = NULL
+};
+#endif
+
static struct spi_board_info mvf_spi_board_info[] __initdata = {
-#if defined(CONFIG_SPI_MVF)
+#if defined(CONFIG_CAN_MCP251X)
+ {
+ .bus_num = 1,
+ .chip_select = 0,
+ .max_speed_hz = 10000000,
+ .modalias = "mcp2515",
+ .platform_data = &mcp251x_pdata,
+ .controller_data = &spidev_chip_info,
+ },
+#elif defined(CONFIG_SPI_SPIDEV)
{
.bus_num = 1, /* DSPI1: Colibri SSP */
.chip_select = 0,
@@ -421,6 +445,9 @@ static struct spi_board_info mvf_spi_board_info[] __initdata = {
static void spi_device_init(void)
{
+#if defined(CONFIG_CAN_MCP251X)
+ mvf_spi_board_info[0].irq = gpio_to_irq(CAN_INTERRUPT_GPIO);
+#endif
spi_register_board_info(mvf_spi_board_info,
ARRAY_SIZE(mvf_spi_board_info));
}
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mvf.h b/arch/arm/plat-mxc/include/mach/iomux-mvf.h
index d68e5f1c944f..1bbf8158051a 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mvf.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mvf.h
@@ -152,6 +152,12 @@ typedef enum iomux_config {
IOMUX_PAD(0x015C, 0x015C, 3, 0x02F8, 1, \
MVF600_DSPI_PAD_CTRL | PAD_CTL_OBE_ENABLE)
+/* CAN_INT GPIO */
+#define MVF600_PAD43_PTB21__CAN_INT \
+ IOMUX_PAD(0x00AC, 0x00AC, 0, 0x0000, 0, \
+ MVF600_GPIO_GENERAL_CTRL | PAD_CTL_IBE_ENABLE)
+
+
/*FEC0*/
#define MVF600_PAD0_PTA6__RMII_CLKIN \
IOMUX_PAD(0x0000, 0x0000, 2, 0x02F0, 0, \