/*
*******************************************************************************
*                     usb_manager_exit
*
* Description:
*    void
*
* Parameters:
*    void
*
* Return value:
*    void
*
* note:
*    void
*
*******************************************************************************
*/
static void __exit usb_manager_exit(void)
{
	bsp_usbc_t usbc;

    DMSG_DBG_MANAGER("[sw usb]: usb_manager_exit\n");

#if defined(CONFIG_USB_SW_SUN3I_USB0_DEVICE_ONLY)
	DMSG_INFO("CONFIG_USB_SW_SUN3I_USB0_DEVICE_ONLY\n");
#elif defined(CONFIG_USB_SW_SUN3I_USB0_HOST_ONLY)
	DMSG_INFO("CONFIG_USB_SW_SUN3I_USB0_HOST_ONLY\n");
#elif defined(CONFIG_USB_SW_SUN3I_USB0_OTG)
	DMSG_INFO("CONFIG_USB_SW_SUN3I_USB0_OTG\n");
#else
	DMSG_INFO("CONFIG_USB_SW_SUN3I_USB0_NULL\n");
	return;
#endif

    memset(&usbc, 0, sizeof(bsp_usbc_t));
	USBC_exit(&usbc);

#ifdef CONFIG_USB_SW_SUN3I_USB0_OTG
	thread_run_flag = 0;
	while(!thread_stopped_flag){
		DMSG_INFO("waitting for usb_hardware_scan_thread stop\n");
	}

	usb_hw_scan_exit(&g_usb_cfg);
#endif

    usbc0_platform_device_exit();
    usbc1_platform_device_exit();
    usbc2_platform_device_exit();

    return;
}
Example #2
0
/*
*******************************************************************************
*                     usb_manager_exit
*
* Description:
*    void
*
* Parameters:
*    void
*
* Return value:
*    void
*
* note:
*    void
*
*******************************************************************************
*/
static void __exit usb_manager_exit(void)
{
	bsp_usbc_t usbc;

    DMSG_MANAGER_DEBUG("[sw usb]: usb_manager_exit\n");

#if defined(CONFIG_USB_SW_SUN4I_USB0_DEVICE_ONLY)
	DMSG_INFO("CONFIG_USB_SW_SUN4I_USB0_DEVICE_ONLY\n");
#elif defined(CONFIG_USB_SW_SUN4I_USB0_HOST_ONLY)
	DMSG_INFO("CONFIG_USB_SW_SUN4I_USB0_HOST_ONLY\n");
#elif defined(CONFIG_USB_SW_SUN4I_USB0_OTG)
	DMSG_INFO("CONFIG_USB_SW_SUN4I_USB0_OTG\n");
#else
	DMSG_INFO("CONFIG_USB_SW_SUN4I_USB0_NULL\n");
	return;
#endif

	if(g_usb_cfg.port[0].enable == 0){
		DMSG_PANIC("wrn: usb0 is disable\n");
		return ;
	}

    memset(&usbc, 0, sizeof(bsp_usbc_t));
	USBC_exit(&usbc);

#ifdef CONFIG_USB_SW_SUN4I_USB0_OTG
    if(g_usb_cfg.port[0].port_type == USB_PORT_TYPE_OTG
       && g_usb_cfg.port[0].detect_type == USB_DETECT_TYPE_VBUS_ID){
    	thread_run_flag = 0;
    	while(!thread_stopped_flag){
    		DMSG_INFO("waitting for usb_hardware_scan_thread stop\n");
    		msleep(10);
    	}

    	usb_hw_scan_exit(&g_usb_cfg);
    }
#endif

    usbc0_platform_device_exit(&g_usb_cfg.port[0]);

    return;
}