Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* linux/include/mach/hsusb.h |
| 2 | * |
| 3 | * Copyright (C) 2008 Google, Inc. |
Manu Gautam | 5143b25 | 2012-01-05 19:25:23 -0800 | [diff] [blame] | 4 | * Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 5 | * Author: Brian Swetland <swetland@google.com> |
| 6 | * |
| 7 | * This software is licensed under the terms of the GNU General Public |
| 8 | * License version 2, as published by the Free Software Foundation, and |
| 9 | * may be copied, distributed, and modified under those terms. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | #ifndef __ASM_ARCH_MSM_HSUSB_H |
| 19 | #define __ASM_ARCH_MSM_HSUSB_H |
| 20 | |
| 21 | #include <linux/types.h> |
| 22 | #include <linux/pm_qos_params.h> |
| 23 | |
| 24 | #define PHY_TYPE_MASK 0x0F |
| 25 | #define PHY_TYPE_MODE 0xF0 |
| 26 | #define PHY_MODEL_MASK 0xFF00 |
| 27 | #define PHY_TYPE(x) ((x) & PHY_TYPE_MASK) |
| 28 | #define PHY_MODEL(x) ((x) & PHY_MODEL_MASK) |
| 29 | |
| 30 | #define USB_PHY_MODEL_65NM 0x100 |
| 31 | #define USB_PHY_MODEL_180NM 0x200 |
| 32 | #define USB_PHY_MODEL_45NM 0x400 |
| 33 | #define USB_PHY_UNDEFINED 0x00 |
| 34 | #define USB_PHY_INTEGRATED 0x01 |
| 35 | #define USB_PHY_EXTERNAL 0x02 |
| 36 | #define USB_PHY_SERIAL_PMIC 0x04 |
| 37 | |
| 38 | #define REQUEST_STOP 0 |
| 39 | #define REQUEST_START 1 |
| 40 | #define REQUEST_RESUME 2 |
| 41 | #define REQUEST_HNP_SUSPEND 3 |
| 42 | #define REQUEST_HNP_RESUME 4 |
| 43 | |
| 44 | /* Flags required to read ID state of PHY for ACA */ |
| 45 | #define PHY_ID_MASK 0xB0 |
| 46 | #define PHY_ID_GND 0 |
| 47 | #define PHY_ID_C 0x10 |
| 48 | #define PHY_ID_B 0x30 |
| 49 | #define PHY_ID_A 0x90 |
| 50 | |
| 51 | #define phy_id_state(ints) ((ints) & PHY_ID_MASK) |
Pavankumar Kondeti | 9e49ea9 | 2011-07-13 17:51:40 +0530 | [diff] [blame] | 52 | #define phy_id_state_gnd(ints) (phy_id_state((ints)) == PHY_ID_GND) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 53 | #define phy_id_state_a(ints) (phy_id_state((ints)) == PHY_ID_A) |
Pavankumar Kondeti | 9e49ea9 | 2011-07-13 17:51:40 +0530 | [diff] [blame] | 54 | /* RID_B and RID_C states does not exist with standard ACA */ |
| 55 | #ifdef CONFIG_USB_MSM_STANDARD_ACA |
| 56 | #define phy_id_state_b(ints) 0 |
| 57 | #define phy_id_state_c(ints) 0 |
| 58 | #else |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 59 | #define phy_id_state_b(ints) (phy_id_state((ints)) == PHY_ID_B) |
| 60 | #define phy_id_state_c(ints) (phy_id_state((ints)) == PHY_ID_C) |
Pavankumar Kondeti | 9e49ea9 | 2011-07-13 17:51:40 +0530 | [diff] [blame] | 61 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 62 | |
Ido Shayevitz | d1cb16c | 2012-03-28 18:57:47 +0200 | [diff] [blame^] | 63 | /* |
| 64 | * The following are bit fields describing the usb_request.udc_priv word. |
| 65 | * These bit fields are set by function drivers that wish to queue |
| 66 | * usb_requests with sps/bam parameters. |
| 67 | */ |
| 68 | #define MSM_PIPE_ID_MASK (0x1F) |
| 69 | #define MSM_TX_PIPE_ID_OFS (16) |
| 70 | #define MSM_SPS_MODE BIT(5) |
| 71 | #define MSM_IS_FINITE_TRANSFER BIT(6) |
| 72 | #define MSM_PRODUCER BIT(7) |
| 73 | #define MSM_DISABLE_WB BIT(8) |
| 74 | #define MSM_ETD_IOC BIT(9) |
| 75 | #define MSM_INTERNAL_MEM BIT(10) |
| 76 | #define MSM_VENDOR_ID BIT(16) |
| 77 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 78 | /* used to detect the OTG Mode */ |
| 79 | enum otg_mode { |
| 80 | OTG_ID = 0, /* ID pin detection */ |
| 81 | OTG_USER_CONTROL, /* User configurable */ |
| 82 | OTG_VCHG, /* Based on VCHG interrupt */ |
| 83 | }; |
| 84 | |
| 85 | /* used to configure the default mode,if otg_mode is USER_CONTROL */ |
| 86 | enum usb_mode { |
| 87 | USB_HOST_MODE, |
| 88 | USB_PERIPHERAL_MODE, |
| 89 | }; |
| 90 | |
| 91 | enum chg_type { |
| 92 | USB_CHG_TYPE__SDP, |
| 93 | USB_CHG_TYPE__CARKIT, |
| 94 | USB_CHG_TYPE__WALLCHARGER, |
| 95 | USB_CHG_TYPE__INVALID |
| 96 | }; |
| 97 | |
| 98 | enum pre_emphasis_level { |
| 99 | PRE_EMPHASIS_DEFAULT, |
| 100 | PRE_EMPHASIS_DISABLE, |
| 101 | PRE_EMPHASIS_WITH_10_PERCENT = (1 << 5), |
| 102 | PRE_EMPHASIS_WITH_20_PERCENT = (3 << 4), |
| 103 | }; |
| 104 | enum cdr_auto_reset { |
| 105 | CDR_AUTO_RESET_DEFAULT, |
| 106 | CDR_AUTO_RESET_ENABLE, |
| 107 | CDR_AUTO_RESET_DISABLE, |
| 108 | }; |
| 109 | |
| 110 | enum se1_gate_state { |
| 111 | SE1_GATING_DEFAULT, |
| 112 | SE1_GATING_ENABLE, |
| 113 | SE1_GATING_DISABLE, |
| 114 | }; |
| 115 | |
| 116 | enum hs_drv_amplitude { |
| 117 | HS_DRV_AMPLITUDE_DEFAULT, |
| 118 | HS_DRV_AMPLITUDE_ZERO_PERCENT, |
| 119 | HS_DRV_AMPLITUDE_25_PERCENTI = (1 << 2), |
| 120 | HS_DRV_AMPLITUDE_5_PERCENT = (1 << 3), |
| 121 | HS_DRV_AMPLITUDE_75_PERCENT = (3 << 2), |
| 122 | }; |
| 123 | |
| 124 | #define HS_DRV_SLOPE_DEFAULT (-1) |
| 125 | |
| 126 | /* used to configure the analog switch to select b/w host and peripheral */ |
| 127 | enum usb_switch_control { |
| 128 | USB_SWITCH_PERIPHERAL = 0, /* Configure switch in peripheral mode*/ |
| 129 | USB_SWITCH_HOST, /* Host mode */ |
| 130 | USB_SWITCH_DISABLE, /* No mode selected, shutdown power */ |
| 131 | }; |
| 132 | |
| 133 | struct msm_hsusb_gadget_platform_data { |
| 134 | int *phy_init_seq; |
| 135 | void (*phy_reset)(void); |
| 136 | |
| 137 | int self_powered; |
| 138 | int is_phy_status_timer_on; |
| 139 | }; |
| 140 | |
| 141 | struct msm_otg_platform_data { |
| 142 | int (*rpc_connect)(int); |
| 143 | int (*phy_reset)(void __iomem *); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 144 | int pmic_vbus_irq; |
Anji jonnala | eb9e60d | 2011-10-05 12:19:46 +0530 | [diff] [blame] | 145 | int pmic_id_irq; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 146 | /* if usb link is in sps there is no need for |
| 147 | * usb pclk as dayatona fabric clock will be |
| 148 | * used instead |
| 149 | */ |
| 150 | int usb_in_sps; |
| 151 | enum pre_emphasis_level pemp_level; |
| 152 | enum cdr_auto_reset cdr_autoreset; |
| 153 | enum hs_drv_amplitude drv_ampl; |
| 154 | enum se1_gate_state se1_gating; |
| 155 | int hsdrvslope; |
| 156 | int phy_reset_sig_inverted; |
| 157 | int phy_can_powercollapse; |
| 158 | int pclk_required_during_lpm; |
Chandra Devireddy | b3fc78c | 2011-08-30 17:25:55 +0530 | [diff] [blame] | 159 | int bam_disable; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 160 | /* HSUSB core in 8660 has the capability to gate the |
| 161 | * pclk when not being used. Though this feature is |
| 162 | * now being disabled because of H/w issues |
| 163 | */ |
| 164 | int pclk_is_hw_gated; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 165 | |
| 166 | int (*ldo_init) (int init); |
| 167 | int (*ldo_enable) (int enable); |
| 168 | int (*ldo_set_voltage) (int mV); |
| 169 | |
| 170 | u32 swfi_latency; |
| 171 | /* pmic notfications apis */ |
| 172 | int (*pmic_vbus_notif_init) (void (*callback)(int online), int init); |
| 173 | int (*pmic_id_notif_init) (void (*callback)(int online), int init); |
Anji jonnala | ae745e9 | 2011-11-14 18:34:31 +0530 | [diff] [blame] | 174 | int (*phy_id_setup_init) (int init); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 175 | int (*pmic_register_vbus_sn) (void (*callback)(int online)); |
| 176 | void (*pmic_unregister_vbus_sn) (void (*callback)(int online)); |
| 177 | int (*pmic_enable_ldo) (int); |
| 178 | int (*init_gpio)(int on); |
| 179 | void (*setup_gpio)(enum usb_switch_control mode); |
| 180 | u8 otg_mode; |
| 181 | u8 usb_mode; |
| 182 | void (*vbus_power) (unsigned phy_info, int on); |
| 183 | |
| 184 | /* charger notification apis */ |
| 185 | void (*chg_connected)(enum chg_type chg_type); |
| 186 | void (*chg_vbus_draw)(unsigned ma); |
| 187 | int (*chg_init)(int init); |
| 188 | int (*config_vddcx)(int high); |
| 189 | int (*init_vddcx)(int init); |
| 190 | |
| 191 | struct pm_qos_request_list pm_qos_req_dma; |
| 192 | }; |
| 193 | |
| 194 | struct msm_usb_host_platform_data { |
| 195 | unsigned phy_info; |
| 196 | unsigned int power_budget; |
| 197 | void (*config_gpio)(unsigned int config); |
| 198 | void (*vbus_power) (unsigned phy_info, int on); |
| 199 | int (*vbus_init)(int init); |
| 200 | struct clk *ebi1_clk; |
| 201 | }; |
| 202 | |
| 203 | #endif |