blob: 978ad00b807c39ceafed212fb582ea41afd84402 [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
Uwe Kleine-Königc10ea4d2010-03-04 16:43:31 +010019/*
20 * This machine is known as:
21 * - i.MX25 3-Stack Development System
22 * - i.MX25 Platform Development Kit (i.MX25 PDK)
23 */
24
Sascha Hauer635baf62009-06-04 11:32:46 +020025#include <linux/types.h>
26#include <linux/init.h>
Baruch Siache71fbaf2009-12-21 13:44:32 +020027#include <linux/delay.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020028#include <linux/clk.h>
29#include <linux/irq.h>
30#include <linux/gpio.h>
Baruch Siache71fbaf2009-12-21 13:44:32 +020031#include <linux/fec.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020032#include <linux/platform_device.h>
33
34#include <mach/hardware.h>
35#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37#include <asm/mach/time.h>
38#include <asm/memory.h>
39#include <asm/mach/map.h>
40#include <mach/common.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020041#include <mach/mx25.h>
Baruch Siach0f547dc2010-02-17 12:33:25 +020042#include <mach/imxfb.h>
Uwe Kleine-König261f6f62010-02-15 21:18:43 +010043#include <mach/iomux-mx25.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020044
Uwe Kleine-Königb0c48452010-06-16 12:34:56 +020045#include "devices-imx25.h"
46#include "devices.h"
47
Uwe Kleine-König7cc3c842010-06-24 15:20:44 +020048static const struct imxuart_platform_data uart_pdata __initconst = {
Sascha Hauer635baf62009-06-04 11:32:46 +020049 .flags = IMXUART_HAVE_RTSCTS,
50};
51
Baruch Siache71fbaf2009-12-21 13:44:32 +020052static struct pad_desc mx25pdk_pads[] = {
53 MX25_PAD_FEC_MDC__FEC_MDC,
54 MX25_PAD_FEC_MDIO__FEC_MDIO,
55 MX25_PAD_FEC_TDATA0__FEC_TDATA0,
56 MX25_PAD_FEC_TDATA1__FEC_TDATA1,
57 MX25_PAD_FEC_TX_EN__FEC_TX_EN,
58 MX25_PAD_FEC_RDATA0__FEC_RDATA0,
59 MX25_PAD_FEC_RDATA1__FEC_RDATA1,
60 MX25_PAD_FEC_RX_DV__FEC_RX_DV,
61 MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
62 MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
63 MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
Baruch Siach0f547dc2010-02-17 12:33:25 +020064
65 /* LCD */
66 MX25_PAD_LD0__LD0,
67 MX25_PAD_LD1__LD1,
68 MX25_PAD_LD2__LD2,
69 MX25_PAD_LD3__LD3,
70 MX25_PAD_LD4__LD4,
71 MX25_PAD_LD5__LD5,
72 MX25_PAD_LD6__LD6,
73 MX25_PAD_LD7__LD7,
74 MX25_PAD_LD8__LD8,
75 MX25_PAD_LD9__LD9,
76 MX25_PAD_LD10__LD10,
77 MX25_PAD_LD11__LD11,
78 MX25_PAD_LD12__LD12,
79 MX25_PAD_LD13__LD13,
80 MX25_PAD_LD14__LD14,
81 MX25_PAD_LD15__LD15,
82 MX25_PAD_GPIO_E__LD16,
83 MX25_PAD_GPIO_F__LD17,
84 MX25_PAD_HSYNC__HSYNC,
85 MX25_PAD_VSYNC__VSYNC,
86 MX25_PAD_LSCLK__LSCLK,
87 MX25_PAD_OE_ACD__OE_ACD,
88 MX25_PAD_CONTRAST__CONTRAST,
Baruch Siache71fbaf2009-12-21 13:44:32 +020089};
90
91static struct fec_platform_data mx25_fec_pdata = {
92 .phy = PHY_INTERFACE_MODE_RMII,
93};
94
95#define FEC_ENABLE_GPIO 35
96#define FEC_RESET_B_GPIO 104
97
98static void __init mx25pdk_fec_reset(void)
99{
100 gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable");
101 gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset");
102
103 gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */
104 gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */
105 udelay(2);
106
107 /* turn on PHY power and lift reset */
108 gpio_set_value(FEC_ENABLE_GPIO, 1);
109 gpio_set_value(FEC_RESET_B_GPIO, 1);
110}
111
Uwe Kleine-Königb0c48452010-06-16 12:34:56 +0200112static const struct mxc_nand_platform_data
113mx25pdk_nand_board_info __initconst = {
Baruch Siachb97235d2010-01-14 11:24:15 +0200114 .width = 1,
115 .hw_ecc = 1,
116 .flash_bbt = 1,
117};
118
Baruch Siach0f547dc2010-02-17 12:33:25 +0200119static struct imx_fb_videomode mx25pdk_modes[] = {
120 {
121 .mode = {
122 .name = "CRT-VGA",
123 .refresh = 60,
124 .xres = 640,
125 .yres = 480,
126 .pixclock = 39683,
127 .left_margin = 45,
128 .right_margin = 114,
129 .upper_margin = 33,
130 .lower_margin = 11,
131 .hsync_len = 1,
132 .vsync_len = 1,
133 },
134 .bpp = 16,
135 .pcr = 0xFA208B80,
136 },
137};
138
139static struct imx_fb_platform_data mx25pdk_fb_pdata = {
140 .mode = mx25pdk_modes,
141 .num_modes = ARRAY_SIZE(mx25pdk_modes),
142 .pwmr = 0x00A903FF,
143 .lscr1 = 0x00120300,
144 .dmacr = 0x00020010,
145};
146
Sascha Hauer635baf62009-06-04 11:32:46 +0200147static void __init mx25pdk_init(void)
148{
Baruch Siache71fbaf2009-12-21 13:44:32 +0200149 mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
150 ARRAY_SIZE(mx25pdk_pads));
151
Uwe Kleine-König7cc3c842010-06-24 15:20:44 +0200152 imx25_add_imx_uart0(&uart_pdata);
Sascha Hauer635baf62009-06-04 11:32:46 +0200153 mxc_register_device(&mxc_usbh2, NULL);
Uwe Kleine-Königb0c48452010-06-16 12:34:56 +0200154 imx25_add_mxc_nand(&mx25pdk_nand_board_info);
Baruch Siach1eaa4f22010-01-27 15:00:49 +0200155 mxc_register_device(&mx25_rtc_device, NULL);
Baruch Siach0f547dc2010-02-17 12:33:25 +0200156 mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata);
Baruch Siache71fbaf2009-12-21 13:44:32 +0200157
158 mx25pdk_fec_reset();
159 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
Sascha Hauer635baf62009-06-04 11:32:46 +0200160}
161
Sascha Hauer635baf62009-06-04 11:32:46 +0200162static void __init mx25pdk_timer_init(void)
163{
Baruch Siachfadc0952010-01-25 12:58:19 +0200164 mx25_clocks_init();
Sascha Hauer635baf62009-06-04 11:32:46 +0200165}
166
167static struct sys_timer mx25pdk_timer = {
168 .init = mx25pdk_timer_init,
169};
170
171MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)")
172 /* Maintainer: Freescale Semiconductor, Inc. */
173 .phys_io = MX25_AIPS1_BASE_ADDR,
174 .io_pg_offst = ((MX25_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
Uwe Kleine-König34101232010-01-29 17:36:05 +0100175 .boot_params = MX25_PHYS_OFFSET + 0x100,
Sascha Hauer635baf62009-06-04 11:32:46 +0200176 .map_io = mx25_map_io,
177 .init_irq = mx25_init_irq,
178 .init_machine = mx25pdk_init,
179 .timer = &mx25pdk_timer,
180MACHINE_END
181