Lines Matching full:padctl

31 /* XUSB PADCTL registers */
261 /* padctl context */
276 to_tegra186_xusb_padctl(struct tegra_xusb_padctl *padctl) in to_tegra186_xusb_padctl() argument
278 return container_of(padctl, struct tegra186_xusb_padctl, base); in to_tegra186_xusb_padctl()
318 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_utmi_enable_phy_sleepwalk() local
319 struct tegra186_xusb_padctl *priv = to_tegra186_xusb_padctl(padctl); in tegra186_utmi_enable_phy_sleepwalk()
323 mutex_lock(&padctl->lock); in tegra186_utmi_enable_phy_sleepwalk()
455 mutex_unlock(&padctl->lock); in tegra186_utmi_enable_phy_sleepwalk()
462 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_utmi_disable_phy_sleepwalk() local
463 struct tegra186_xusb_padctl *priv = to_tegra186_xusb_padctl(padctl); in tegra186_utmi_disable_phy_sleepwalk()
467 mutex_lock(&padctl->lock); in tegra186_utmi_disable_phy_sleepwalk()
496 mutex_unlock(&padctl->lock); in tegra186_utmi_disable_phy_sleepwalk()
503 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_utmi_enable_phy_wake() local
507 mutex_lock(&padctl->lock); in tegra186_utmi_enable_phy_wake()
509 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_utmi_enable_phy_wake()
512 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_utmi_enable_phy_wake()
516 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_utmi_enable_phy_wake()
519 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_utmi_enable_phy_wake()
521 mutex_unlock(&padctl->lock); in tegra186_utmi_enable_phy_wake()
528 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_utmi_disable_phy_wake() local
532 mutex_lock(&padctl->lock); in tegra186_utmi_disable_phy_wake()
534 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_utmi_disable_phy_wake()
537 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_utmi_disable_phy_wake()
541 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_utmi_disable_phy_wake()
544 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_utmi_disable_phy_wake()
546 mutex_unlock(&padctl->lock); in tegra186_utmi_disable_phy_wake()
553 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_utmi_phy_remote_wake_detected() local
557 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_utmi_phy_remote_wake_detected()
575 static void tegra186_utmi_bias_pad_power_on(struct tegra_xusb_padctl *padctl) in tegra186_utmi_bias_pad_power_on() argument
577 struct tegra186_xusb_padctl *priv = to_tegra186_xusb_padctl(padctl); in tegra186_utmi_bias_pad_power_on()
578 struct device *dev = padctl->dev; in tegra186_utmi_bias_pad_power_on()
582 mutex_lock(&padctl->lock); in tegra186_utmi_bias_pad_power_on()
585 mutex_unlock(&padctl->lock); in tegra186_utmi_bias_pad_power_on()
593 value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); in tegra186_utmi_bias_pad_power_on()
598 padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); in tegra186_utmi_bias_pad_power_on()
600 value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); in tegra186_utmi_bias_pad_power_on()
604 padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); in tegra186_utmi_bias_pad_power_on()
608 value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); in tegra186_utmi_bias_pad_power_on()
610 padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); in tegra186_utmi_bias_pad_power_on()
612 mutex_unlock(&padctl->lock); in tegra186_utmi_bias_pad_power_on()
615 static void tegra186_utmi_bias_pad_power_off(struct tegra_xusb_padctl *padctl) in tegra186_utmi_bias_pad_power_off() argument
617 struct tegra186_xusb_padctl *priv = to_tegra186_xusb_padctl(padctl); in tegra186_utmi_bias_pad_power_off()
620 mutex_lock(&padctl->lock); in tegra186_utmi_bias_pad_power_off()
623 mutex_unlock(&padctl->lock); in tegra186_utmi_bias_pad_power_off()
628 mutex_unlock(&padctl->lock); in tegra186_utmi_bias_pad_power_off()
632 value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); in tegra186_utmi_bias_pad_power_off()
634 padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); in tegra186_utmi_bias_pad_power_off()
638 mutex_unlock(&padctl->lock); in tegra186_utmi_bias_pad_power_off()
644 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra_phy_xusb_utmi_pad_power_on() local
646 struct device *dev = padctl->dev; in tegra_phy_xusb_utmi_pad_power_on()
653 port = tegra_xusb_find_usb2_port(padctl, index); in tegra_phy_xusb_utmi_pad_power_on()
659 tegra186_utmi_bias_pad_power_on(padctl); in tegra_phy_xusb_utmi_pad_power_on()
663 value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); in tegra_phy_xusb_utmi_pad_power_on()
665 padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); in tegra_phy_xusb_utmi_pad_power_on()
667 value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); in tegra_phy_xusb_utmi_pad_power_on()
669 padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); in tegra_phy_xusb_utmi_pad_power_on()
675 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra_phy_xusb_utmi_pad_power_down() local
682 value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); in tegra_phy_xusb_utmi_pad_power_down()
684 padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); in tegra_phy_xusb_utmi_pad_power_down()
686 value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); in tegra_phy_xusb_utmi_pad_power_down()
688 padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); in tegra_phy_xusb_utmi_pad_power_down()
692 tegra186_utmi_bias_pad_power_off(padctl); in tegra_phy_xusb_utmi_pad_power_down()
695 static int tegra186_xusb_padctl_vbus_override(struct tegra_xusb_padctl *padctl, in tegra186_xusb_padctl_vbus_override() argument
700 dev_dbg(padctl->dev, "%s vbus override\n", status ? "set" : "clear"); in tegra186_xusb_padctl_vbus_override()
702 value = padctl_readl(padctl, USB2_VBUS_ID); in tegra186_xusb_padctl_vbus_override()
712 padctl_writel(padctl, value, USB2_VBUS_ID); in tegra186_xusb_padctl_vbus_override()
717 static int tegra186_xusb_padctl_id_override(struct tegra_xusb_padctl *padctl, in tegra186_xusb_padctl_id_override() argument
722 dev_dbg(padctl->dev, "%s id override\n", status ? "set" : "clear"); in tegra186_xusb_padctl_id_override()
724 value = padctl_readl(padctl, USB2_VBUS_ID); in tegra186_xusb_padctl_id_override()
729 padctl_writel(padctl, value, USB2_VBUS_ID); in tegra186_xusb_padctl_id_override()
732 value = padctl_readl(padctl, USB2_VBUS_ID); in tegra186_xusb_padctl_id_override()
742 padctl_writel(padctl, value, USB2_VBUS_ID); in tegra186_xusb_padctl_id_override()
751 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_utmi_phy_set_mode() local
752 struct tegra_xusb_usb2_port *port = tegra_xusb_find_usb2_port(padctl, in tegra186_utmi_phy_set_mode()
756 mutex_lock(&padctl->lock); in tegra186_utmi_phy_set_mode()
762 tegra186_xusb_padctl_id_override(padctl, true); in tegra186_utmi_phy_set_mode()
766 tegra186_xusb_padctl_vbus_override(padctl, true); in tegra186_utmi_phy_set_mode()
776 tegra186_xusb_padctl_id_override(padctl, false); in tegra186_utmi_phy_set_mode()
777 tegra186_xusb_padctl_vbus_override(padctl, false); in tegra186_utmi_phy_set_mode()
781 mutex_unlock(&padctl->lock); in tegra186_utmi_phy_set_mode()
790 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_utmi_phy_power_on() local
791 struct tegra186_xusb_padctl *priv = to_tegra186_xusb_padctl(padctl); in tegra186_utmi_phy_power_on()
794 struct device *dev = padctl->dev; in tegra186_utmi_phy_power_on()
797 port = tegra_xusb_find_usb2_port(padctl, index); in tegra186_utmi_phy_power_on()
803 value = padctl_readl(padctl, XUSB_PADCTL_USB2_PAD_MUX); in tegra186_utmi_phy_power_on()
806 padctl_writel(padctl, value, XUSB_PADCTL_USB2_PAD_MUX); in tegra186_utmi_phy_power_on()
808 value = padctl_readl(padctl, XUSB_PADCTL_USB2_PORT_CAP); in tegra186_utmi_phy_power_on()
820 padctl_writel(padctl, value, XUSB_PADCTL_USB2_PORT_CAP); in tegra186_utmi_phy_power_on()
822 value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); in tegra186_utmi_phy_power_on()
843 padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); in tegra186_utmi_phy_power_on()
845 value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); in tegra186_utmi_phy_power_on()
850 padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); in tegra186_utmi_phy_power_on()
868 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_utmi_phy_init() local
871 struct device *dev = padctl->dev; in tegra186_utmi_phy_init()
874 port = tegra_xusb_find_usb2_port(padctl, index); in tegra186_utmi_phy_init()
895 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_utmi_phy_exit() local
898 struct device *dev = padctl->dev; in tegra186_utmi_phy_exit()
901 port = tegra_xusb_find_usb2_port(padctl, index); in tegra186_utmi_phy_exit()
929 tegra186_usb2_pad_probe(struct tegra_xusb_padctl *padctl, in tegra186_usb2_pad_probe() argument
933 struct tegra186_xusb_padctl *priv = to_tegra186_xusb_padctl(padctl); in tegra186_usb2_pad_probe()
946 err = tegra_xusb_pad_init(pad, padctl, np); in tegra186_usb2_pad_probe()
1001 return tegra_xusb_find_lane(port->padctl, "usb2", port->index); in tegra186_usb2_port_map()
1049 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_usb3_enable_phy_sleepwalk() local
1053 mutex_lock(&padctl->lock); in tegra186_usb3_enable_phy_sleepwalk()
1055 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_enable_phy_sleepwalk()
1057 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_enable_phy_sleepwalk()
1061 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_enable_phy_sleepwalk()
1063 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_enable_phy_sleepwalk()
1067 mutex_unlock(&padctl->lock); in tegra186_usb3_enable_phy_sleepwalk()
1074 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_usb3_disable_phy_sleepwalk() local
1078 mutex_lock(&padctl->lock); in tegra186_usb3_disable_phy_sleepwalk()
1080 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_disable_phy_sleepwalk()
1082 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_disable_phy_sleepwalk()
1086 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_disable_phy_sleepwalk()
1088 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_disable_phy_sleepwalk()
1090 mutex_unlock(&padctl->lock); in tegra186_usb3_disable_phy_sleepwalk()
1097 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_usb3_enable_phy_wake() local
1101 mutex_lock(&padctl->lock); in tegra186_usb3_enable_phy_wake()
1103 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_usb3_enable_phy_wake()
1106 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_usb3_enable_phy_wake()
1110 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_usb3_enable_phy_wake()
1113 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_usb3_enable_phy_wake()
1115 mutex_unlock(&padctl->lock); in tegra186_usb3_enable_phy_wake()
1122 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_usb3_disable_phy_wake() local
1126 mutex_lock(&padctl->lock); in tegra186_usb3_disable_phy_wake()
1128 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_usb3_disable_phy_wake()
1131 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_usb3_disable_phy_wake()
1135 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_usb3_disable_phy_wake()
1138 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_usb3_disable_phy_wake()
1140 mutex_unlock(&padctl->lock); in tegra186_usb3_disable_phy_wake()
1147 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_usb3_phy_remote_wake_detected() local
1151 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM); in tegra186_usb3_phy_remote_wake_detected()
1180 return tegra_xusb_find_lane(port->padctl, "usb3", port->index); in tegra186_usb3_port_map()
1194 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_usb3_phy_power_on() local
1198 struct device *dev = padctl->dev; in tegra186_usb3_phy_power_on()
1201 port = tegra_xusb_find_usb3_port(padctl, index); in tegra186_usb3_phy_power_on()
1207 usb2 = tegra_xusb_find_usb2_port(padctl, port->port); in tegra186_usb3_phy_power_on()
1214 mutex_lock(&padctl->lock); in tegra186_usb3_phy_power_on()
1216 value = padctl_readl(padctl, XUSB_PADCTL_SS_PORT_CAP); in tegra186_usb3_phy_power_on()
1228 padctl_writel(padctl, value, XUSB_PADCTL_SS_PORT_CAP); in tegra186_usb3_phy_power_on()
1230 if (padctl->soc->supports_gen2 && port->disable_gen2) { in tegra186_usb3_phy_power_on()
1231 value = padctl_readl(padctl, XUSB_PADCTL_SS_PORT_CFG); in tegra186_usb3_phy_power_on()
1236 padctl_writel(padctl, value, XUSB_PADCTL_SS_PORT_CFG); in tegra186_usb3_phy_power_on()
1239 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_on()
1241 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_on()
1245 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_on()
1247 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_on()
1251 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_on()
1253 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_on()
1255 mutex_unlock(&padctl->lock); in tegra186_usb3_phy_power_on()
1263 struct tegra_xusb_padctl *padctl = lane->pad->padctl; in tegra186_usb3_phy_power_off() local
1266 struct device *dev = padctl->dev; in tegra186_usb3_phy_power_off()
1269 port = tegra_xusb_find_usb3_port(padctl, index); in tegra186_usb3_phy_power_off()
1275 mutex_lock(&padctl->lock); in tegra186_usb3_phy_power_off()
1277 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_off()
1279 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_off()
1283 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_off()
1285 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_off()
1289 value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_off()
1291 padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM_1); in tegra186_usb3_phy_power_off()
1293 mutex_unlock(&padctl->lock); in tegra186_usb3_phy_power_off()
1317 tegra186_usb3_pad_probe(struct tegra_xusb_padctl *padctl, in tegra186_usb3_pad_probe() argument
1333 err = tegra_xusb_pad_init(pad, padctl, np); in tegra186_usb3_pad_probe()
1370 tegra186_xusb_read_fuse_calibration(struct tegra186_xusb_padctl *padctl) in tegra186_xusb_read_fuse_calibration() argument
1372 struct device *dev = padctl->base.dev; in tegra186_xusb_read_fuse_calibration()
1377 count = padctl->base.soc->ports.usb2.count; in tegra186_xusb_read_fuse_calibration()
1397 padctl->calib.hs_curr_level = level; in tegra186_xusb_read_fuse_calibration()
1399 padctl->calib.hs_squelch = (value >> HS_SQUELCH_SHIFT) & in tegra186_xusb_read_fuse_calibration()
1401 padctl->calib.hs_term_range_adj = (value >> HS_TERM_RANGE_ADJ_SHIFT) & in tegra186_xusb_read_fuse_calibration()
1412 padctl->calib.rpd_ctrl = (value >> RPD_CTRL_SHIFT) & RPD_CTRL_MASK; in tegra186_xusb_read_fuse_calibration()
1445 static void tegra186_xusb_padctl_save(struct tegra_xusb_padctl *padctl) in tegra186_xusb_padctl_save() argument
1447 struct tegra186_xusb_padctl *priv = to_tegra186_xusb_padctl(padctl); in tegra186_xusb_padctl_save()
1449 priv->context.vbus_id = padctl_readl(padctl, USB2_VBUS_ID); in tegra186_xusb_padctl_save()
1450 priv->context.usb2_pad_mux = padctl_readl(padctl, XUSB_PADCTL_USB2_PAD_MUX); in tegra186_xusb_padctl_save()
1451 priv->context.usb2_port_cap = padctl_readl(padctl, XUSB_PADCTL_USB2_PORT_CAP); in tegra186_xusb_padctl_save()
1452 priv->context.ss_port_cap = padctl_readl(padctl, XUSB_PADCTL_SS_PORT_CAP); in tegra186_xusb_padctl_save()
1455 static void tegra186_xusb_padctl_restore(struct tegra_xusb_padctl *padctl) in tegra186_xusb_padctl_restore() argument
1457 struct tegra186_xusb_padctl *priv = to_tegra186_xusb_padctl(padctl); in tegra186_xusb_padctl_restore()
1459 padctl_writel(padctl, priv->context.usb2_pad_mux, XUSB_PADCTL_USB2_PAD_MUX); in tegra186_xusb_padctl_restore()
1460 padctl_writel(padctl, priv->context.usb2_port_cap, XUSB_PADCTL_USB2_PORT_CAP); in tegra186_xusb_padctl_restore()
1461 padctl_writel(padctl, priv->context.ss_port_cap, XUSB_PADCTL_SS_PORT_CAP); in tegra186_xusb_padctl_restore()
1462 padctl_writel(padctl, priv->context.vbus_id, USB2_VBUS_ID); in tegra186_xusb_padctl_restore()
1465 static int tegra186_xusb_padctl_suspend_noirq(struct tegra_xusb_padctl *padctl) in tegra186_xusb_padctl_suspend_noirq() argument
1467 tegra186_xusb_padctl_save(padctl); in tegra186_xusb_padctl_suspend_noirq()
1472 static int tegra186_xusb_padctl_resume_noirq(struct tegra_xusb_padctl *padctl) in tegra186_xusb_padctl_resume_noirq() argument
1474 tegra186_xusb_padctl_restore(padctl); in tegra186_xusb_padctl_resume_noirq()
1479 static void tegra186_xusb_padctl_remove(struct tegra_xusb_padctl *padctl) in tegra186_xusb_padctl_remove() argument