1 /* 2 * drivers/usb/sunxi_usb/manager/usb_msg_center.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 msg distribution. 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_MSG_CENTER_H__ 17 #define __USB_MSG_CENTER_H__ 18 19 /* usb role mode */ 20 typedef enum usb_role { 21 USB_ROLE_NULL = 0, 22 USB_ROLE_HOST, 23 USB_ROLE_DEVICE, 24 } usb_role_t; 25 26 typedef struct usb_msg { 27 u8 app_drv_null; /* not install any driver */ 28 u8 app_insmod_host; 29 u8 app_rmmod_host; 30 u8 app_insmod_device; 31 u8 app_rmmod_device; 32 33 u8 hw_insmod_host; 34 u8 hw_rmmod_host; 35 u8 hw_insmod_device; 36 u8 hw_rmmod_device; 37 } usb_msg_t; 38 39 typedef struct usb_msg_center_info { 40 struct usb_cfg *cfg; 41 42 struct usb_msg msg; 43 enum usb_role role; 44 45 u32 skip; /* if skip, not enter msg process */ 46 /* mainly to omit invalid msg */ 47 } usb_msg_center_info_t; 48 49 extern int sunxi_usb_disable_ehci(__u32 usbc_no); 50 extern int sunxi_usb_enable_ehci(__u32 usbc_no); 51 extern int sunxi_usb_disable_ohci(__u32 usbc_no); 52 extern int sunxi_usb_enable_ohci(__u32 usbc_no); 53 54 void hw_insmod_usb_host(void); 55 void hw_rmmod_usb_host(void); 56 void hw_insmod_usb_device(void); 57 void hw_rmmod_usb_device(void); 58 59 enum usb_role get_usb_role(void); 60 void set_usb_role_ex(enum usb_role role); 61 void usb_msg_center(struct usb_cfg *cfg); 62 63 s32 usb_msg_center_init(void); 64 s32 usb_msg_center_exit(void); 65 66 #endif /* __USB_MSG_CENTER_H__ */ 67 68