Skip to content

Commit 6398fc0

Browse files
khayash1gregkh
authored andcommitted
phy: uniphier-pcie: Fix updating phy parameters
[ Upstream commit 4a90bbb ] The current driver uses a value from register TEST_O as the original value for register TEST_I, though, the value is overwritten by "param", so there is a bug that the original value isn't no longer used. The value of TEST_O[7:0] should be masked with "mask", replaced with "param", and placed in the bitfield TESTI_DAT_MASK as new TEST_I value. Fixes: c6d9b13 ("phy: socionext: add PCIe PHY driver support") Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Link: https://lore.kernel.org/r/1623037842-19363-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 a4b7c0a commit 6398fc0

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
#define PORT_SEL_1 FIELD_PREP(PORT_SEL_MASK, 1)
2525

2626
#define PCL_PHY_TEST_I 0x2000
27-
#define PCL_PHY_TEST_O 0x2004
2827
#define TESTI_DAT_MASK GENMASK(13, 6)
2928
#define TESTI_ADR_MASK GENMASK(5, 1)
3029
#define TESTI_WR_EN BIT(0)
3130

31+
#define PCL_PHY_TEST_O 0x2004
32+
#define TESTO_DAT_MASK GENMASK(7, 0)
33+
3234
#define PCL_PHY_RESET 0x200c
3335
#define PCL_PHY_RESET_N_MNMODE BIT(8) /* =1:manual */
3436
#define PCL_PHY_RESET_N BIT(0) /* =1:deasssert */
@@ -77,11 +79,12 @@ static void uniphier_pciephy_set_param(struct uniphier_pciephy_priv *priv,
7779
val = FIELD_PREP(TESTI_DAT_MASK, 1);
7880
val |= FIELD_PREP(TESTI_ADR_MASK, reg);
7981
uniphier_pciephy_testio_write(priv, val);
80-
val = readl(priv->base + PCL_PHY_TEST_O);
82+
val = readl(priv->base + PCL_PHY_TEST_O) & TESTO_DAT_MASK;
8183

8284
/* update value */
83-
val &= ~FIELD_PREP(TESTI_DAT_MASK, mask);
84-
val = FIELD_PREP(TESTI_DAT_MASK, mask & param);
85+
val &= ~mask;
86+
val |= mask & param;
87+
val = FIELD_PREP(TESTI_DAT_MASK, val);
8588
val |= FIELD_PREP(TESTI_ADR_MASK, reg);
8689
uniphier_pciephy_testio_write(priv, val);
8790
uniphier_pciephy_testio_write(priv, val | TESTI_WR_EN);

0 commit comments

Comments
 (0)