static void spmp_stop_ohc(struct spmp_ohci *ohci, struct device *dev) { struct spmpohci_platform_data *inf; inf = dev->platform_data; if (inf->exit) inf->exit(dev); #ifdef CONFIG_PM gpHalScuUsbPhyClkEnable(0); gpHalScuClkEnable(SCU_A_PERI_USB0 | SCU_A_PERI_USB1, SCU_A, 0); gpHalScuClkEnable(SCU_C_PERI_SYS_A, SCU_C, 0); #else clk_disable(ohci->clk); #endif }
static int spmp_start_ohc(struct spmp_ohci *ohci, struct device *dev) { int retval = 0; struct spmpohci_platform_data *inf; inf = dev->platform_data; #ifdef CONFIG_PM gpHalScuClkEnable(SCU_C_PERI_SYS_A, SCU_C, 1); gpHalScuClkEnable(SCU_A_PERI_USB0 | SCU_A_PERI_USB1, SCU_A, 1); gpHalScuUsbPhyClkEnable(1); #else clk_enable(ohci->clk); #endif if (inf->init) retval = inf->init(dev); if (retval < 0) return retval; return 0; }
/***************************************************************** * USB HOST OHCI Info *****************************************************************/ static int spmp_usb_host_phy( unsigned int host_id, int enable ) { struct gp_board_usb_s *pConfig = gp_board_get_config("usb", gp_board_usb_t); static int g_usb_host_cnt[2] = {0}; //char *host_name = (host_id)? "USB_HOST1" : "USB_HOST0"; int phy_config; if(host_id == 0 ) { phy_config = (pConfig->phy0_func_en_get() == PHY0_HOST)? 1 : 0; } else { phy_config = (pConfig->phy1_func_sel_get() == PHY0_HOST)? 1 : 0; } if(enable) { if( g_usb_host_cnt[host_id] <= 0 ) { printk("host id %d enable\n",host_id ); g_usb_host_cnt[host_id] = 0; gpHalUsbHostEn(host_id, 1); pConfig->set_power(1); gpHalScuUsbPhyClkEnable(1); gpHalUsbPhyPowerControlSet( host_id ^0x01, 0x0 ); if(phy_config) gpHalUsbPhyFuncSet( host_id ^0x01, 1 ); msleep(5); } g_usb_host_cnt[host_id] ++; } else { g_usb_host_cnt[host_id] --; if(g_usb_host_cnt[host_id] <= 0) { g_usb_host_cnt[host_id] = 0; if(phy_config) gpHalUsbPhyFuncSet( host_id ^0x01, 0 ); gpHalUsbPhyPowerControlSet( host_id ^0x01, 0x1); pConfig->set_power(0); gpHalUsbHostEn(host_id, 0); } } #if 0 int phy0_config = pConfig->phy0_func_en_get(); /*0: phy0 host, 1: phy0 disable*/ int phy1_config = pConfig->phy1_func_sel_get(); /*0: phy1 host, 1: phy1 slave, 2: phy1 host/slave, 3 phy1 disable*/ int host_phy = -1; if( phy0_config == PHY0_HOST ) { host_phy = 0; } else if( phy1_config == PHY1_HOST || phy1_config == PHY1_HOST_SLAVE ) { host_phy = 1; } else return -1; if(enable) { if( g_usb_host_cnt <= 0 ) { printk("host id %d enable, host phy = %d\n",host_id,host_phy ); g_usb_host_cnt = 0; gpHalUsbHostEn(host_id, 1); pConfig->set_power(1); gpHalScuUsbPhyClkEnable(1); gpHalUsbPhyPowerControlSet(host_phy, 0x0); msleep(5); } g_usb_host_cnt ++; } else { g_usb_host_cnt --; if(g_usb_host_cnt <= 0) { g_usb_host_cnt = 0; gpHalUsbPhyPowerControlSet(host_phy, 0x1); pConfig->set_power(0); gpHalUsbHostEn(host_id, 0); } } #endif return 0; }