1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * LILLY-1131 development board support
5 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
7 * based on code for other MX31 boards,
9 * Copyright 2005-2007 Freescale Semiconductor
10 * Copyright (c) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
11 * Copyright (C) 2009 Valentin Longchamp, EPFL Mobots group
14 #include <linux/kernel.h>
15 #include <linux/types.h>
16 #include <linux/init.h>
17 #include <linux/gpio.h>
18 #include <linux/platform_device.h>
20 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/map.h>
24 #include "board-mx31lilly.h"
26 #include "devices-imx31.h"
28 #include "iomux-mx3.h"
31 * This file contains board-specific initialization routines for the
32 * LILLY-1131 development board. If you design an own baseboard for the
33 * module, use this file as base for support code.
36 static unsigned int lilly_db_board_pins
[] __initdata
= {
37 MX31_PIN_SD1_DATA3__SD1_DATA3
,
38 MX31_PIN_SD1_DATA2__SD1_DATA2
,
39 MX31_PIN_SD1_DATA1__SD1_DATA1
,
40 MX31_PIN_SD1_DATA0__SD1_DATA0
,
41 MX31_PIN_SD1_CLK__SD1_CLK
,
42 MX31_PIN_SD1_CMD__SD1_CMD
,
61 MX31_PIN_VSYNC3__VSYNC3
,
62 MX31_PIN_HSYNC__HSYNC
,
63 MX31_PIN_FPSHIFT__FPSHIFT
,
64 MX31_PIN_DRDY0__DRDY0
,
65 MX31_PIN_CONTRAST__CONTRAST
,
70 static int mxc_mmc1_get_ro(struct device
*dev
)
72 return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_LCS0
));
75 static int gpio_det
, gpio_wp
;
77 #define MMC_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
78 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
80 static int mxc_mmc1_init(struct device
*dev
,
81 irq_handler_t detect_irq
, void *data
)
85 gpio_det
= IOMUX_TO_GPIO(MX31_PIN_GPIO1_1
);
86 gpio_wp
= IOMUX_TO_GPIO(MX31_PIN_LCS0
);
88 mxc_iomux_set_pad(MX31_PIN_SD1_DATA0
, MMC_PAD_CFG
);
89 mxc_iomux_set_pad(MX31_PIN_SD1_DATA1
, MMC_PAD_CFG
);
90 mxc_iomux_set_pad(MX31_PIN_SD1_DATA2
, MMC_PAD_CFG
);
91 mxc_iomux_set_pad(MX31_PIN_SD1_DATA3
, MMC_PAD_CFG
);
92 mxc_iomux_set_pad(MX31_PIN_SD1_CLK
, MMC_PAD_CFG
);
93 mxc_iomux_set_pad(MX31_PIN_SD1_CMD
, MMC_PAD_CFG
);
95 ret
= gpio_request(gpio_det
, "MMC detect");
99 ret
= gpio_request(gpio_wp
, "MMC w/p");
103 gpio_direction_input(gpio_det
);
104 gpio_direction_input(gpio_wp
);
106 ret
= request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1
)),
107 detect_irq
, IRQF_TRIGGER_FALLING
,
123 static void mxc_mmc1_exit(struct device
*dev
, void *data
)
127 free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1
)), data
);
130 static const struct imxmmc_platform_data mmc_pdata __initconst
= {
131 .get_ro
= mxc_mmc1_get_ro
,
132 .init
= mxc_mmc1_init
,
133 .exit
= mxc_mmc1_exit
,
136 /* Framebuffer support */
137 static const struct fb_videomode fb_modedb
= {
138 /* 640x480 TFT panel (IPS-056T) */
150 .sync
= FB_SYNC_VERT_HIGH_ACT
| FB_SYNC_OE_ACT_HIGH
,
151 .vmode
= FB_VMODE_NONINTERLACED
,
155 static struct mx3fb_platform_data fb_pdata __initdata
= {
161 #define LCD_VCC_EN_GPIO (7)
163 static void __init
mx31lilly_init_fb(void)
165 if (gpio_request(LCD_VCC_EN_GPIO
, "LCD enable") != 0) {
166 printk(KERN_WARNING
"unable to request LCD_VCC_EN pin.\n");
170 imx31_add_ipu_core();
171 imx31_add_mx3_sdc_fb(&fb_pdata
);
172 gpio_direction_output(LCD_VCC_EN_GPIO
, 1);
175 void __init
mx31lilly_db_init(void)
177 mxc_iomux_setup_multiple_pins(lilly_db_board_pins
,
178 ARRAY_SIZE(lilly_db_board_pins
),
179 "development board pins");
180 imx31_add_mxc_mmc(0, &mmc_pdata
);