Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: cadence: salvo: Add cdns,usb2-disconnect-threshold-microvolt property

Add cdns,usb2-disconnect-threshold-microvolt property to address fake USB
disconnection issue during enumeration or suspend state for difference
platform.

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20230517161646.3418250-6-Frank.Li@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Frank Li and committed by
Vinod Koul
e8c33361 3ad5cebe

+29
+29
drivers/phy/cadence/phy-cadence-salvo.c
··· 6 6 * Copyright (c) 2019-2020 NXP 7 7 */ 8 8 9 + #include <linux/bitfield.h> 9 10 #include <linux/clk.h> 10 11 #include <linux/io.h> 11 12 #include <linux/module.h> ··· 92 91 93 92 /* USB2 PHY register definition */ 94 93 #define UTMI_REG15 0xaf 94 + #define UTMI_AFE_RX_REG0 0x0d 95 95 #define UTMI_AFE_RX_REG5 0x12 96 96 #define UTMI_AFE_BC_REG4 0x29 97 + 98 + /* Align UTMI_AFE_RX_REG0 bit[7:6] define */ 99 + enum usb2_disconn_threshold { 100 + USB2_DISCONN_THRESHOLD_575 = 0x0, 101 + USB2_DISCONN_THRESHOLD_610 = 0x1, 102 + USB2_DISCONN_THRESHOLD_645 = 0x3, 103 + }; 104 + 105 + #define RX_USB2_DISCONN_MASK GENMASK(7, 6) 97 106 98 107 /* TB_ADDR_TX_RCVDETSC_CTRL */ 99 108 #define RXDET_IN_P3_32KHZ BIT(0) ··· 136 125 struct clk *clk; 137 126 void __iomem *base; 138 127 struct cdns_salvo_data *data; 128 + enum usb2_disconn_threshold usb2_disconn; 139 129 }; 140 130 141 131 static const struct of_device_id cdns_salvo_phy_of_match[]; ··· 272 260 value | TXVALID_GATE_THRESHOLD_HS_0US); 273 261 274 262 cdns_salvo_write(salvo_phy, USB2_PHY_OFFSET, UTMI_AFE_RX_REG5, 0x5); 263 + 264 + value = cdns_salvo_read(salvo_phy, USB2_PHY_OFFSET, UTMI_AFE_RX_REG0); 265 + value &= ~RX_USB2_DISCONN_MASK; 266 + value = FIELD_PREP(RX_USB2_DISCONN_MASK, salvo_phy->usb2_disconn); 267 + cdns_salvo_write(salvo_phy, USB2_PHY_OFFSET, UTMI_AFE_RX_REG0, value); 268 + 275 269 udelay(10); 276 270 277 271 clk_disable_unprepare(salvo_phy->clk); ··· 332 314 struct device *dev = &pdev->dev; 333 315 struct cdns_salvo_phy *salvo_phy; 334 316 struct cdns_salvo_data *data; 317 + u32 val; 335 318 336 319 data = (struct cdns_salvo_data *)of_device_get_match_data(dev); 337 320 salvo_phy = devm_kzalloc(dev, sizeof(*salvo_phy), GFP_KERNEL); ··· 343 324 salvo_phy->clk = devm_clk_get_optional(dev, "salvo_phy_clk"); 344 325 if (IS_ERR(salvo_phy->clk)) 345 326 return PTR_ERR(salvo_phy->clk); 327 + 328 + if (of_property_read_u32(dev->of_node, "cdns,usb2-disconnect-threshold-microvolt", &val)) 329 + val = 575; 330 + 331 + if (val < 610) 332 + salvo_phy->usb2_disconn = USB2_DISCONN_THRESHOLD_575; 333 + else if (val < 645) 334 + salvo_phy->usb2_disconn = USB2_DISCONN_THRESHOLD_610; 335 + else 336 + salvo_phy->usb2_disconn = USB2_DISCONN_THRESHOLD_645; 346 337 347 338 salvo_phy->base = devm_platform_ioremap_resource(pdev, 0); 348 339 if (IS_ERR(salvo_phy->base))