Lines Matching +full:pull +full:- +full:ups

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved.
27 ((x) ? (11 + ((x) - 1) * 6) : 0)
451 for (map = tegra210_usb3_map; map->type; map++) { in tegra210_usb3_lane_map()
452 if (map->index == lane->index && in tegra210_usb3_lane_map()
453 strcmp(map->type, lane->pad->soc->name) == 0) { in tegra210_usb3_lane_map()
454 dev_dbg(lane->pad->padctl->dev, "lane = %s map to port = usb3-%d\n", in tegra210_usb3_lane_map()
455 lane->pad->soc->lanes[lane->index].name, map->port); in tegra210_usb3_lane_map()
456 return map->port; in tegra210_usb3_lane_map()
460 return -EINVAL; in tegra210_usb3_lane_map()
463 /* must be called under padctl->lock */
466 struct tegra_xusb_pcie_pad *pcie = to_pcie_pad(padctl->pcie); in tegra210_pex_uphy_enable()
472 if (pcie->enable) in tegra210_pex_uphy_enable()
475 err = clk_prepare_enable(pcie->pll); in tegra210_pex_uphy_enable()
482 err = reset_control_deassert(pcie->rst); in tegra210_pex_uphy_enable()
561 err = -ETIMEDOUT; in tegra210_pex_uphy_enable()
580 err = -ETIMEDOUT; in tegra210_pex_uphy_enable()
599 err = -ETIMEDOUT; in tegra210_pex_uphy_enable()
619 err = -ETIMEDOUT; in tegra210_pex_uphy_enable()
638 err = -ETIMEDOUT; in tegra210_pex_uphy_enable()
665 pcie->enable = true; in tegra210_pex_uphy_enable()
667 for (i = 0; i < padctl->pcie->soc->num_lanes; i++) { in tegra210_pex_uphy_enable()
676 reset_control_assert(pcie->rst); in tegra210_pex_uphy_enable()
678 clk_disable_unprepare(pcie->pll); in tegra210_pex_uphy_enable()
684 struct tegra_xusb_pcie_pad *pcie = to_pcie_pad(padctl->pcie); in tegra210_pex_uphy_disable()
688 if (WARN_ON(!pcie->enable)) in tegra210_pex_uphy_disable()
691 pcie->enable = false; in tegra210_pex_uphy_disable()
693 for (i = 0; i < padctl->pcie->soc->num_lanes; i++) { in tegra210_pex_uphy_disable()
699 clk_disable_unprepare(pcie->pll); in tegra210_pex_uphy_disable()
702 /* must be called under padctl->lock */
705 struct tegra_xusb_sata_pad *sata = to_sata_pad(padctl->sata); in tegra210_sata_uphy_enable()
713 if (sata->enable) in tegra210_sata_uphy_enable()
722 usb = tegra_xusb_lane_check(lane, "usb3-ss"); in tegra210_sata_uphy_enable()
724 err = clk_prepare_enable(sata->pll); in tegra210_sata_uphy_enable()
728 err = reset_control_deassert(sata->rst); in tegra210_sata_uphy_enable()
820 err = -ETIMEDOUT; in tegra210_sata_uphy_enable()
839 err = -ETIMEDOUT; in tegra210_sata_uphy_enable()
858 err = -ETIMEDOUT; in tegra210_sata_uphy_enable()
878 err = -ETIMEDOUT; in tegra210_sata_uphy_enable()
897 err = -ETIMEDOUT; in tegra210_sata_uphy_enable()
924 sata->enable = true; in tegra210_sata_uphy_enable()
926 for (i = 0; i < padctl->sata->soc->num_lanes; i++) { in tegra210_sata_uphy_enable()
935 reset_control_assert(sata->rst); in tegra210_sata_uphy_enable()
937 clk_disable_unprepare(sata->pll); in tegra210_sata_uphy_enable()
943 struct tegra_xusb_sata_pad *sata = to_sata_pad(padctl->sata); in tegra210_sata_uphy_disable()
947 if (WARN_ON(!sata->enable)) in tegra210_sata_uphy_disable()
950 sata->enable = false; in tegra210_sata_uphy_disable()
952 for (i = 0; i < padctl->sata->soc->num_lanes; i++) { in tegra210_sata_uphy_disable()
958 clk_disable_unprepare(sata->pll); in tegra210_sata_uphy_disable()
1005 if (padctl->pcie) in tegra210_uphy_init()
1008 if (padctl->sata) in tegra210_uphy_init()
1014 dev_dbg(padctl->dev, "PLLE is already in HW control\n"); in tegra210_uphy_init()
1026 if (padctl->sata) in tegra210_uphy_deinit()
1029 if (padctl->pcie) in tegra210_uphy_deinit()
1061 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb3_enable_phy_sleepwalk()
1063 struct device *dev = padctl->dev; in tegra210_usb3_enable_phy_sleepwalk()
1068 return -EINVAL; in tegra210_usb3_enable_phy_sleepwalk()
1071 mutex_lock(&padctl->lock); in tegra210_usb3_enable_phy_sleepwalk()
1085 mutex_unlock(&padctl->lock); in tegra210_usb3_enable_phy_sleepwalk()
1092 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb3_disable_phy_sleepwalk()
1094 struct device *dev = padctl->dev; in tegra210_usb3_disable_phy_sleepwalk()
1099 return -EINVAL; in tegra210_usb3_disable_phy_sleepwalk()
1102 mutex_lock(&padctl->lock); in tegra210_usb3_disable_phy_sleepwalk()
1114 mutex_unlock(&padctl->lock); in tegra210_usb3_disable_phy_sleepwalk()
1121 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb3_enable_phy_wake()
1123 struct device *dev = padctl->dev; in tegra210_usb3_enable_phy_wake()
1128 return -EINVAL; in tegra210_usb3_enable_phy_wake()
1131 mutex_lock(&padctl->lock); in tegra210_usb3_enable_phy_wake()
1145 mutex_unlock(&padctl->lock); in tegra210_usb3_enable_phy_wake()
1152 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb3_disable_phy_wake()
1154 struct device *dev = padctl->dev; in tegra210_usb3_disable_phy_wake()
1159 return -EINVAL; in tegra210_usb3_disable_phy_wake()
1162 mutex_lock(&padctl->lock); in tegra210_usb3_disable_phy_wake()
1176 mutex_unlock(&padctl->lock); in tegra210_usb3_disable_phy_wake()
1183 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb3_phy_remote_wake_detected()
1199 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_utmi_enable_phy_wake()
1200 unsigned int index = lane->index; in tegra210_utmi_enable_phy_wake()
1203 mutex_lock(&padctl->lock); in tegra210_utmi_enable_phy_wake()
1217 mutex_unlock(&padctl->lock); in tegra210_utmi_enable_phy_wake()
1224 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_utmi_disable_phy_wake()
1225 unsigned int index = lane->index; in tegra210_utmi_disable_phy_wake()
1228 mutex_lock(&padctl->lock); in tegra210_utmi_disable_phy_wake()
1242 mutex_unlock(&padctl->lock); in tegra210_utmi_disable_phy_wake()
1249 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_utmi_phy_remote_wake_detected()
1250 unsigned int index = lane->index; in tegra210_utmi_phy_remote_wake_detected()
1263 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_hsic_enable_phy_wake()
1264 unsigned int index = lane->index; in tegra210_hsic_enable_phy_wake()
1267 mutex_lock(&padctl->lock); in tegra210_hsic_enable_phy_wake()
1281 mutex_unlock(&padctl->lock); in tegra210_hsic_enable_phy_wake()
1288 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_hsic_disable_phy_wake()
1289 unsigned int index = lane->index; in tegra210_hsic_disable_phy_wake()
1292 mutex_lock(&padctl->lock); in tegra210_hsic_disable_phy_wake()
1306 mutex_unlock(&padctl->lock); in tegra210_hsic_disable_phy_wake()
1313 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_hsic_phy_remote_wake_detected()
1314 unsigned int index = lane->index; in tegra210_hsic_phy_remote_wake_detected()
1328 WARN(regmap_read(_priv->regmap, _offset, &value), "read %s failed\n", #_offset);\
1333 WARN(regmap_write(_priv->regmap, _offset, _value), "write %s failed\n", #_offset)
1338 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_pmc_utmi_enable_phy_sleepwalk()
1340 unsigned int port = lane->index; in tegra210_pmc_utmi_enable_phy_sleepwalk()
1343 if (!priv->regmap) in tegra210_pmc_utmi_enable_phy_sleepwalk()
1344 return -EOPNOTSUPP; in tegra210_pmc_utmi_enable_phy_sleepwalk()
1347 return -EINVAL; in tegra210_pmc_utmi_enable_phy_sleepwalk()
1443 * Set up the pull-ups and pull-downs of the signals during the four in tegra210_pmc_utmi_enable_phy_sleepwalk()
1454 /* J state: D+/D- = high/low, K state: D+/D- = low/high */ in tegra210_pmc_utmi_enable_phy_sleepwalk()
1461 /* J state: D+/D- = low/high, K state: D+/D- = high/low */ in tegra210_pmc_utmi_enable_phy_sleepwalk()
1510 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_pmc_utmi_disable_phy_sleepwalk()
1512 unsigned int port = lane->index; in tegra210_pmc_utmi_disable_phy_sleepwalk()
1515 if (!priv->regmap) in tegra210_pmc_utmi_disable_phy_sleepwalk()
1516 return -EOPNOTSUPP; in tegra210_pmc_utmi_disable_phy_sleepwalk()
1559 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_pmc_hsic_enable_phy_sleepwalk()
1563 if (!priv->regmap) in tegra210_pmc_hsic_enable_phy_sleepwalk()
1564 return -EOPNOTSUPP; in tegra210_pmc_hsic_enable_phy_sleepwalk()
1624 * Set up the pull-ups and pull-downs of the signals during the four in tegra210_pmc_hsic_enable_phy_sleepwalk()
1660 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_pmc_hsic_disable_phy_sleepwalk()
1664 if (!priv->regmap) in tegra210_pmc_hsic_disable_phy_sleepwalk()
1665 return -EOPNOTSUPP; in tegra210_pmc_hsic_disable_phy_sleepwalk()
1704 return -ENODEV; in tegra210_usb3_set_lfps_detect()
1706 lane = port->lane; in tegra210_usb3_set_lfps_detect()
1708 if (lane->pad == padctl->pcie) in tegra210_usb3_set_lfps_detect()
1709 offset = XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL1(lane->index); in tegra210_usb3_set_lfps_detect()
1749 TEGRA210_LANE("usb2-0", 0x004, 0, 0x3, usb2),
1750 TEGRA210_LANE("usb2-1", 0x004, 2, 0x3, usb2),
1751 TEGRA210_LANE("usb2-2", 0x004, 4, 0x3, usb2),
1752 TEGRA210_LANE("usb2-3", 0x004, 6, 0x3, usb2),
1764 return ERR_PTR(-ENOMEM); in tegra210_usb2_lane_probe()
1766 INIT_LIST_HEAD(&usb2->base.list); in tegra210_usb2_lane_probe()
1767 usb2->base.soc = &pad->soc->lanes[index]; in tegra210_usb2_lane_probe()
1768 usb2->base.index = index; in tegra210_usb2_lane_probe()
1769 usb2->base.pad = pad; in tegra210_usb2_lane_probe()
1770 usb2->base.np = np; in tegra210_usb2_lane_probe()
1772 err = tegra_xusb_lane_parse_dt(&usb2->base, np); in tegra210_usb2_lane_probe()
1778 return &usb2->base; in tegra210_usb2_lane_probe()
1801 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb2_phy_init()
1802 unsigned int index = lane->index; in tegra210_usb2_phy_init()
1809 dev_err(&phy->dev, "no port found for USB2 lane %u\n", index); in tegra210_usb2_phy_init()
1810 return -ENODEV; in tegra210_usb2_phy_init()
1813 if (port->supply && port->mode == USB_DR_MODE_HOST) { in tegra210_usb2_phy_init()
1814 err = regulator_enable(port->supply); in tegra210_usb2_phy_init()
1819 mutex_lock(&padctl->lock); in tegra210_usb2_phy_init()
1828 mutex_unlock(&padctl->lock); in tegra210_usb2_phy_init()
1836 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb2_phy_exit()
1840 port = tegra_xusb_find_usb2_port(padctl, lane->index); in tegra210_usb2_phy_exit()
1842 dev_err(&phy->dev, "no port found for USB2 lane %u\n", lane->index); in tegra210_usb2_phy_exit()
1843 return -ENODEV; in tegra210_usb2_phy_exit()
1846 if (port->supply && port->mode == USB_DR_MODE_HOST) { in tegra210_usb2_phy_exit()
1847 err = regulator_disable(port->supply); in tegra210_usb2_phy_exit()
1860 dev_dbg(padctl->dev, "%s vbus override\n", status ? "set" : "clear"); in tegra210_xusb_padctl_vbus_override()
1884 dev_dbg(padctl->dev, "%s id override\n", status ? "set" : "clear"); in tegra210_xusb_padctl_id_override()
1917 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb2_phy_set_mode()
1919 lane->index); in tegra210_usb2_phy_set_mode()
1922 mutex_lock(&padctl->lock); in tegra210_usb2_phy_set_mode()
1924 dev_dbg(&port->base.dev, "%s: mode %d", __func__, mode); in tegra210_usb2_phy_set_mode()
1930 err = regulator_enable(port->supply); in tegra210_usb2_phy_set_mode()
1939 if (regulator_is_enabled(port->supply)) in tegra210_usb2_phy_set_mode()
1940 regulator_disable(port->supply); in tegra210_usb2_phy_set_mode()
1947 mutex_unlock(&padctl->lock); in tegra210_usb2_phy_set_mode()
1956 struct tegra_xusb_usb2_pad *pad = to_usb2_pad(lane->pad); in tegra210_usb2_phy_power_on()
1957 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb2_phy_power_on()
1960 unsigned int index = lane->index; in tegra210_usb2_phy_power_on()
1966 dev_err(&phy->dev, "no port found for USB2 lane %u\n", index); in tegra210_usb2_phy_power_on()
1967 return -ENODEV; in tegra210_usb2_phy_power_on()
1972 mutex_lock(&padctl->lock); in tegra210_usb2_phy_power_on()
1974 if (port->usb3_port_fake != -1) { in tegra210_usb2_phy_power_on()
1977 port->usb3_port_fake); in tegra210_usb2_phy_power_on()
1979 port->usb3_port_fake, index); in tegra210_usb2_phy_power_on()
1984 port->usb3_port_fake); in tegra210_usb2_phy_power_on()
1991 port->usb3_port_fake); in tegra210_usb2_phy_power_on()
1998 port->usb3_port_fake); in tegra210_usb2_phy_power_on()
2019 if (port->mode == USB_DR_MODE_UNKNOWN) in tegra210_usb2_phy_power_on()
2021 else if (port->mode == USB_DR_MODE_PERIPHERAL) in tegra210_usb2_phy_power_on()
2023 else if (port->mode == USB_DR_MODE_HOST) in tegra210_usb2_phy_power_on()
2025 else if (port->mode == USB_DR_MODE_OTG) in tegra210_usb2_phy_power_on()
2035 value |= (priv->fuse.hs_curr_level[index] + in tegra210_usb2_phy_power_on()
2036 usb2->hs_curr_level_offset) << in tegra210_usb2_phy_power_on()
2048 value |= (priv->fuse.hs_term_range_adj << in tegra210_usb2_phy_power_on()
2050 (priv->fuse.rpd_ctrl << in tegra210_usb2_phy_power_on()
2058 if (port->mode == USB_DR_MODE_HOST) in tegra210_usb2_phy_power_on()
2067 if (pad->enable > 0) { in tegra210_usb2_phy_power_on()
2068 pad->enable++; in tegra210_usb2_phy_power_on()
2069 mutex_unlock(&padctl->lock); in tegra210_usb2_phy_power_on()
2073 err = clk_prepare_enable(pad->clk); in tegra210_usb2_phy_power_on()
2100 clk_disable_unprepare(pad->clk); in tegra210_usb2_phy_power_on()
2102 pad->enable++; in tegra210_usb2_phy_power_on()
2103 mutex_unlock(&padctl->lock); in tegra210_usb2_phy_power_on()
2108 mutex_unlock(&padctl->lock); in tegra210_usb2_phy_power_on()
2115 struct tegra_xusb_usb2_pad *pad = to_usb2_pad(lane->pad); in tegra210_usb2_phy_power_off()
2116 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb2_phy_power_off()
2120 port = tegra_xusb_find_usb2_port(padctl, lane->index); in tegra210_usb2_phy_power_off()
2122 dev_err(&phy->dev, "no port found for USB2 lane %u\n", in tegra210_usb2_phy_power_off()
2123 lane->index); in tegra210_usb2_phy_power_off()
2124 return -ENODEV; in tegra210_usb2_phy_power_off()
2127 mutex_lock(&padctl->lock); in tegra210_usb2_phy_power_off()
2129 if (port->usb3_port_fake != -1) { in tegra210_usb2_phy_power_off()
2132 port->usb3_port_fake); in tegra210_usb2_phy_power_off()
2139 port->usb3_port_fake); in tegra210_usb2_phy_power_off()
2146 port->usb3_port_fake); in tegra210_usb2_phy_power_off()
2150 value |= XUSB_PADCTL_SS_PORT_MAP_PORTX_MAP(port->usb3_port_fake, in tegra210_usb2_phy_power_off()
2155 if (WARN_ON(pad->enable == 0)) in tegra210_usb2_phy_power_off()
2158 if (--pad->enable > 0) in tegra210_usb2_phy_power_off()
2166 mutex_unlock(&padctl->lock); in tegra210_usb2_phy_power_off()
2190 return ERR_PTR(-ENOMEM); in tegra210_usb2_pad_probe()
2192 pad = &usb2->base; in tegra210_usb2_pad_probe()
2193 pad->ops = &tegra210_usb2_lane_ops; in tegra210_usb2_pad_probe()
2194 pad->soc = soc; in tegra210_usb2_pad_probe()
2202 usb2->clk = devm_clk_get(&pad->dev, "trk"); in tegra210_usb2_pad_probe()
2203 if (IS_ERR(usb2->clk)) { in tegra210_usb2_pad_probe()
2204 err = PTR_ERR(usb2->clk); in tegra210_usb2_pad_probe()
2205 dev_err(&pad->dev, "failed to get trk clock: %d\n", err); in tegra210_usb2_pad_probe()
2213 dev_set_drvdata(&pad->dev, pad); in tegra210_usb2_pad_probe()
2218 device_unregister(&pad->dev); in tegra210_usb2_pad_probe()
2248 TEGRA210_LANE("hsic-0", 0x004, 14, 0x1, hsic),
2260 return ERR_PTR(-ENOMEM); in tegra210_hsic_lane_probe()
2262 INIT_LIST_HEAD(&hsic->base.list); in tegra210_hsic_lane_probe()
2263 hsic->base.soc = &pad->soc->lanes[index]; in tegra210_hsic_lane_probe()
2264 hsic->base.index = index; in tegra210_hsic_lane_probe()
2265 hsic->base.pad = pad; in tegra210_hsic_lane_probe()
2266 hsic->base.np = np; in tegra210_hsic_lane_probe()
2268 err = tegra_xusb_lane_parse_dt(&hsic->base, np); in tegra210_hsic_lane_probe()
2274 return &hsic->base; in tegra210_hsic_lane_probe()
2297 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_hsic_phy_init()
2319 struct tegra_xusb_hsic_pad *pad = to_hsic_pad(lane->pad); in tegra210_hsic_phy_power_on()
2320 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_hsic_phy_power_on()
2321 unsigned int index = lane->index; in tegra210_hsic_phy_power_on()
2325 err = regulator_enable(pad->supply); in tegra210_hsic_phy_power_on()
2329 padctl_writel(padctl, hsic->strobe_trim, in tegra210_hsic_phy_power_on()
2335 value |= (hsic->tx_rtune_p << in tegra210_hsic_phy_power_on()
2344 value |= (hsic->rx_strobe_trim << in tegra210_hsic_phy_power_on()
2346 (hsic->rx_data_trim << in tegra210_hsic_phy_power_on()
2368 err = clk_prepare_enable(pad->clk); in tegra210_hsic_phy_power_on()
2391 clk_disable_unprepare(pad->clk); in tegra210_hsic_phy_power_on()
2396 regulator_disable(pad->supply); in tegra210_hsic_phy_power_on()
2403 struct tegra_xusb_hsic_pad *pad = to_hsic_pad(lane->pad); in tegra210_hsic_phy_power_off()
2404 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_hsic_phy_power_off()
2405 unsigned int index = lane->index; in tegra210_hsic_phy_power_off()
2420 regulator_disable(pad->supply); in tegra210_hsic_phy_power_off()
2444 return ERR_PTR(-ENOMEM); in tegra210_hsic_pad_probe()
2446 pad = &hsic->base; in tegra210_hsic_pad_probe()
2447 pad->ops = &tegra210_hsic_lane_ops; in tegra210_hsic_pad_probe()
2448 pad->soc = soc; in tegra210_hsic_pad_probe()
2456 hsic->clk = devm_clk_get(&pad->dev, "trk"); in tegra210_hsic_pad_probe()
2457 if (IS_ERR(hsic->clk)) { in tegra210_hsic_pad_probe()
2458 err = PTR_ERR(hsic->clk); in tegra210_hsic_pad_probe()
2459 dev_err(&pad->dev, "failed to get trk clock: %d\n", err); in tegra210_hsic_pad_probe()
2467 dev_set_drvdata(&pad->dev, pad); in tegra210_hsic_pad_probe()
2472 device_unregister(&pad->dev); in tegra210_hsic_pad_probe()
2498 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_uphy_lane_iddq_enable()
2501 value = padctl_readl(padctl, lane->soc->regs.misc_ctl2); in tegra210_uphy_lane_iddq_enable()
2512 padctl_writel(padctl, value, lane->soc->regs.misc_ctl2); in tegra210_uphy_lane_iddq_enable()
2517 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_uphy_lane_iddq_disable()
2520 value = padctl_readl(padctl, lane->soc->regs.misc_ctl2); in tegra210_uphy_lane_iddq_disable()
2531 padctl_writel(padctl, value, lane->soc->regs.misc_ctl2); in tegra210_uphy_lane_iddq_disable()
2546 "pcie-x1",
2547 "usb3-ss",
2549 "pcie-x4",
2553 TEGRA210_UPHY_LANE("pcie-0", 0x028, 12, 0x3, pcie, XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2(0)),
2554 TEGRA210_UPHY_LANE("pcie-1", 0x028, 14, 0x3, pcie, XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2(1)),
2555 TEGRA210_UPHY_LANE("pcie-2", 0x028, 16, 0x3, pcie, XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2(2)),
2556 TEGRA210_UPHY_LANE("pcie-3", 0x028, 18, 0x3, pcie, XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2(3)),
2557 TEGRA210_UPHY_LANE("pcie-4", 0x028, 20, 0x3, pcie, XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2(4)),
2558 TEGRA210_UPHY_LANE("pcie-5", 0x028, 22, 0x3, pcie, XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2(5)),
2559 TEGRA210_UPHY_LANE("pcie-6", 0x028, 24, 0x3, pcie, XUSB_PADCTL_UPHY_MISC_PAD_PX_CTL2(6)),
2567 if (!lane || !lane->pad || !lane->pad->padctl) in tegra210_lane_to_usb3_port()
2574 return tegra_xusb_find_usb3_port(lane->pad->padctl, port); in tegra210_lane_to_usb3_port()
2579 struct device *dev = &phy->dev; in tegra210_usb3_phy_power_on()
2581 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb3_phy_power_on()
2587 dev_err(dev, "no USB3 port found for lane %u\n", lane->index); in tegra210_usb3_phy_power_on()
2588 return -ENODEV; in tegra210_usb3_phy_power_on()
2591 index = usb3->base.index; in tegra210_usb3_phy_power_on()
2595 if (!usb3->internal) in tegra210_usb3_phy_power_on()
2601 value |= XUSB_PADCTL_SS_PORT_MAP_PORTX_MAP(index, usb3->port); in tegra210_usb3_phy_power_on()
2652 struct device *dev = &phy->dev; in tegra210_usb3_phy_power_off()
2654 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_usb3_phy_power_off()
2660 dev_err(dev, "no USB3 port found for lane %u\n", lane->index); in tegra210_usb3_phy_power_off()
2661 return -ENODEV; in tegra210_usb3_phy_power_off()
2664 index = usb3->base.index; in tegra210_usb3_phy_power_off()
2693 return ERR_PTR(-ENOMEM); in tegra210_pcie_lane_probe()
2695 INIT_LIST_HEAD(&pcie->base.list); in tegra210_pcie_lane_probe()
2696 pcie->base.soc = &pad->soc->lanes[index]; in tegra210_pcie_lane_probe()
2697 pcie->base.index = index; in tegra210_pcie_lane_probe()
2698 pcie->base.pad = pad; in tegra210_pcie_lane_probe()
2699 pcie->base.np = np; in tegra210_pcie_lane_probe()
2701 err = tegra_xusb_lane_parse_dt(&pcie->base, np); in tegra210_pcie_lane_probe()
2707 return &pcie->base; in tegra210_pcie_lane_probe()
2732 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_pcie_phy_init()
2734 mutex_lock(&padctl->lock); in tegra210_pcie_phy_init()
2738 mutex_unlock(&padctl->lock); in tegra210_pcie_phy_init()
2746 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_pcie_phy_power_on()
2749 mutex_lock(&padctl->lock); in tegra210_pcie_phy_power_on()
2751 if (tegra_xusb_lane_check(lane, "usb3-ss")) in tegra210_pcie_phy_power_on()
2754 mutex_unlock(&padctl->lock); in tegra210_pcie_phy_power_on()
2761 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_pcie_phy_power_off()
2764 mutex_lock(&padctl->lock); in tegra210_pcie_phy_power_off()
2766 if (tegra_xusb_lane_check(lane, "usb3-ss")) in tegra210_pcie_phy_power_off()
2769 mutex_unlock(&padctl->lock); in tegra210_pcie_phy_power_off()
2791 return ERR_PTR(-ENOMEM); in tegra210_pcie_pad_probe()
2793 pad = &pcie->base; in tegra210_pcie_pad_probe()
2794 pad->ops = &tegra210_pcie_lane_ops; in tegra210_pcie_pad_probe()
2795 pad->soc = soc; in tegra210_pcie_pad_probe()
2803 pcie->pll = devm_clk_get(&pad->dev, "pll"); in tegra210_pcie_pad_probe()
2804 if (IS_ERR(pcie->pll)) { in tegra210_pcie_pad_probe()
2805 err = PTR_ERR(pcie->pll); in tegra210_pcie_pad_probe()
2806 dev_err(&pad->dev, "failed to get PLL: %d\n", err); in tegra210_pcie_pad_probe()
2810 pcie->rst = devm_reset_control_get(&pad->dev, "phy"); in tegra210_pcie_pad_probe()
2811 if (IS_ERR(pcie->rst)) { in tegra210_pcie_pad_probe()
2812 err = PTR_ERR(pcie->rst); in tegra210_pcie_pad_probe()
2813 dev_err(&pad->dev, "failed to get PCIe pad reset: %d\n", err); in tegra210_pcie_pad_probe()
2821 dev_set_drvdata(&pad->dev, pad); in tegra210_pcie_pad_probe()
2826 device_unregister(&pad->dev); in tegra210_pcie_pad_probe()
2851 TEGRA210_UPHY_LANE("sata-0", 0x028, 30, 0x3, pcie, XUSB_PADCTL_UPHY_MISC_PAD_S0_CTL2),
2863 return ERR_PTR(-ENOMEM); in tegra210_sata_lane_probe()
2865 INIT_LIST_HEAD(&sata->base.list); in tegra210_sata_lane_probe()
2866 sata->base.soc = &pad->soc->lanes[index]; in tegra210_sata_lane_probe()
2867 sata->base.index = index; in tegra210_sata_lane_probe()
2868 sata->base.pad = pad; in tegra210_sata_lane_probe()
2869 sata->base.np = np; in tegra210_sata_lane_probe()
2871 err = tegra_xusb_lane_parse_dt(&sata->base, np); in tegra210_sata_lane_probe()
2877 return &sata->base; in tegra210_sata_lane_probe()
2902 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_sata_phy_init()
2904 mutex_lock(&padctl->lock); in tegra210_sata_phy_init()
2908 mutex_unlock(&padctl->lock); in tegra210_sata_phy_init()
2915 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_sata_phy_power_on()
2918 mutex_lock(&padctl->lock); in tegra210_sata_phy_power_on()
2920 if (tegra_xusb_lane_check(lane, "usb3-ss")) in tegra210_sata_phy_power_on()
2923 mutex_unlock(&padctl->lock); in tegra210_sata_phy_power_on()
2930 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra210_sata_phy_power_off()
2933 mutex_lock(&padctl->lock); in tegra210_sata_phy_power_off()
2935 if (tegra_xusb_lane_check(lane, "usb3-ss")) in tegra210_sata_phy_power_off()
2938 mutex_unlock(&padctl->lock); in tegra210_sata_phy_power_off()
2960 return ERR_PTR(-ENOMEM); in tegra210_sata_pad_probe()
2962 pad = &sata->base; in tegra210_sata_pad_probe()
2963 pad->ops = &tegra210_sata_lane_ops; in tegra210_sata_pad_probe()
2964 pad->soc = soc; in tegra210_sata_pad_probe()
2972 sata->rst = devm_reset_control_get(&pad->dev, "phy"); in tegra210_sata_pad_probe()
2973 if (IS_ERR(sata->rst)) { in tegra210_sata_pad_probe()
2974 err = PTR_ERR(sata->rst); in tegra210_sata_pad_probe()
2975 dev_err(&pad->dev, "failed to get SATA pad reset: %d\n", err); in tegra210_sata_pad_probe()
2983 dev_set_drvdata(&pad->dev, pad); in tegra210_sata_pad_probe()
2988 device_unregister(&pad->dev); in tegra210_sata_pad_probe()
3031 return tegra_xusb_find_lane(port->padctl, "usb2", port->index); in tegra210_usb2_port_map()
3054 return tegra_xusb_find_lane(port->padctl, "hsic", port->index); in tegra210_hsic_port_map()
3076 return tegra_xusb_port_find_lane(port, tegra210_usb3_map, "usb3-ss"); in tegra210_usb3_port_map()
3093 padctl = lane->pad->padctl; in tegra210_utmi_port_reset()
3096 XUSB_PADCTL_USB2_BATTERY_CHRG_OTGPADX_CTL0(lane->index)); in tegra210_utmi_port_reset()
3119 for (i = 0; i < ARRAY_SIZE(fuse->hs_curr_level); i++) { in tegra210_xusb_read_fuse_calibration()
3120 fuse->hs_curr_level[i] = in tegra210_xusb_read_fuse_calibration()
3125 fuse->hs_term_range_adj = in tegra210_xusb_read_fuse_calibration()
3133 fuse->rpd_ctrl = in tegra210_xusb_read_fuse_calibration()
3151 return ERR_PTR(-ENOMEM); in tegra210_xusb_padctl_probe()
3153 padctl->base.dev = dev; in tegra210_xusb_padctl_probe()
3154 padctl->base.soc = soc; in tegra210_xusb_padctl_probe()
3156 err = tegra210_xusb_read_fuse_calibration(&padctl->fuse); in tegra210_xusb_padctl_probe()
3160 np = of_parse_phandle(dev->of_node, "nvidia,pmc", 0); in tegra210_xusb_padctl_probe()
3173 return ERR_PTR(-EPROBE_DEFER); in tegra210_xusb_padctl_probe()
3175 padctl->regmap = dev_get_regmap(&pdev->dev, "usb_sleepwalk"); in tegra210_xusb_padctl_probe()
3176 if (!padctl->regmap) in tegra210_xusb_padctl_probe()
3180 return &padctl->base; in tegra210_xusb_padctl_probe()
3191 priv->context.usb2_pad_mux = in tegra210_xusb_padctl_save()
3193 priv->context.usb2_port_cap = in tegra210_xusb_padctl_save()
3195 priv->context.ss_port_map = in tegra210_xusb_padctl_save()
3197 priv->context.usb3_pad_mux = in tegra210_xusb_padctl_save()
3206 padctl_writel(padctl, priv->context.usb2_pad_mux, in tegra210_xusb_padctl_restore()
3208 padctl_writel(padctl, priv->context.usb2_port_cap, in tegra210_xusb_padctl_restore()
3210 padctl_writel(padctl, priv->context.ss_port_map, in tegra210_xusb_padctl_restore()
3213 list_for_each_entry(lane, &padctl->lanes, list) { in tegra210_xusb_padctl_restore()
3214 if (lane->pad->ops->iddq_enable) in tegra210_xusb_padctl_restore()
3218 padctl_writel(padctl, priv->context.usb3_pad_mux, in tegra210_xusb_padctl_restore()
3221 list_for_each_entry(lane, &padctl->lanes, list) { in tegra210_xusb_padctl_restore()
3222 if (lane->pad->ops->iddq_disable) in tegra210_xusb_padctl_restore()
3229 mutex_lock(&padctl->lock); in tegra210_xusb_padctl_suspend_noirq()
3235 mutex_unlock(&padctl->lock); in tegra210_xusb_padctl_suspend_noirq()
3241 mutex_lock(&padctl->lock); in tegra210_xusb_padctl_resume_noirq()
3247 mutex_unlock(&padctl->lock); in tegra210_xusb_padctl_resume_noirq()
3263 "avdd-pll-utmip",
3264 "avdd-pll-uerefe",
3265 "dvdd-pex-pll",
3266 "hvdd-pex-pll-e",