blob: f3da62ac9f13674daaaa835f639c6d91cf897311 [file] [log] [blame]
Yong Shen6f12ea42011-01-12 17:14:46 +08001/*
2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10
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 along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/init.h>
22#include <linux/clk.h>
Yong Shen6f12ea42011-01-12 17:14:46 +080023#include <linux/delay.h>
24#include <linux/gpio.h>
25
26#include <mach/common.h>
27#include <mach/hardware.h>
Yong Shen6f12ea42011-01-12 17:14:46 +080028#include <mach/iomux-mx53.h>
29
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32#include <asm/mach/time.h>
33
34#include "crm_regs.h"
35#include "devices-imx53.h"
36
37#define SMD_FEC_PHY_RST IMX_GPIO_NR(7, 6)
38
39static iomux_v3_cfg_t mx53_smd_pads[] = {
Fabio Estevam67f2a872011-01-25 13:08:33 -020040 MX53_PAD_CSI0_DAT10__UART1_TXD_MUX,
41 MX53_PAD_CSI0_DAT11__UART1_RXD_MUX,
Yong Shen6f12ea42011-01-12 17:14:46 +080042
Fabio Estevam67f2a872011-01-25 13:08:33 -020043 MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX,
44 MX53_PAD_PATA_DMARQ__UART2_TXD_MUX,
Yong Shen6f12ea42011-01-12 17:14:46 +080045
Fabio Estevam67f2a872011-01-25 13:08:33 -020046 MX53_PAD_PATA_CS_0__UART3_TXD_MUX,
47 MX53_PAD_PATA_CS_1__UART3_RXD_MUX,
48 MX53_PAD_PATA_DA_1__UART3_CTS,
49 MX53_PAD_PATA_DA_2__UART3_RTS,
Fabio Estevam20930232011-03-01 16:59:48 -030050 /* I2C1 */
51 MX53_PAD_CSI0_DAT8__I2C1_SDA,
52 MX53_PAD_CSI0_DAT9__I2C1_SCL,
Yong Shen6f12ea42011-01-12 17:14:46 +080053};
54
55static const struct imxuart_platform_data mx53_smd_uart_data __initconst = {
56 .flags = IMXUART_HAVE_RTSCTS,
57};
58
59static inline void mx53_smd_init_uart(void)
60{
Fabio Estevamcdb2daa2011-01-31 10:32:27 -020061 imx53_add_imx_uart(0, NULL);
Fabio Estevamd79c01b2011-03-02 13:30:52 -030062 imx53_add_imx_uart(1, NULL);
Yong Shen6f12ea42011-01-12 17:14:46 +080063 imx53_add_imx_uart(2, &mx53_smd_uart_data);
64}
65
66static inline void mx53_smd_fec_reset(void)
67{
68 int ret;
69
70 /* reset FEC PHY */
71 ret = gpio_request(SMD_FEC_PHY_RST, "fec-phy-reset");
72 if (ret) {
73 printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
74 return;
75 }
76 gpio_direction_output(SMD_FEC_PHY_RST, 0);
77 msleep(1);
78 gpio_set_value(SMD_FEC_PHY_RST, 1);
79}
80
81static struct fec_platform_data mx53_smd_fec_data = {
82 .phy = PHY_INTERFACE_MODE_RMII,
83};
84
Fabio Estevam20930232011-03-01 16:59:48 -030085static const struct imxi2c_platform_data mx53_smd_i2c_data __initconst = {
86 .bitrate = 100000,
87};
88
Yong Shen6f12ea42011-01-12 17:14:46 +080089static void __init mx53_smd_board_init(void)
90{
91 mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads,
92 ARRAY_SIZE(mx53_smd_pads));
93 mx53_smd_init_uart();
94 mx53_smd_fec_reset();
95 imx53_add_fec(&mx53_smd_fec_data);
Fabio Estevamdaa79542011-02-17 18:09:53 -020096 imx53_add_imx2_wdt(0, NULL);
Fabio Estevam20930232011-03-01 16:59:48 -030097 imx53_add_imx_i2c(0, &mx53_smd_i2c_data);
Yong Shen6f12ea42011-01-12 17:14:46 +080098}
99
100static void __init mx53_smd_timer_init(void)
101{
102 mx53_clocks_init(32768, 24000000, 22579200, 0);
103}
104
105static struct sys_timer mx53_smd_timer = {
106 .init = mx53_smd_timer_init,
107};
108
109MACHINE_START(MX53_SMD, "Freescale MX53 SMD Board")
110 .map_io = mx53_map_io,
Uwe Kleine-Königab1304212011-02-07 16:35:21 +0100111 .init_early = imx53_init_early,
Yong Shen6f12ea42011-01-12 17:14:46 +0800112 .init_irq = mx53_init_irq,
Yong Shen6f12ea42011-01-12 17:14:46 +0800113 .timer = &mx53_smd_timer,
Uwe Kleine-Königab1304212011-02-07 16:35:21 +0100114 .init_machine = mx53_smd_board_init,
Yong Shen6f12ea42011-01-12 17:14:46 +0800115MACHINE_END