at v5.2 2.1 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * omap_usb.h -- omap usb2 phy header file 4 * 5 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com 6 * Author: Kishon Vijay Abraham I <kishon@ti.com> 7 */ 8 9#ifndef __DRIVERS_OMAP_USB2_H 10#define __DRIVERS_OMAP_USB2_H 11 12#include <linux/io.h> 13#include <linux/usb/otg.h> 14 15struct usb_dpll_params { 16 u16 m; 17 u8 n; 18 u8 freq:3; 19 u8 sd; 20 u32 mf; 21}; 22 23enum 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 */ 27}; 28 29struct omap_usb { 30 struct usb_phy phy; 31 struct phy_companion *comparator; 32 void __iomem *pll_ctrl_base; 33 void __iomem *phy_base; 34 struct device *dev; 35 struct device *control_dev; 36 struct clk *wkupclk; 37 struct clk *optclk; 38 u8 flags; 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 */ 42 u32 mask; 43 u32 power_on; 44 u32 power_off; 45}; 46 47struct usb_phy_data { 48 const char *label; 49 u8 flags; 50 u32 mask; 51 u32 power_on; 52 u32 power_off; 53}; 54 55/* Driver Flags */ 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) 59 60#define OMAP_DEV_PHY_PD BIT(0) 61#define OMAP_USB2_PHY_PD BIT(28) 62 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) 67 68#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy) 69 70#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE) 71extern int omap_usb2_set_comparator(struct phy_companion *comparator); 72#else 73static inline int omap_usb2_set_comparator(struct phy_companion *comparator) 74{ 75 return -ENODEV; 76} 77#endif 78 79static inline u32 omap_usb_readl(void __iomem *addr, unsigned offset) 80{ 81 return __raw_readl(addr + offset); 82} 83 84static inline void omap_usb_writel(void __iomem *addr, unsigned offset, 85 u32 data) 86{ 87 __raw_writel(data, addr + offset); 88} 89 90#endif /* __DRIVERS_OMAP_USB_H */