Skip to content

Commit a338619

Browse files
wqyoungpinchartl
authored andcommitted
drm: xlnx: zynqmp: release reset to DP controller before accessing DP registers
When insmod zynqmp-dpsub.ko after rmmod it, system will hang with the error log as below: root@xilinx-zynqmp:~# insmod zynqmp-dpsub.ko [ 88.391289] [drm] Initialized zynqmp-dpsub 1.0.0 20130509 for fd4a0000.display on minor 0 [ 88.529906] Console: switching to colour frame buffer device 128x48 [ 88.549402] zynqmp-dpsub fd4a0000.display: [drm] fb0: zynqmp-dpsubdrm frame buffer device [ 88.571624] zynqmp-dpsub fd4a0000.display: ZynqMP DisplayPort Subsystem driver probed root@xilinx-zynqmp:~# rmmod zynqmp_dpsub [ 94.023404] Console: switching to colour dummy device 80x25 root@xilinx-zynqmp:~# insmod zynqmp-dpsub.ko <hang here> This is because that in zynqmp_dp_probe it tries to access some DP registers while the DP controller is still in the reset state. When running "rmmod zynqmp_dpsub", zynqmp_dp_reset(dp, true) in zynqmp_dp_phy_exit is called to force the DP controller into the reset state. Then insmod will call zynqmp_dp_probe to program the DP registers, but at this moment the DP controller hasn't been brought out of the reset state yet since the function zynqmp_dp_reset(dp, false) is called later and this will result the system hang. Releasing the reset to DP controller before any read/write operation to it will fix this issue. And for symmetry, move zynqmp_dp_reset() call from zynqmp_dp_phy_exit() to zynqmp_dp_remove(). Signed-off-by: Quanyang Wang <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]>
1 parent 97271c7 commit a338619

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

drivers/gpu/drm/xlnx/zynqmp_dp.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,6 @@ static int zynqmp_dp_phy_init(struct zynqmp_dp *dp)
402402
}
403403
}
404404

405-
ret = zynqmp_dp_reset(dp, false);
406-
if (ret < 0)
407-
return ret;
408-
409405
zynqmp_dp_clr(dp, ZYNQMP_DP_PHY_RESET, ZYNQMP_DP_PHY_RESET_ALL_RESET);
410406

411407
/*
@@ -441,8 +437,6 @@ static void zynqmp_dp_phy_exit(struct zynqmp_dp *dp)
441437
ret);
442438
}
443439

444-
zynqmp_dp_reset(dp, true);
445-
446440
for (i = 0; i < dp->num_lanes; i++) {
447441
ret = phy_exit(dp->phy[i]);
448442
if (ret)
@@ -1683,9 +1677,13 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm)
16831677
return PTR_ERR(dp->reset);
16841678
}
16851679

1680+
ret = zynqmp_dp_reset(dp, false);
1681+
if (ret < 0)
1682+
return ret;
1683+
16861684
ret = zynqmp_dp_phy_probe(dp);
16871685
if (ret)
1688-
return ret;
1686+
goto err_reset;
16891687

16901688
/* Initialize the hardware. */
16911689
zynqmp_dp_write(dp, ZYNQMP_DP_TX_PHY_POWER_DOWN,
@@ -1697,7 +1695,7 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm)
16971695

16981696
ret = zynqmp_dp_phy_init(dp);
16991697
if (ret)
1700-
return ret;
1698+
goto err_reset;
17011699

17021700
zynqmp_dp_write(dp, ZYNQMP_DP_TRANSMITTER_ENABLE, 1);
17031701

@@ -1709,15 +1707,18 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm)
17091707
zynqmp_dp_irq_handler, IRQF_ONESHOT,
17101708
dev_name(dp->dev), dp);
17111709
if (ret < 0)
1712-
goto error;
1710+
goto err_phy_exit;
17131711

17141712
dev_dbg(dp->dev, "ZynqMP DisplayPort Tx probed with %u lanes\n",
17151713
dp->num_lanes);
17161714

17171715
return 0;
17181716

1719-
error:
1717+
err_phy_exit:
17201718
zynqmp_dp_phy_exit(dp);
1719+
err_reset:
1720+
zynqmp_dp_reset(dp, true);
1721+
17211722
return ret;
17221723
}
17231724

@@ -1735,4 +1736,5 @@ void zynqmp_dp_remove(struct zynqmp_dpsub *dpsub)
17351736
zynqmp_dp_write(dp, ZYNQMP_DP_INT_DS, 0xffffffff);
17361737

17371738
zynqmp_dp_phy_exit(dp);
1739+
zynqmp_dp_reset(dp, true);
17381740
}

0 commit comments

Comments
 (0)