diff options
author | Eric Bénard <eric@eukrea.com> | 2012-05-08 03:20:17 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-05-08 11:31:23 -0400 |
commit | 49ed94075ce481f5319f4ff55a3657fa3867d92d (patch) | |
tree | 879718317c0180654555210effe5696f5722ec9f /arch/arm/mach-imx | |
parent | f381f9fc7b57c9cdb2685aab2af39924f0454df2 (diff) |
ARM: imx: eukrea_mbimxsd25: add spi controler and spidev support
Signed-off-by: Eric Bénard <eric@eukrea.com>
Cc: Sascha Hauer <kernel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r-- | arch/arm/mach-imx/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c | 42 |
2 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 7561eca131b0..e102f8fd2c55 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -181,6 +181,7 @@ config MACH_EUKREA_MBIMXSD25_BASEBOARD | |||
181 | bool "Eukrea MBIMXSD development board" | 181 | bool "Eukrea MBIMXSD development board" |
182 | select IMX_HAVE_PLATFORM_GPIO_KEYS | 182 | select IMX_HAVE_PLATFORM_GPIO_KEYS |
183 | select IMX_HAVE_PLATFORM_IMX_SSI | 183 | select IMX_HAVE_PLATFORM_IMX_SSI |
184 | select IMX_HAVE_PLATFORM_SPI_IMX | ||
184 | select LEDS_GPIO_REGISTER | 185 | select LEDS_GPIO_REGISTER |
185 | help | 186 | help |
186 | This adds board specific devices that can be found on Eukrea's | 187 | This adds board specific devices that can be found on Eukrea's |
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c index 2cf603e11c4f..cafa1092d8aa 100644 --- a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c +++ b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/leds.h> | 23 | #include <linux/leds.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/input.h> | 25 | #include <linux/input.h> |
26 | #include <linux/spi/spi.h> | ||
26 | #include <video/platform_lcd.h> | 27 | #include <video/platform_lcd.h> |
27 | 28 | ||
28 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
@@ -87,12 +88,22 @@ static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = { | |||
87 | /* CAN */ | 88 | /* CAN */ |
88 | MX25_PAD_GPIO_D__CAN2_RX, | 89 | MX25_PAD_GPIO_D__CAN2_RX, |
89 | MX25_PAD_GPIO_C__CAN2_TX, | 90 | MX25_PAD_GPIO_C__CAN2_TX, |
91 | /* SPI1 */ | ||
92 | MX25_PAD_CSPI1_MOSI__CSPI1_MOSI, | ||
93 | MX25_PAD_CSPI1_MISO__CSPI1_MISO, | ||
94 | MX25_PAD_CSPI1_SS0__GPIO_1_16, | ||
95 | MX25_PAD_CSPI1_SS1__GPIO_1_17, | ||
96 | MX25_PAD_CSPI1_SCLK__CSPI1_SCLK, | ||
97 | MX25_PAD_CSPI1_RDY__GPIO_2_22, | ||
90 | }; | 98 | }; |
91 | 99 | ||
92 | #define GPIO_LED1 83 | 100 | #define GPIO_LED1 83 |
93 | #define GPIO_SWITCH1 82 | 101 | #define GPIO_SWITCH1 82 |
94 | #define GPIO_SD1CD 52 | 102 | #define GPIO_SD1CD 52 |
95 | #define GPIO_LCDPWR 26 | 103 | #define GPIO_LCDPWR 26 |
104 | #define GPIO_SPI1_SS0 IMX_GPIO_NR(1, 16) | ||
105 | #define GPIO_SPI1_SS1 IMX_GPIO_NR(1, 17) | ||
106 | #define GPIO_SPI1_IRQ IMX_GPIO_NR(2, 22) | ||
96 | 107 | ||
97 | static struct imx_fb_videomode eukrea_mximxsd_modes[] = { | 108 | static struct imx_fb_videomode eukrea_mximxsd_modes[] = { |
98 | { | 109 | { |
@@ -228,6 +239,30 @@ static struct esdhc_platform_data sd1_pdata = { | |||
228 | .wp_type = ESDHC_WP_NONE, | 239 | .wp_type = ESDHC_WP_NONE, |
229 | }; | 240 | }; |
230 | 241 | ||
242 | static struct spi_board_info eukrea_mbimxsd25_spi_board_info[] __initdata = { | ||
243 | { | ||
244 | .modalias = "spidev", | ||
245 | .max_speed_hz = 20000000, | ||
246 | .bus_num = 0, | ||
247 | .chip_select = 0, | ||
248 | .mode = SPI_MODE_0, | ||
249 | }, | ||
250 | { | ||
251 | .modalias = "spidev", | ||
252 | .max_speed_hz = 20000000, | ||
253 | .bus_num = 0, | ||
254 | .chip_select = 1, | ||
255 | .mode = SPI_MODE_0, | ||
256 | }, | ||
257 | }; | ||
258 | |||
259 | static int eukrea_mbimxsd25_spi_cs[] = {GPIO_SPI1_SS0, GPIO_SPI1_SS1}; | ||
260 | |||
261 | static const struct spi_imx_master eukrea_mbimxsd25_spi0_data __initconst = { | ||
262 | .chipselect = eukrea_mbimxsd25_spi_cs, | ||
263 | .num_chipselect = ARRAY_SIZE(eukrea_mbimxsd25_spi_cs), | ||
264 | }; | ||
265 | |||
231 | /* | 266 | /* |
232 | * system init for baseboard usage. Will be called by cpuimx25 init. | 267 | * system init for baseboard usage. Will be called by cpuimx25 init. |
233 | * | 268 | * |
@@ -262,6 +297,13 @@ void __init eukrea_mbimxsd25_baseboard_init(void) | |||
262 | i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, | 297 | i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, |
263 | ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); | 298 | ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); |
264 | 299 | ||
300 | gpio_request(GPIO_SPI1_IRQ, "SPI1_IRQ"); | ||
301 | gpio_direction_input(GPIO_SPI1_IRQ); | ||
302 | gpio_free(GPIO_SPI1_IRQ); | ||
303 | imx25_add_spi_imx0(&eukrea_mbimxsd25_spi0_data); | ||
304 | spi_register_board_info(eukrea_mbimxsd25_spi_board_info, | ||
305 | ARRAY_SIZE(eukrea_mbimxsd25_spi_board_info)); | ||
306 | |||
265 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 307 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
266 | gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); | 308 | gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); |
267 | imx_add_gpio_keys(&eukrea_mbimxsd_button_data); | 309 | imx_add_gpio_keys(&eukrea_mbimxsd_button_data); |