Skip to content

Commit c73ccdd

Browse files
Ryuta NAKANISHIgregkh
authored andcommitted
phy: uniphier-usb3ss: fix unintended writing zeros to PHY register
[ Upstream commit 898c7a9 ] Similar to commit 4a90bbb ("phy: uniphier-pcie: Fix updating phy parameters"), in function uniphier_u3ssphy_set_param(), unintentionally write zeros to other fields when writing PHY registers. Fixes: 5ab43d0 ("phy: socionext: add USB3 PHY driver for UniPhier SoC") Signed-off-by: Ryuta NAKANISHI <nakanishi.ryuta@socionext.com> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Link: https://lore.kernel.org/r/1640150369-4134-1-git-send-email-hayashi.kunihiko@socionext.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d781f4c commit c73ccdd

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎drivers/phy/socionext/phy-uniphier-usb3ss.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222
#include <linux/reset.h>
2323

2424
#define SSPHY_TESTI 0x0
25-
#define SSPHY_TESTO 0x4
2625
#define TESTI_DAT_MASK GENMASK(13, 6)
2726
#define TESTI_ADR_MASK GENMASK(5, 1)
2827
#define TESTI_WR_EN BIT(0)
2928

29+
#define SSPHY_TESTO 0x4
30+
#define TESTO_DAT_MASK GENMASK(7, 0)
31+
3032
#define PHY_F(regno, msb, lsb) { (regno), (msb), (lsb) }
3133

3234
#define CDR_CPD_TRIM PHY_F(7, 3, 0) /* RxPLL charge pump current */
@@ -84,12 +86,12 @@ static void uniphier_u3ssphy_set_param(struct uniphier_u3ssphy_priv *priv,
8486
val = FIELD_PREP(TESTI_DAT_MASK, 1);
8587
val |= FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no);
8688
uniphier_u3ssphy_testio_write(priv, val);
87-
val = readl(priv->base + SSPHY_TESTO);
89+
val = readl(priv->base + SSPHY_TESTO) & TESTO_DAT_MASK;
8890

8991
/* update value */
90-
val &= ~FIELD_PREP(TESTI_DAT_MASK, field_mask);
92+
val &= ~field_mask;
9193
data = field_mask & (p->value << p->field.lsb);
92-
val = FIELD_PREP(TESTI_DAT_MASK, data);
94+
val = FIELD_PREP(TESTI_DAT_MASK, data | val);
9395
val |= FIELD_PREP(TESTI_ADR_MASK, p->field.reg_no);
9496
uniphier_u3ssphy_testio_write(priv, val);
9597
uniphier_u3ssphy_testio_write(priv, val | TESTI_WR_EN);

0 commit comments

Comments
 (0)