* [PATCH] drm: xlnx: zynqmp: release reset to DP controller before accessing DP registers
@ 2021-03-20 8:37 quanyang.wang
2021-03-20 20:08 ` Laurent Pinchart
0 siblings, 1 reply; 3+ messages in thread
From: quanyang.wang @ 2021-03-20 8:37 UTC (permalink / raw)
To: Hyun Kwon, Laurent Pinchart, David Airlie, Daniel Vetter, Michal Simek
Cc: Quanyang Wang, linux-arm-kernel, dri-devel, linux-kernel
From: Quanyang Wang <quanyang.wang@windriver.com>
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 write to the DP registers,
but at this moment the DP controller isn't brought out of the reset state
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.
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
---
drivers/gpu/drm/xlnx/zynqmp_dp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
index 99158ee67d02..bb45b3663d6b 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
@@ -402,10 +402,6 @@ static int zynqmp_dp_phy_init(struct zynqmp_dp *dp)
}
}
- ret = zynqmp_dp_reset(dp, false);
- if (ret < 0)
- return ret;
-
zynqmp_dp_clr(dp, ZYNQMP_DP_PHY_RESET, ZYNQMP_DP_PHY_RESET_ALL_RESET);
/*
@@ -1682,6 +1678,10 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm)
return PTR_ERR(dp->reset);
}
+ ret = zynqmp_dp_reset(dp, false);
+ if (ret < 0)
+ return ret;
+
ret = zynqmp_dp_phy_probe(dp);
if (ret)
return ret;
--
2.25.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm: xlnx: zynqmp: release reset to DP controller before accessing DP registers
2021-03-20 8:37 [PATCH] drm: xlnx: zynqmp: release reset to DP controller before accessing DP registers quanyang.wang
@ 2021-03-20 20:08 ` Laurent Pinchart
2021-03-22 9:43 ` quanyang.wang
0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2021-03-20 20:08 UTC (permalink / raw)
To: quanyang.wang
Cc: Hyun Kwon, David Airlie, Michal Simek, dri-devel, linux-kernel,
linux-arm-kernel
Hi Quanyang,
Thank you for the patch.
On Sat, Mar 20, 2021 at 04:37:39PM +0800, quanyang.wang@windriver.com wrote:
> From: Quanyang Wang <quanyang.wang@windriver.com>
>
> 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 write to the DP registers,
> but at this moment the DP controller isn't brought out of the reset state
> 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.
>
> Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
> ---
> drivers/gpu/drm/xlnx/zynqmp_dp.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
> index 99158ee67d02..bb45b3663d6b 100644
> --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
> +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
> @@ -402,10 +402,6 @@ static int zynqmp_dp_phy_init(struct zynqmp_dp *dp)
> }
> }
>
> - ret = zynqmp_dp_reset(dp, false);
> - if (ret < 0)
> - return ret;
> -
> zynqmp_dp_clr(dp, ZYNQMP_DP_PHY_RESET, ZYNQMP_DP_PHY_RESET_ALL_RESET);
>
> /*
> @@ -1682,6 +1678,10 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm)
> return PTR_ERR(dp->reset);
> }
>
> + ret = zynqmp_dp_reset(dp, false);
> + if (ret < 0)
> + return ret;
> +
This change looks good to me.
> ret = zynqmp_dp_phy_probe(dp);
> if (ret)
> return ret;
But shouldn't we call zynqmp_dp_reset(dp, true) here ? Or rather, call
it in the error path at the end of the function, with a goto label.
For symmetry, should we also move the zynqmp_dp_reset() call from
zynqmp_dp_phy_exit() to zynqmp_dp_remove() ?
--
Regards,
Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm: xlnx: zynqmp: release reset to DP controller before accessing DP registers
2021-03-20 20:08 ` Laurent Pinchart
@ 2021-03-22 9:43 ` quanyang.wang
0 siblings, 0 replies; 3+ messages in thread
From: quanyang.wang @ 2021-03-22 9:43 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Hyun Kwon, David Airlie, Michal Simek, dri-devel, linux-kernel,
linux-arm-kernel
Hi Laurent,
On 3/21/21 4:08 AM, Laurent Pinchart wrote:
> Hi Quanyang,
>
> Thank you for the patch.
>
> On Sat, Mar 20, 2021 at 04:37:39PM +0800, quanyang.wang@windriver.com wrote:
>> From: Quanyang Wang <quanyang.wang@windriver.com>
>>
>> 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 write to the DP registers,
>> but at this moment the DP controller isn't brought out of the reset state
>> 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.
>>
>> Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
>> ---
>> drivers/gpu/drm/xlnx/zynqmp_dp.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
>> index 99158ee67d02..bb45b3663d6b 100644
>> --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
>> +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
>> @@ -402,10 +402,6 @@ static int zynqmp_dp_phy_init(struct zynqmp_dp *dp)
>> }
>> }
>>
>> - ret = zynqmp_dp_reset(dp, false);
>> - if (ret < 0)
>> - return ret;
>> -
>> zynqmp_dp_clr(dp, ZYNQMP_DP_PHY_RESET, ZYNQMP_DP_PHY_RESET_ALL_RESET);
>>
>> /*
>> @@ -1682,6 +1678,10 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub, struct drm_device *drm)
>> return PTR_ERR(dp->reset);
>> }
>>
>> + ret = zynqmp_dp_reset(dp, false);
>> + if (ret < 0)
>> + return ret;
>> +
> This change looks good to me.
>
>> ret = zynqmp_dp_phy_probe(dp);
>> if (ret)
>> return ret;
> But shouldn't we call zynqmp_dp_reset(dp, true) here ? Or rather, call
> it in the error path at the end of the function, with a goto label.
Thank you for the suggestions.
zynqmp_dp_reset(dp, true) should be added in the error path, I will add
this in the V2 patch.
>
> For symmetry, should we also move the zynqmp_dp_reset() call from
> zynqmp_dp_phy_exit() to zynqmp_dp_remove() ?
Yes, I will move it out of zynqmp_dp_phy_exit and to zynqmp_dp_remove()
in the V2 patch.
Thanks,
Quanyang
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-22 9:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-20 8:37 [PATCH] drm: xlnx: zynqmp: release reset to DP controller before accessing DP registers quanyang.wang
2021-03-20 20:08 ` Laurent Pinchart
2021-03-22 9:43 ` quanyang.wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).