| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  | /* linux/include/asm-arm/arch-msm/hsusb.h
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2008 Google, Inc. | 
					
						
							|  |  |  |  * Author: Brian Swetland <swetland@google.com> | 
					
						
							| 
									
										
										
										
											2011-05-04 10:19:47 +05:30
										 |  |  |  * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved. | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  |  * | 
					
						
							|  |  |  |  * This software is licensed under the terms of the GNU General Public | 
					
						
							|  |  |  |  * License version 2, as published by the Free Software Foundation, and | 
					
						
							|  |  |  |  * may be copied, distributed, and modified under those terms. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef __ASM_ARCH_MSM_HSUSB_H
 | 
					
						
							|  |  |  | #define __ASM_ARCH_MSM_HSUSB_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/types.h>
 | 
					
						
							|  |  |  | #include <linux/usb/otg.h>
 | 
					
						
							| 
									
										
										
										
											2013-12-30 13:15:27 -08:00
										 |  |  | #include <linux/clk.h>
 | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * OTG control | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * OTG_NO_CONTROL	Id/VBUS notifications not required. Useful in host | 
					
						
							|  |  |  |  *                      only configuration. | 
					
						
							|  |  |  |  * OTG_PHY_CONTROL	Id/VBUS notifications comes form USB PHY. | 
					
						
							|  |  |  |  * OTG_PMIC_CONTROL	Id/VBUS notifications comes from PMIC hardware. | 
					
						
							|  |  |  |  * OTG_USER_CONTROL	Id/VBUS notifcations comes from User via sysfs. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | enum otg_control_type { | 
					
						
							|  |  |  | 	OTG_NO_CONTROL = 0, | 
					
						
							|  |  |  | 	OTG_PHY_CONTROL, | 
					
						
							|  |  |  | 	OTG_PMIC_CONTROL, | 
					
						
							|  |  |  | 	OTG_USER_CONTROL, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-04 10:19:47 +05:30
										 |  |  | /**
 | 
					
						
							|  |  |  |  * PHY used in | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * INVALID_PHY			Unsupported PHY | 
					
						
							|  |  |  |  * CI_45NM_INTEGRATED_PHY	Chipidea 45nm integrated PHY | 
					
						
							|  |  |  |  * SNPS_28NM_INTEGRATED_PHY	Synopsis 28nm integrated PHY | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | enum msm_usb_phy_type { | 
					
						
							|  |  |  | 	INVALID_PHY = 0, | 
					
						
							|  |  |  | 	CI_45NM_INTEGRATED_PHY, | 
					
						
							|  |  |  | 	SNPS_28NM_INTEGRATED_PHY, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define IDEV_CHG_MAX	1500
 | 
					
						
							|  |  |  | #define IUNIT		100
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * Different states involved in USB charger detection. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * USB_CHG_STATE_UNDEFINED	USB charger is not connected or detection | 
					
						
							|  |  |  |  *                              process is not yet started. | 
					
						
							|  |  |  |  * USB_CHG_STATE_WAIT_FOR_DCD	Waiting for Data pins contact. | 
					
						
							|  |  |  |  * USB_CHG_STATE_DCD_DONE	Data pin contact is detected. | 
					
						
							|  |  |  |  * USB_CHG_STATE_PRIMARY_DONE	Primary detection is completed (Detects | 
					
						
							|  |  |  |  *                              between SDP and DCP/CDP). | 
					
						
							|  |  |  |  * USB_CHG_STATE_SECONDARY_DONE	Secondary detection is completed (Detects | 
					
						
							|  |  |  |  *                              between DCP and CDP). | 
					
						
							|  |  |  |  * USB_CHG_STATE_DETECTED	USB charger type is determined. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | enum usb_chg_state { | 
					
						
							|  |  |  | 	USB_CHG_STATE_UNDEFINED = 0, | 
					
						
							|  |  |  | 	USB_CHG_STATE_WAIT_FOR_DCD, | 
					
						
							|  |  |  | 	USB_CHG_STATE_DCD_DONE, | 
					
						
							|  |  |  | 	USB_CHG_STATE_PRIMARY_DONE, | 
					
						
							|  |  |  | 	USB_CHG_STATE_SECONDARY_DONE, | 
					
						
							|  |  |  | 	USB_CHG_STATE_DETECTED, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * USB charger types | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * USB_INVALID_CHARGER	Invalid USB charger. | 
					
						
							|  |  |  |  * USB_SDP_CHARGER	Standard downstream port. Refers to a downstream port | 
					
						
							|  |  |  |  *                      on USB2.0 compliant host/hub. | 
					
						
							|  |  |  |  * USB_DCP_CHARGER	Dedicated charger port (AC charger/ Wall charger). | 
					
						
							|  |  |  |  * USB_CDP_CHARGER	Charging downstream port. Enumeration can happen and | 
					
						
							|  |  |  |  *                      IDEV_CHG_MAX can be drawn irrespective of USB state. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | enum usb_chg_type { | 
					
						
							|  |  |  | 	USB_INVALID_CHARGER = 0, | 
					
						
							|  |  |  | 	USB_SDP_CHARGER, | 
					
						
							|  |  |  | 	USB_DCP_CHARGER, | 
					
						
							|  |  |  | 	USB_CDP_CHARGER, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  | /**
 | 
					
						
							|  |  |  |  * struct msm_otg_platform_data - platform device data | 
					
						
							| 
									
										
										
										
											2011-03-04 22:45:02 +05:30
										 |  |  |  *              for msm_otg driver. | 
					
						
							| 
									
										
										
										
											2014-04-28 16:34:15 +03:00
										 |  |  |  * @phy_init_seq: PHY configuration sequence values. Value of -1 is reserved as | 
					
						
							|  |  |  |  *              "do not overwrite default vaule at this address". | 
					
						
							|  |  |  |  * @phy_init_sz: PHY configuration sequence size. | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  |  * @vbus_power: VBUS power on/off routine. | 
					
						
							|  |  |  |  * @power_budget: VBUS power budget in mA (0 will be treated as 500mA). | 
					
						
							|  |  |  |  * @mode: Supported mode (OTG/peripheral/host). | 
					
						
							|  |  |  |  * @otg_control: OTG switch controlled by user/Id pin | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | struct msm_otg_platform_data { | 
					
						
							|  |  |  | 	int *phy_init_seq; | 
					
						
							| 
									
										
										
										
											2014-04-28 16:34:15 +03:00
										 |  |  | 	int phy_init_sz; | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  | 	void (*vbus_power)(bool on); | 
					
						
							|  |  |  | 	unsigned power_budget; | 
					
						
							| 
									
										
										
										
											2014-04-28 16:34:11 +03:00
										 |  |  | 	enum usb_dr_mode mode; | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  | 	enum otg_control_type otg_control; | 
					
						
							| 
									
										
										
										
											2011-05-04 10:19:47 +05:30
										 |  |  | 	enum msm_usb_phy_type phy_type; | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  | 	void (*setup_gpio)(enum usb_otg_state state); | 
					
						
							| 
									
										
										
										
											2013-12-30 13:15:27 -08:00
										 |  |  | 	int (*link_clk_reset)(struct clk *link_clk, bool assert); | 
					
						
							|  |  |  | 	int (*phy_clk_reset)(struct clk *phy_clk); | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * struct msm_otg: OTG driver data. Shared by HCD and DCD. | 
					
						
							|  |  |  |  * @otg: USB OTG Transceiver structure. | 
					
						
							|  |  |  |  * @pdata: otg device platform data. | 
					
						
							|  |  |  |  * @irq: IRQ number assigned for HSUSB controller. | 
					
						
							|  |  |  |  * @clk: clock struct of usb_hs_clk. | 
					
						
							|  |  |  |  * @pclk: clock struct of usb_hs_pclk. | 
					
						
							|  |  |  |  * @phy_reset_clk: clock struct of usb_phy_clk. | 
					
						
							|  |  |  |  * @core_clk: clock struct of usb_hs_core_clk. | 
					
						
							|  |  |  |  * @regs: ioremapped register base address. | 
					
						
							|  |  |  |  * @inputs: OTG state machine inputs(Id, SessValid etc). | 
					
						
							|  |  |  |  * @sm_work: OTG state machine work. | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:58 +05:30
										 |  |  |  * @in_lpm: indicates low power mode (LPM) state. | 
					
						
							|  |  |  |  * @async_int: Async interrupt arrived. | 
					
						
							| 
									
										
										
										
											2011-05-04 10:19:47 +05:30
										 |  |  |  * @cur_power: The amount of mA available from downstream port. | 
					
						
							|  |  |  |  * @chg_work: Charger detection work. | 
					
						
							|  |  |  |  * @chg_state: The state of charger detection process. | 
					
						
							|  |  |  |  * @chg_type: The type of charger attached. | 
					
						
							|  |  |  |  * @dcd_retires: The retry count used to track Data contact | 
					
						
							|  |  |  |  *               detection process. | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  |  */ | 
					
						
							|  |  |  | struct msm_otg { | 
					
						
							| 
									
										
										
										
											2012-02-13 13:24:09 +02:00
										 |  |  | 	struct usb_phy phy; | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  | 	struct msm_otg_platform_data *pdata; | 
					
						
							|  |  |  | 	int irq; | 
					
						
							|  |  |  | 	struct clk *clk; | 
					
						
							|  |  |  | 	struct clk *pclk; | 
					
						
							|  |  |  | 	struct clk *phy_reset_clk; | 
					
						
							|  |  |  | 	struct clk *core_clk; | 
					
						
							|  |  |  | 	void __iomem *regs; | 
					
						
							|  |  |  | #define ID		0
 | 
					
						
							|  |  |  | #define B_SESS_VLD	1
 | 
					
						
							|  |  |  | 	unsigned long inputs; | 
					
						
							|  |  |  | 	struct work_struct sm_work; | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:58 +05:30
										 |  |  | 	atomic_t in_lpm; | 
					
						
							|  |  |  | 	int async_int; | 
					
						
							| 
									
										
										
										
											2011-05-04 10:19:47 +05:30
										 |  |  | 	unsigned cur_power; | 
					
						
							| 
									
										
										
										
											2014-04-28 16:34:17 +03:00
										 |  |  | 	int phy_number; | 
					
						
							| 
									
										
										
										
											2011-05-04 10:19:47 +05:30
										 |  |  | 	struct delayed_work chg_work; | 
					
						
							|  |  |  | 	enum usb_chg_state chg_state; | 
					
						
							|  |  |  | 	enum usb_chg_type chg_type; | 
					
						
							|  |  |  | 	u8 dcd_retries; | 
					
						
							| 
									
										
										
										
											2014-04-28 16:34:06 +03:00
										 |  |  | 	struct regulator *v3p3; | 
					
						
							|  |  |  | 	struct regulator *v1p8; | 
					
						
							|  |  |  | 	struct regulator *vddcx; | 
					
						
							| 
									
										
										
										
											2014-04-28 16:34:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	struct reset_control *phy_rst; | 
					
						
							|  |  |  | 	struct reset_control *link_rst; | 
					
						
							| 
									
										
										
										
											2014-04-28 16:34:22 +03:00
										 |  |  | 	int vdd_levels[3]; | 
					
						
							| 
									
										
										
										
											2010-12-07 17:53:55 +05:30
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 |