]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/arm/mach-imx/eukrea_mbimxsd-baseboard.c
ARM: imx: eukrea_mbimxsd: add audio support
[karo-tx-linux.git] / arch / arm / mach-imx / eukrea_mbimxsd-baseboard.c
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>
27 #include <linux/leds.h>
28 #include <linux/platform_device.h>
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>
39 #include <mach/iomux-mx51.h>
40
41 #include "devices-imx51.h"
42
43 static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
44         /* LED */
45         MX51_PAD_NANDF_D10__GPIO3_30,
46         /* SWITCH */
47         NEW_PAD_CTRL(MX51_PAD_NANDF_D9__GPIO3_31, PAD_CTL_PUS_22K_UP |
48                         PAD_CTL_PKE | PAD_CTL_SRE_FAST |
49                         PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
50         /* UART2 */
51         MX51_PAD_UART2_RXD__UART2_RXD,
52         MX51_PAD_UART2_TXD__UART2_TXD,
53         /* UART 3 */
54         MX51_PAD_UART3_RXD__UART3_RXD,
55         MX51_PAD_UART3_TXD__UART3_TXD,
56         MX51_PAD_KEY_COL4__UART3_RTS,
57         MX51_PAD_KEY_COL5__UART3_CTS,
58         /* SD */
59         MX51_PAD_SD1_CMD__SD1_CMD,
60         MX51_PAD_SD1_CLK__SD1_CLK,
61         MX51_PAD_SD1_DATA0__SD1_DATA0,
62         MX51_PAD_SD1_DATA1__SD1_DATA1,
63         MX51_PAD_SD1_DATA2__SD1_DATA2,
64         MX51_PAD_SD1_DATA3__SD1_DATA3,
65         /* SD1 CD */
66         NEW_PAD_CTRL(MX51_PAD_GPIO1_0__SD1_CD, PAD_CTL_PUS_22K_UP |
67                         PAD_CTL_PKE | PAD_CTL_SRE_FAST |
68                         PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
69         /* SSI */
70         MX51_PAD_AUD3_BB_TXD__AUD3_TXD,
71         MX51_PAD_AUD3_BB_RXD__AUD3_RXD,
72         MX51_PAD_AUD3_BB_CK__AUD3_TXC,
73         MX51_PAD_AUD3_BB_FS__AUD3_TXFS,
74 };
75
76 #define GPIO_LED1       IMX_GPIO_NR(3, 30)
77 #define GPIO_SWITCH1    IMX_GPIO_NR(3, 31)
78
79 static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = {
80         {
81                 .name                   = "led1",
82                 .default_trigger        = "heartbeat",
83                 .active_low             = 1,
84                 .gpio                   = GPIO_LED1,
85         },
86 };
87
88 static const struct gpio_led_platform_data
89                 eukrea_mbimxsd_led_info __initconst = {
90         .leds           = eukrea_mbimxsd_leds,
91         .num_leds       = ARRAY_SIZE(eukrea_mbimxsd_leds),
92 };
93
94 static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {
95         {
96                 .gpio           = GPIO_SWITCH1,
97                 .code           = BTN_0,
98                 .desc           = "BP1",
99                 .active_low     = 1,
100                 .wakeup         = 1,
101         },
102 };
103
104 static const struct gpio_keys_platform_data
105                 eukrea_mbimxsd_button_data __initconst = {
106         .buttons        = eukrea_mbimxsd_gpio_buttons,
107         .nbuttons       = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons),
108 };
109
110 static const struct imxuart_platform_data uart_pdata __initconst = {
111         .flags = IMXUART_HAVE_RTSCTS,
112 };
113
114 static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
115         {
116                 I2C_BOARD_INFO("tlv320aic23", 0x1a),
117         },
118 };
119
120 static const
121 struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata __initconst = {
122         .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
123 };
124
125 /*
126  * system init for baseboard usage. Will be called by cpuimx51sd init.
127  *
128  * Add platform devices present on this baseboard and init
129  * them from CPU side as far as required to use them later on
130  */
131 void __init eukrea_mbimxsd51_baseboard_init(void)
132 {
133         if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads,
134                         ARRAY_SIZE(eukrea_mbimxsd_pads)))
135                 printk(KERN_ERR "error setting mbimxsd pads !\n");
136
137         imx51_add_imx_uart(1, NULL);
138         imx51_add_imx_uart(2, &uart_pdata);
139
140         imx51_add_sdhci_esdhc_imx(0, NULL);
141
142         imx51_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
143
144         gpio_request(GPIO_LED1, "LED1");
145         gpio_direction_output(GPIO_LED1, 1);
146         gpio_free(GPIO_LED1);
147
148         gpio_request(GPIO_SWITCH1, "SWITCH1");
149         gpio_direction_input(GPIO_SWITCH1);
150         gpio_free(GPIO_SWITCH1);
151
152         i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
153                                 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
154
155         gpio_led_register_device(-1, &eukrea_mbimxsd_led_info);
156         imx_add_gpio_keys(&eukrea_mbimxsd_button_data);
157 }