Skip to content

Commit 37291f6

Browse files
robhancocksedvinodkoul
authored andcommitted
phy: xilinx: zynqmp: Fix bus width setting for SGMII
TX_PROT_BUS_WIDTH and RX_PROT_BUS_WIDTH are single registers with separate bit fields for each lane. The code in xpsgtr_phy_init_sgmii was not preserving the existing register value for other lanes, so enabling the PHY in SGMII mode on one lane zeroed out the settings for all other lanes, causing other PS-GTR peripherals such as USB3 to malfunction. Use xpsgtr_clr_set to only manipulate the desired bits in the register. Fixes: 4a33bea ("phy: zynqmp: Add PHY driver for the Xilinx ZynqMP Gigabit Transceiver") Signed-off-by: Robert Hancock <[email protected]> Acked-by: Michal Simek <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 29afbd7 commit 37291f6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/phy/xilinx/phy-zynqmp.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@
134134
#define PROT_BUS_WIDTH_10 0x0
135135
#define PROT_BUS_WIDTH_20 0x1
136136
#define PROT_BUS_WIDTH_40 0x2
137-
#define PROT_BUS_WIDTH_SHIFT 2
137+
#define PROT_BUS_WIDTH_SHIFT(n) ((n) * 2)
138+
#define PROT_BUS_WIDTH_MASK(n) GENMASK((n) * 2 + 1, (n) * 2)
138139

139140
/* Number of GT lanes */
140141
#define NUM_LANES 4
@@ -445,12 +446,12 @@ static void xpsgtr_phy_init_sata(struct xpsgtr_phy *gtr_phy)
445446
static void xpsgtr_phy_init_sgmii(struct xpsgtr_phy *gtr_phy)
446447
{
447448
struct xpsgtr_dev *gtr_dev = gtr_phy->dev;
449+
u32 mask = PROT_BUS_WIDTH_MASK(gtr_phy->lane);
450+
u32 val = PROT_BUS_WIDTH_10 << PROT_BUS_WIDTH_SHIFT(gtr_phy->lane);
448451

449452
/* Set SGMII protocol TX and RX bus width to 10 bits. */
450-
xpsgtr_write(gtr_dev, TX_PROT_BUS_WIDTH,
451-
PROT_BUS_WIDTH_10 << (gtr_phy->lane * PROT_BUS_WIDTH_SHIFT));
452-
xpsgtr_write(gtr_dev, RX_PROT_BUS_WIDTH,
453-
PROT_BUS_WIDTH_10 << (gtr_phy->lane * PROT_BUS_WIDTH_SHIFT));
453+
xpsgtr_clr_set(gtr_dev, TX_PROT_BUS_WIDTH, mask, val);
454+
xpsgtr_clr_set(gtr_dev, RX_PROT_BUS_WIDTH, mask, val);
454455

455456
xpsgtr_bypass_scrambler_8b10b(gtr_phy);
456457
}

0 commit comments

Comments
 (0)