Skip to content

Commit e5b2502

Browse files
clamor-sgregkh
authored andcommitted
usb: phy: tegra: parametrize PORTSC1 register offset
The PORTSC1 register has a different offset in Tegra20 compared to Tegra30+, yet they share a crucial set of registers required for HSIC functionality. Reflect this register offset change in the SoC config. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> Link: https://patch.msgid.link/20260202080526.23487-5-clamor95@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8dc7ab6 commit e5b2502

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

drivers/usb/phy/phy-tegra-usb.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -965,17 +965,10 @@ static int uhsic_phy_power_on(struct tegra_usb_phy *phy)
965965
writel_relaxed(val, base + USB_TXFILLTUNING);
966966
}
967967

968-
if (phy->soc_config->has_hostpc) {
969-
val = readl_relaxed(base + TEGRA30_USB_PORTSC1);
970-
val &= ~(TEGRA_USB_PORTSC1_WKOC | TEGRA_USB_PORTSC1_WKDS |
971-
TEGRA_USB_PORTSC1_WKCN);
972-
writel_relaxed(val, base + TEGRA30_USB_PORTSC1);
973-
} else {
974-
val = readl_relaxed(base + TEGRA_USB_PORTSC1);
975-
val &= ~(TEGRA_USB_PORTSC1_WKOC | TEGRA_USB_PORTSC1_WKDS |
976-
TEGRA_USB_PORTSC1_WKCN);
977-
writel_relaxed(val, base + TEGRA_USB_PORTSC1);
978-
}
968+
val = readl_relaxed(base + phy->soc_config->portsc1_offset);
969+
val &= ~(TEGRA_USB_PORTSC1_WKOC | TEGRA_USB_PORTSC1_WKDS |
970+
TEGRA_USB_PORTSC1_WKCN);
971+
writel_relaxed(val, base + phy->soc_config->portsc1_offset);
979972

980973
val = tegra_hsic_readl(phy, UHSIC_PADS_CFG0);
981974
val &= ~UHSIC_TX_RTUNEN;
@@ -1472,6 +1465,7 @@ static const struct tegra_phy_soc_config tegra20_soc_config = {
14721465
.uhsic_registers_offset = 0,
14731466
.uhsic_tx_rtune = 0, /* 40 ohm */
14741467
.uhsic_pts_value = 0, /* UTMI */
1468+
.portsc1_offset = TEGRA_USB_PORTSC1,
14751469
};
14761470

14771471
static const struct tegra_phy_soc_config tegra30_soc_config = {
@@ -1483,6 +1477,7 @@ static const struct tegra_phy_soc_config tegra30_soc_config = {
14831477
.uhsic_registers_offset = 0x400,
14841478
.uhsic_tx_rtune = 8, /* 50 ohm */
14851479
.uhsic_pts_value = TEGRA_USB_HOSTPC1_DEVLC_PTS_HSIC,
1480+
.portsc1_offset = TEGRA30_USB_PORTSC1,
14861481
};
14871482

14881483
static const struct of_device_id tegra_usb_phy_id_table[] = {

include/linux/usb/tegra_usb_phy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct gpio_desc;
2727
* comparing to Tegra20 by 0x400, since Tegra20 has no UTMIP on PHY2
2828
* uhsic_tx_rtune: fine tuned 50 Ohm termination resistor for NMOS/PMOS driver
2929
* uhsic_pts_value: parallel transceiver select enumeration value
30+
* portsc1_offset: register offset of PORTSC1
3031
*/
3132

3233
struct tegra_phy_soc_config {
@@ -38,6 +39,7 @@ struct tegra_phy_soc_config {
3839
u32 uhsic_registers_offset;
3940
u32 uhsic_tx_rtune;
4041
u32 uhsic_pts_value;
42+
u32 portsc1_offset;
4143
};
4244

4345
struct tegra_utmip_config {

0 commit comments

Comments
 (0)