blob: 4a57f68860cb9e4ad0cf447665df7bce1400e4b0 [file] [log] [blame]
Sascha Hauerde41fdd2009-10-02 09:14:18 +02001/*
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
Sascha Hauer635baf62009-06-04 11:32:46 +020019#include <linux/types.h>
20#include <linux/init.h>
Baruch Siache71fbaf2009-12-21 13:44:32 +020021#include <linux/delay.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020022#include <linux/clk.h>
23#include <linux/irq.h>
24#include <linux/gpio.h>
Baruch Siache71fbaf2009-12-21 13:44:32 +020025#include <linux/fec.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020026#include <linux/platform_device.h>
Baruch Siachc45dd812010-05-26 15:12:11 +030027#include <linux/input/matrix_keypad.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020028
29#include <mach/hardware.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/time.h>
33#include <asm/memory.h>
34#include <asm/mach/map.h>
35#include <mach/common.h>
36#include <mach/imx-uart.h>
37#include <mach/mx25.h>
38#include <mach/mxc_nand.h>
Baruch Siach0f547dc2010-02-17 12:33:25 +020039#include <mach/imxfb.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020040#include "devices.h"
Uwe Kleine-König261f6f62010-02-15 21:18:43 +010041#include <mach/iomux-mx25.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020042
43static struct imxuart_platform_data uart_pdata = {
44 .flags = IMXUART_HAVE_RTSCTS,
45};
46
Baruch Siache71fbaf2009-12-21 13:44:32 +020047static struct pad_desc mx25pdk_pads[] = {
48 MX25_PAD_FEC_MDC__FEC_MDC,
49 MX25_PAD_FEC_MDIO__FEC_MDIO,
50 MX25_PAD_FEC_TDATA0__FEC_TDATA0,
51 MX25_PAD_FEC_TDATA1__FEC_TDATA1,
52 MX25_PAD_FEC_TX_EN__FEC_TX_EN,
53 MX25_PAD_FEC_RDATA0__FEC_RDATA0,
54 MX25_PAD_FEC_RDATA1__FEC_RDATA1,
55 MX25_PAD_FEC_RX_DV__FEC_RX_DV,
56 MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
57 MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
58 MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
Baruch Siach0f547dc2010-02-17 12:33:25 +020059
60 /* LCD */
61 MX25_PAD_LD0__LD0,
62 MX25_PAD_LD1__LD1,
63 MX25_PAD_LD2__LD2,
64 MX25_PAD_LD3__LD3,
65 MX25_PAD_LD4__LD4,
66 MX25_PAD_LD5__LD5,
67 MX25_PAD_LD6__LD6,
68 MX25_PAD_LD7__LD7,
69 MX25_PAD_LD8__LD8,
70 MX25_PAD_LD9__LD9,
71 MX25_PAD_LD10__LD10,
72 MX25_PAD_LD11__LD11,
73 MX25_PAD_LD12__LD12,
74 MX25_PAD_LD13__LD13,
75 MX25_PAD_LD14__LD14,
76 MX25_PAD_LD15__LD15,
77 MX25_PAD_GPIO_E__LD16,
78 MX25_PAD_GPIO_F__LD17,
79 MX25_PAD_HSYNC__HSYNC,
80 MX25_PAD_VSYNC__VSYNC,
81 MX25_PAD_LSCLK__LSCLK,
82 MX25_PAD_OE_ACD__OE_ACD,
83 MX25_PAD_CONTRAST__CONTRAST,
Baruch Siachc45dd812010-05-26 15:12:11 +030084
85 /* Keypad */
86 MX25_PAD_KPP_ROW0__KPP_ROW0,
87 MX25_PAD_KPP_ROW1__KPP_ROW1,
88 MX25_PAD_KPP_ROW2__KPP_ROW2,
89 MX25_PAD_KPP_ROW3__KPP_ROW3,
90 MX25_PAD_KPP_COL0__KPP_COL0,
91 MX25_PAD_KPP_COL1__KPP_COL1,
92 MX25_PAD_KPP_COL2__KPP_COL2,
93 MX25_PAD_KPP_COL3__KPP_COL3,
Baruch Siache71fbaf2009-12-21 13:44:32 +020094};
95
96static struct fec_platform_data mx25_fec_pdata = {
97 .phy = PHY_INTERFACE_MODE_RMII,
98};
99
100#define FEC_ENABLE_GPIO 35
101#define FEC_RESET_B_GPIO 104
102
103static void __init mx25pdk_fec_reset(void)
104{
105 gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable");
106 gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset");
107
108 gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */
109 gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */
110 udelay(2);
111
112 /* turn on PHY power and lift reset */
113 gpio_set_value(FEC_ENABLE_GPIO, 1);
114 gpio_set_value(FEC_RESET_B_GPIO, 1);
115}
116
Baruch Siachb97235d2010-01-14 11:24:15 +0200117static struct mxc_nand_platform_data mx25pdk_nand_board_info = {
118 .width = 1,
119 .hw_ecc = 1,
120 .flash_bbt = 1,
121};
122
Baruch Siach0f547dc2010-02-17 12:33:25 +0200123static struct imx_fb_videomode mx25pdk_modes[] = {
124 {
125 .mode = {
126 .name = "CRT-VGA",
127 .refresh = 60,
128 .xres = 640,
129 .yres = 480,
130 .pixclock = 39683,
131 .left_margin = 45,
132 .right_margin = 114,
133 .upper_margin = 33,
134 .lower_margin = 11,
135 .hsync_len = 1,
136 .vsync_len = 1,
137 },
138 .bpp = 16,
139 .pcr = 0xFA208B80,
140 },
141};
142
143static struct imx_fb_platform_data mx25pdk_fb_pdata = {
144 .mode = mx25pdk_modes,
145 .num_modes = ARRAY_SIZE(mx25pdk_modes),
146 .pwmr = 0x00A903FF,
147 .lscr1 = 0x00120300,
148 .dmacr = 0x00020010,
149};
150
Baruch Siachc45dd812010-05-26 15:12:11 +0300151static const uint32_t mx25pdk_keymap[] = {
152 KEY(0, 0, KEY_UP),
153 KEY(0, 1, KEY_DOWN),
154 KEY(0, 2, KEY_VOLUMEDOWN),
155 KEY(0, 3, KEY_HOME),
156 KEY(1, 0, KEY_RIGHT),
157 KEY(1, 1, KEY_LEFT),
158 KEY(1, 2, KEY_ENTER),
159 KEY(1, 3, KEY_VOLUMEUP),
160 KEY(2, 0, KEY_F6),
161 KEY(2, 1, KEY_F8),
162 KEY(2, 2, KEY_F9),
163 KEY(2, 3, KEY_F10),
164 KEY(3, 0, KEY_F1),
165 KEY(3, 1, KEY_F2),
166 KEY(3, 2, KEY_F3),
167 KEY(3, 3, KEY_POWER),
168};
169
170static struct matrix_keymap_data mx25pdk_keymap_data = {
171 .keymap = mx25pdk_keymap,
172 .keymap_size = ARRAY_SIZE(mx25pdk_keymap),
173};
174
Sascha Hauer635baf62009-06-04 11:32:46 +0200175static void __init mx25pdk_init(void)
176{
Baruch Siache71fbaf2009-12-21 13:44:32 +0200177 mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
178 ARRAY_SIZE(mx25pdk_pads));
179
Sascha Hauer635baf62009-06-04 11:32:46 +0200180 mxc_register_device(&mxc_uart_device0, &uart_pdata);
181 mxc_register_device(&mxc_usbh2, NULL);
Baruch Siachb97235d2010-01-14 11:24:15 +0200182 mxc_register_device(&mxc_nand_device, &mx25pdk_nand_board_info);
Baruch Siach1eaa4f22010-01-27 15:00:49 +0200183 mxc_register_device(&mx25_rtc_device, NULL);
Baruch Siach0f547dc2010-02-17 12:33:25 +0200184 mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata);
Baruch Siache71fbaf2009-12-21 13:44:32 +0200185
186 mx25pdk_fec_reset();
187 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
Baruch Siachc45dd812010-05-26 15:12:11 +0300188 mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data);
Sascha Hauer635baf62009-06-04 11:32:46 +0200189}
190
Sascha Hauer635baf62009-06-04 11:32:46 +0200191static void __init mx25pdk_timer_init(void)
192{
Baruch Siachfadc0952010-01-25 12:58:19 +0200193 mx25_clocks_init();
Sascha Hauer635baf62009-06-04 11:32:46 +0200194}
195
196static struct sys_timer mx25pdk_timer = {
197 .init = mx25pdk_timer_init,
198};
199
200MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)")
201 /* Maintainer: Freescale Semiconductor, Inc. */
202 .phys_io = MX25_AIPS1_BASE_ADDR,
203 .io_pg_offst = ((MX25_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
Uwe Kleine-König34101232010-01-29 17:36:05 +0100204 .boot_params = MX25_PHYS_OFFSET + 0x100,
Sascha Hauer635baf62009-06-04 11:32:46 +0200205 .map_io = mx25_map_io,
206 .init_irq = mx25_init_irq,
207 .init_machine = mx25pdk_init,
208 .timer = &mx25pdk_timer,
209MACHINE_END
210