static int host_port_enable(int port, int enable) { int err; static int pre_state = -1; mif_info("port(%d) control(%d -> %d) by <%pf>\n", port, pre_state, enable, __builtin_return_address(0)); if (!enable && !pre_state) { mif_info("hub state not changed. Skip state change !!!\n"); return 0; } pre_state = enable; if (enable) { if (modem_using_hub()) { err = usbhub_set_mode(usbhub_ctl, USB3503_MODE_HUB); if (err < 0) { mif_err("ERR: hub on fail\n"); goto exit; } } err = s5p_ehci_port_control(&s5p_device_ehci, port, 1); if (err < 0) { mif_err("ERR: port(%d) enable fail\n", port); goto exit; } } else { if (modem_using_hub()) { err = usbhub_set_mode(usbhub_ctl, USB3503_MODE_STANDBY); if (err < 0) { mif_err("ERR: hub off fail\n"); goto exit; } } err = s5p_ehci_port_control(&s5p_device_ehci, port, 0); if (err < 0) { mif_err("ERR: port(%d) enable fail\n", port); goto exit; } } mif_info("> H-ACT %d\n", enable); err = gpio_direction_output(umts_modem_data.gpio_host_active, enable); mif_info("active state err(%d), en(%d), level(%d)\n", err, enable, gpio_get_value(umts_modem_data.gpio_host_active)); exit: return err; }
static ssize_t store_port_power(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct platform_device *pdev = to_platform_device(dev); struct s5p_ehci_platdata *pdata = pdev->dev.platform_data; int power_on, port; int err; err = sscanf(buf, "%d %d", &power_on, &port); if (err < 2 || port < 0 || port > 3 || power_on < 0 || power_on > 1) { pr_err("port power fail: port_power 1 2(port 2 enable 1)\n"); return count; } pr_debug("%s: Port:%d power: %d\n", __func__, port, power_on); device_lock(dev); s5p_ehci_port_control(pdev, port, power_on); /*HSIC IPC control the ACTIVE_STATE*/ if (pdata && pdata->noti_host_states && port == CP_PORT) pdata->noti_host_states(pdev, power_on ? S5P_HOST_ON : S5P_HOST_OFF); device_unlock(dev); return count; }
static void s5p_wait_for_cp_resume(struct platform_device *pdev, struct usb_hcd *hcd) { struct ehci_hcd *ehci = hcd_to_ehci(hcd); struct s5p_ehci_platdata *pdata = pdev->dev.platform_data; u32 __iomem *portsc ; u32 val32, retry_cnt = 0; #if !defined(CONFIG_MDM_HSIC_PM) /* when use usb3503 hub, need not wait cp resume */ if (modem_using_hub()) return; #endif portsc = &ehci->regs->port_status[CP_PORT-1]; #if !defined(CONFIG_MDM_HSIC_PM) if (pdata && pdata->noti_host_states) pdata->noti_host_states(pdev, S5P_HOST_ON); #endif do { msleep(10); val32 = ehci_readl(ehci, portsc); } while (++retry_cnt < RETRY_CNT_LIMIT && !(val32 & PORT_CONNECT)); if (retry_cnt >= RETRY_CNT_LIMIT) dev_info(&pdev->dev, "%s: retry_cnt = %d, portsc = 0x%x\n", __func__, retry_cnt, val32); #if defined(CONFIG_UMTS_MODEM_XMM6262) if (pdata->get_cp_active_state && !pdata->get_cp_active_state()) { s5p_ehci_port_control(pdev, CP_PORT, 0); pr_err("mif: force port%d off by cp reset\n", CP_PORT); } #endif }
static int host_port_enable(int port, int enable) { int err; mif_info("port(%d) control(%d)\n", port, enable); if (enable) { if (modem_using_hub()) { err = usbhub_set_mode(usbhub_ctl, USB3503_MODE_HUB); if (err < 0) { mif_err("ERR: hub on fail\n"); goto exit; } } err = s5p_ehci_port_control(&s5p_device_ehci, port, 1); if (err < 0) { mif_err("ERR: port(%d) enable fail\n", port); goto exit; } } else { if (modem_using_hub()) { err = usbhub_set_mode(usbhub_ctl, USB3503_MODE_STANDBY); if (err < 0) { mif_err("ERR: hub off fail\n"); goto exit; } } err = s5p_ehci_port_control(&s5p_device_ehci, port, 0); if (err < 0) { mif_err("ERR: port(%d) enable fail\n", port); goto exit; } } err = gpio_direction_output(umts_modem_data.gpio_host_active, enable); mif_info("active state err(%d), en(%d), level(%d)\n", err, enable, gpio_get_value(umts_modem_data.gpio_host_active)); exit: return err; }
static int host_port_enable(int port, int enable) { return s5p_ehci_port_control(&s5p_device_ehci, port, enable); }