blob: aec57dd784f729d6298ded8bd8474d876db66ae3 [file] [log] [blame]
Thomas Gleixnerc942fdd2019-05-27 08:55:06 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +05302/*
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +02003 * omap_control_phy.h - Header file for the PHY part of control module.
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +05304 *
5 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +05306 * Author: Kishon Vijay Abraham I <kishon@ti.com>
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +05307 */
8
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +02009#ifndef __OMAP_CONTROL_PHY_H__
10#define __OMAP_CONTROL_PHY_H__
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053011
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020012enum omap_control_phy_type {
Roger Quadros6cb93102013-10-03 18:12:31 +030013 OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
14 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
15 OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
Kishon Vijay Abraham If0e2cf72014-06-25 23:22:57 +053016 OMAP_CTRL_TYPE_PCIE, /* RX TX control of ACSPCIE */
Roger Quadros6cb93102013-10-03 18:12:31 +030017 OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
George Cherianc4b34a32013-10-15 15:32:14 +053018 OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
Roger Quadros6cb93102013-10-03 18:12:31 +030019};
20
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020021struct omap_control_phy {
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053022 struct device *dev;
23
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053024 u32 __iomem *otghs_control;
Roger Quadros6cb93102013-10-03 18:12:31 +030025 u32 __iomem *power;
26 u32 __iomem *power_aux;
Kishon Vijay Abraham If0e2cf72014-06-25 23:22:57 +053027 u32 __iomem *pcie_pcs;
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053028
29 struct clk *sys_clk;
30
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020031 enum omap_control_phy_type type;
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053032};
33
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053034enum omap_control_usb_mode {
35 USB_MODE_UNDEFINED = 0,
36 USB_MODE_HOST,
37 USB_MODE_DEVICE,
38 USB_MODE_DISCONNECT,
39};
40
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053041#define OMAP_CTRL_DEV_PHY_PD BIT(0)
42
43#define OMAP_CTRL_DEV_AVALID BIT(0)
44#define OMAP_CTRL_DEV_BVALID BIT(1)
45#define OMAP_CTRL_DEV_VBUSVALID BIT(2)
46#define OMAP_CTRL_DEV_SESSEND BIT(3)
47#define OMAP_CTRL_DEV_IDDIG BIT(4)
48
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020049#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000
50#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT 0xE
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053051
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020052#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK 0xFFC00000
53#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT 0x16
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053054
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020055#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
56#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053057
Kishon Vijay Abraham If0e2cf72014-06-25 23:22:57 +053058#define OMAP_CTRL_PCIE_PCS_MASK 0xff
Vignesh R0bc09f92014-12-16 14:52:50 +053059#define OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT 16
Kishon Vijay Abraham If0e2cf72014-06-25 23:22:57 +053060
Roger Quadros6cb93102013-10-03 18:12:31 +030061#define OMAP_CTRL_USB2_PHY_PD BIT(28)
62
George Cherianc4b34a32013-10-15 15:32:14 +053063#define AM437X_CTRL_USB2_PHY_PD BIT(0)
64#define AM437X_CTRL_USB2_OTG_PD BIT(1)
65#define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
66#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
67
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020068#if IS_ENABLED(CONFIG_OMAP_CONTROL_PHY)
69void omap_control_phy_power(struct device *dev, int on);
70void omap_control_usb_set_mode(struct device *dev,
71 enum omap_control_usb_mode mode);
Vignesh R0bc09f92014-12-16 14:52:50 +053072void omap_control_pcie_pcs(struct device *dev, u8 delay);
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053073#else
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053074
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020075static inline void omap_control_phy_power(struct device *dev, int on)
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053076{
77}
78
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053079static inline void omap_control_usb_set_mode(struct device *dev,
80 enum omap_control_usb_mode mode)
81{
82}
Kishon Vijay Abraham If0e2cf72014-06-25 23:22:57 +053083
Vignesh R0bc09f92014-12-16 14:52:50 +053084static inline void omap_control_pcie_pcs(struct device *dev, u8 delay)
Kishon Vijay Abraham If0e2cf72014-06-25 23:22:57 +053085{
86}
Kishon Vijay Abraham I01658f02013-01-25 15:53:57 +053087#endif
88
Kishon Vijay Abraham I14da6992014-03-06 16:38:37 +020089#endif /* __OMAP_CONTROL_PHY_H__ */