blob: cb85e2e7961aa45fc24db62a6aad459981d36bef [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>
27
28#include <mach/hardware.h>
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31#include <asm/mach/time.h>
32#include <asm/memory.h>
33#include <asm/mach/map.h>
34#include <mach/common.h>
35#include <mach/imx-uart.h>
36#include <mach/mx25.h>
37#include <mach/mxc_nand.h>
38#include "devices.h"
Uwe Kleine-König261f6f62010-02-15 21:18:43 +010039#include <mach/iomux-mx25.h>
Sascha Hauer635baf62009-06-04 11:32:46 +020040
41static struct imxuart_platform_data uart_pdata = {
42 .flags = IMXUART_HAVE_RTSCTS,
43};
44
Baruch Siache71fbaf2009-12-21 13:44:32 +020045static struct pad_desc mx25pdk_pads[] = {
46 MX25_PAD_FEC_MDC__FEC_MDC,
47 MX25_PAD_FEC_MDIO__FEC_MDIO,
48 MX25_PAD_FEC_TDATA0__FEC_TDATA0,
49 MX25_PAD_FEC_TDATA1__FEC_TDATA1,
50 MX25_PAD_FEC_TX_EN__FEC_TX_EN,
51 MX25_PAD_FEC_RDATA0__FEC_RDATA0,
52 MX25_PAD_FEC_RDATA1__FEC_RDATA1,
53 MX25_PAD_FEC_RX_DV__FEC_RX_DV,
54 MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
55 MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
56 MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
57};
58
59static struct fec_platform_data mx25_fec_pdata = {
60 .phy = PHY_INTERFACE_MODE_RMII,
61};
62
63#define FEC_ENABLE_GPIO 35
64#define FEC_RESET_B_GPIO 104
65
66static void __init mx25pdk_fec_reset(void)
67{
68 gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable");
69 gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset");
70
71 gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */
72 gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */
73 udelay(2);
74
75 /* turn on PHY power and lift reset */
76 gpio_set_value(FEC_ENABLE_GPIO, 1);
77 gpio_set_value(FEC_RESET_B_GPIO, 1);
78}
79
Baruch Siachb97235d2010-01-14 11:24:15 +020080static struct mxc_nand_platform_data mx25pdk_nand_board_info = {
81 .width = 1,
82 .hw_ecc = 1,
83 .flash_bbt = 1,
84};
85
Sascha Hauer635baf62009-06-04 11:32:46 +020086static void __init mx25pdk_init(void)
87{
Baruch Siache71fbaf2009-12-21 13:44:32 +020088 mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
89 ARRAY_SIZE(mx25pdk_pads));
90
Sascha Hauer635baf62009-06-04 11:32:46 +020091 mxc_register_device(&mxc_uart_device0, &uart_pdata);
92 mxc_register_device(&mxc_usbh2, NULL);
Baruch Siachb97235d2010-01-14 11:24:15 +020093 mxc_register_device(&mxc_nand_device, &mx25pdk_nand_board_info);
Baruch Siach1eaa4f22010-01-27 15:00:49 +020094 mxc_register_device(&mx25_rtc_device, NULL);
Baruch Siache71fbaf2009-12-21 13:44:32 +020095
96 mx25pdk_fec_reset();
97 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
Sascha Hauer635baf62009-06-04 11:32:46 +020098}
99
Sascha Hauer635baf62009-06-04 11:32:46 +0200100static void __init mx25pdk_timer_init(void)
101{
Baruch Siachfadc0952010-01-25 12:58:19 +0200102 mx25_clocks_init();
Sascha Hauer635baf62009-06-04 11:32:46 +0200103}
104
105static struct sys_timer mx25pdk_timer = {
106 .init = mx25pdk_timer_init,
107};
108
109MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)")
110 /* Maintainer: Freescale Semiconductor, Inc. */
111 .phys_io = MX25_AIPS1_BASE_ADDR,
112 .io_pg_offst = ((MX25_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
Uwe Kleine-König34101232010-01-29 17:36:05 +0100113 .boot_params = MX25_PHYS_OFFSET + 0x100,
Sascha Hauer635baf62009-06-04 11:32:46 +0200114 .map_io = mx25_map_io,
115 .init_irq = mx25_init_irq,
116 .init_machine = mx25pdk_init,
117 .timer = &mx25pdk_timer,
118MACHINE_END
119