Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de> |
| 3 | * Copyright (C) 2010 Freescale Semiconductor, Inc. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License as published by the |
| 7 | * Free Software Foundation; either version 2 of the License, or (at your |
| 8 | * option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 13 | * for more details. |
| 14 | */ |
| 15 | |
| 16 | #include <common.h> |
| 17 | #include <usb.h> |
| 18 | #include <errno.h> |
| 19 | #include <linux/compiler.h> |
| 20 | #include <usb/ehci-fsl.h> |
| 21 | #include <asm/io.h> |
| 22 | #include <asm/arch/imx-regs.h> |
| 23 | #include <asm/arch/clock.h> |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 24 | |
| 25 | #include "ehci.h" |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 26 | |
| 27 | #define MX5_USBOTHER_REGS_OFFSET 0x800 |
| 28 | |
| 29 | |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 30 | #define MXC_OTG_OFFSET 0 |
| 31 | #define MXC_H1_OFFSET 0x200 |
| 32 | #define MXC_H2_OFFSET 0x400 |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 33 | #define MXC_H3_OFFSET 0x600 |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 34 | |
| 35 | #define MXC_USBCTRL_OFFSET 0 |
| 36 | #define MXC_USB_PHY_CTR_FUNC_OFFSET 0x8 |
| 37 | #define MXC_USB_PHY_CTR_FUNC2_OFFSET 0xc |
| 38 | #define MXC_USB_CTRL_1_OFFSET 0x10 |
| 39 | #define MXC_USBH2CTRL_OFFSET 0x14 |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 40 | #define MXC_USBH3CTRL_OFFSET 0x18 |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 41 | |
| 42 | /* USB_CTRL */ |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 43 | /* OTG wakeup intr enable */ |
| 44 | #define MXC_OTG_UCTRL_OWIE_BIT (1 << 27) |
| 45 | /* OTG power mask */ |
| 46 | #define MXC_OTG_UCTRL_OPM_BIT (1 << 24) |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 47 | /* OTG power pin polarity */ |
| 48 | #define MXC_OTG_UCTRL_O_PWR_POL_BIT (1 << 24) |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 49 | /* Host1 ULPI interrupt enable */ |
| 50 | #define MXC_H1_UCTRL_H1UIE_BIT (1 << 12) |
| 51 | /* HOST1 wakeup intr enable */ |
| 52 | #define MXC_H1_UCTRL_H1WIE_BIT (1 << 11) |
| 53 | /* HOST1 power mask */ |
| 54 | #define MXC_H1_UCTRL_H1PM_BIT (1 << 8) |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 55 | /* HOST1 power pin polarity */ |
| 56 | #define MXC_H1_UCTRL_H1_PWR_POL_BIT (1 << 8) |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 57 | |
| 58 | /* USB_PHY_CTRL_FUNC */ |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 59 | /* OTG Polarity of Overcurrent */ |
| 60 | #define MXC_OTG_PHYCTRL_OC_POL_BIT (1 << 9) |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 61 | /* OTG Disable Overcurrent Event */ |
| 62 | #define MXC_OTG_PHYCTRL_OC_DIS_BIT (1 << 8) |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 63 | /* UH1 Polarity of Overcurrent */ |
| 64 | #define MXC_H1_OC_POL_BIT (1 << 6) |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 65 | /* UH1 Disable Overcurrent Event */ |
| 66 | #define MXC_H1_OC_DIS_BIT (1 << 5) |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 67 | /* OTG Power Pin Polarity */ |
| 68 | #define MXC_OTG_PHYCTRL_PWR_POL_BIT (1 << 3) |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 69 | |
| 70 | /* USBH2CTRL */ |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 71 | #define MXC_H2_UCTRL_H2_OC_POL_BIT (1 << 31) |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 72 | #define MXC_H2_UCTRL_H2_OC_DIS_BIT (1 << 30) |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 73 | #define MXC_H2_UCTRL_H2UIE_BIT (1 << 8) |
| 74 | #define MXC_H2_UCTRL_H2WIE_BIT (1 << 7) |
| 75 | #define MXC_H2_UCTRL_H2PM_BIT (1 << 4) |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 76 | #define MXC_H2_UCTRL_H2_PWR_POL_BIT (1 << 4) |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 77 | |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 78 | /* USBH3CTRL */ |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 79 | #define MXC_H3_UCTRL_H3_OC_POL_BIT (1 << 31) |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 80 | #define MXC_H3_UCTRL_H3_OC_DIS_BIT (1 << 30) |
| 81 | #define MXC_H3_UCTRL_H3UIE_BIT (1 << 8) |
| 82 | #define MXC_H3_UCTRL_H3WIE_BIT (1 << 7) |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 83 | #define MXC_H3_UCTRL_H3_PWR_POL_BIT (1 << 4) |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 84 | |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 85 | /* USB_CTRL_1 */ |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 86 | #define MXC_USB_CTRL_UH1_EXT_CLK_EN (1 << 25) |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 87 | |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 88 | int mxc_set_usbcontrol(int port, unsigned int flags) |
| 89 | { |
| 90 | unsigned int v; |
| 91 | void __iomem *usb_base = (void __iomem *)OTG_BASE_ADDR; |
| 92 | void __iomem *usbother_base; |
| 93 | int ret = 0; |
| 94 | |
| 95 | usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET; |
| 96 | |
| 97 | switch (port) { |
| 98 | case 0: /* OTG port */ |
| 99 | if (flags & MXC_EHCI_INTERNAL_PHY) { |
| 100 | v = __raw_readl(usbother_base + |
| 101 | MXC_USB_PHY_CTR_FUNC_OFFSET); |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 102 | if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW) |
| 103 | v |= MXC_OTG_PHYCTRL_OC_POL_BIT; |
| 104 | else |
| 105 | v &= ~MXC_OTG_PHYCTRL_OC_POL_BIT; |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 106 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 107 | /* OC/USBPWR is used */ |
| 108 | v &= ~MXC_OTG_PHYCTRL_OC_DIS_BIT; |
Benoît Thébaudeau | 7d42432 | 2012-11-13 09:56:30 +0000 | [diff] [blame] | 109 | else |
| 110 | /* OC/USBPWR is not used */ |
| 111 | v |= MXC_OTG_PHYCTRL_OC_DIS_BIT; |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 112 | #ifdef CONFIG_MX51 |
| 113 | if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) |
| 114 | v |= MXC_OTG_PHYCTRL_PWR_POL_BIT; |
| 115 | else |
| 116 | v &= ~MXC_OTG_PHYCTRL_PWR_POL_BIT; |
| 117 | #endif |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 118 | __raw_writel(v, usbother_base + |
| 119 | MXC_USB_PHY_CTR_FUNC_OFFSET); |
| 120 | |
| 121 | v = __raw_readl(usbother_base + MXC_USBCTRL_OFFSET); |
Benoît Thébaudeau | 661052f | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 122 | #ifdef CONFIG_MX51 |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 123 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 124 | v &= ~MXC_OTG_UCTRL_OPM_BIT; |
Benoît Thébaudeau | 394c00d | 2012-11-13 09:56:44 +0000 | [diff] [blame] | 125 | else |
| 126 | v |= MXC_OTG_UCTRL_OPM_BIT; |
Benoît Thébaudeau | 661052f | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 127 | #endif |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 128 | #ifdef CONFIG_MX53 |
| 129 | if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) |
| 130 | v |= MXC_OTG_UCTRL_O_PWR_POL_BIT; |
| 131 | else |
| 132 | v &= ~MXC_OTG_UCTRL_O_PWR_POL_BIT; |
| 133 | #endif |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 134 | __raw_writel(v, usbother_base + MXC_USBCTRL_OFFSET); |
| 135 | } |
| 136 | break; |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 137 | case 1: /* Host 1 ULPI */ |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 138 | #ifdef CONFIG_MX51 |
| 139 | /* The clock for the USBH1 ULPI port will come externally |
| 140 | from the PHY. */ |
| 141 | v = __raw_readl(usbother_base + MXC_USB_CTRL_1_OFFSET); |
| 142 | __raw_writel(v | MXC_USB_CTRL_UH1_EXT_CLK_EN, usbother_base + |
| 143 | MXC_USB_CTRL_1_OFFSET); |
| 144 | #endif |
| 145 | |
| 146 | v = __raw_readl(usbother_base + MXC_USBCTRL_OFFSET); |
Benoît Thébaudeau | 661052f | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 147 | #ifdef CONFIG_MX51 |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 148 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 149 | v &= ~MXC_H1_UCTRL_H1PM_BIT; /* H1 power mask unused */ |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 150 | else |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 151 | v |= MXC_H1_UCTRL_H1PM_BIT; /* H1 power mask used */ |
Benoît Thébaudeau | 661052f | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 152 | #endif |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 153 | #ifdef CONFIG_MX53 |
| 154 | if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) |
| 155 | v |= MXC_H1_UCTRL_H1_PWR_POL_BIT; |
| 156 | else |
| 157 | v &= ~MXC_H1_UCTRL_H1_PWR_POL_BIT; |
| 158 | #endif |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 159 | __raw_writel(v, usbother_base + MXC_USBCTRL_OFFSET); |
| 160 | |
| 161 | v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET); |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 162 | if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW) |
| 163 | v |= MXC_H1_OC_POL_BIT; |
| 164 | else |
| 165 | v &= ~MXC_H1_OC_POL_BIT; |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 166 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
| 167 | v &= ~MXC_H1_OC_DIS_BIT; /* OC is used */ |
| 168 | else |
| 169 | v |= MXC_H1_OC_DIS_BIT; /* OC is not used */ |
| 170 | __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET); |
| 171 | |
| 172 | break; |
| 173 | case 2: /* Host 2 ULPI */ |
| 174 | v = __raw_readl(usbother_base + MXC_USBH2CTRL_OFFSET); |
Benoît Thébaudeau | 661052f | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 175 | #ifdef CONFIG_MX51 |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 176 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 177 | v &= ~MXC_H2_UCTRL_H2PM_BIT; /* H2 power mask unused */ |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 178 | else |
Benoît Thébaudeau | bdc5202 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 179 | v |= MXC_H2_UCTRL_H2PM_BIT; /* H2 power mask used */ |
Benoît Thébaudeau | 661052f | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 180 | #endif |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 181 | #ifdef CONFIG_MX53 |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 182 | if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW) |
| 183 | v |= MXC_H2_UCTRL_H2_OC_POL_BIT; |
| 184 | else |
| 185 | v &= ~MXC_H2_UCTRL_H2_OC_POL_BIT; |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 186 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
| 187 | v &= ~MXC_H2_UCTRL_H2_OC_DIS_BIT; /* OC is used */ |
| 188 | else |
| 189 | v |= MXC_H2_UCTRL_H2_OC_DIS_BIT; /* OC is not used */ |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 190 | if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) |
| 191 | v |= MXC_H2_UCTRL_H2_PWR_POL_BIT; |
| 192 | else |
| 193 | v &= ~MXC_H2_UCTRL_H2_PWR_POL_BIT; |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 194 | #endif |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 195 | __raw_writel(v, usbother_base + MXC_USBH2CTRL_OFFSET); |
| 196 | break; |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 197 | #ifdef CONFIG_MX53 |
| 198 | case 3: /* Host 3 ULPI */ |
| 199 | v = __raw_readl(usbother_base + MXC_USBH3CTRL_OFFSET); |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 200 | if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW) |
| 201 | v |= MXC_H3_UCTRL_H3_OC_POL_BIT; |
| 202 | else |
| 203 | v &= ~MXC_H3_UCTRL_H3_OC_POL_BIT; |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 204 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
| 205 | v &= ~MXC_H3_UCTRL_H3_OC_DIS_BIT; /* OC is used */ |
| 206 | else |
| 207 | v |= MXC_H3_UCTRL_H3_OC_DIS_BIT; /* OC is not used */ |
Benoît Thébaudeau | 31ac2d0 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 208 | if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) |
| 209 | v |= MXC_H3_UCTRL_H3_PWR_POL_BIT; |
| 210 | else |
| 211 | v &= ~MXC_H3_UCTRL_H3_PWR_POL_BIT; |
Benoît Thébaudeau | 2cfe0b8 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 212 | __raw_writel(v, usbother_base + MXC_USBH3CTRL_OFFSET); |
| 213 | break; |
| 214 | #endif |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | return ret; |
| 218 | } |
| 219 | |
Benoît Thébaudeau | f22e4fa | 2012-11-13 09:58:35 +0000 | [diff] [blame] | 220 | int __weak board_ehci_hcd_init(int port) |
Marek Vasut | 1b80f27 | 2011-11-24 05:14:00 +0100 | [diff] [blame] | 221 | { |
Benoît Thébaudeau | f22e4fa | 2012-11-13 09:58:35 +0000 | [diff] [blame] | 222 | return 0; |
Marek Vasut | 1b80f27 | 2011-11-24 05:14:00 +0100 | [diff] [blame] | 223 | } |
| 224 | |
Benoît Thébaudeau | f22e4fa | 2012-11-13 09:58:35 +0000 | [diff] [blame] | 225 | void __weak board_ehci_hcd_postinit(struct usb_ehci *ehci, int port) |
| 226 | { |
| 227 | } |
Marek Vasut | 1b80f27 | 2011-11-24 05:14:00 +0100 | [diff] [blame] | 228 | |
Lucas Stach | 676ae06 | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 229 | int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 230 | { |
| 231 | struct usb_ehci *ehci; |
| 232 | #ifdef CONFIG_MX53 |
| 233 | struct clkctl *sc_regs = (struct clkctl *)CCM_BASE_ADDR; |
| 234 | u32 reg; |
| 235 | |
| 236 | reg = __raw_readl(&sc_regs->cscmr1) & ~(1 << 26); |
| 237 | /* derive USB PHY clock multiplexer from PLL3 */ |
| 238 | reg |= 1 << 26; |
| 239 | __raw_writel(reg, &sc_regs->cscmr1); |
| 240 | #endif |
| 241 | |
| 242 | set_usboh3_clk(); |
| 243 | enable_usboh3_clk(1); |
Benoît Thébaudeau | 414e166 | 2012-09-28 07:09:03 +0000 | [diff] [blame] | 244 | set_usb_phy_clk(); |
| 245 | enable_usb_phy1_clk(1); |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 246 | enable_usb_phy2_clk(1); |
| 247 | mdelay(1); |
| 248 | |
Marek Vasut | 1b80f27 | 2011-11-24 05:14:00 +0100 | [diff] [blame] | 249 | /* Do board specific initialization */ |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 250 | board_ehci_hcd_init(CONFIG_MXC_USB_PORT); |
| 251 | |
| 252 | ehci = (struct usb_ehci *)(OTG_BASE_ADDR + |
| 253 | (0x200 * CONFIG_MXC_USB_PORT)); |
Lucas Stach | 676ae06 | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 254 | *hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength); |
| 255 | *hcor = (struct ehci_hcor *)((uint32_t)*hccr + |
| 256 | HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase))); |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 257 | setbits_le32(&ehci->usbmode, CM_HOST); |
| 258 | |
| 259 | __raw_writel(CONFIG_MXC_USB_PORTSC, &ehci->portsc); |
| 260 | setbits_le32(&ehci->portsc, USB_EN); |
| 261 | |
| 262 | mxc_set_usbcontrol(CONFIG_MXC_USB_PORT, CONFIG_MXC_USB_FLAGS); |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 263 | mdelay(10); |
| 264 | |
Marek Vasut | 1b80f27 | 2011-11-24 05:14:00 +0100 | [diff] [blame] | 265 | /* Do board specific post-initialization */ |
| 266 | board_ehci_hcd_postinit(ehci, CONFIG_MXC_USB_PORT); |
| 267 | |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 268 | return 0; |
| 269 | } |
| 270 | |
Lucas Stach | 676ae06 | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 271 | int ehci_hcd_stop(int index) |
Wolfgang Grandegger | 1ca5620 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 272 | { |
| 273 | return 0; |
| 274 | } |