blob: 5450403c7546d4e9429468a9225cf62e0fa9d7f6 [file] [log] [blame]
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +05301/*
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +02002 * omap_control_phy.h - Header file for the PHY part of control module.
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +05303 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * Author: Kishon Vijay Abraham I <kishon@ti.com>
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020019#ifndef __OMAP_CONTROL_PHY_H__
20#define __OMAP_CONTROL_PHY_H__
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053021
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020022enum omap_control_phy_type {
Roger Quadros6cb93102013-10-03 18:12:31 +030023 OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
24 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
25 OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
26 OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
George Cherianc4b34a32013-10-15 15:32:14 +053027 OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
Roger Quadros6cb93102013-10-03 18:12:31 +030028};
29
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020030struct omap_control_phy {
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053031 struct device *dev;
32
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053033 u32 __iomem *otghs_control;
Roger Quadros6cb93102013-10-03 18:12:31 +030034 u32 __iomem *power;
35 u32 __iomem *power_aux;
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053036
37 struct clk *sys_clk;
38
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020039 enum omap_control_phy_type type;
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053040};
41
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053042enum omap_control_usb_mode {
43 USB_MODE_UNDEFINED = 0,
44 USB_MODE_HOST,
45 USB_MODE_DEVICE,
46 USB_MODE_DISCONNECT,
47};
48
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053049#define OMAP_CTRL_DEV_PHY_PD BIT(0)
50
51#define OMAP_CTRL_DEV_AVALID BIT(0)
52#define OMAP_CTRL_DEV_BVALID BIT(1)
53#define OMAP_CTRL_DEV_VBUSVALID BIT(2)
54#define OMAP_CTRL_DEV_SESSEND BIT(3)
55#define OMAP_CTRL_DEV_IDDIG BIT(4)
56
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020057#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000
58#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT 0xE
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053059
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020060#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK 0xFFC00000
61#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT 0x16
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053062
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020063#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
64#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053065
Roger Quadros6cb93102013-10-03 18:12:31 +030066#define OMAP_CTRL_USB2_PHY_PD BIT(28)
67
George Cherianc4b34a32013-10-15 15:32:14 +053068#define AM437X_CTRL_USB2_PHY_PD BIT(0)
69#define AM437X_CTRL_USB2_OTG_PD BIT(1)
70#define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
71#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
72
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020073#if IS_ENABLED(CONFIG_OMAP_CONTROL_PHY)
74void omap_control_phy_power(struct device *dev, int on);
75void omap_control_usb_set_mode(struct device *dev,
76 enum omap_control_usb_mode mode);
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053077#else
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053078
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020079static inline void omap_control_phy_power(struct device *dev, int on)
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053080{
81}
82
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053083static inline void omap_control_usb_set_mode(struct device *dev,
84 enum omap_control_usb_mode mode)
85{
86}
87#endif
88
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020089#endif /* __OMAP_CONTROL_PHY_H__ */