import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / usb20 / mt8127 / usb20.h
1 #ifndef __USB20_H__
2 #define __USB20_H__
3
4 #define ID_PIN_USE_EX_EINT 1
5
6 #ifdef CONFIG_USB_MTK_OTG
7 #ifdef ID_PIN_USE_EX_EINT
8 #define IDDIG_EINT_PIN (49 & ~(0x80000000))
9 #else
10 #define U2PHYDTM1 (USB_SIF_BASE+0x800 + 0x6c)
11 #define ID_PULL_UP 0x0101
12 #define ID_PHY_RESET 0x3d11
13 #endif
14 #endif
15
16 #if (defined(CONFIG_MTK_FAN5405_SUPPORT) \
17 || defined(CONFIG_MTK_BQ24158_SUPPORT) \
18 || defined(CONFIG_MTK_NCP1851_SUPPORT) \
19 || defined(CONFIG_MTK_BQ24196_SUPPORT)\
20 || defined(CONFIG_MTK_NCP1854_SUPPORT) \
21 || defined(CONFIG_MTK_BQ24296_SUPPORT)) \
22 && !defined(CONFIG_MTK_DUAL_INPUT_CHARGER_SUPPORT)
23 #define OTG_BOOST_BY_SWITCH_CHARGER 1
24 #endif
25
26 #if defined (CONFIG_MT6589_FPGA)\
27 || defined(CONFIG_MT8127_FPGA)
28 #define FPGA_PLATFORM 1
29 #endif
30
31 struct mt_usb_glue {
32 struct device *dev;
33 struct platform_device *musb;
34 };
35
36 /* Battery relative fucntion */
37 typedef enum {
38 CHARGER_UNKNOWN = 0,
39 STANDARD_HOST, // USB : 450mA
40 CHARGING_HOST,
41 NONSTANDARD_CHARGER, // AC : 450mA~1A
42 STANDARD_CHARGER, // AC : ~1A
43 } CHARGER_TYPE;
44
45 extern void wake_up_bat(void);
46 extern CHARGER_TYPE mt_charger_type_detection(void);
47 extern bool upmu_is_chr_det(void);
48 extern void BATTERY_SetUSBState(int usb_state);
49 extern void upmu_interrupt_chrdet_int_en(kal_uint32 val);
50 extern u32 get_devinfo_with_index(u32 index);
51
52 /* specific USB fuctnion */
53 typedef enum
54 {
55 CABLE_MODE_CHRG_ONLY = 0,
56 CABLE_MODE_NORMAL,
57 CABLE_MODE_HOST_ONLY,
58 CABLE_MODE_MAX
59 } CABLE_MODE;
60
61 #ifdef CONFIG_MTK_UART_USB_SWITCH
62 typedef enum
63 {
64 PORT_MODE_USB = 0,
65 PORT_MODE_UART,
66
67 PORT_MODE_MAX
68 } PORT_MODE;
69
70 extern bool usb_phy_check_in_uart_mode(void);
71 extern void usb_phy_switch_to_usb(void);
72 extern void usb_phy_switch_to_uart(void);
73 #endif
74
75 #ifdef OTG_BOOST_BY_SWITCH_CHARGER
76 extern void tbl_charger_otg_vbus(kal_uint32 mode);
77 #endif
78
79
80 #ifdef FPGA_PLATFORM
81 extern void USB_PHY_Write_Register8(UINT8 var, UINT8 addr);
82 extern UINT8 USB_PHY_Read_Register8(UINT8 addr);
83 #endif
84
85 #endif