1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * LogicPD i.MX31 SOM-LV 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/leds.h>
19 #include <linux/platform_device.h>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/map.h>
25 #include "board-mx31lite.h"
27 #include "devices-imx31.h"
29 #include "iomux-mx3.h"
32 * This file contains board-specific initialization routines for the
33 * LogicPD i.MX31 SOM-LV development board, aka 'LiteKit'.
34 * If you design an own baseboard for the module, use this file as base
38 static unsigned int litekit_db_board_pins[] __initdata = {
40 MX31_PIN_SD1_DATA0__SD1_DATA0,
41 MX31_PIN_SD1_DATA1__SD1_DATA1,
42 MX31_PIN_SD1_DATA2__SD1_DATA2,
43 MX31_PIN_SD1_DATA3__SD1_DATA3,
44 MX31_PIN_SD1_CLK__SD1_CLK,
45 MX31_PIN_SD1_CMD__SD1_CMD,
50 static int gpio_det, gpio_wp;
52 #define MMC_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
55 static int mxc_mmc1_get_ro(struct device *dev)
57 return gpio_get_value(IOMUX_TO_GPIO(MX31_PIN_GPIO1_6));
60 static int mxc_mmc1_init(struct device *dev,
61 irq_handler_t detect_irq, void *data)
65 gpio_det = IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1);
66 gpio_wp = IOMUX_TO_GPIO(MX31_PIN_GPIO1_6);
68 mxc_iomux_set_pad(MX31_PIN_SD1_DATA0,
69 MMC_PAD_CFG | PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
70 mxc_iomux_set_pad(MX31_PIN_SD1_DATA1,
71 MMC_PAD_CFG | PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
72 mxc_iomux_set_pad(MX31_PIN_SD1_DATA2,
73 MMC_PAD_CFG | PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
74 mxc_iomux_set_pad(MX31_PIN_SD1_DATA3,
75 MMC_PAD_CFG | PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
76 mxc_iomux_set_pad(MX31_PIN_SD1_CMD,
77 MMC_PAD_CFG | PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
78 mxc_iomux_set_pad(MX31_PIN_SD1_CLK, MMC_PAD_CFG);
80 ret = gpio_request(gpio_det, "MMC detect");
84 ret = gpio_request(gpio_wp, "MMC w/p");
88 gpio_direction_input(gpio_det);
89 gpio_direction_input(gpio_wp);
91 ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)),
93 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
109 static void mxc_mmc1_exit(struct device *dev, void *data)
113 free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)), data);
116 static const struct imxmmc_platform_data mmc_pdata __initconst = {
117 .get_ro = mxc_mmc1_get_ro,
118 .init = mxc_mmc1_init,
119 .exit = mxc_mmc1_exit,
124 static const struct gpio_led litekit_leds[] __initconst = {
127 .gpio = IOMUX_TO_GPIO(MX31_PIN_COMPARE),
129 .default_state = LEDS_GPIO_DEFSTATE_OFF,
133 .gpio = IOMUX_TO_GPIO(MX31_PIN_CAPTURE),
135 .default_state = LEDS_GPIO_DEFSTATE_OFF,
139 static const struct gpio_led_platform_data
140 litekit_led_platform_data __initconst = {
141 .leds = litekit_leds,
142 .num_leds = ARRAY_SIZE(litekit_leds),
145 void __init mx31lite_db_init(void)
147 mxc_iomux_setup_multiple_pins(litekit_db_board_pins,
148 ARRAY_SIZE(litekit_db_board_pins),
149 "development board pins");
150 imx31_add_mxc_mmc(0, &mmc_pdata);
151 gpio_led_register_device(-1, &litekit_led_platform_data);
152 imx31_add_imx2_wdt();