Path: blob/master/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c
10817 views
/*1* Copyright (C) 2010 Eric Benard - [email protected]2*3* Based on pcm970-baseboard.c which is :4* Copyright (C) 2008 Juergen Beisert ([email protected])5*6* This program is free software; you can redistribute it and/or7* modify it under the terms of the GNU General Public License8* as published by the Free Software Foundation; either version 29* of the License, or (at your option) any later version.10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,18* MA 02110-1301, USA.19*/2021#include <linux/types.h>22#include <linux/init.h>2324#include <linux/gpio.h>25#include <linux/interrupt.h>26#include <linux/irq.h>27#include <linux/leds.h>28#include <linux/platform_device.h>29#include <linux/input.h>30#include <linux/i2c.h>3132#include <asm/mach-types.h>33#include <asm/mach/arch.h>34#include <asm/mach/time.h>35#include <asm/mach/map.h>3637#include <mach/hardware.h>38#include <mach/common.h>39#include <mach/iomux-mx51.h>40#include <mach/audmux.h>4142#include "devices-imx51.h"43#include "devices.h"4445static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {46/* LED */47MX51_PAD_NANDF_D10__GPIO3_30,48/* SWITCH */49_MX51_PAD_NANDF_D9__GPIO3_31 | MUX_PAD_CTRL(PAD_CTL_PUS_22K_UP |50PAD_CTL_PKE | PAD_CTL_SRE_FAST |51PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),52/* UART2 */53MX51_PAD_UART2_RXD__UART2_RXD,54MX51_PAD_UART2_TXD__UART2_TXD,55/* UART 3 */56MX51_PAD_UART3_RXD__UART3_RXD,57MX51_PAD_UART3_TXD__UART3_TXD,58MX51_PAD_KEY_COL4__UART3_RTS,59MX51_PAD_KEY_COL5__UART3_CTS,60/* SD */61MX51_PAD_SD1_CMD__SD1_CMD,62MX51_PAD_SD1_CLK__SD1_CLK,63MX51_PAD_SD1_DATA0__SD1_DATA0,64MX51_PAD_SD1_DATA1__SD1_DATA1,65MX51_PAD_SD1_DATA2__SD1_DATA2,66MX51_PAD_SD1_DATA3__SD1_DATA3,67/* SD1 CD */68_MX51_PAD_GPIO1_0__SD1_CD | MUX_PAD_CTRL(PAD_CTL_PUS_22K_UP |69PAD_CTL_PKE | PAD_CTL_SRE_FAST |70PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),71};7273#define GPIO_LED1 IMX_GPIO_NR(3, 30)74#define GPIO_SWITCH1 IMX_GPIO_NR(3, 31)7576static struct gpio_led eukrea_mbimxsd_leds[] = {77{78.name = "led1",79.default_trigger = "heartbeat",80.active_low = 1,81.gpio = GPIO_LED1,82},83};8485static struct gpio_led_platform_data eukrea_mbimxsd_led_info = {86.leds = eukrea_mbimxsd_leds,87.num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds),88};8990static struct platform_device eukrea_mbimxsd_leds_gpio = {91.name = "leds-gpio",92.id = -1,93.dev = {94.platform_data = &eukrea_mbimxsd_led_info,95},96};9798static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {99{100.gpio = GPIO_SWITCH1,101.code = BTN_0,102.desc = "BP1",103.active_low = 1,104.wakeup = 1,105},106};107108static const struct gpio_keys_platform_data109eukrea_mbimxsd_button_data __initconst = {110.buttons = eukrea_mbimxsd_gpio_buttons,111.nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons),112};113114static struct platform_device *platform_devices[] __initdata = {115&eukrea_mbimxsd_leds_gpio,116};117118static const struct imxuart_platform_data uart_pdata __initconst = {119.flags = IMXUART_HAVE_RTSCTS,120};121122static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {123{124I2C_BOARD_INFO("tlv320aic23", 0x1a),125},126};127128/*129* system init for baseboard usage. Will be called by cpuimx51sd init.130*131* Add platform devices present on this baseboard and init132* them from CPU side as far as required to use them later on133*/134void __init eukrea_mbimxsd51_baseboard_init(void)135{136if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads,137ARRAY_SIZE(eukrea_mbimxsd_pads)))138printk(KERN_ERR "error setting mbimxsd pads !\n");139140imx51_add_imx_uart(1, NULL);141imx51_add_imx_uart(2, &uart_pdata);142143imx51_add_sdhci_esdhc_imx(0, NULL);144145gpio_request(GPIO_LED1, "LED1");146gpio_direction_output(GPIO_LED1, 1);147gpio_free(GPIO_LED1);148149gpio_request(GPIO_SWITCH1, "SWITCH1");150gpio_direction_input(GPIO_SWITCH1);151gpio_free(GPIO_SWITCH1);152153i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,154ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));155156platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));157imx_add_gpio_keys(&eukrea_mbimxsd_button_data);158}159160161