Kishon Vijay Abraham I | 01658f0 | 2013-01-25 15:53:57 +0530 | [diff] [blame] | 1 | /* |
| 2 | * omap_control_usb.h - Header file for the USB part of control module. |
| 3 | * |
| 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 | |
| 19 | #ifndef __OMAP_CONTROL_USB_H__ |
| 20 | #define __OMAP_CONTROL_USB_H__ |
| 21 | |
Roger Quadros | 6cb9310 | 2013-10-03 18:12:31 +0300 | [diff] [blame^] | 22 | enum omap_control_usb_type { |
| 23 | 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 */ |
| 27 | }; |
| 28 | |
Kishon Vijay Abraham I | 01658f0 | 2013-01-25 15:53:57 +0530 | [diff] [blame] | 29 | struct omap_control_usb { |
| 30 | struct device *dev; |
| 31 | |
Kishon Vijay Abraham I | 01658f0 | 2013-01-25 15:53:57 +0530 | [diff] [blame] | 32 | u32 __iomem *otghs_control; |
Roger Quadros | 6cb9310 | 2013-10-03 18:12:31 +0300 | [diff] [blame^] | 33 | u32 __iomem *power; |
| 34 | u32 __iomem *power_aux; |
Kishon Vijay Abraham I | 01658f0 | 2013-01-25 15:53:57 +0530 | [diff] [blame] | 35 | |
| 36 | struct clk *sys_clk; |
| 37 | |
Roger Quadros | 6cb9310 | 2013-10-03 18:12:31 +0300 | [diff] [blame^] | 38 | enum omap_control_usb_type type; |
Kishon Vijay Abraham I | 01658f0 | 2013-01-25 15:53:57 +0530 | [diff] [blame] | 39 | }; |
| 40 | |
Kishon Vijay Abraham I | 01658f0 | 2013-01-25 15:53:57 +0530 | [diff] [blame] | 41 | enum omap_control_usb_mode { |
| 42 | USB_MODE_UNDEFINED = 0, |
| 43 | USB_MODE_HOST, |
| 44 | USB_MODE_DEVICE, |
| 45 | USB_MODE_DISCONNECT, |
| 46 | }; |
| 47 | |
Kishon Vijay Abraham I | 01658f0 | 2013-01-25 15:53:57 +0530 | [diff] [blame] | 48 | #define OMAP_CTRL_DEV_PHY_PD BIT(0) |
| 49 | |
| 50 | #define OMAP_CTRL_DEV_AVALID BIT(0) |
| 51 | #define OMAP_CTRL_DEV_BVALID BIT(1) |
| 52 | #define OMAP_CTRL_DEV_VBUSVALID BIT(2) |
| 53 | #define OMAP_CTRL_DEV_SESSEND BIT(3) |
| 54 | #define OMAP_CTRL_DEV_IDDIG BIT(4) |
| 55 | |
| 56 | #define OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK 0x003FC000 |
| 57 | #define OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT 0xE |
| 58 | |
| 59 | #define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK 0xFFC00000 |
| 60 | #define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT 0x16 |
| 61 | |
| 62 | #define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3 |
| 63 | #define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0 |
| 64 | |
Roger Quadros | 6cb9310 | 2013-10-03 18:12:31 +0300 | [diff] [blame^] | 65 | #define OMAP_CTRL_USB2_PHY_PD BIT(28) |
| 66 | |
Kishon Vijay Abraham I | 01658f0 | 2013-01-25 15:53:57 +0530 | [diff] [blame] | 67 | #if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) |
| 68 | extern struct device *omap_get_control_dev(void); |
| 69 | extern void omap_control_usb_phy_power(struct device *dev, int on); |
Kishon Vijay Abraham I | 01658f0 | 2013-01-25 15:53:57 +0530 | [diff] [blame] | 70 | extern void omap_control_usb_set_mode(struct device *dev, |
| 71 | enum omap_control_usb_mode mode); |
| 72 | #else |
Felipe Balbi | c8ce60b | 2013-02-06 18:58:51 +0530 | [diff] [blame] | 73 | static inline struct device *omap_get_control_dev(void) |
Kishon Vijay Abraham I | 01658f0 | 2013-01-25 15:53:57 +0530 | [diff] [blame] | 74 | { |
| 75 | return ERR_PTR(-ENODEV); |
| 76 | } |
| 77 | |
| 78 | static inline void omap_control_usb_phy_power(struct device *dev, int on) |
| 79 | { |
| 80 | } |
| 81 | |
Kishon Vijay Abraham I | 01658f0 | 2013-01-25 15:53:57 +0530 | [diff] [blame] | 82 | static inline void omap_control_usb_set_mode(struct device *dev, |
| 83 | enum omap_control_usb_mode mode) |
| 84 | { |
| 85 | } |
| 86 | #endif |
| 87 | |
| 88 | #endif /* __OMAP_CONTROL_USB_H__ */ |