• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * drivers/usb/sunxi_usb/manager/usb_hw_scan.h
3  * (C) Copyright 2010-2015
4  * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
5  * javen, 2011-4-14, create this file
6  *
7  * usb detect module.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of
12  * the License, or (at your option) any later version.
13  *
14  */
15 
16 #ifndef __USB_HW_SCAN_H__
17 #define __USB_HW_SCAN_H__
18 
19 #define  USB_SCAN_INSMOD_DEVICE_DRIVER_DELAY	2
20 #define  USB_SCAN_INSMOD_HOST_DRIVER_DELAY	1
21 
22 /* ubs id */
23 typedef enum usb_id_state {
24 	USB_HOST_MODE = 0,
25 	USB_DEVICE_MODE = 1,
26 } usb_id_state_t;
27 
28 /* usb detect vbus */
29 typedef enum usb_det_vbus_state {
30 	USB_DET_VBUS_INVALID = 0,
31 	USB_DET_VBUS_VALID  = 1
32 } usb_det_vbus_state_t;
33 
34 /* usb info */
35 typedef struct usb_scan_info {
36 	struct usb_cfg		*cfg;
37 
38 	usb_id_state_t		id_old_state;		/* last id state */
39 	usb_det_vbus_state_t	det_vbus_old_state;	/* last vbus state */
40 
41 	u32			device_insmod_delay;	/* debounce time */
42 	u32			host_insmod_delay;	/* debounce time */
43 } usb_scan_info_t;
44 
45 #if IS_ENABLED(CONFIG_TYPE_C)
46 extern int axp_usb_cc_status(void);
47 #endif
48 
49 extern int usb_hw_scan_debug;
50 extern int thread_stopped_flag;
51 
52 void usb_hw_scan(struct usb_cfg *cfg);
53 __u32 set_vbus_id_state(u32 state);
54 
55 __s32 usb_hw_scan_init(struct usb_cfg *cfg);
56 __s32 usb_hw_scan_exit(struct usb_cfg *cfg);
57 __s32 usbc0_platform_device_init(struct usb_port_info *port_info);
58 __s32 usbc0_platform_device_exit(struct usb_port_info *info);
59 
60 #endif /* __USB_HW_SCAN_H__ */
61 
62