1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * omap_usb.h -- omap usb2 phy header file
5 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
9 #ifndef __DRIVERS_OMAP_USB2_H
10 #define __DRIVERS_OMAP_USB2_H
13 #include <linux/usb/otg.h>
15 struct usb_dpll_params {
23 enum omap_usb_phy_type {
24 TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
25 TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
26 TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
31 struct phy_companion *comparator;
32 void __iomem *pll_ctrl_base;
33 void __iomem *phy_base;
35 struct device *control_dev;
39 enum omap_usb_phy_type type;
40 struct regmap *syscon_phy_power; /* ctrl. reg. acces */
41 unsigned int power_reg; /* power reg. index within syscon */
56 #define OMAP_USB2_HAS_START_SRP (1 << 0)
57 #define OMAP_USB2_HAS_SET_VBUS (1 << 1)
58 #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
60 #define OMAP_DEV_PHY_PD BIT(0)
61 #define OMAP_USB2_PHY_PD BIT(28)
63 #define AM437X_USB2_PHY_PD BIT(0)
64 #define AM437X_USB2_OTG_PD BIT(1)
65 #define AM437X_USB2_OTGVDET_EN BIT(19)
66 #define AM437X_USB2_OTGSESSEND_EN BIT(20)
68 #define phy_to_omapusb(x) container_of((x), struct omap_usb, phy)
70 #if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
71 extern int omap_usb2_set_comparator(struct phy_companion *comparator);
73 static inline int omap_usb2_set_comparator(struct phy_companion *comparator)
79 static inline u32 omap_usb_readl(void __iomem *addr, unsigned offset)
81 return __raw_readl(addr + offset);
84 static inline void omap_usb_writel(void __iomem *addr, unsigned offset,
87 __raw_writel(data, addr + offset);
90 #endif /* __DRIVERS_OMAP_USB_H */