summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTapani <tapani@vmail.me>2013-01-21 07:31:10 +0100
committerTapani <tapani@vmail.me>2013-01-21 07:31:10 +0100
commitbef63d74fc0210b25c0c104d407c2b7839b002e5 (patch)
tree9afd37f700c7717ef5c28191c29528de7557fb06
parent3de6cffac0be1a21a989d879e8a1afd47ed5f257 (diff)
Wandboard : Enable SPI in boardfile
-rw-r--r--arch/arm/mach-mx6/Kconfig1
-rw-r--r--arch/arm/mach-mx6/board-wand.c52
2 files changed, 53 insertions, 0 deletions
diff --git a/arch/arm/mach-mx6/Kconfig b/arch/arm/mach-mx6/Kconfig
index 8e1a138842a9..2d426dd687c8 100644
--- a/arch/arm/mach-mx6/Kconfig
+++ b/arch/arm/mach-mx6/Kconfig
@@ -305,6 +305,7 @@ config MACH_WANDBOARD
select IMX_HAVE_PLATFORM_IMX_ANATOP_THERMAL if ANATOP_THERMAL
select IMX_HAVE_PLATFORM_IMX_PM if PM
select IMX_HAVE_PLATFORM_IMX_DVFS if CPU_FREQ_IMX
+ select IMX_HAVE_PLATFORM_SPI_IMX if SPI
help
Include support for the WandBoard SoM.
diff --git a/arch/arm/mach-mx6/board-wand.c b/arch/arm/mach-mx6/board-wand.c
index 176c21c86b08..eb28396a41e4 100644
--- a/arch/arm/mach-mx6/board-wand.c
+++ b/arch/arm/mach-mx6/board-wand.c
@@ -799,6 +799,57 @@ static __init void wand_init_external_gpios(void) {
}
+/****************************************************************************
+ *
+ * SPI - while not used on the Wandboard, the pins are routed out
+ *
+ ****************************************************************************/
+
+static const __initdata iomux_v3_cfg_t wand_spi_pads[] = {
+ MX6DL_PAD_EIM_D16__ECSPI1_SCLK,
+ MX6DL_PAD_EIM_D17__ECSPI1_MISO,
+ MX6DL_PAD_EIM_D18__ECSPI1_MOSI,
+ MX6DL_PAD_EIM_EB2__GPIO_2_30,
+
+ MX6DL_PAD_EIM_CS0__ECSPI2_SCLK,
+ MX6DL_PAD_EIM_CS1__ECSPI2_MOSI,
+ MX6DL_PAD_EIM_OE__ECSPI2_MISO,
+ MX6DL_PAD_EIM_RW__GPIO_2_26,
+ MX6DL_PAD_EIM_LBA__GPIO_2_27,
+};
+/* The choice of using gpios for chipselect is deliberate,
+ there can be issues using the dedicated mux modes for cs.
+*/
+
+/* ------------------------------------------------------------------------ */
+
+static const int wand_spi1_chipselect[] = { IMX_GPIO_NR(2, 30) };
+
+/* platform device */
+static const struct spi_imx_master wand_spi1_data = {
+ .chipselect = wand_spi1_chipselect,
+ .num_chipselect = ARRAY_SIZE(wand_spi1_chipselect),
+};
+
+/* ------------------------------------------------------------------------ */
+
+static const int wand_spi2_chipselect[] = { IMX_GPIO_NR(2, 26), IMX_GPIO_NR(2, 27) };
+
+static const struct spi_imx_master wand_spi2_data = {
+ .chipselect = wand_spi2_chipselect,
+ .num_chipselect = ARRAY_SIZE(wand_spi2_chipselect),
+};
+
+/* ------------------------------------------------------------------------ */
+
+static void __init wand_init_spi(void) {
+ WAND_SETUP_PADS(wand_spi_pads);
+
+ imx6q_add_ecspi(0, &wand_spi1_data);
+ imx6q_add_ecspi(1, &wand_spi2_data);
+}
+
+
/*****************************************************************************
*
* Init clocks and early boot console
@@ -845,6 +896,7 @@ static void __init wand_board_init(void) {
wand_init_bluetooth();
wand_init_pm();
wand_init_external_gpios();
+ wand_init_spi();
}
/* ------------------------------------------------------------------------ */