diff options
author | Eric Bénard <eric@eukrea.com> | 2012-05-08 03:20:19 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-05-08 11:31:24 -0400 |
commit | 0e189858ffcf0f79423d95f4f36d7156734bba82 (patch) | |
tree | a831f6da8ffdf6e8cfe5431d15fad5674c414eff | |
parent | 4692cba14f5bc43f08b82210e2bd13b654fa3c6a (diff) |
ARM: imx: eukrea_mbimxsd35: 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>
-rw-r--r-- | arch/arm/mach-imx/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-imx/eukrea_mbimxsd35-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 9d7f1914c751..28d89d35fc6a 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -608,6 +608,7 @@ config MACH_EUKREA_MBIMXSD35_BASEBOARD | |||
608 | select IMX_HAVE_PLATFORM_GPIO_KEYS | 608 | select IMX_HAVE_PLATFORM_GPIO_KEYS |
609 | select IMX_HAVE_PLATFORM_IMX_SSI | 609 | select IMX_HAVE_PLATFORM_IMX_SSI |
610 | select IMX_HAVE_PLATFORM_IPU_CORE | 610 | select IMX_HAVE_PLATFORM_IPU_CORE |
611 | select IMX_HAVE_PLATFORM_SPI_IMX | ||
611 | select LEDS_GPIO_REGISTER | 612 | select LEDS_GPIO_REGISTER |
612 | help | 613 | help |
613 | This adds board specific devices that can be found on Eukrea's | 614 | This adds board specific devices that can be found on Eukrea's |
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c index fd8bf8a425a7..557f6c486053 100644 --- a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c +++ b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/leds.h> | 27 | #include <linux/leds.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/input.h> | 29 | #include <linux/input.h> |
30 | #include <linux/spi/spi.h> | ||
30 | #include <video/platform_lcd.h> | 31 | #include <video/platform_lcd.h> |
31 | #include <linux/i2c.h> | 32 | #include <linux/i2c.h> |
32 | 33 | ||
@@ -158,12 +159,22 @@ static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = { | |||
158 | MX35_PAD_SD1_DATA3__ESDHC1_DAT3, | 159 | MX35_PAD_SD1_DATA3__ESDHC1_DAT3, |
159 | /* SD1 CD */ | 160 | /* SD1 CD */ |
160 | MX35_PAD_LD18__GPIO3_24, | 161 | MX35_PAD_LD18__GPIO3_24, |
162 | /* SPI */ | ||
163 | MX35_PAD_CSPI1_MOSI__CSPI1_MOSI, | ||
164 | MX35_PAD_CSPI1_MISO__CSPI1_MISO, | ||
165 | MX35_PAD_CSPI1_SS0__GPIO1_18, | ||
166 | MX35_PAD_CSPI1_SS1__GPIO1_19, | ||
167 | MX35_PAD_CSPI1_SCLK__CSPI1_SCLK, | ||
168 | MX35_PAD_CSPI1_SPI_RDY__GPIO3_5, | ||
161 | }; | 169 | }; |
162 | 170 | ||
163 | #define GPIO_LED1 IMX_GPIO_NR(3, 29) | 171 | #define GPIO_LED1 IMX_GPIO_NR(3, 29) |
164 | #define GPIO_SWITCH1 IMX_GPIO_NR(3, 25) | 172 | #define GPIO_SWITCH1 IMX_GPIO_NR(3, 25) |
165 | #define GPIO_LCDPWR IMX_GPIO_NR(1, 4) | 173 | #define GPIO_LCDPWR IMX_GPIO_NR(1, 4) |
166 | #define GPIO_SD1CD IMX_GPIO_NR(3, 24) | 174 | #define GPIO_SD1CD IMX_GPIO_NR(3, 24) |
175 | #define GPIO_SPI1_SS0 IMX_GPIO_NR(1, 18) | ||
176 | #define GPIO_SPI1_SS1 IMX_GPIO_NR(1, 19) | ||
177 | #define GPIO_SPI1_IRQ IMX_GPIO_NR(3, 5) | ||
167 | 178 | ||
168 | static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd, | 179 | static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd, |
169 | unsigned int power) | 180 | unsigned int power) |
@@ -239,6 +250,30 @@ static struct esdhc_platform_data sd1_pdata = { | |||
239 | .wp_type = ESDHC_WP_NONE, | 250 | .wp_type = ESDHC_WP_NONE, |
240 | }; | 251 | }; |
241 | 252 | ||
253 | static struct spi_board_info eukrea_mbimxsd35_spi_board_info[] __initdata = { | ||
254 | { | ||
255 | .modalias = "spidev", | ||
256 | .max_speed_hz = 20000000, | ||
257 | .bus_num = 0, | ||
258 | .chip_select = 0, | ||
259 | .mode = SPI_MODE_0, | ||
260 | }, | ||
261 | { | ||
262 | .modalias = "spidev", | ||
263 | .max_speed_hz = 20000000, | ||
264 | .bus_num = 0, | ||
265 | .chip_select = 1, | ||
266 | .mode = SPI_MODE_0, | ||
267 | }, | ||
268 | }; | ||
269 | |||
270 | static int eukrea_mbimxsd35_spi_cs[] = {GPIO_SPI1_SS0, GPIO_SPI1_SS1}; | ||
271 | |||
272 | static const struct spi_imx_master eukrea_mbimxsd35_spi0_data __initconst = { | ||
273 | .chipselect = eukrea_mbimxsd35_spi_cs, | ||
274 | .num_chipselect = ARRAY_SIZE(eukrea_mbimxsd35_spi_cs), | ||
275 | }; | ||
276 | |||
242 | /* | 277 | /* |
243 | * system init for baseboard usage. Will be called by cpuimx35 init. | 278 | * system init for baseboard usage. Will be called by cpuimx35 init. |
244 | * | 279 | * |
@@ -274,6 +309,13 @@ void __init eukrea_mbimxsd35_baseboard_init(void) | |||
274 | i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, | 309 | i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, |
275 | ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); | 310 | ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); |
276 | 311 | ||
312 | gpio_request(GPIO_SPI1_IRQ, "SPI1_IRQ"); | ||
313 | gpio_direction_input(GPIO_SPI1_IRQ); | ||
314 | gpio_free(GPIO_SPI1_IRQ); | ||
315 | imx35_add_spi_imx0(&eukrea_mbimxsd35_spi0_data); | ||
316 | spi_register_board_info(eukrea_mbimxsd35_spi_board_info, | ||
317 | ARRAY_SIZE(eukrea_mbimxsd35_spi_board_info)); | ||
318 | |||
277 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 319 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
278 | gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); | 320 | gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); |
279 | imx_add_gpio_keys(&eukrea_mbimxsd_button_data); | 321 | imx_add_gpio_keys(&eukrea_mbimxsd_button_data); |