1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
4 * Copyright (C) 2010 Freescale Semiconductor, Inc.
7 #include <linux/platform_device.h>
9 #include <linux/platform_data/usb-ehci-mxc.h>
14 #define USBCTRL_OTGBASE_OFFSET 0x600
16 #define MX31_OTG_SIC_SHIFT 29
17 #define MX31_OTG_SIC_MASK (0x3 << MX31_OTG_SIC_SHIFT)
18 #define MX31_OTG_PM_BIT (1 << 24)
20 #define MX31_H2_SIC_SHIFT 21
21 #define MX31_H2_SIC_MASK (0x3 << MX31_H2_SIC_SHIFT)
22 #define MX31_H2_PM_BIT (1 << 16)
23 #define MX31_H2_DT_BIT (1 << 5)
25 #define MX31_H1_SIC_SHIFT 13
26 #define MX31_H1_SIC_MASK (0x3 << MX31_H1_SIC_SHIFT)
27 #define MX31_H1_PM_BIT (1 << 8)
28 #define MX31_H1_DT_BIT (1 << 4)
30 int mx31_initialize_usb_hw(int port
, unsigned int flags
)
34 v
= readl(MX31_IO_ADDRESS(MX31_USB_BASE_ADDR
+ USBCTRL_OTGBASE_OFFSET
));
37 case 0: /* OTG port */
38 v
&= ~(MX31_OTG_SIC_MASK
| MX31_OTG_PM_BIT
);
39 v
|= (flags
& MXC_EHCI_INTERFACE_MASK
) << MX31_OTG_SIC_SHIFT
;
41 if (!(flags
& MXC_EHCI_POWER_PINS_ENABLED
))
46 v
&= ~(MX31_H1_SIC_MASK
| MX31_H1_PM_BIT
| MX31_H1_DT_BIT
);
47 v
|= (flags
& MXC_EHCI_INTERFACE_MASK
) << MX31_H1_SIC_SHIFT
;
49 if (!(flags
& MXC_EHCI_POWER_PINS_ENABLED
))
52 if (!(flags
& MXC_EHCI_TTL_ENABLED
))
57 v
&= ~(MX31_H2_SIC_MASK
| MX31_H2_PM_BIT
| MX31_H2_DT_BIT
);
58 v
|= (flags
& MXC_EHCI_INTERFACE_MASK
) << MX31_H2_SIC_SHIFT
;
60 if (!(flags
& MXC_EHCI_POWER_PINS_ENABLED
))
63 if (!(flags
& MXC_EHCI_TTL_ENABLED
))
71 writel(v
, MX31_IO_ADDRESS(MX31_USB_BASE_ADDR
+ USBCTRL_OTGBASE_OFFSET
));