2 * mach-imx27_visstrim_m10.c
4 * Copyright 2010 Javier Martin <javier.martin@vista-silicon.com>
6 * Based on mach-pcm038.c, mach-pca100.c, mach-mx27ads.c and others.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
26 #include <linux/platform_device.h>
27 #include <linux/mtd/physmap.h>
28 #include <linux/i2c.h>
29 #include <linux/i2c/pca953x.h>
30 #include <linux/gpio_keys.h>
31 #include <linux/input.h>
32 #include <linux/gpio.h>
33 #include <linux/delay.h>
34 #include <asm/mach-types.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/time.h>
37 #include <mach/common.h>
38 #include <mach/iomux.h>
40 #include "devices-imx27.h"
42 #define OTG_PHY_CS_GPIO (GPIO_PORTF + 17)
43 #define SDHC1_IRQ IRQ_GPIOB(25)
45 static const int visstrim_m10_pins[] __initconst = {
88 OTG_PHY_CS_GPIO | GPIO_GPIO | GPIO_OUT,
105 /* GPIOs used as events for applications */
106 static struct gpio_keys_button visstrim_gpio_keys[] = {
110 .gpio = (GPIO_PORTC + 15),
111 .desc = "Default config",
118 .gpio = (GPIO_PORTF + 14),
126 .gpio = (GPIO_PORTF + 13),
133 static struct gpio_keys_platform_data visstrim_gpio_keys_platform_data = {
134 .buttons = visstrim_gpio_keys,
135 .nbuttons = ARRAY_SIZE(visstrim_gpio_keys),
138 static struct platform_device visstrim_gpio_keys_device = {
142 .platform_data = &visstrim_gpio_keys_platform_data,
146 /* Visstrim_SM10 has a microSD slot connected to sdhc1 */
147 static int visstrim_m10_sdhc1_init(struct device *dev,
148 irq_handler_t detect_irq, void *data)
152 ret = request_irq(SDHC1_IRQ, detect_irq, IRQF_TRIGGER_FALLING,
157 static void visstrim_m10_sdhc1_exit(struct device *dev, void *data)
159 free_irq(SDHC1_IRQ, data);
162 static const struct imxmmc_platform_data visstrim_m10_sdhc_pdata __initconst = {
163 .init = visstrim_m10_sdhc1_init,
164 .exit = visstrim_m10_sdhc1_exit,
167 /* Visstrim_SM10 NOR flash */
168 static struct physmap_flash_data visstrim_m10_flash_data = {
172 static struct resource visstrim_m10_flash_resource = {
174 .end = 0xc0000000 + SZ_64M - 1,
175 .flags = IORESOURCE_MEM,
178 static struct platform_device visstrim_m10_nor_mtd_device = {
179 .name = "physmap-flash",
182 .platform_data = &visstrim_m10_flash_data,
185 .resource = &visstrim_m10_flash_resource,
188 static struct platform_device *platform_devices[] __initdata = {
189 &visstrim_gpio_keys_device,
190 &visstrim_m10_nor_mtd_device,
193 /* Visstrim_M10 uses UART0 as console */
194 static const struct imxuart_platform_data uart_pdata __initconst = {
195 .flags = IMXUART_HAVE_RTSCTS,
199 static const struct imxi2c_platform_data visstrim_m10_i2c_data __initconst = {
203 static struct pca953x_platform_data visstrim_m10_pca9555_pdata = {
204 .gpio_base = 240, /* After MX27 internal GPIOs */
208 static struct i2c_board_info visstrim_m10_i2c_devices[] = {
210 I2C_BOARD_INFO("pca9555", 0x20),
211 .platform_data = &visstrim_m10_pca9555_pdata,
214 I2C_BOARD_INFO("tlv320aic32x4", 0x18),
219 static int otg_phy_init(struct platform_device *pdev)
221 gpio_set_value(OTG_PHY_CS_GPIO, 0);
225 return mx27_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
228 static const struct mxc_usbh_platform_data
229 visstrim_m10_usbotg_pdata __initconst = {
230 .init = otg_phy_init,
231 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
235 static const struct imx_ssi_platform_data visstrim_m10_ssi_pdata __initconst = {
236 .flags = IMX_SSI_DMA | IMX_SSI_SYN,
239 static void __init visstrim_m10_board_init(void)
243 ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins,
244 ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10");
246 pr_err("Failed to setup pins (%d)\n", ret);
248 imx27_add_imx_ssi(0, &visstrim_m10_ssi_pdata);
249 imx27_add_imx_uart0(&uart_pdata);
251 i2c_register_board_info(0, visstrim_m10_i2c_devices,
252 ARRAY_SIZE(visstrim_m10_i2c_devices));
253 imx27_add_imx_i2c(0, &visstrim_m10_i2c_data);
254 imx27_add_imx_i2c(1, &visstrim_m10_i2c_data);
255 imx27_add_mxc_mmc(0, &visstrim_m10_sdhc_pdata);
256 imx27_add_mxc_ehci_otg(&visstrim_m10_usbotg_pdata);
258 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
261 static void __init visstrim_m10_timer_init(void)
263 mx27_clocks_init((unsigned long)25000000);
266 static struct sys_timer visstrim_m10_timer = {
267 .init = visstrim_m10_timer_init,
270 MACHINE_START(IMX27_VISSTRIM_M10, "Vista Silicon Visstrim_M10")
271 .boot_params = MX27_PHYS_OFFSET + 0x100,
272 .map_io = mx27_map_io,
273 .init_early = imx27_init_early,
274 .init_irq = mx27_init_irq,
275 .timer = &visstrim_m10_timer,
276 .init_machine = visstrim_m10_board_init,