Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de> |
| 3 | * Copyright 2010 Eric Bénard - Eukréa Electromatique, <eric@eukrea.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | #include <linux/types.h> |
| 21 | #include <linux/init.h> |
| 22 | #include <linux/delay.h> |
| 23 | #include <linux/clk.h> |
| 24 | #include <linux/irq.h> |
| 25 | #include <linux/gpio.h> |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 26 | #include <linux/platform_device.h> |
| 27 | #include <linux/usb/otg.h> |
| 28 | #include <linux/usb/ulpi.h> |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 29 | |
Eric Bénard | 95afd09 | 2010-07-23 14:56:40 +0200 | [diff] [blame] | 30 | #include <mach/eukrea-baseboards.h> |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 31 | #include <mach/hardware.h> |
| 32 | #include <asm/mach-types.h> |
| 33 | #include <asm/mach/arch.h> |
| 34 | #include <asm/mach/time.h> |
| 35 | #include <asm/memory.h> |
| 36 | #include <asm/mach/map.h> |
| 37 | #include <mach/common.h> |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 38 | #include <mach/mx25.h> |
| 39 | #include <mach/mxc_nand.h> |
| 40 | #include <mach/imxfb.h> |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 41 | #include <mach/iomux-mx25.h> |
| 42 | |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 43 | #include "devices-imx25.h" |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 44 | |
| 45 | static const struct imxuart_platform_data uart_pdata __initconst = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 46 | .flags = IMXUART_HAVE_RTSCTS, |
| 47 | }; |
| 48 | |
Lothar Waßmann | 8f5260c | 2010-10-26 14:28:31 +0200 | [diff] [blame] | 49 | static iomux_v3_cfg_t eukrea_cpuimx25_pads[] = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 50 | /* FEC - RMII */ |
| 51 | MX25_PAD_FEC_MDC__FEC_MDC, |
| 52 | MX25_PAD_FEC_MDIO__FEC_MDIO, |
| 53 | MX25_PAD_FEC_TDATA0__FEC_TDATA0, |
| 54 | MX25_PAD_FEC_TDATA1__FEC_TDATA1, |
| 55 | MX25_PAD_FEC_TX_EN__FEC_TX_EN, |
| 56 | MX25_PAD_FEC_RDATA0__FEC_RDATA0, |
| 57 | MX25_PAD_FEC_RDATA1__FEC_RDATA1, |
| 58 | MX25_PAD_FEC_RX_DV__FEC_RX_DV, |
| 59 | MX25_PAD_FEC_TX_CLK__FEC_TX_CLK, |
| 60 | /* I2C1 */ |
| 61 | MX25_PAD_I2C1_CLK__I2C1_CLK, |
| 62 | MX25_PAD_I2C1_DAT__I2C1_DAT, |
| 63 | }; |
| 64 | |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 65 | static const struct fec_platform_data mx25_fec_pdata __initconst = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 66 | .phy = PHY_INTERFACE_MODE_RMII, |
| 67 | }; |
| 68 | |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 69 | static const struct mxc_nand_platform_data |
| 70 | eukrea_cpuimx25_nand_board_info __initconst = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 71 | .width = 1, |
| 72 | .hw_ecc = 1, |
| 73 | .flash_bbt = 1, |
| 74 | }; |
| 75 | |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 76 | static const struct imxi2c_platform_data |
| 77 | eukrea_cpuimx25_i2c0_data __initconst = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 78 | .bitrate = 100000, |
| 79 | }; |
| 80 | |
| 81 | static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = { |
| 82 | { |
| 83 | I2C_BOARD_INFO("pcf8563", 0x51), |
| 84 | }, |
| 85 | }; |
| 86 | |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 87 | static int eukrea_cpuimx25_otg_init(struct platform_device *pdev) |
| 88 | { |
| 89 | return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); |
| 90 | } |
| 91 | |
Uwe Kleine-König | 2c20b9f | 2010-11-10 21:27:55 +0100 | [diff] [blame] | 92 | static const struct mxc_usbh_platform_data otg_pdata __initconst = { |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 93 | .init = eukrea_cpuimx25_otg_init, |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 94 | .portsc = MXC_EHCI_MODE_UTMI, |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 95 | }; |
| 96 | |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 97 | static int eukrea_cpuimx25_usbh2_init(struct platform_device *pdev) |
| 98 | { |
| 99 | return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_SINGLE_UNI | |
| 100 | MXC_EHCI_INTERNAL_PHY | MXC_EHCI_IPPUE_DOWN); |
| 101 | } |
| 102 | |
Uwe Kleine-König | 2c20b9f | 2010-11-10 21:27:55 +0100 | [diff] [blame] | 103 | static const struct mxc_usbh_platform_data usbh2_pdata __initconst = { |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 104 | .init = eukrea_cpuimx25_usbh2_init, |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 105 | .portsc = MXC_EHCI_MODE_SERIAL, |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 106 | }; |
| 107 | |
Uwe Kleine-König | 224b8c8 | 2010-11-10 21:50:07 +0100 | [diff] [blame] | 108 | static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 109 | .operating_mode = FSL_USB2_DR_DEVICE, |
| 110 | .phy_mode = FSL_USB2_PHY_UTMI, |
| 111 | }; |
| 112 | |
| 113 | static int otg_mode_host; |
| 114 | |
| 115 | static int __init eukrea_cpuimx25_otg_mode(char *options) |
| 116 | { |
| 117 | if (!strcmp(options, "host")) |
| 118 | otg_mode_host = 1; |
| 119 | else if (!strcmp(options, "device")) |
| 120 | otg_mode_host = 0; |
| 121 | else |
| 122 | pr_info("otg_mode neither \"host\" nor \"device\". " |
| 123 | "Defaulting to device\n"); |
| 124 | return 0; |
| 125 | } |
| 126 | __setup("otg_mode=", eukrea_cpuimx25_otg_mode); |
| 127 | |
| 128 | static void __init eukrea_cpuimx25_init(void) |
| 129 | { |
| 130 | if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads, |
| 131 | ARRAY_SIZE(eukrea_cpuimx25_pads))) |
| 132 | printk(KERN_ERR "error setting cpuimx25 pads !\n"); |
| 133 | |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 134 | imx25_add_imx_uart0(&uart_pdata); |
| 135 | imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info); |
Uwe Kleine-König | e7c74b3 | 2010-11-11 11:57:21 +0100 | [diff] [blame] | 136 | imx25_add_imxdi_rtc(NULL); |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 137 | imx25_add_fec(&mx25_fec_pdata); |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 138 | |
| 139 | i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices, |
| 140 | ARRAY_SIZE(eukrea_cpuimx25_i2c_devices)); |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 141 | imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data); |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 142 | |
Eric Bénard | 52d084f | 2010-10-05 18:02:30 +0200 | [diff] [blame] | 143 | if (otg_mode_host) |
Uwe Kleine-König | 2c20b9f | 2010-11-10 21:27:55 +0100 | [diff] [blame] | 144 | imx25_add_mxc_ehci_otg(&otg_pdata); |
Eric Bénard | 52d084f | 2010-10-05 18:02:30 +0200 | [diff] [blame] | 145 | else |
Uwe Kleine-König | 224b8c8 | 2010-11-10 21:50:07 +0100 | [diff] [blame] | 146 | imx25_add_fsl_usb2_udc(&otg_device_pdata); |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 147 | |
Uwe Kleine-König | 2c20b9f | 2010-11-10 21:27:55 +0100 | [diff] [blame] | 148 | imx25_add_mxc_ehci_hs(&usbh2_pdata); |
Eric Bénard | 52d084f | 2010-10-05 18:02:30 +0200 | [diff] [blame] | 149 | |
Eric Bénard | ec53fe3 | 2010-07-30 22:58:40 +0200 | [diff] [blame] | 150 | #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD |
| 151 | eukrea_mbimxsd25_baseboard_init(); |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 152 | #endif |
| 153 | } |
| 154 | |
| 155 | static void __init eukrea_cpuimx25_timer_init(void) |
| 156 | { |
| 157 | mx25_clocks_init(); |
| 158 | } |
| 159 | |
| 160 | static struct sys_timer eukrea_cpuimx25_timer = { |
| 161 | .init = eukrea_cpuimx25_timer_init, |
| 162 | }; |
| 163 | |
| 164 | MACHINE_START(EUKREA_CPUIMX25, "Eukrea CPUIMX25") |
| 165 | /* Maintainer: Eukrea Electromatique */ |
Uwe Kleine-König | 3dac219 | 2011-02-07 16:35:19 +0100 | [diff] [blame] | 166 | .boot_params = MX25_PHYS_OFFSET + 0x100, |
| 167 | .map_io = mx25_map_io, |
| 168 | .init_early = imx25_init_early, |
| 169 | .init_irq = mx25_init_irq, |
| 170 | .timer = &eukrea_cpuimx25_timer, |
| 171 | .init_machine = eukrea_cpuimx25_init, |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 172 | MACHINE_END |