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 | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 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> |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 35 | |
Shawn Guo | e337247 | 2012-09-13 21:01:00 +0800 | [diff] [blame] | 36 | #include "common.h" |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 37 | #include "devices-imx25.h" |
Shawn Guo | 641dfe8 | 2014-05-19 20:41:52 +0800 | [diff] [blame] | 38 | #include "ehci.h" |
Shawn Guo | 3ed0bcb | 2012-09-13 09:37:49 +0800 | [diff] [blame] | 39 | #include "eukrea-baseboards.h" |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 40 | #include "hardware.h" |
Shawn Guo | 267dd34 | 2012-09-13 13:26:00 +0800 | [diff] [blame] | 41 | #include "iomux-mx25.h" |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 42 | #include "mx25.h" |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 43 | |
| 44 | static const struct imxuart_platform_data uart_pdata __initconst = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 45 | .flags = IMXUART_HAVE_RTSCTS, |
| 46 | }; |
| 47 | |
Lothar Waßmann | 8f5260c | 2010-10-26 14:28:31 +0200 | [diff] [blame] | 48 | static iomux_v3_cfg_t eukrea_cpuimx25_pads[] = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 49 | /* FEC - RMII */ |
| 50 | MX25_PAD_FEC_MDC__FEC_MDC, |
| 51 | MX25_PAD_FEC_MDIO__FEC_MDIO, |
| 52 | MX25_PAD_FEC_TDATA0__FEC_TDATA0, |
| 53 | MX25_PAD_FEC_TDATA1__FEC_TDATA1, |
| 54 | MX25_PAD_FEC_TX_EN__FEC_TX_EN, |
| 55 | MX25_PAD_FEC_RDATA0__FEC_RDATA0, |
| 56 | MX25_PAD_FEC_RDATA1__FEC_RDATA1, |
| 57 | MX25_PAD_FEC_RX_DV__FEC_RX_DV, |
| 58 | MX25_PAD_FEC_TX_CLK__FEC_TX_CLK, |
| 59 | /* I2C1 */ |
| 60 | MX25_PAD_I2C1_CLK__I2C1_CLK, |
| 61 | MX25_PAD_I2C1_DAT__I2C1_DAT, |
| 62 | }; |
| 63 | |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 64 | static const struct fec_platform_data mx25_fec_pdata __initconst = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 65 | .phy = PHY_INTERFACE_MODE_RMII, |
| 66 | }; |
| 67 | |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 68 | static const struct mxc_nand_platform_data |
| 69 | eukrea_cpuimx25_nand_board_info __initconst = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 70 | .width = 1, |
| 71 | .hw_ecc = 1, |
| 72 | .flash_bbt = 1, |
| 73 | }; |
| 74 | |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 75 | static const struct imxi2c_platform_data |
| 76 | eukrea_cpuimx25_i2c0_data __initconst = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 77 | .bitrate = 100000, |
| 78 | }; |
| 79 | |
| 80 | static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = { |
| 81 | { |
| 82 | I2C_BOARD_INFO("pcf8563", 0x51), |
| 83 | }, |
| 84 | }; |
| 85 | |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 86 | static int eukrea_cpuimx25_otg_init(struct platform_device *pdev) |
| 87 | { |
| 88 | return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); |
| 89 | } |
| 90 | |
Uwe Kleine-König | 2c20b9f | 2010-11-10 21:27:55 +0100 | [diff] [blame] | 91 | static const struct mxc_usbh_platform_data otg_pdata __initconst = { |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 92 | .init = eukrea_cpuimx25_otg_init, |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 93 | .portsc = MXC_EHCI_MODE_UTMI, |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 94 | }; |
| 95 | |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 96 | static int eukrea_cpuimx25_usbh2_init(struct platform_device *pdev) |
| 97 | { |
| 98 | return mx25_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_SINGLE_UNI | |
| 99 | MXC_EHCI_INTERNAL_PHY | MXC_EHCI_IPPUE_DOWN); |
| 100 | } |
| 101 | |
Uwe Kleine-König | 2c20b9f | 2010-11-10 21:27:55 +0100 | [diff] [blame] | 102 | static const struct mxc_usbh_platform_data usbh2_pdata __initconst = { |
Sascha Hauer | 4bd597b | 2011-01-03 11:30:28 +0100 | [diff] [blame] | 103 | .init = eukrea_cpuimx25_usbh2_init, |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 104 | .portsc = MXC_EHCI_MODE_SERIAL, |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 105 | }; |
| 106 | |
Uwe Kleine-König | 224b8c8 | 2010-11-10 21:50:07 +0100 | [diff] [blame] | 107 | static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 108 | .operating_mode = FSL_USB2_DR_DEVICE, |
| 109 | .phy_mode = FSL_USB2_PHY_UTMI, |
Eric Bénard | f381f9f | 2012-05-08 09:20:16 +0200 | [diff] [blame] | 110 | .workaround = FLS_USB2_WORKAROUND_ENGCM09152, |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 111 | }; |
| 112 | |
Benoît Thébaudeau | 33a264d | 2012-06-12 19:46:43 +0200 | [diff] [blame] | 113 | static bool otg_mode_host __initdata; |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 114 | |
| 115 | static int __init eukrea_cpuimx25_otg_mode(char *options) |
| 116 | { |
| 117 | if (!strcmp(options, "host")) |
Benoît Thébaudeau | 33a264d | 2012-06-12 19:46:43 +0200 | [diff] [blame] | 118 | otg_mode_host = true; |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 119 | else if (!strcmp(options, "device")) |
Benoît Thébaudeau | 33a264d | 2012-06-12 19:46:43 +0200 | [diff] [blame] | 120 | otg_mode_host = false; |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 121 | else |
| 122 | pr_info("otg_mode neither \"host\" nor \"device\". " |
| 123 | "Defaulting to device\n"); |
Benoît Thébaudeau | 33a264d | 2012-06-12 19:46:43 +0200 | [diff] [blame] | 124 | return 1; |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 125 | } |
| 126 | __setup("otg_mode=", eukrea_cpuimx25_otg_mode); |
| 127 | |
| 128 | static void __init eukrea_cpuimx25_init(void) |
| 129 | { |
Shawn Guo | b78d8e5 | 2011-06-06 00:07:55 +0800 | [diff] [blame] | 130 | imx25_soc_init(); |
| 131 | |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 132 | if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads, |
| 133 | ARRAY_SIZE(eukrea_cpuimx25_pads))) |
| 134 | printk(KERN_ERR "error setting cpuimx25 pads !\n"); |
| 135 | |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 136 | imx25_add_imx_uart0(&uart_pdata); |
| 137 | imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info); |
Benoît Thébaudeau | bec31a8 | 2012-07-04 16:35:54 +0200 | [diff] [blame] | 138 | imx25_add_imxdi_rtc(); |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 139 | imx25_add_fec(&mx25_fec_pdata); |
Benoît Thébaudeau | bec31a8 | 2012-07-04 16:35:54 +0200 | [diff] [blame] | 140 | imx25_add_imx2_wdt(); |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 141 | |
| 142 | i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices, |
| 143 | ARRAY_SIZE(eukrea_cpuimx25_i2c_devices)); |
Uwe Kleine-König | 2dcf78c | 2010-06-30 12:16:24 +0200 | [diff] [blame] | 144 | imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data); |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 145 | |
Eric Bénard | 52d084f | 2010-10-05 18:02:30 +0200 | [diff] [blame] | 146 | if (otg_mode_host) |
Uwe Kleine-König | 2c20b9f | 2010-11-10 21:27:55 +0100 | [diff] [blame] | 147 | imx25_add_mxc_ehci_otg(&otg_pdata); |
Eric Bénard | 52d084f | 2010-10-05 18:02:30 +0200 | [diff] [blame] | 148 | else |
Uwe Kleine-König | 224b8c8 | 2010-11-10 21:50:07 +0100 | [diff] [blame] | 149 | imx25_add_fsl_usb2_udc(&otg_device_pdata); |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 150 | |
Uwe Kleine-König | 2c20b9f | 2010-11-10 21:27:55 +0100 | [diff] [blame] | 151 | imx25_add_mxc_ehci_hs(&usbh2_pdata); |
Eric Bénard | 52d084f | 2010-10-05 18:02:30 +0200 | [diff] [blame] | 152 | |
Eric Bénard | ec53fe3 | 2010-07-30 22:58:40 +0200 | [diff] [blame] | 153 | #ifdef CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD |
| 154 | eukrea_mbimxsd25_baseboard_init(); |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 155 | #endif |
| 156 | } |
| 157 | |
| 158 | static void __init eukrea_cpuimx25_timer_init(void) |
| 159 | { |
| 160 | mx25_clocks_init(); |
| 161 | } |
| 162 | |
Eric Bénard | 0d6cfa3 | 2011-08-22 15:41:46 +0100 | [diff] [blame] | 163 | MACHINE_START(EUKREA_CPUIMX25SD, "Eukrea CPUIMX25") |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 164 | /* Maintainer: Eukrea Electromatique */ |
Nicolas Pitre | dc8f190 | 2011-07-05 22:38:12 -0400 | [diff] [blame] | 165 | .atag_offset = 0x100, |
Uwe Kleine-König | 3dac219 | 2011-02-07 16:35:19 +0100 | [diff] [blame] | 166 | .map_io = mx25_map_io, |
| 167 | .init_early = imx25_init_early, |
| 168 | .init_irq = mx25_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 169 | .init_time = eukrea_cpuimx25_timer_init, |
Uwe Kleine-König | 3dac219 | 2011-02-07 16:35:19 +0100 | [diff] [blame] | 170 | .init_machine = eukrea_cpuimx25_init, |
Russell King | 65ea788 | 2011-11-06 17:12:08 +0000 | [diff] [blame] | 171 | .restart = mxc_restart, |
Eric Bénard | 6f1fa706f | 2010-06-08 11:03:01 +0200 | [diff] [blame] | 172 | MACHINE_END |