1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef __OMAP_CONTROL_PHY_H__
20#define __OMAP_CONTROL_PHY_H__
21
22enum omap_control_phy_type {
23 OMAP_CTRL_TYPE_OTGHS = 1,
24 OMAP_CTRL_TYPE_USB2,
25 OMAP_CTRL_TYPE_PIPE3,
26 OMAP_CTRL_TYPE_PCIE,
27 OMAP_CTRL_TYPE_DRA7USB2,
28 OMAP_CTRL_TYPE_AM437USB2,
29};
30
31struct omap_control_phy {
32 struct device *dev;
33
34 u32 __iomem *otghs_control;
35 u32 __iomem *power;
36 u32 __iomem *power_aux;
37 u32 __iomem *pcie_pcs;
38
39 struct clk *sys_clk;
40
41 enum omap_control_phy_type type;
42};
43
44enum omap_control_usb_mode {
45 USB_MODE_UNDEFINED = 0,
46 USB_MODE_HOST,
47 USB_MODE_DEVICE,
48 USB_MODE_DISCONNECT,
49};
50
51#define OMAP_CTRL_DEV_PHY_PD BIT(0)
52
53#define OMAP_CTRL_DEV_AVALID BIT(0)
54#define OMAP_CTRL_DEV_BVALID BIT(1)
55#define OMAP_CTRL_DEV_VBUSVALID BIT(2)
56#define OMAP_CTRL_DEV_SESSEND BIT(3)
57#define OMAP_CTRL_DEV_IDDIG BIT(4)
58
59#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000
60#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT 0xE
61
62#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK 0xFFC00000
63#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT 0x16
64
65#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
66#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
67
68#define OMAP_CTRL_PCIE_PCS_MASK 0xff
69#define OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT 16
70
71#define OMAP_CTRL_USB2_PHY_PD BIT(28)
72
73#define AM437X_CTRL_USB2_PHY_PD BIT(0)
74#define AM437X_CTRL_USB2_OTG_PD BIT(1)
75#define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
76#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
77
78#if IS_ENABLED(CONFIG_OMAP_CONTROL_PHY)
79void omap_control_phy_power(struct device *dev, int on);
80void omap_control_usb_set_mode(struct device *dev,
81 enum omap_control_usb_mode mode);
82void omap_control_pcie_pcs(struct device *dev, u8 delay);
83#else
84
85static inline void omap_control_phy_power(struct device *dev, int on)
86{
87}
88
89static inline void omap_control_usb_set_mode(struct device *dev,
90 enum omap_control_usb_mode mode)
91{
92}
93
94static inline void omap_control_pcie_pcs(struct device *dev, u8 delay)
95{
96}
97#endif
98
99#endif
100