| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2010 Eric Benard - eric@eukrea.com | 
|  | 3 | * | 
|  | 4 | * Based on pcm970-baseboard.c which is : | 
|  | 5 | * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) | 
|  | 6 | * | 
|  | 7 | * This program is free software; you can redistribute it and/or | 
|  | 8 | * modify it under the terms of the GNU General Public License | 
|  | 9 | * as published by the Free Software Foundation; either version 2 | 
|  | 10 | * of the License, or (at your option) any later version. | 
|  | 11 | * This program is distributed in the hope that it will be useful, | 
|  | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 14 | * GNU General Public License for more details. | 
|  | 15 | * | 
|  | 16 | * You should have received a copy of the GNU General Public License | 
|  | 17 | * along with this program; if not, write to the Free Software | 
|  | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | 
|  | 19 | * MA 02110-1301, USA. | 
|  | 20 | */ | 
|  | 21 |  | 
|  | 22 | #include <linux/types.h> | 
|  | 23 | #include <linux/init.h> | 
|  | 24 |  | 
|  | 25 | #include <linux/gpio.h> | 
|  | 26 | #include <linux/interrupt.h> | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 27 | #include <linux/leds.h> | 
|  | 28 | #include <linux/platform_device.h> | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 29 | #include <linux/input.h> | 
|  | 30 | #include <linux/i2c.h> | 
|  | 31 |  | 
|  | 32 | #include <asm/mach-types.h> | 
|  | 33 | #include <asm/mach/arch.h> | 
|  | 34 | #include <asm/mach/time.h> | 
|  | 35 | #include <asm/mach/map.h> | 
|  | 36 |  | 
|  | 37 | #include <mach/hardware.h> | 
|  | 38 | #include <mach/common.h> | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 39 | #include <mach/iomux-mx51.h> | 
|  | 40 | #include <mach/audmux.h> | 
|  | 41 |  | 
|  | 42 | #include "devices-imx51.h" | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 43 |  | 
| Lothar Waßmann | 8f5260c | 2010-10-26 14:28:31 +0200 | [diff] [blame] | 44 | static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = { | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 45 | /* LED */ | 
| Sascha Hauer | ee1ae4d | 2010-12-15 09:56:35 +0100 | [diff] [blame] | 46 | MX51_PAD_NANDF_D10__GPIO3_30, | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 47 | /* SWITCH */ | 
| Troy Kisky | 7242e24 | 2011-08-13 12:51:41 -0700 | [diff] [blame] | 48 | NEW_PAD_CTRL(MX51_PAD_NANDF_D9__GPIO3_31, PAD_CTL_PUS_22K_UP | | 
| Sascha Hauer | ee1ae4d | 2010-12-15 09:56:35 +0100 | [diff] [blame] | 49 | PAD_CTL_PKE | PAD_CTL_SRE_FAST | | 
|  | 50 | PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS), | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 51 | /* UART2 */ | 
|  | 52 | MX51_PAD_UART2_RXD__UART2_RXD, | 
|  | 53 | MX51_PAD_UART2_TXD__UART2_TXD, | 
|  | 54 | /* UART 3 */ | 
|  | 55 | MX51_PAD_UART3_RXD__UART3_RXD, | 
|  | 56 | MX51_PAD_UART3_TXD__UART3_TXD, | 
|  | 57 | MX51_PAD_KEY_COL4__UART3_RTS, | 
|  | 58 | MX51_PAD_KEY_COL5__UART3_CTS, | 
|  | 59 | /* SD */ | 
|  | 60 | MX51_PAD_SD1_CMD__SD1_CMD, | 
|  | 61 | MX51_PAD_SD1_CLK__SD1_CLK, | 
|  | 62 | MX51_PAD_SD1_DATA0__SD1_DATA0, | 
|  | 63 | MX51_PAD_SD1_DATA1__SD1_DATA1, | 
|  | 64 | MX51_PAD_SD1_DATA2__SD1_DATA2, | 
|  | 65 | MX51_PAD_SD1_DATA3__SD1_DATA3, | 
| Eric Bénard | ef560bf | 2011-02-25 14:38:31 +0100 | [diff] [blame] | 66 | /* SD1 CD */ | 
| Troy Kisky | 7242e24 | 2011-08-13 12:51:41 -0700 | [diff] [blame] | 67 | NEW_PAD_CTRL(MX51_PAD_GPIO1_0__SD1_CD, PAD_CTL_PUS_22K_UP | | 
| Eric Bénard | ef560bf | 2011-02-25 14:38:31 +0100 | [diff] [blame] | 68 | PAD_CTL_PKE | PAD_CTL_SRE_FAST | | 
|  | 69 | PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS), | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 70 | }; | 
|  | 71 |  | 
| Arnaud Patard (Rtp) | 96886c4 | 2010-11-26 15:20:52 +0100 | [diff] [blame] | 72 | #define GPIO_LED1	IMX_GPIO_NR(3, 30) | 
|  | 73 | #define GPIO_SWITCH1	IMX_GPIO_NR(3, 31) | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 74 |  | 
| Uwe Kleine-König | 5b8d628 | 2011-05-28 21:05:02 +0200 | [diff] [blame] | 75 | static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = { | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 76 | { | 
|  | 77 | .name			= "led1", | 
|  | 78 | .default_trigger	= "heartbeat", | 
|  | 79 | .active_low		= 1, | 
|  | 80 | .gpio			= GPIO_LED1, | 
|  | 81 | }, | 
|  | 82 | }; | 
|  | 83 |  | 
| Uwe Kleine-König | 5b8d628 | 2011-05-28 21:05:02 +0200 | [diff] [blame] | 84 | static const struct gpio_led_platform_data | 
|  | 85 | eukrea_mbimxsd_led_info __initconst = { | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 86 | .leds		= eukrea_mbimxsd_leds, | 
|  | 87 | .num_leds	= ARRAY_SIZE(eukrea_mbimxsd_leds), | 
|  | 88 | }; | 
|  | 89 |  | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 90 | static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = { | 
|  | 91 | { | 
|  | 92 | .gpio		= GPIO_SWITCH1, | 
|  | 93 | .code		= BTN_0, | 
|  | 94 | .desc		= "BP1", | 
|  | 95 | .active_low	= 1, | 
|  | 96 | .wakeup		= 1, | 
|  | 97 | }, | 
|  | 98 | }; | 
|  | 99 |  | 
| Uwe Kleine-König | 5309498 | 2011-02-28 18:04:33 +0100 | [diff] [blame] | 100 | static const struct gpio_keys_platform_data | 
|  | 101 | eukrea_mbimxsd_button_data __initconst = { | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 102 | .buttons	= eukrea_mbimxsd_gpio_buttons, | 
|  | 103 | .nbuttons	= ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons), | 
|  | 104 | }; | 
|  | 105 |  | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 106 | static const struct imxuart_platform_data uart_pdata __initconst = { | 
|  | 107 | .flags = IMXUART_HAVE_RTSCTS, | 
|  | 108 | }; | 
|  | 109 |  | 
|  | 110 | static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = { | 
|  | 111 | { | 
|  | 112 | I2C_BOARD_INFO("tlv320aic23", 0x1a), | 
|  | 113 | }, | 
|  | 114 | }; | 
|  | 115 |  | 
|  | 116 | /* | 
|  | 117 | * system init for baseboard usage. Will be called by cpuimx51sd init. | 
|  | 118 | * | 
|  | 119 | * Add platform devices present on this baseboard and init | 
|  | 120 | * them from CPU side as far as required to use them later on | 
|  | 121 | */ | 
|  | 122 | void __init eukrea_mbimxsd51_baseboard_init(void) | 
|  | 123 | { | 
|  | 124 | if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads, | 
|  | 125 | ARRAY_SIZE(eukrea_mbimxsd_pads))) | 
|  | 126 | printk(KERN_ERR "error setting mbimxsd pads !\n"); | 
|  | 127 |  | 
|  | 128 | imx51_add_imx_uart(1, NULL); | 
|  | 129 | imx51_add_imx_uart(2, &uart_pdata); | 
|  | 130 |  | 
| Uwe Kleine-König | 124bf94 | 2010-11-19 21:03:33 +0100 | [diff] [blame] | 131 | imx51_add_sdhci_esdhc_imx(0, NULL); | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 132 |  | 
|  | 133 | gpio_request(GPIO_LED1, "LED1"); | 
|  | 134 | gpio_direction_output(GPIO_LED1, 1); | 
|  | 135 | gpio_free(GPIO_LED1); | 
|  | 136 |  | 
|  | 137 | gpio_request(GPIO_SWITCH1, "SWITCH1"); | 
|  | 138 | gpio_direction_input(GPIO_SWITCH1); | 
|  | 139 | gpio_free(GPIO_SWITCH1); | 
|  | 140 |  | 
|  | 141 | i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, | 
|  | 142 | ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); | 
|  | 143 |  | 
| Uwe Kleine-König | 5b8d628 | 2011-05-28 21:05:02 +0200 | [diff] [blame] | 144 | gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); | 
| Uwe Kleine-König | 5309498 | 2011-02-28 18:04:33 +0100 | [diff] [blame] | 145 | imx_add_gpio_keys(&eukrea_mbimxsd_button_data); | 
| Eric Bénard | 70b1726 | 2010-10-12 16:12:36 +0200 | [diff] [blame] | 146 | } |