rtc: Namespace fixup
[pandora-kernel.git] / arch / arm / mach-mx25 / mach-mx25_3ds.c
1 /*
2  * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA  02110-1301, USA.
17  */
18
19 /*
20  * This machine is known as:
21  *  - i.MX25 3-Stack Development System
22  *  - i.MX25 Platform Development Kit (i.MX25 PDK)
23  */
24
25 #include <linux/types.h>
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/clk.h>
29 #include <linux/irq.h>
30 #include <linux/gpio.h>
31 #include <linux/fec.h>
32 #include <linux/platform_device.h>
33 #include <linux/input/matrix_keypad.h>
34
35 #include <mach/hardware.h>
36 #include <asm/mach-types.h>
37 #include <asm/mach/arch.h>
38 #include <asm/mach/time.h>
39 #include <asm/memory.h>
40 #include <asm/mach/map.h>
41 #include <mach/common.h>
42 #include <mach/mx25.h>
43 #include <mach/imxfb.h>
44 #include <mach/iomux-mx25.h>
45
46 #include "devices-imx25.h"
47 #include "devices.h"
48
49 static const struct imxuart_platform_data uart_pdata __initconst = {
50         .flags = IMXUART_HAVE_RTSCTS,
51 };
52
53 static struct pad_desc mx25pdk_pads[] = {
54         MX25_PAD_FEC_MDC__FEC_MDC,
55         MX25_PAD_FEC_MDIO__FEC_MDIO,
56         MX25_PAD_FEC_TDATA0__FEC_TDATA0,
57         MX25_PAD_FEC_TDATA1__FEC_TDATA1,
58         MX25_PAD_FEC_TX_EN__FEC_TX_EN,
59         MX25_PAD_FEC_RDATA0__FEC_RDATA0,
60         MX25_PAD_FEC_RDATA1__FEC_RDATA1,
61         MX25_PAD_FEC_RX_DV__FEC_RX_DV,
62         MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
63         MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
64         MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
65
66         /* LCD */
67         MX25_PAD_LD0__LD0,
68         MX25_PAD_LD1__LD1,
69         MX25_PAD_LD2__LD2,
70         MX25_PAD_LD3__LD3,
71         MX25_PAD_LD4__LD4,
72         MX25_PAD_LD5__LD5,
73         MX25_PAD_LD6__LD6,
74         MX25_PAD_LD7__LD7,
75         MX25_PAD_LD8__LD8,
76         MX25_PAD_LD9__LD9,
77         MX25_PAD_LD10__LD10,
78         MX25_PAD_LD11__LD11,
79         MX25_PAD_LD12__LD12,
80         MX25_PAD_LD13__LD13,
81         MX25_PAD_LD14__LD14,
82         MX25_PAD_LD15__LD15,
83         MX25_PAD_GPIO_E__LD16,
84         MX25_PAD_GPIO_F__LD17,
85         MX25_PAD_HSYNC__HSYNC,
86         MX25_PAD_VSYNC__VSYNC,
87         MX25_PAD_LSCLK__LSCLK,
88         MX25_PAD_OE_ACD__OE_ACD,
89         MX25_PAD_CONTRAST__CONTRAST,
90
91         /* Keypad */
92         MX25_PAD_KPP_ROW0__KPP_ROW0,
93         MX25_PAD_KPP_ROW1__KPP_ROW1,
94         MX25_PAD_KPP_ROW2__KPP_ROW2,
95         MX25_PAD_KPP_ROW3__KPP_ROW3,
96         MX25_PAD_KPP_COL0__KPP_COL0,
97         MX25_PAD_KPP_COL1__KPP_COL1,
98         MX25_PAD_KPP_COL2__KPP_COL2,
99         MX25_PAD_KPP_COL3__KPP_COL3,
100 };
101
102 static struct fec_platform_data mx25_fec_pdata = {
103         .phy    = PHY_INTERFACE_MODE_RMII,
104 };
105
106 #define FEC_ENABLE_GPIO         35
107 #define FEC_RESET_B_GPIO        104
108
109 static void __init mx25pdk_fec_reset(void)
110 {
111         gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable");
112         gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset");
113
114         gpio_direction_output(FEC_ENABLE_GPIO, 0);  /* drop PHY power */
115         gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */
116         udelay(2);
117
118         /* turn on PHY power and lift reset */
119         gpio_set_value(FEC_ENABLE_GPIO, 1);
120         gpio_set_value(FEC_RESET_B_GPIO, 1);
121 }
122
123 static const struct mxc_nand_platform_data
124 mx25pdk_nand_board_info __initconst = {
125         .width          = 1,
126         .hw_ecc         = 1,
127         .flash_bbt      = 1,
128 };
129
130 static struct imx_fb_videomode mx25pdk_modes[] = {
131         {
132                 .mode   = {
133                         .name           = "CRT-VGA",
134                         .refresh        = 60,
135                         .xres           = 640,
136                         .yres           = 480,
137                         .pixclock       = 39683,
138                         .left_margin    = 45,
139                         .right_margin   = 114,
140                         .upper_margin   = 33,
141                         .lower_margin   = 11,
142                         .hsync_len      = 1,
143                         .vsync_len      = 1,
144                 },
145                 .bpp    = 16,
146                 .pcr    = 0xFA208B80,
147         },
148 };
149
150 static struct imx_fb_platform_data mx25pdk_fb_pdata = {
151         .mode           = mx25pdk_modes,
152         .num_modes      = ARRAY_SIZE(mx25pdk_modes),
153         .pwmr           = 0x00A903FF,
154         .lscr1          = 0x00120300,
155         .dmacr          = 0x00020010,
156 };
157
158 static const uint32_t mx25pdk_keymap[] = {
159         KEY(0, 0, KEY_UP),
160         KEY(0, 1, KEY_DOWN),
161         KEY(0, 2, KEY_VOLUMEDOWN),
162         KEY(0, 3, KEY_HOME),
163         KEY(1, 0, KEY_RIGHT),
164         KEY(1, 1, KEY_LEFT),
165         KEY(1, 2, KEY_ENTER),
166         KEY(1, 3, KEY_VOLUMEUP),
167         KEY(2, 0, KEY_F6),
168         KEY(2, 1, KEY_F8),
169         KEY(2, 2, KEY_F9),
170         KEY(2, 3, KEY_F10),
171         KEY(3, 0, KEY_F1),
172         KEY(3, 1, KEY_F2),
173         KEY(3, 2, KEY_F3),
174         KEY(3, 3, KEY_POWER),
175 };
176
177 static struct matrix_keymap_data mx25pdk_keymap_data = {
178         .keymap         = mx25pdk_keymap,
179         .keymap_size    = ARRAY_SIZE(mx25pdk_keymap),
180 };
181
182 static void __init mx25pdk_init(void)
183 {
184         mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
185                         ARRAY_SIZE(mx25pdk_pads));
186
187         imx25_add_imx_uart0(&uart_pdata);
188         mxc_register_device(&mxc_usbh2, NULL);
189         imx25_add_mxc_nand(&mx25pdk_nand_board_info);
190         mxc_register_device(&mx25_rtc_device, NULL);
191         mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata);
192         mxc_register_device(&mxc_wdt, NULL);
193
194         mx25pdk_fec_reset();
195         mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
196         mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data);
197 }
198
199 static void __init mx25pdk_timer_init(void)
200 {
201         mx25_clocks_init();
202 }
203
204 static struct sys_timer mx25pdk_timer = {
205         .init   = mx25pdk_timer_init,
206 };
207
208 MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)")
209         /* Maintainer: Freescale Semiconductor, Inc. */
210         .phys_io        = MX25_AIPS1_BASE_ADDR,
211         .io_pg_offst    = ((MX25_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
212         .boot_params    = MX25_PHYS_OFFSET + 0x100,
213         .map_io         = mx25_map_io,
214         .init_irq       = mx25_init_irq,
215         .init_machine   = mx25pdk_init,
216         .timer          = &mx25pdk_timer,
217 MACHINE_END
218