Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de> |
| 4 | * Copyright (C) 2010 Freescale Semiconductor, Inc. |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <usb.h> |
| 9 | #include <errno.h> |
| 10 | #include <linux/compiler.h> |
Mateusz Kulikowski | 3add69e | 2016-03-31 23:12:23 +0200 | [diff] [blame] | 11 | #include <usb/ehci-ci.h> |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 12 | #include <asm/io.h> |
| 13 | #include <asm/arch/imx-regs.h> |
| 14 | #include <asm/arch/clock.h> |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 15 | |
| 16 | #include "ehci.h" |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 17 | |
| 18 | #define MX5_USBOTHER_REGS_OFFSET 0x800 |
| 19 | |
| 20 | |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 21 | #define MXC_OTG_OFFSET 0 |
| 22 | #define MXC_H1_OFFSET 0x200 |
| 23 | #define MXC_H2_OFFSET 0x400 |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 24 | #define MXC_H3_OFFSET 0x600 |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 25 | |
| 26 | #define MXC_USBCTRL_OFFSET 0 |
| 27 | #define MXC_USB_PHY_CTR_FUNC_OFFSET 0x8 |
| 28 | #define MXC_USB_PHY_CTR_FUNC2_OFFSET 0xc |
| 29 | #define MXC_USB_CTRL_1_OFFSET 0x10 |
| 30 | #define MXC_USBH2CTRL_OFFSET 0x14 |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 31 | #define MXC_USBH3CTRL_OFFSET 0x18 |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 32 | |
| 33 | /* USB_CTRL */ |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 34 | /* OTG wakeup intr enable */ |
| 35 | #define MXC_OTG_UCTRL_OWIE_BIT (1 << 27) |
| 36 | /* OTG power mask */ |
| 37 | #define MXC_OTG_UCTRL_OPM_BIT (1 << 24) |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 38 | /* OTG power pin polarity */ |
| 39 | #define MXC_OTG_UCTRL_O_PWR_POL_BIT (1 << 24) |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 40 | /* Host1 ULPI interrupt enable */ |
| 41 | #define MXC_H1_UCTRL_H1UIE_BIT (1 << 12) |
| 42 | /* HOST1 wakeup intr enable */ |
| 43 | #define MXC_H1_UCTRL_H1WIE_BIT (1 << 11) |
| 44 | /* HOST1 power mask */ |
| 45 | #define MXC_H1_UCTRL_H1PM_BIT (1 << 8) |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 46 | /* HOST1 power pin polarity */ |
| 47 | #define MXC_H1_UCTRL_H1_PWR_POL_BIT (1 << 8) |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 48 | |
| 49 | /* USB_PHY_CTRL_FUNC */ |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 50 | /* OTG Polarity of Overcurrent */ |
| 51 | #define MXC_OTG_PHYCTRL_OC_POL_BIT (1 << 9) |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 52 | /* OTG Disable Overcurrent Event */ |
| 53 | #define MXC_OTG_PHYCTRL_OC_DIS_BIT (1 << 8) |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 54 | /* UH1 Polarity of Overcurrent */ |
| 55 | #define MXC_H1_OC_POL_BIT (1 << 6) |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 56 | /* UH1 Disable Overcurrent Event */ |
| 57 | #define MXC_H1_OC_DIS_BIT (1 << 5) |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 58 | /* OTG Power Pin Polarity */ |
| 59 | #define MXC_OTG_PHYCTRL_PWR_POL_BIT (1 << 3) |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 60 | |
| 61 | /* USBH2CTRL */ |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 62 | #define MXC_H2_UCTRL_H2_OC_POL_BIT (1 << 31) |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 63 | #define MXC_H2_UCTRL_H2_OC_DIS_BIT (1 << 30) |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 64 | #define MXC_H2_UCTRL_H2UIE_BIT (1 << 8) |
| 65 | #define MXC_H2_UCTRL_H2WIE_BIT (1 << 7) |
| 66 | #define MXC_H2_UCTRL_H2PM_BIT (1 << 4) |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 67 | #define MXC_H2_UCTRL_H2_PWR_POL_BIT (1 << 4) |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 68 | |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 69 | /* USBH3CTRL */ |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 70 | #define MXC_H3_UCTRL_H3_OC_POL_BIT (1 << 31) |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 71 | #define MXC_H3_UCTRL_H3_OC_DIS_BIT (1 << 30) |
| 72 | #define MXC_H3_UCTRL_H3UIE_BIT (1 << 8) |
| 73 | #define MXC_H3_UCTRL_H3WIE_BIT (1 << 7) |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 74 | #define MXC_H3_UCTRL_H3_PWR_POL_BIT (1 << 4) |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 75 | |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 76 | /* USB_CTRL_1 */ |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 77 | #define MXC_USB_CTRL_UH1_EXT_CLK_EN (1 << 25) |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 78 | |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 79 | int mxc_set_usbcontrol(int port, unsigned int flags) |
| 80 | { |
| 81 | unsigned int v; |
| 82 | void __iomem *usb_base = (void __iomem *)OTG_BASE_ADDR; |
| 83 | void __iomem *usbother_base; |
| 84 | int ret = 0; |
| 85 | |
| 86 | usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET; |
| 87 | |
| 88 | switch (port) { |
| 89 | case 0: /* OTG port */ |
| 90 | if (flags & MXC_EHCI_INTERNAL_PHY) { |
| 91 | v = __raw_readl(usbother_base + |
| 92 | MXC_USB_PHY_CTR_FUNC_OFFSET); |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 93 | if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW) |
| 94 | v |= MXC_OTG_PHYCTRL_OC_POL_BIT; |
| 95 | else |
| 96 | v &= ~MXC_OTG_PHYCTRL_OC_POL_BIT; |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 97 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 98 | /* OC/USBPWR is used */ |
| 99 | v &= ~MXC_OTG_PHYCTRL_OC_DIS_BIT; |
Benoît Thébaudeau | 2b2a415 | 2012-11-13 09:56:30 +0000 | [diff] [blame] | 100 | else |
| 101 | /* OC/USBPWR is not used */ |
| 102 | v |= MXC_OTG_PHYCTRL_OC_DIS_BIT; |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 103 | #ifdef CONFIG_MX51 |
| 104 | if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) |
| 105 | v |= MXC_OTG_PHYCTRL_PWR_POL_BIT; |
| 106 | else |
| 107 | v &= ~MXC_OTG_PHYCTRL_PWR_POL_BIT; |
| 108 | #endif |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 109 | __raw_writel(v, usbother_base + |
| 110 | MXC_USB_PHY_CTR_FUNC_OFFSET); |
| 111 | |
| 112 | v = __raw_readl(usbother_base + MXC_USBCTRL_OFFSET); |
Benoît Thébaudeau | 46a53ab | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 113 | #ifdef CONFIG_MX51 |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 114 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 115 | v &= ~MXC_OTG_UCTRL_OPM_BIT; |
Benoît Thébaudeau | b7647f3 | 2012-11-13 09:56:44 +0000 | [diff] [blame] | 116 | else |
| 117 | v |= MXC_OTG_UCTRL_OPM_BIT; |
Benoît Thébaudeau | 46a53ab | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 118 | #endif |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 119 | #ifdef CONFIG_MX53 |
| 120 | if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) |
| 121 | v |= MXC_OTG_UCTRL_O_PWR_POL_BIT; |
| 122 | else |
| 123 | v &= ~MXC_OTG_UCTRL_O_PWR_POL_BIT; |
| 124 | #endif |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 125 | __raw_writel(v, usbother_base + MXC_USBCTRL_OFFSET); |
| 126 | } |
| 127 | break; |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 128 | case 1: /* Host 1 ULPI */ |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 129 | #ifdef CONFIG_MX51 |
| 130 | /* The clock for the USBH1 ULPI port will come externally |
| 131 | from the PHY. */ |
| 132 | v = __raw_readl(usbother_base + MXC_USB_CTRL_1_OFFSET); |
| 133 | __raw_writel(v | MXC_USB_CTRL_UH1_EXT_CLK_EN, usbother_base + |
| 134 | MXC_USB_CTRL_1_OFFSET); |
| 135 | #endif |
| 136 | |
| 137 | v = __raw_readl(usbother_base + MXC_USBCTRL_OFFSET); |
Benoît Thébaudeau | 46a53ab | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 138 | #ifdef CONFIG_MX51 |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 139 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 140 | v &= ~MXC_H1_UCTRL_H1PM_BIT; /* H1 power mask unused */ |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 141 | else |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 142 | v |= MXC_H1_UCTRL_H1PM_BIT; /* H1 power mask used */ |
Benoît Thébaudeau | 46a53ab | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 143 | #endif |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 144 | #ifdef CONFIG_MX53 |
| 145 | if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) |
| 146 | v |= MXC_H1_UCTRL_H1_PWR_POL_BIT; |
| 147 | else |
| 148 | v &= ~MXC_H1_UCTRL_H1_PWR_POL_BIT; |
| 149 | #endif |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 150 | __raw_writel(v, usbother_base + MXC_USBCTRL_OFFSET); |
| 151 | |
| 152 | v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET); |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 153 | if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW) |
| 154 | v |= MXC_H1_OC_POL_BIT; |
| 155 | else |
| 156 | v &= ~MXC_H1_OC_POL_BIT; |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 157 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
| 158 | v &= ~MXC_H1_OC_DIS_BIT; /* OC is used */ |
| 159 | else |
| 160 | v |= MXC_H1_OC_DIS_BIT; /* OC is not used */ |
| 161 | __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC_OFFSET); |
| 162 | |
| 163 | break; |
| 164 | case 2: /* Host 2 ULPI */ |
| 165 | v = __raw_readl(usbother_base + MXC_USBH2CTRL_OFFSET); |
Benoît Thébaudeau | 46a53ab | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 166 | #ifdef CONFIG_MX51 |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 167 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 168 | v &= ~MXC_H2_UCTRL_H2PM_BIT; /* H2 power mask unused */ |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 169 | else |
Benoît Thébaudeau | cb10972 | 2012-11-13 09:56:15 +0000 | [diff] [blame] | 170 | v |= MXC_H2_UCTRL_H2PM_BIT; /* H2 power mask used */ |
Benoît Thébaudeau | 46a53ab | 2012-11-13 09:56:59 +0000 | [diff] [blame] | 171 | #endif |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 172 | #ifdef CONFIG_MX53 |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 173 | if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW) |
| 174 | v |= MXC_H2_UCTRL_H2_OC_POL_BIT; |
| 175 | else |
| 176 | v &= ~MXC_H2_UCTRL_H2_OC_POL_BIT; |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 177 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
| 178 | v &= ~MXC_H2_UCTRL_H2_OC_DIS_BIT; /* OC is used */ |
| 179 | else |
| 180 | v |= MXC_H2_UCTRL_H2_OC_DIS_BIT; /* OC is not used */ |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 181 | if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) |
| 182 | v |= MXC_H2_UCTRL_H2_PWR_POL_BIT; |
| 183 | else |
| 184 | v &= ~MXC_H2_UCTRL_H2_PWR_POL_BIT; |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 185 | #endif |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 186 | __raw_writel(v, usbother_base + MXC_USBH2CTRL_OFFSET); |
| 187 | break; |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 188 | #ifdef CONFIG_MX53 |
| 189 | case 3: /* Host 3 ULPI */ |
| 190 | v = __raw_readl(usbother_base + MXC_USBH3CTRL_OFFSET); |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 191 | if (flags & MXC_EHCI_OC_PIN_ACTIVE_LOW) |
| 192 | v |= MXC_H3_UCTRL_H3_OC_POL_BIT; |
| 193 | else |
| 194 | v &= ~MXC_H3_UCTRL_H3_OC_POL_BIT; |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 195 | if (flags & MXC_EHCI_POWER_PINS_ENABLED) |
| 196 | v &= ~MXC_H3_UCTRL_H3_OC_DIS_BIT; /* OC is used */ |
| 197 | else |
| 198 | v |= MXC_H3_UCTRL_H3_OC_DIS_BIT; /* OC is not used */ |
Benoît Thébaudeau | 17971a9 | 2012-11-13 09:57:27 +0000 | [diff] [blame] | 199 | if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH) |
| 200 | v |= MXC_H3_UCTRL_H3_PWR_POL_BIT; |
| 201 | else |
| 202 | v &= ~MXC_H3_UCTRL_H3_PWR_POL_BIT; |
Benoît Thébaudeau | 284a459 | 2012-11-13 09:57:14 +0000 | [diff] [blame] | 203 | __raw_writel(v, usbother_base + MXC_USBH3CTRL_OFFSET); |
| 204 | break; |
| 205 | #endif |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | return ret; |
| 209 | } |
| 210 | |
Benoît Thébaudeau | 98023c1 | 2012-11-13 09:58:35 +0000 | [diff] [blame] | 211 | int __weak board_ehci_hcd_init(int port) |
Marek Vasut | de09b79 | 2011-11-24 05:14:00 +0100 | [diff] [blame] | 212 | { |
Benoît Thébaudeau | 98023c1 | 2012-11-13 09:58:35 +0000 | [diff] [blame] | 213 | return 0; |
Marek Vasut | de09b79 | 2011-11-24 05:14:00 +0100 | [diff] [blame] | 214 | } |
| 215 | |
Benoît Thébaudeau | 98023c1 | 2012-11-13 09:58:35 +0000 | [diff] [blame] | 216 | void __weak board_ehci_hcd_postinit(struct usb_ehci *ehci, int port) |
| 217 | { |
| 218 | } |
Marek Vasut | de09b79 | 2011-11-24 05:14:00 +0100 | [diff] [blame] | 219 | |
Simon Glass | dc9f3ed | 2015-03-25 12:22:27 -0600 | [diff] [blame] | 220 | __weak void mx5_ehci_powerup_fixup(struct ehci_ctrl *ctrl, uint32_t *status_reg, |
| 221 | uint32_t *reg) |
| 222 | { |
| 223 | mdelay(50); |
| 224 | } |
| 225 | |
| 226 | static const struct ehci_ops mx5_ehci_ops = { |
| 227 | .powerup_fixup = mx5_ehci_powerup_fixup, |
| 228 | }; |
| 229 | |
Troy Kisky | 7d6bbb9 | 2013-10-10 15:27:57 -0700 | [diff] [blame] | 230 | int ehci_hcd_init(int index, enum usb_init_type init, |
| 231 | struct ehci_hccr **hccr, struct ehci_hcor **hcor) |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 232 | { |
| 233 | struct usb_ehci *ehci; |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 234 | |
Simon Glass | dc9f3ed | 2015-03-25 12:22:27 -0600 | [diff] [blame] | 235 | /* The only user for this is efikamx-usb */ |
| 236 | ehci_set_controller_priv(index, NULL, &mx5_ehci_ops); |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 237 | set_usboh3_clk(); |
Fabio Estevam | 800cb81 | 2013-07-26 13:54:28 -0300 | [diff] [blame] | 238 | enable_usboh3_clk(true); |
Benoît Thébaudeau | f2f0038 | 2012-09-28 07:09:03 +0000 | [diff] [blame] | 239 | set_usb_phy_clk(); |
Fabio Estevam | 800cb81 | 2013-07-26 13:54:28 -0300 | [diff] [blame] | 240 | enable_usb_phy1_clk(true); |
| 241 | enable_usb_phy2_clk(true); |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 242 | mdelay(1); |
| 243 | |
Marek Vasut | de09b79 | 2011-11-24 05:14:00 +0100 | [diff] [blame] | 244 | /* Do board specific initialization */ |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 245 | board_ehci_hcd_init(CONFIG_MXC_USB_PORT); |
| 246 | |
| 247 | ehci = (struct usb_ehci *)(OTG_BASE_ADDR + |
| 248 | (0x200 * CONFIG_MXC_USB_PORT)); |
Lucas Stach | 3494a4c | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 249 | *hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength); |
| 250 | *hcor = (struct ehci_hcor *)((uint32_t)*hccr + |
| 251 | HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase))); |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 252 | setbits_le32(&ehci->usbmode, CM_HOST); |
| 253 | |
| 254 | __raw_writel(CONFIG_MXC_USB_PORTSC, &ehci->portsc); |
| 255 | setbits_le32(&ehci->portsc, USB_EN); |
| 256 | |
| 257 | mxc_set_usbcontrol(CONFIG_MXC_USB_PORT, CONFIG_MXC_USB_FLAGS); |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 258 | mdelay(10); |
| 259 | |
Marek Vasut | de09b79 | 2011-11-24 05:14:00 +0100 | [diff] [blame] | 260 | /* Do board specific post-initialization */ |
| 261 | board_ehci_hcd_postinit(ehci, CONFIG_MXC_USB_PORT); |
| 262 | |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 263 | return 0; |
| 264 | } |
| 265 | |
Lucas Stach | 3494a4c | 2012-09-26 00:14:35 +0200 | [diff] [blame] | 266 | int ehci_hcd_stop(int index) |
Wolfgang Grandegger | d17f2d2 | 2011-11-11 14:03:36 +0100 | [diff] [blame] | 267 | { |
| 268 | return 0; |
| 269 | } |