summaryrefslogtreecommitdiff
path: root/drivers/usb/host/ohci-sunxi.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-03-23 18:35:11 -0400
committerTom Rini <trini@konsulko.com>2016-03-23 18:35:11 -0400
commitb5b84be8a7356d4c3618b6edcb501885e53569f5 (patch)
treef172eee81583287573c027189bf099385f22d2b5 /drivers/usb/host/ohci-sunxi.c
parentd085ecd61b9956cda0d37b89b5c538f54440fe58 (diff)
parente449e840c5adf728ddd308501af3115656aa9a60 (diff)
downloadu-boot-imx-b5b84be8a7356d4c3618b6edcb501885e53569f5.zip
u-boot-imx-b5b84be8a7356d4c3618b6edcb501885e53569f5.tar.gz
u-boot-imx-b5b84be8a7356d4c3618b6edcb501885e53569f5.tar.bz2
Merge branch 'master' of http://git.denx.de/u-boot-sunxi
Diffstat (limited to 'drivers/usb/host/ohci-sunxi.c')
-rw-r--r--drivers/usb/host/ohci-sunxi.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/usb/host/ohci-sunxi.c b/drivers/usb/host/ohci-sunxi.c
index 1b1f651..d4fb95a 100644
--- a/drivers/usb/host/ohci-sunxi.c
+++ b/drivers/usb/host/ohci-sunxi.c
@@ -17,6 +17,14 @@
#include <usb.h>
#include "ohci.h"
+#ifdef CONFIG_SUNXI_GEN_SUN4I
+#define BASE_DIST 0x8000
+#define AHB_CLK_DIST 2
+#else
+#define BASE_DIST 0x1000
+#define AHB_CLK_DIST 1
+#endif
+
struct ohci_sunxi_priv {
ohci_t ohci;
int ahb_gate_mask; /* Mask of ahb_gate0 clk gate bits for this hcd */
@@ -42,9 +50,10 @@ static int ohci_usb_probe(struct udevice *dev)
priv->ahb_gate_mask |= 1 << AHB_GATE_OFFSET_USB_EHCI0;
#endif
priv->usb_gate_mask = CCM_USB_CTRL_OHCI0_CLK;
- priv->phy_index = ((u32)regs - (SUNXI_USB1_BASE + 0x400)) / 0x1000 + 1;
- priv->ahb_gate_mask <<= priv->phy_index - 1;
- priv->usb_gate_mask <<= priv->phy_index - 1;
+ priv->phy_index = ((u32)regs - (SUNXI_USB1_BASE + 0x400)) / BASE_DIST;
+ priv->ahb_gate_mask <<= priv->phy_index * AHB_CLK_DIST;
+ priv->usb_gate_mask <<= priv->phy_index;
+ priv->phy_index++; /* Non otg phys start at 1 */
setbits_le32(&ccm->ahb_gate0, priv->ahb_gate_mask);
setbits_le32(&ccm->usb_clk_cfg, priv->usb_gate_mask);