Lines Matching +full:num +full:- +full:ss +full:- +full:bits
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved.
11 #include <linux/dma-mapping.h>
170 unsigned int num; member
283 return readl(tegra->fpci_base + offset); in fpci_readl()
289 writel(value, tegra->fpci_base + offset); in fpci_writel()
294 return readl(tegra->ipfs_base + offset); in ipfs_readl()
300 writel(value, tegra->ipfs_base + offset); in ipfs_writel()
327 struct clk *clk = tegra->ss_src_clk; in tegra_xusb_set_ss_clk()
341 new_parent_rate = clk_get_rate(tegra->pll_u_480m); in tegra_xusb_set_ss_clk()
348 err = clk_set_parent(clk, tegra->pll_u_480m); in tegra_xusb_set_ss_clk()
364 err = clk_set_parent(clk, tegra->clk_m); in tegra_xusb_set_ss_clk()
375 dev_err(tegra->dev, "Invalid SS rate: %lu Hz\n", rate); in tegra_xusb_set_ss_clk()
376 return -EINVAL; in tegra_xusb_set_ss_clk()
380 dev_err(tegra->dev, "SS clock doesn't match requested rate\n"); in tegra_xusb_set_ss_clk()
381 return -EINVAL; in tegra_xusb_set_ss_clk()
390 return (value >> start) & ((1 << count) - 1); in extract_field()
428 return (msg->cmd & CMD_TYPE_MASK) << CMD_TYPE_SHIFT | in tegra_xusb_mbox_pack()
429 (msg->data & CMD_DATA_MASK) << CMD_DATA_SHIFT; in tegra_xusb_mbox_pack()
434 msg->cmd = (value >> CMD_TYPE_SHIFT) & CMD_TYPE_MASK; in tegra_xusb_mbox_unpack()
435 msg->data = (value >> CMD_DATA_SHIFT) & CMD_DATA_MASK; in tegra_xusb_mbox_unpack()
461 if (!(msg->cmd == MBOX_CMD_ACK || msg->cmd == MBOX_CMD_NAK)) { in tegra_xusb_mbox_send()
462 value = fpci_readl(tegra, tegra->soc->mbox.owner); in tegra_xusb_mbox_send()
464 dev_err(tegra->dev, "mailbox is busy\n"); in tegra_xusb_mbox_send()
465 return -EBUSY; in tegra_xusb_mbox_send()
468 fpci_writel(tegra, MBOX_OWNER_SW, tegra->soc->mbox.owner); in tegra_xusb_mbox_send()
470 value = fpci_readl(tegra, tegra->soc->mbox.owner); in tegra_xusb_mbox_send()
472 dev_err(tegra->dev, "failed to acquire mailbox\n"); in tegra_xusb_mbox_send()
473 return -EBUSY; in tegra_xusb_mbox_send()
480 fpci_writel(tegra, value, tegra->soc->mbox.data_in); in tegra_xusb_mbox_send()
482 value = fpci_readl(tegra, tegra->soc->mbox.cmd); in tegra_xusb_mbox_send()
484 fpci_writel(tegra, value, tegra->soc->mbox.cmd); in tegra_xusb_mbox_send()
490 value = fpci_readl(tegra, tegra->soc->mbox.owner); in tegra_xusb_mbox_send()
498 value = fpci_readl(tegra, tegra->soc->mbox.owner); in tegra_xusb_mbox_send()
501 return -ETIMEDOUT; in tegra_xusb_mbox_send()
517 dev_err(tegra->dev, "controller firmware hang\n"); in tegra_xusb_mbox_irq()
525 struct tegra_xusb_padctl *padctl = tegra->padctl; in tegra_xusb_mbox_handle()
526 const struct tegra_xusb_soc *soc = tegra->soc; in tegra_xusb_mbox_handle()
527 struct device *dev = tegra->dev; in tegra_xusb_mbox_handle()
536 switch (msg->cmd) { in tegra_xusb_mbox_handle()
539 rsp.data = clk_get_rate(tegra->falcon_clk) / 1000; in tegra_xusb_mbox_handle()
540 if (rsp.data != msg->data) in tegra_xusb_mbox_handle()
549 if (tegra->soc->scale_ss_clock) { in tegra_xusb_mbox_handle()
550 err = tegra_xusb_set_ss_clk(tegra, msg->data * 1000); in tegra_xusb_mbox_handle()
556 rsp.data = clk_get_rate(tegra->ss_src_clk) / 1000; in tegra_xusb_mbox_handle()
559 rsp.data = msg->data; in tegra_xusb_mbox_handle()
573 err = tegra_xusb_padctl_usb3_save_context(padctl, msg->data); in tegra_xusb_mbox_handle()
576 msg->data, err); in tegra_xusb_mbox_handle()
582 rsp.data = msg->data; in tegra_xusb_mbox_handle()
587 if (msg->cmd == MBOX_CMD_STOP_HSIC_IDLE) in tegra_xusb_mbox_handle()
592 mask = extract_field(msg->data, 1 + soc->ports.hsic.offset, in tegra_xusb_mbox_handle()
593 soc->ports.hsic.count); in tegra_xusb_mbox_handle()
610 rsp.data = msg->data; in tegra_xusb_mbox_handle()
615 if (msg->cmd == MBOX_CMD_DISABLE_SS_LFPS_DETECTION) in tegra_xusb_mbox_handle()
620 mask = extract_field(msg->data, 1 + soc->ports.usb3.offset, in tegra_xusb_mbox_handle()
621 soc->ports.usb3.count); in tegra_xusb_mbox_handle()
623 for_each_set_bit(port, &mask, soc->ports.usb3.count) { in tegra_xusb_mbox_handle()
647 rsp.data = msg->data; in tegra_xusb_mbox_handle()
651 dev_warn(dev, "unknown message: %#x\n", msg->cmd); in tegra_xusb_mbox_handle()
670 mutex_lock(&tegra->lock); in tegra_xusb_mbox_thread()
672 if (pm_runtime_suspended(tegra->dev) || tegra->suspended) in tegra_xusb_mbox_thread()
675 value = fpci_readl(tegra, tegra->soc->mbox.data_out); in tegra_xusb_mbox_thread()
678 value = fpci_readl(tegra, tegra->soc->mbox.cmd); in tegra_xusb_mbox_thread()
680 fpci_writel(tegra, value, tegra->soc->mbox.cmd); in tegra_xusb_mbox_thread()
684 fpci_writel(tegra, MBOX_OWNER_NONE, tegra->soc->mbox.owner); in tegra_xusb_mbox_thread()
689 mutex_unlock(&tegra->lock); in tegra_xusb_mbox_thread()
695 u32 regs = tegra->hcd->rsrc_start; in tegra_xusb_config()
698 if (tegra->soc->has_ipfs) { in tegra_xusb_config()
719 if (tegra->soc->has_ipfs) { in tegra_xusb_config()
734 err = clk_prepare_enable(tegra->pll_e); in tegra_xusb_clk_enable()
738 err = clk_prepare_enable(tegra->host_clk); in tegra_xusb_clk_enable()
742 err = clk_prepare_enable(tegra->ss_clk); in tegra_xusb_clk_enable()
746 err = clk_prepare_enable(tegra->falcon_clk); in tegra_xusb_clk_enable()
750 err = clk_prepare_enable(tegra->fs_src_clk); in tegra_xusb_clk_enable()
754 err = clk_prepare_enable(tegra->hs_src_clk); in tegra_xusb_clk_enable()
758 if (tegra->soc->scale_ss_clock) { in tegra_xusb_clk_enable()
767 clk_disable_unprepare(tegra->hs_src_clk); in tegra_xusb_clk_enable()
769 clk_disable_unprepare(tegra->fs_src_clk); in tegra_xusb_clk_enable()
771 clk_disable_unprepare(tegra->falcon_clk); in tegra_xusb_clk_enable()
773 clk_disable_unprepare(tegra->ss_clk); in tegra_xusb_clk_enable()
775 clk_disable_unprepare(tegra->host_clk); in tegra_xusb_clk_enable()
777 clk_disable_unprepare(tegra->pll_e); in tegra_xusb_clk_enable()
783 clk_disable_unprepare(tegra->pll_e); in tegra_xusb_clk_disable()
784 clk_disable_unprepare(tegra->host_clk); in tegra_xusb_clk_disable()
785 clk_disable_unprepare(tegra->ss_clk); in tegra_xusb_clk_disable()
786 clk_disable_unprepare(tegra->falcon_clk); in tegra_xusb_clk_disable()
787 clk_disable_unprepare(tegra->fs_src_clk); in tegra_xusb_clk_disable()
788 clk_disable_unprepare(tegra->hs_src_clk); in tegra_xusb_clk_disable()
796 for (i = 0; i < tegra->num_phys; i++) { in tegra_xusb_phy_enable()
797 err = phy_init(tegra->phys[i]); in tegra_xusb_phy_enable()
801 err = phy_power_on(tegra->phys[i]); in tegra_xusb_phy_enable()
803 phy_exit(tegra->phys[i]); in tegra_xusb_phy_enable()
811 while (i--) { in tegra_xusb_phy_enable()
812 phy_power_off(tegra->phys[i]); in tegra_xusb_phy_enable()
813 phy_exit(tegra->phys[i]); in tegra_xusb_phy_enable()
823 for (i = 0; i < tegra->num_phys; i++) { in tegra_xusb_phy_disable()
824 phy_power_off(tegra->phys[i]); in tegra_xusb_phy_disable()
825 phy_exit(tegra->phys[i]); in tegra_xusb_phy_disable()
832 const struct tegra_xusb_context_soc *soc = tegra->soc->context; in tegra_xusb_init_context()
834 tegra->context.ipfs = devm_kcalloc(tegra->dev, soc->ipfs.num_offsets, in tegra_xusb_init_context()
836 if (!tegra->context.ipfs) in tegra_xusb_init_context()
837 return -ENOMEM; in tegra_xusb_init_context()
839 tegra->context.fpci = devm_kcalloc(tegra->dev, soc->fpci.num_offsets, in tegra_xusb_init_context()
841 if (!tegra->context.fpci) in tegra_xusb_init_context()
842 return -ENOMEM; in tegra_xusb_init_context()
859 err = request_firmware(&fw, tegra->soc->firmware, tegra->dev); in tegra_xusb_request_firmware()
861 dev_err(tegra->dev, "failed to request firmware: %d\n", err); in tegra_xusb_request_firmware()
866 header = (struct tegra_xusb_fw_header *)fw->data; in tegra_xusb_request_firmware()
867 tegra->fw.size = le32_to_cpu(header->fwimg_len); in tegra_xusb_request_firmware()
869 tegra->fw.virt = dma_alloc_coherent(tegra->dev, tegra->fw.size, in tegra_xusb_request_firmware()
870 &tegra->fw.phys, GFP_KERNEL); in tegra_xusb_request_firmware()
871 if (!tegra->fw.virt) { in tegra_xusb_request_firmware()
872 dev_err(tegra->dev, "failed to allocate memory for firmware\n"); in tegra_xusb_request_firmware()
874 return -ENOMEM; in tegra_xusb_request_firmware()
877 header = (struct tegra_xusb_fw_header *)tegra->fw.virt; in tegra_xusb_request_firmware()
878 memcpy(tegra->fw.virt, fw->data, tegra->fw.size); in tegra_xusb_request_firmware()
887 struct xhci_cap_regs __iomem *cap = tegra->regs; in tegra_xusb_load_firmware()
889 struct device *dev = tegra->dev; in tegra_xusb_load_firmware()
897 header = (struct tegra_xusb_fw_header *)tegra->fw.virt; in tegra_xusb_load_firmware()
898 op = tegra->regs + HC_LENGTH(readl(&cap->hc_capbase)); in tegra_xusb_load_firmware()
907 csb_writel(tegra, tegra->fw.size, XUSB_CSB_MP_ILOAD_ATTR); in tegra_xusb_load_firmware()
913 address = tegra->fw.phys + sizeof(*header); in tegra_xusb_load_firmware()
927 code_tag_blocks = DIV_ROUND_UP(le32_to_cpu(header->boot_codetag), in tegra_xusb_load_firmware()
929 code_size_blocks = DIV_ROUND_UP(le32_to_cpu(header->boot_codesize), in tegra_xusb_load_firmware()
943 /* Setup Falcon auto-fill. */ in tegra_xusb_load_firmware()
965 csb_writel(tegra, le32_to_cpu(header->boot_codetag), in tegra_xusb_load_firmware()
974 value = readl(&op->status); in tegra_xusb_load_firmware()
981 value = readl(&op->status); in tegra_xusb_load_firmware()
985 return -EIO; in tegra_xusb_load_firmware()
988 timestamp = le32_to_cpu(header->fwimg_created_time); in tegra_xusb_load_firmware()
998 if (!tegra->use_genpd) in tegra_xusb_powerdomain_remove()
1001 if (!IS_ERR_OR_NULL(tegra->genpd_dev_ss)) in tegra_xusb_powerdomain_remove()
1002 dev_pm_domain_detach(tegra->genpd_dev_ss, true); in tegra_xusb_powerdomain_remove()
1003 if (!IS_ERR_OR_NULL(tegra->genpd_dev_host)) in tegra_xusb_powerdomain_remove()
1004 dev_pm_domain_detach(tegra->genpd_dev_host, true); in tegra_xusb_powerdomain_remove()
1012 tegra->genpd_dev_host = dev_pm_domain_attach_by_name(dev, "xusb_host"); in tegra_xusb_powerdomain_init()
1013 if (IS_ERR_OR_NULL(tegra->genpd_dev_host)) { in tegra_xusb_powerdomain_init()
1014 err = PTR_ERR(tegra->genpd_dev_host) ? : -ENODATA; in tegra_xusb_powerdomain_init()
1015 dev_err(dev, "failed to get host pm-domain: %d\n", err); in tegra_xusb_powerdomain_init()
1019 tegra->genpd_dev_ss = dev_pm_domain_attach_by_name(dev, "xusb_ss"); in tegra_xusb_powerdomain_init()
1020 if (IS_ERR_OR_NULL(tegra->genpd_dev_ss)) { in tegra_xusb_powerdomain_init()
1021 err = PTR_ERR(tegra->genpd_dev_ss) ? : -ENODATA; in tegra_xusb_powerdomain_init()
1022 dev_err(dev, "failed to get superspeed pm-domain: %d\n", err); in tegra_xusb_powerdomain_init()
1026 tegra->use_genpd = true; in tegra_xusb_powerdomain_init()
1033 struct device *dev = tegra->dev; in tegra_xusb_unpowergate_partitions()
1036 if (tegra->use_genpd) { in tegra_xusb_unpowergate_partitions()
1037 rc = pm_runtime_resume_and_get(tegra->genpd_dev_ss); in tegra_xusb_unpowergate_partitions()
1039 dev_err(dev, "failed to enable XUSB SS partition\n"); in tegra_xusb_unpowergate_partitions()
1043 rc = pm_runtime_resume_and_get(tegra->genpd_dev_host); in tegra_xusb_unpowergate_partitions()
1046 pm_runtime_put_sync(tegra->genpd_dev_ss); in tegra_xusb_unpowergate_partitions()
1051 tegra->ss_clk, in tegra_xusb_unpowergate_partitions()
1052 tegra->ss_rst); in tegra_xusb_unpowergate_partitions()
1054 dev_err(dev, "failed to enable XUSB SS partition\n"); in tegra_xusb_unpowergate_partitions()
1059 tegra->host_clk, in tegra_xusb_unpowergate_partitions()
1060 tegra->host_rst); in tegra_xusb_unpowergate_partitions()
1073 struct device *dev = tegra->dev; in tegra_xusb_powergate_partitions()
1076 if (tegra->use_genpd) { in tegra_xusb_powergate_partitions()
1077 rc = pm_runtime_put_sync(tegra->genpd_dev_host); in tegra_xusb_powergate_partitions()
1083 rc = pm_runtime_put_sync(tegra->genpd_dev_ss); in tegra_xusb_powergate_partitions()
1085 dev_err(dev, "failed to disable XUSB SS partition\n"); in tegra_xusb_powergate_partitions()
1086 pm_runtime_get_sync(tegra->genpd_dev_host); in tegra_xusb_powergate_partitions()
1098 dev_err(dev, "failed to disable XUSB SS partition\n"); in tegra_xusb_powergate_partitions()
1100 tegra->host_clk, in tegra_xusb_powergate_partitions()
1101 tegra->host_rst); in tegra_xusb_powergate_partitions()
1120 dev_err(tegra->dev, "failed to enable messages: %d\n", err); in __tegra_xusb_enable_firmware_messages()
1129 mutex_lock(&tegra->lock); in tegra_xusb_padctl_irq()
1131 if (tegra->suspended) { in tegra_xusb_padctl_irq()
1132 mutex_unlock(&tegra->lock); in tegra_xusb_padctl_irq()
1136 mutex_unlock(&tegra->lock); in tegra_xusb_padctl_irq()
1138 pm_runtime_resume(tegra->dev); in tegra_xusb_padctl_irq()
1147 mutex_lock(&tegra->lock); in tegra_xusb_enable_firmware_messages()
1149 mutex_unlock(&tegra->lock); in tegra_xusb_enable_firmware_messages()
1157 struct xhci_hcd *xhci = hcd_to_xhci(tegra->hcd); in tegra_xhci_set_port_power()
1158 struct usb_hcd *hcd = main ? xhci->main_hcd : xhci->shared_hcd; in tegra_xhci_set_port_power()
1161 u16 wIndex = main ? tegra->otg_usb2_port + 1 : tegra->otg_usb3_port + 1; in tegra_xhci_set_port_power()
1166 dev_dbg(tegra->dev, "%s():%s %s port power\n", __func__, in tegra_xhci_set_port_power()
1167 set ? "set" : "clear", main ? "HS" : "SS"); in tegra_xhci_set_port_power()
1169 hcd->driver->hub_control(hcd, typeReq, USB_PORT_FEAT_POWER, wIndex, in tegra_xhci_set_port_power()
1182 } while (--wait > 0); in tegra_xhci_set_port_power()
1185 dev_info(tegra->dev, "failed to %s %s PP %d\n", in tegra_xhci_set_port_power()
1187 main ? "HS" : "SS", status); in tegra_xhci_set_port_power()
1195 for (i = 0; i < tegra->soc->num_types; i++) { in tegra_xusb_get_phy()
1196 if (!strncmp(tegra->soc->phy_types[i].name, name, in tegra_xusb_get_phy()
1198 return tegra->phys[phy_count+port]; in tegra_xusb_get_phy()
1200 phy_count += tegra->soc->phy_types[i].num; in tegra_xusb_get_phy()
1210 struct xhci_hcd *xhci = hcd_to_xhci(tegra->hcd); in tegra_xhci_id_work()
1213 tegra->otg_usb2_port); in tegra_xhci_id_work()
1217 dev_dbg(tegra->dev, "host mode %s\n", tegra->host_mode ? "on" : "off"); in tegra_xhci_id_work()
1219 mutex_lock(&tegra->lock); in tegra_xhci_id_work()
1221 if (tegra->host_mode) in tegra_xhci_id_work()
1226 mutex_unlock(&tegra->lock); in tegra_xhci_id_work()
1228 if (tegra->host_mode) { in tegra_xhci_id_work()
1230 if (tegra->otg_usb3_port >= 0) { in tegra_xhci_id_work()
1231 if (tegra->soc->otg_reset_sspi) { in tegra_xhci_id_work()
1234 xhci->shared_hcd, GetPortStatus, in tegra_xhci_id_work()
1235 0, tegra->otg_usb3_port+1, in tegra_xhci_id_work()
1243 msg.data = tegra->otg_usb3_port+1; in tegra_xhci_id_work()
1247 dev_info(tegra->dev, in tegra_xhci_id_work()
1259 if (tegra->otg_usb3_port >= 0) in tegra_xhci_id_work()
1269 return (tegra->usbphy[index] != NULL); in is_usb2_otg_phy()
1274 struct tegra_xusb_padctl *padctl = tegra->padctl; in is_usb3_otg_phy()
1278 for (i = 0; i < tegra->num_usb_phys; i++) { in is_usb3_otg_phy()
1291 if (strcmp(tegra->soc->phy_types[phy_type].name, "hsic") == 0) in is_host_mode_phy()
1294 if (strcmp(tegra->soc->phy_types[phy_type].name, "usb2") == 0) { in is_host_mode_phy()
1296 return ((index == tegra->otg_usb2_port) && tegra->host_mode); in is_host_mode_phy()
1301 if (strcmp(tegra->soc->phy_types[phy_type].name, "usb3") == 0) { in is_host_mode_phy()
1303 return ((index == tegra->otg_usb3_port) && tegra->host_mode); in is_host_mode_phy()
1317 for (i = 0; i < tegra->num_usb_phys; i++) { in tegra_xusb_get_usb2_port()
1318 if (tegra->usbphy[i] && usbphy == tegra->usbphy[i]) in tegra_xusb_get_usb2_port()
1322 return -1; in tegra_xusb_get_usb2_port()
1332 dev_dbg(tegra->dev, "%s(): action is %d", __func__, usbphy->last_event); in tegra_xhci_id_notify()
1334 if ((tegra->host_mode && usbphy->last_event == USB_EVENT_ID) || in tegra_xhci_id_notify()
1335 (!tegra->host_mode && usbphy->last_event != USB_EVENT_ID)) { in tegra_xhci_id_notify()
1336 dev_dbg(tegra->dev, "Same role(%d) received. Ignore", in tegra_xhci_id_notify()
1337 tegra->host_mode); in tegra_xhci_id_notify()
1341 tegra->otg_usb2_port = tegra_xusb_get_usb2_port(tegra, usbphy); in tegra_xhci_id_notify()
1342 tegra->otg_usb3_port = tegra_xusb_padctl_get_usb3_companion( in tegra_xhci_id_notify()
1343 tegra->padctl, in tegra_xhci_id_notify()
1344 tegra->otg_usb2_port); in tegra_xhci_id_notify()
1346 tegra->host_mode = (usbphy->last_event == USB_EVENT_ID) ? true : false; in tegra_xhci_id_notify()
1348 schedule_work(&tegra->id_work); in tegra_xhci_id_notify()
1357 tegra->usbphy = devm_kcalloc(tegra->dev, tegra->num_usb_phys, in tegra_xusb_init_usb_phy()
1358 sizeof(*tegra->usbphy), GFP_KERNEL); in tegra_xusb_init_usb_phy()
1359 if (!tegra->usbphy) in tegra_xusb_init_usb_phy()
1360 return -ENOMEM; in tegra_xusb_init_usb_phy()
1362 INIT_WORK(&tegra->id_work, tegra_xhci_id_work); in tegra_xusb_init_usb_phy()
1363 tegra->id_nb.notifier_call = tegra_xhci_id_notify; in tegra_xusb_init_usb_phy()
1364 tegra->otg_usb2_port = -EINVAL; in tegra_xusb_init_usb_phy()
1365 tegra->otg_usb3_port = -EINVAL; in tegra_xusb_init_usb_phy()
1367 for (i = 0; i < tegra->num_usb_phys; i++) { in tegra_xusb_init_usb_phy()
1373 tegra->usbphy[i] = devm_usb_get_phy_by_node(tegra->dev, in tegra_xusb_init_usb_phy()
1374 phy->dev.of_node, in tegra_xusb_init_usb_phy()
1375 &tegra->id_nb); in tegra_xusb_init_usb_phy()
1376 if (!IS_ERR(tegra->usbphy[i])) { in tegra_xusb_init_usb_phy()
1377 dev_dbg(tegra->dev, "usbphy-%d registered", i); in tegra_xusb_init_usb_phy()
1378 otg_set_host(tegra->usbphy[i]->otg, &tegra->hcd->self); in tegra_xusb_init_usb_phy()
1381 * usb-phy is optional, continue if its not available. in tegra_xusb_init_usb_phy()
1383 tegra->usbphy[i] = NULL; in tegra_xusb_init_usb_phy()
1394 cancel_work_sync(&tegra->id_work); in tegra_xusb_deinit_usb_phy()
1396 for (i = 0; i < tegra->num_usb_phys; i++) in tegra_xusb_deinit_usb_phy()
1397 if (tegra->usbphy[i]) in tegra_xusb_deinit_usb_phy()
1398 otg_set_host(tegra->usbphy[i]->otg, NULL); in tegra_xusb_deinit_usb_phy()
1414 tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL); in tegra_xusb_probe()
1416 return -ENOMEM; in tegra_xusb_probe()
1418 tegra->soc = of_device_get_match_data(&pdev->dev); in tegra_xusb_probe()
1419 mutex_init(&tegra->lock); in tegra_xusb_probe()
1420 tegra->dev = &pdev->dev; in tegra_xusb_probe()
1426 tegra->regs = devm_platform_get_and_ioremap_resource(pdev, 0, ®s); in tegra_xusb_probe()
1427 if (IS_ERR(tegra->regs)) in tegra_xusb_probe()
1428 return PTR_ERR(tegra->regs); in tegra_xusb_probe()
1430 tegra->fpci_base = devm_platform_ioremap_resource(pdev, 1); in tegra_xusb_probe()
1431 if (IS_ERR(tegra->fpci_base)) in tegra_xusb_probe()
1432 return PTR_ERR(tegra->fpci_base); in tegra_xusb_probe()
1434 if (tegra->soc->has_ipfs) { in tegra_xusb_probe()
1435 tegra->ipfs_base = devm_platform_ioremap_resource(pdev, 2); in tegra_xusb_probe()
1436 if (IS_ERR(tegra->ipfs_base)) in tegra_xusb_probe()
1437 return PTR_ERR(tegra->ipfs_base); in tegra_xusb_probe()
1440 tegra->xhci_irq = platform_get_irq(pdev, 0); in tegra_xusb_probe()
1441 if (tegra->xhci_irq < 0) in tegra_xusb_probe()
1442 return tegra->xhci_irq; in tegra_xusb_probe()
1444 tegra->mbox_irq = platform_get_irq(pdev, 1); in tegra_xusb_probe()
1445 if (tegra->mbox_irq < 0) in tegra_xusb_probe()
1446 return tegra->mbox_irq; in tegra_xusb_probe()
1448 tegra->padctl = tegra_xusb_padctl_get(&pdev->dev); in tegra_xusb_probe()
1449 if (IS_ERR(tegra->padctl)) in tegra_xusb_probe()
1450 return PTR_ERR(tegra->padctl); in tegra_xusb_probe()
1452 np = of_parse_phandle(pdev->dev.of_node, "nvidia,xusb-padctl", 0); in tegra_xusb_probe()
1454 err = -ENODEV; in tegra_xusb_probe()
1458 /* Older device-trees don't have padctrl interrupt */ in tegra_xusb_probe()
1461 tegra->padctl_irq = of_irq_get(np, 0); in tegra_xusb_probe()
1462 if (tegra->padctl_irq <= 0) { in tegra_xusb_probe()
1463 err = (tegra->padctl_irq == 0) ? -ENODEV : tegra->padctl_irq; in tegra_xusb_probe()
1467 dev_dbg(&pdev->dev, in tegra_xusb_probe()
1471 tegra->host_clk = devm_clk_get(&pdev->dev, "xusb_host"); in tegra_xusb_probe()
1472 if (IS_ERR(tegra->host_clk)) { in tegra_xusb_probe()
1473 err = PTR_ERR(tegra->host_clk); in tegra_xusb_probe()
1474 dev_err(&pdev->dev, "failed to get xusb_host: %d\n", err); in tegra_xusb_probe()
1478 tegra->falcon_clk = devm_clk_get(&pdev->dev, "xusb_falcon_src"); in tegra_xusb_probe()
1479 if (IS_ERR(tegra->falcon_clk)) { in tegra_xusb_probe()
1480 err = PTR_ERR(tegra->falcon_clk); in tegra_xusb_probe()
1481 dev_err(&pdev->dev, "failed to get xusb_falcon_src: %d\n", err); in tegra_xusb_probe()
1485 tegra->ss_clk = devm_clk_get(&pdev->dev, "xusb_ss"); in tegra_xusb_probe()
1486 if (IS_ERR(tegra->ss_clk)) { in tegra_xusb_probe()
1487 err = PTR_ERR(tegra->ss_clk); in tegra_xusb_probe()
1488 dev_err(&pdev->dev, "failed to get xusb_ss: %d\n", err); in tegra_xusb_probe()
1492 tegra->ss_src_clk = devm_clk_get(&pdev->dev, "xusb_ss_src"); in tegra_xusb_probe()
1493 if (IS_ERR(tegra->ss_src_clk)) { in tegra_xusb_probe()
1494 err = PTR_ERR(tegra->ss_src_clk); in tegra_xusb_probe()
1495 dev_err(&pdev->dev, "failed to get xusb_ss_src: %d\n", err); in tegra_xusb_probe()
1499 tegra->hs_src_clk = devm_clk_get(&pdev->dev, "xusb_hs_src"); in tegra_xusb_probe()
1500 if (IS_ERR(tegra->hs_src_clk)) { in tegra_xusb_probe()
1501 err = PTR_ERR(tegra->hs_src_clk); in tegra_xusb_probe()
1502 dev_err(&pdev->dev, "failed to get xusb_hs_src: %d\n", err); in tegra_xusb_probe()
1506 tegra->fs_src_clk = devm_clk_get(&pdev->dev, "xusb_fs_src"); in tegra_xusb_probe()
1507 if (IS_ERR(tegra->fs_src_clk)) { in tegra_xusb_probe()
1508 err = PTR_ERR(tegra->fs_src_clk); in tegra_xusb_probe()
1509 dev_err(&pdev->dev, "failed to get xusb_fs_src: %d\n", err); in tegra_xusb_probe()
1513 tegra->pll_u_480m = devm_clk_get(&pdev->dev, "pll_u_480m"); in tegra_xusb_probe()
1514 if (IS_ERR(tegra->pll_u_480m)) { in tegra_xusb_probe()
1515 err = PTR_ERR(tegra->pll_u_480m); in tegra_xusb_probe()
1516 dev_err(&pdev->dev, "failed to get pll_u_480m: %d\n", err); in tegra_xusb_probe()
1520 tegra->clk_m = devm_clk_get(&pdev->dev, "clk_m"); in tegra_xusb_probe()
1521 if (IS_ERR(tegra->clk_m)) { in tegra_xusb_probe()
1522 err = PTR_ERR(tegra->clk_m); in tegra_xusb_probe()
1523 dev_err(&pdev->dev, "failed to get clk_m: %d\n", err); in tegra_xusb_probe()
1527 tegra->pll_e = devm_clk_get(&pdev->dev, "pll_e"); in tegra_xusb_probe()
1528 if (IS_ERR(tegra->pll_e)) { in tegra_xusb_probe()
1529 err = PTR_ERR(tegra->pll_e); in tegra_xusb_probe()
1530 dev_err(&pdev->dev, "failed to get pll_e: %d\n", err); in tegra_xusb_probe()
1534 if (!of_property_read_bool(pdev->dev.of_node, "power-domains")) { in tegra_xusb_probe()
1535 tegra->host_rst = devm_reset_control_get(&pdev->dev, in tegra_xusb_probe()
1537 if (IS_ERR(tegra->host_rst)) { in tegra_xusb_probe()
1538 err = PTR_ERR(tegra->host_rst); in tegra_xusb_probe()
1539 dev_err(&pdev->dev, in tegra_xusb_probe()
1544 tegra->ss_rst = devm_reset_control_get(&pdev->dev, "xusb_ss"); in tegra_xusb_probe()
1545 if (IS_ERR(tegra->ss_rst)) { in tegra_xusb_probe()
1546 err = PTR_ERR(tegra->ss_rst); in tegra_xusb_probe()
1547 dev_err(&pdev->dev, "failed to get xusb_ss reset: %d\n", in tegra_xusb_probe()
1552 err = tegra_xusb_powerdomain_init(&pdev->dev, tegra); in tegra_xusb_probe()
1557 tegra->supplies = devm_kcalloc(&pdev->dev, tegra->soc->num_supplies, in tegra_xusb_probe()
1558 sizeof(*tegra->supplies), GFP_KERNEL); in tegra_xusb_probe()
1559 if (!tegra->supplies) { in tegra_xusb_probe()
1560 err = -ENOMEM; in tegra_xusb_probe()
1564 regulator_bulk_set_supply_names(tegra->supplies, in tegra_xusb_probe()
1565 tegra->soc->supply_names, in tegra_xusb_probe()
1566 tegra->soc->num_supplies); in tegra_xusb_probe()
1568 err = devm_regulator_bulk_get(&pdev->dev, tegra->soc->num_supplies, in tegra_xusb_probe()
1569 tegra->supplies); in tegra_xusb_probe()
1571 dev_err(&pdev->dev, "failed to get regulators: %d\n", err); in tegra_xusb_probe()
1575 for (i = 0; i < tegra->soc->num_types; i++) { in tegra_xusb_probe()
1576 if (!strncmp(tegra->soc->phy_types[i].name, "usb2", 4)) in tegra_xusb_probe()
1577 tegra->num_usb_phys = tegra->soc->phy_types[i].num; in tegra_xusb_probe()
1578 tegra->num_phys += tegra->soc->phy_types[i].num; in tegra_xusb_probe()
1581 tegra->phys = devm_kcalloc(&pdev->dev, tegra->num_phys, in tegra_xusb_probe()
1582 sizeof(*tegra->phys), GFP_KERNEL); in tegra_xusb_probe()
1583 if (!tegra->phys) { in tegra_xusb_probe()
1584 err = -ENOMEM; in tegra_xusb_probe()
1588 for (i = 0, k = 0; i < tegra->soc->num_types; i++) { in tegra_xusb_probe()
1591 for (j = 0; j < tegra->soc->phy_types[i].num; j++) { in tegra_xusb_probe()
1592 snprintf(prop, sizeof(prop), "%s-%d", in tegra_xusb_probe()
1593 tegra->soc->phy_types[i].name, j); in tegra_xusb_probe()
1595 phy = devm_phy_optional_get(&pdev->dev, prop); in tegra_xusb_probe()
1597 dev_err(&pdev->dev, in tegra_xusb_probe()
1604 tegra->phys[k++] = phy; in tegra_xusb_probe()
1608 tegra->hcd = usb_create_hcd(&tegra_xhci_hc_driver, &pdev->dev, in tegra_xusb_probe()
1609 dev_name(&pdev->dev)); in tegra_xusb_probe()
1610 if (!tegra->hcd) { in tegra_xusb_probe()
1611 err = -ENOMEM; in tegra_xusb_probe()
1615 tegra->hcd->skip_phy_initialization = 1; in tegra_xusb_probe()
1616 tegra->hcd->regs = tegra->regs; in tegra_xusb_probe()
1617 tegra->hcd->rsrc_start = regs->start; in tegra_xusb_probe()
1618 tegra->hcd->rsrc_len = resource_size(regs); in tegra_xusb_probe()
1628 dev_err(tegra->dev, "failed to enable clocks: %d\n", err); in tegra_xusb_probe()
1632 err = regulator_bulk_enable(tegra->soc->num_supplies, tegra->supplies); in tegra_xusb_probe()
1634 dev_err(tegra->dev, "failed to enable regulators: %d\n", err); in tegra_xusb_probe()
1640 dev_err(&pdev->dev, "failed to enable PHYs: %d\n", err); in tegra_xusb_probe()
1645 * The XUSB Falcon microcontroller can only address 40 bits, so set in tegra_xusb_probe()
1648 err = dma_set_mask_and_coherent(tegra->dev, DMA_BIT_MASK(40)); in tegra_xusb_probe()
1650 dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err); in tegra_xusb_probe()
1656 dev_err(&pdev->dev, "failed to request firmware: %d\n", err); in tegra_xusb_probe()
1668 dev_err(&pdev->dev, "failed to load firmware: %d\n", err); in tegra_xusb_probe()
1672 err = usb_add_hcd(tegra->hcd, tegra->xhci_irq, IRQF_SHARED); in tegra_xusb_probe()
1674 dev_err(&pdev->dev, "failed to add USB HCD: %d\n", err); in tegra_xusb_probe()
1678 device_wakeup_enable(tegra->hcd->self.controller); in tegra_xusb_probe()
1680 xhci = hcd_to_xhci(tegra->hcd); in tegra_xusb_probe()
1682 xhci->shared_hcd = usb_create_shared_hcd(&tegra_xhci_hc_driver, in tegra_xusb_probe()
1683 &pdev->dev, in tegra_xusb_probe()
1684 dev_name(&pdev->dev), in tegra_xusb_probe()
1685 tegra->hcd); in tegra_xusb_probe()
1686 if (!xhci->shared_hcd) { in tegra_xusb_probe()
1687 dev_err(&pdev->dev, "failed to create shared HCD\n"); in tegra_xusb_probe()
1688 err = -ENOMEM; in tegra_xusb_probe()
1692 err = usb_add_hcd(xhci->shared_hcd, tegra->xhci_irq, IRQF_SHARED); in tegra_xusb_probe()
1694 dev_err(&pdev->dev, "failed to add shared HCD: %d\n", err); in tegra_xusb_probe()
1698 err = devm_request_threaded_irq(&pdev->dev, tegra->mbox_irq, in tegra_xusb_probe()
1701 dev_name(&pdev->dev), tegra); in tegra_xusb_probe()
1703 dev_err(&pdev->dev, "failed to request IRQ: %d\n", err); in tegra_xusb_probe()
1707 if (tegra->padctl_irq) { in tegra_xusb_probe()
1708 err = devm_request_threaded_irq(&pdev->dev, tegra->padctl_irq, in tegra_xusb_probe()
1710 IRQF_ONESHOT, dev_name(&pdev->dev), in tegra_xusb_probe()
1713 dev_err(&pdev->dev, "failed to request padctl IRQ: %d\n", err); in tegra_xusb_probe()
1720 dev_err(&pdev->dev, "failed to enable messages: %d\n", err); in tegra_xusb_probe()
1726 dev_err(&pdev->dev, "failed to init USB PHY: %d\n", err); in tegra_xusb_probe()
1731 device_init_wakeup(&tegra->hcd->self.root_hub->dev, true); in tegra_xusb_probe()
1732 device_init_wakeup(&xhci->shared_hcd->self.root_hub->dev, true); in tegra_xusb_probe()
1734 pm_runtime_use_autosuspend(tegra->dev); in tegra_xusb_probe()
1735 pm_runtime_set_autosuspend_delay(tegra->dev, 2000); in tegra_xusb_probe()
1736 pm_runtime_mark_last_busy(tegra->dev); in tegra_xusb_probe()
1737 pm_runtime_set_active(tegra->dev); in tegra_xusb_probe()
1739 if (tegra->padctl_irq) { in tegra_xusb_probe()
1740 device_init_wakeup(tegra->dev, true); in tegra_xusb_probe()
1741 pm_runtime_enable(tegra->dev); in tegra_xusb_probe()
1747 usb_remove_hcd(xhci->shared_hcd); in tegra_xusb_probe()
1749 usb_put_hcd(xhci->shared_hcd); in tegra_xusb_probe()
1751 usb_remove_hcd(tegra->hcd); in tegra_xusb_probe()
1755 dma_free_coherent(&pdev->dev, tegra->fw.size, tegra->fw.virt, in tegra_xusb_probe()
1756 tegra->fw.phys); in tegra_xusb_probe()
1760 regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies); in tegra_xusb_probe()
1764 usb_put_hcd(tegra->hcd); in tegra_xusb_probe()
1766 tegra_xusb_powerdomain_remove(&pdev->dev, tegra); in tegra_xusb_probe()
1769 tegra_xusb_padctl_put(tegra->padctl); in tegra_xusb_probe()
1776 struct xhci_hcd *xhci = hcd_to_xhci(tegra->hcd); in tegra_xusb_remove()
1780 pm_runtime_get_sync(&pdev->dev); in tegra_xusb_remove()
1781 usb_remove_hcd(xhci->shared_hcd); in tegra_xusb_remove()
1782 usb_put_hcd(xhci->shared_hcd); in tegra_xusb_remove()
1783 xhci->shared_hcd = NULL; in tegra_xusb_remove()
1784 usb_remove_hcd(tegra->hcd); in tegra_xusb_remove()
1785 usb_put_hcd(tegra->hcd); in tegra_xusb_remove()
1787 dma_free_coherent(&pdev->dev, tegra->fw.size, tegra->fw.virt, in tegra_xusb_remove()
1788 tegra->fw.phys); in tegra_xusb_remove()
1790 if (tegra->padctl_irq) in tegra_xusb_remove()
1791 pm_runtime_disable(&pdev->dev); in tegra_xusb_remove()
1793 pm_runtime_put(&pdev->dev); in tegra_xusb_remove()
1797 tegra_xusb_powerdomain_remove(&pdev->dev, tegra); in tegra_xusb_remove()
1801 regulator_bulk_disable(tegra->soc->num_supplies, tegra->supplies); in tegra_xusb_remove()
1802 tegra_xusb_padctl_put(tegra->padctl); in tegra_xusb_remove()
1809 struct device *dev = hub->hcd->self.controller; in xhci_hub_ports_suspended()
1814 for (i = 0; i < hub->num_ports; i++) { in xhci_hub_ports_suspended()
1815 value = readl(hub->ports[i]->addr); in xhci_hub_ports_suspended()
1820 dev_info(dev, "%u-%u isn't suspended: %#010x\n", in xhci_hub_ports_suspended()
1821 hub->hcd->self.busnum, i + 1, value); in xhci_hub_ports_suspended()
1831 struct xhci_hcd *xhci = hcd_to_xhci(tegra->hcd); in tegra_xusb_check_ports()
1832 struct xhci_bus_state *bus_state = &xhci->usb2_rhub.bus_state; in tegra_xusb_check_ports()
1836 if (bus_state->bus_suspended) { in tegra_xusb_check_ports()
1843 spin_lock_irqsave(&xhci->lock, flags); in tegra_xusb_check_ports()
1845 if (!xhci_hub_ports_suspended(&xhci->usb2_rhub) || in tegra_xusb_check_ports()
1846 !xhci_hub_ports_suspended(&xhci->usb3_rhub)) in tegra_xusb_check_ports()
1847 err = -EBUSY; in tegra_xusb_check_ports()
1849 spin_unlock_irqrestore(&xhci->lock, flags); in tegra_xusb_check_ports()
1856 const struct tegra_xusb_context_soc *soc = tegra->soc->context; in tegra_xusb_save_context()
1857 struct tegra_xusb_context *ctx = &tegra->context; in tegra_xusb_save_context()
1860 if (soc->ipfs.num_offsets > 0) { in tegra_xusb_save_context()
1861 for (i = 0; i < soc->ipfs.num_offsets; i++) in tegra_xusb_save_context()
1862 ctx->ipfs[i] = ipfs_readl(tegra, soc->ipfs.offsets[i]); in tegra_xusb_save_context()
1865 if (soc->fpci.num_offsets > 0) { in tegra_xusb_save_context()
1866 for (i = 0; i < soc->fpci.num_offsets; i++) in tegra_xusb_save_context()
1867 ctx->fpci[i] = fpci_readl(tegra, soc->fpci.offsets[i]); in tegra_xusb_save_context()
1873 const struct tegra_xusb_context_soc *soc = tegra->soc->context; in tegra_xusb_restore_context()
1874 struct tegra_xusb_context *ctx = &tegra->context; in tegra_xusb_restore_context()
1877 if (soc->fpci.num_offsets > 0) { in tegra_xusb_restore_context()
1878 for (i = 0; i < soc->fpci.num_offsets; i++) in tegra_xusb_restore_context()
1879 fpci_writel(tegra, ctx->fpci[i], soc->fpci.offsets[i]); in tegra_xusb_restore_context()
1882 if (soc->ipfs.num_offsets > 0) { in tegra_xusb_restore_context()
1883 for (i = 0; i < soc->ipfs.num_offsets; i++) in tegra_xusb_restore_context()
1884 ipfs_writel(tegra, ctx->ipfs[i], soc->ipfs.offsets[i]); in tegra_xusb_restore_context()
1907 struct tegra_xusb_padctl *padctl = tegra->padctl; in tegra_xhci_enable_phy_sleepwalk_wake()
1908 struct xhci_hcd *xhci = hcd_to_xhci(tegra->hcd); in tegra_xhci_enable_phy_sleepwalk_wake()
1916 for (i = 0, k = 0; i < tegra->soc->num_types; i++) { in tegra_xhci_enable_phy_sleepwalk_wake()
1917 if (strcmp(tegra->soc->phy_types[i].name, "usb3") == 0) in tegra_xhci_enable_phy_sleepwalk_wake()
1918 rhub = &xhci->usb3_rhub; in tegra_xhci_enable_phy_sleepwalk_wake()
1920 rhub = &xhci->usb2_rhub; in tegra_xhci_enable_phy_sleepwalk_wake()
1922 if (strcmp(tegra->soc->phy_types[i].name, "hsic") == 0) in tegra_xhci_enable_phy_sleepwalk_wake()
1923 offset = tegra->soc->ports.usb2.count; in tegra_xhci_enable_phy_sleepwalk_wake()
1927 for (j = 0; j < tegra->soc->phy_types[i].num; j++) { in tegra_xhci_enable_phy_sleepwalk_wake()
1928 phy = tegra->phys[k++]; in tegra_xhci_enable_phy_sleepwalk_wake()
1935 if (index >= rhub->num_ports) in tegra_xhci_enable_phy_sleepwalk_wake()
1941 portsc = readl(rhub->ports[index]->addr); in tegra_xhci_enable_phy_sleepwalk_wake()
1951 struct tegra_xusb_padctl *padctl = tegra->padctl; in tegra_xhci_disable_phy_wake()
1954 for (i = 0; i < tegra->num_phys; i++) { in tegra_xhci_disable_phy_wake()
1955 if (!tegra->phys[i]) in tegra_xhci_disable_phy_wake()
1958 tegra_xusb_padctl_disable_phy_wake(padctl, tegra->phys[i]); in tegra_xhci_disable_phy_wake()
1964 struct tegra_xusb_padctl *padctl = tegra->padctl; in tegra_xhci_disable_phy_sleepwalk()
1967 for (i = 0; i < tegra->num_phys; i++) { in tegra_xhci_disable_phy_sleepwalk()
1968 if (!tegra->phys[i]) in tegra_xhci_disable_phy_sleepwalk()
1971 tegra_xusb_padctl_disable_phy_sleepwalk(padctl, tegra->phys[i]); in tegra_xhci_disable_phy_sleepwalk()
1977 struct xhci_hcd *xhci = hcd_to_xhci(tegra->hcd); in tegra_xusb_enter_elpg()
1978 struct device *dev = tegra->dev; in tegra_xusb_enter_elpg()
1986 usbcmd = readl(&xhci->op_regs->command); in tegra_xusb_enter_elpg()
1988 writel(usbcmd, &xhci->op_regs->command); in tegra_xusb_enter_elpg()
1992 dev_err(tegra->dev, "not all ports suspended: %d\n", err); in tegra_xusb_enter_elpg()
1998 dev_err(tegra->dev, "failed to suspend XHCI: %d\n", err); in tegra_xusb_enter_elpg()
2009 for (i = 0; i < tegra->num_phys; i++) { in tegra_xusb_enter_elpg()
2010 if (!tegra->phys[i]) in tegra_xusb_enter_elpg()
2013 phy_power_off(tegra->phys[i]); in tegra_xusb_enter_elpg()
2015 phy_exit(tegra->phys[i]); in tegra_xusb_enter_elpg()
2022 dev_dbg(tegra->dev, "entering ELPG done\n"); in tegra_xusb_enter_elpg()
2024 usbcmd = readl(&xhci->op_regs->command); in tegra_xusb_enter_elpg()
2026 writel(usbcmd, &xhci->op_regs->command); in tegra_xusb_enter_elpg()
2028 dev_dbg(tegra->dev, "entering ELPG failed\n"); in tegra_xusb_enter_elpg()
2029 pm_runtime_mark_last_busy(tegra->dev); in tegra_xusb_enter_elpg()
2037 struct xhci_hcd *xhci = hcd_to_xhci(tegra->hcd); in tegra_xusb_exit_elpg()
2038 struct device *dev = tegra->dev; in tegra_xusb_exit_elpg()
2045 pm_runtime_mark_last_busy(tegra->dev); in tegra_xusb_exit_elpg()
2049 dev_err(tegra->dev, "failed to enable clocks: %d\n", err); in tegra_xusb_exit_elpg()
2060 for (i = 0; i < tegra->num_phys; i++) { in tegra_xusb_exit_elpg()
2061 if (!tegra->phys[i]) in tegra_xusb_exit_elpg()
2065 phy_init(tegra->phys[i]); in tegra_xusb_exit_elpg()
2067 phy_power_on(tegra->phys[i]); in tegra_xusb_exit_elpg()
2075 dev_err(tegra->dev, "failed to load firmware: %d\n", err); in tegra_xusb_exit_elpg()
2081 dev_err(tegra->dev, "failed to enable messages: %d\n", err); in tegra_xusb_exit_elpg()
2090 dev_err(tegra->dev, "failed to resume XHCI: %d\n", err); in tegra_xusb_exit_elpg()
2094 usbcmd = readl(&xhci->op_regs->command); in tegra_xusb_exit_elpg()
2096 writel(usbcmd, &xhci->op_regs->command); in tegra_xusb_exit_elpg()
2101 for (i = 0; i < tegra->num_phys; i++) { in tegra_xusb_exit_elpg()
2102 if (!tegra->phys[i]) in tegra_xusb_exit_elpg()
2105 phy_power_off(tegra->phys[i]); in tegra_xusb_exit_elpg()
2107 phy_exit(tegra->phys[i]); in tegra_xusb_exit_elpg()
2126 synchronize_irq(tegra->mbox_irq); in tegra_xusb_suspend()
2128 mutex_lock(&tegra->lock); in tegra_xusb_suspend()
2149 tegra->suspended = true; in tegra_xusb_suspend()
2153 if (enable_irq_wake(tegra->padctl_irq)) in tegra_xusb_suspend()
2158 mutex_unlock(&tegra->lock); in tegra_xusb_suspend()
2168 mutex_lock(&tegra->lock); in tegra_xusb_resume()
2170 if (!tegra->suspended) { in tegra_xusb_resume()
2171 mutex_unlock(&tegra->lock); in tegra_xusb_resume()
2177 mutex_unlock(&tegra->lock); in tegra_xusb_resume()
2182 if (disable_irq_wake(tegra->padctl_irq)) in tegra_xusb_resume()
2185 tegra->suspended = false; in tegra_xusb_resume()
2186 mutex_unlock(&tegra->lock); in tegra_xusb_resume()
2199 synchronize_irq(tegra->mbox_irq); in tegra_xusb_runtime_suspend()
2200 mutex_lock(&tegra->lock); in tegra_xusb_runtime_suspend()
2202 mutex_unlock(&tegra->lock); in tegra_xusb_runtime_suspend()
2212 mutex_lock(&tegra->lock); in tegra_xusb_runtime_resume()
2214 mutex_unlock(&tegra->lock); in tegra_xusb_runtime_resume()
2226 "avddio-pex",
2227 "dvddio-pex",
2228 "avdd-usb",
2229 "hvdd-usb-ss",
2233 { .name = "usb3", .num = 2, },
2234 { .name = "usb2", .num = 3, },
2235 { .name = "hsic", .num = 2, },
2299 "dvddio-pex",
2300 "hvddio-pex",
2301 "avdd-usb",
2305 { .name = "usb3", .num = 4, },
2306 { .name = "usb2", .num = 4, },
2307 { .name = "hsic", .num = 1, },
2339 { .name = "usb3", .num = 3, },
2340 { .name = "usb2", .num = 3, },
2341 { .name = "hsic", .num = 1, },
2379 { .name = "usb3", .num = 4, },
2380 { .name = "usb2", .num = 4, },
2408 { .compatible = "nvidia,tegra124-xusb", .data = &tegra124_soc },
2409 { .compatible = "nvidia,tegra210-xusb", .data = &tegra210_soc },
2410 { .compatible = "nvidia,tegra186-xusb", .data = &tegra186_soc },
2411 { .compatible = "nvidia,tegra194-xusb", .data = &tegra194_soc },
2420 .name = "tegra-xusb",
2430 xhci->quirks |= XHCI_PLAT; in tegra_xhci_quirks()
2431 if (tegra && tegra->soc->lpm_support) in tegra_xhci_quirks()
2432 xhci->quirks |= XHCI_LPM_SUPPORT; in tegra_xhci_quirks()
2459 MODULE_DESCRIPTION("NVIDIA Tegra XUSB xHCI host-controller driver");