* [PATCH] drm/rockchip: vop: do axi reset in vop initial time
@ 2016-06-01 9:19 Yakir Yang
2016-06-01 9:49 ` Mark yao
2016-06-01 15:19 ` Thierry Reding
0 siblings, 2 replies; 4+ messages in thread
From: Yakir Yang @ 2016-06-01 9:19 UTC (permalink / raw)
To: Mark Yao, Heiko Stuebner, tfiga
Cc: David Airlie, daniel.vetter, Thierry Reding, dianders, Yakir Yang,
linux-kernel, dri-devel, linux-rockchip
There is a bug in RK3399 VOP, when bootloader/kernel only enable
VOP Big or VOP Little to display, then VOP IOMMU would failed to
reset at the initial time and VOP register couldn't write rightly.
After do the pure reset of VOP module, then things back to right.
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
---
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 1c4d5b5..4150323 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1292,7 +1292,7 @@ static int vop_initial(struct vop *vop)
{
const struct vop_data *vop_data = vop->data;
const struct vop_reg_data *init_table = vop_data->init_table;
- struct reset_control *ahb_rst;
+ struct reset_control *ahb_rst, *axi_rst;
int i, ret;
vop->hclk = devm_clk_get(vop->dev, "hclk_vop");
@@ -1331,6 +1331,19 @@ static int vop_initial(struct vop *vop)
}
/*
+ * do aclk_reset, reset all vop registers.
+ */
+ axi_rst = devm_reset_control_get(vop->dev, "axi");
+ if (IS_ERR(axi_rst)) {
+ dev_err(vop->dev, "failed to get axi reset\n");
+ ret = PTR_ERR(axi_rst);
+ goto err_disable_aclk;
+ }
+ reset_control_assert(axi_rst);
+ usleep_range(10, 20);
+ reset_control_deassert(axi_rst);
+
+ /*
* do hclk_reset, reset all vop registers.
*/
ahb_rst = devm_reset_control_get(vop->dev, "ahb");
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/rockchip: vop: do axi reset in vop initial time
2016-06-01 9:19 [PATCH] drm/rockchip: vop: do axi reset in vop initial time Yakir Yang
@ 2016-06-01 9:49 ` Mark yao
2016-06-01 15:19 ` Thierry Reding
1 sibling, 0 replies; 4+ messages in thread
From: Mark yao @ 2016-06-01 9:49 UTC (permalink / raw)
To: Yakir Yang, Mark Yao, Heiko Stuebner, tfiga
Cc: David Airlie, daniel.vetter, Thierry Reding, dianders,
linux-kernel, dri-devel, linux-rockchip
On 2016年06月01日 17:19, Yakir Yang wrote:
> There is a bug in RK3399 VOP, when bootloader/kernel only enable
> VOP Big or VOP Little to display, then VOP IOMMU would failed to
> reset at the initial time and VOP register couldn't write rightly.
>
> After do the pure reset of VOP module, then things back to right.
>
> Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Hi Yakir
I think you get vop iommu reset failed should be IOMMU Page fault, the
vop iommu access a ummap address.
You should ensure all vop windows access right iommu mapping address
before attach iommu.
Actually, I'm working no flash display from bootloader to kernel, and
prepare remove all the reset on vop initial, because it would flash the
display.
Thanks.
> ---
> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 1c4d5b5..4150323 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1292,7 +1292,7 @@ static int vop_initial(struct vop *vop)
> {
> const struct vop_data *vop_data = vop->data;
> const struct vop_reg_data *init_table = vop_data->init_table;
> - struct reset_control *ahb_rst;
> + struct reset_control *ahb_rst, *axi_rst;
> int i, ret;
>
> vop->hclk = devm_clk_get(vop->dev, "hclk_vop");
> @@ -1331,6 +1331,19 @@ static int vop_initial(struct vop *vop)
> }
>
> /*
> + * do aclk_reset, reset all vop registers.
> + */
> + axi_rst = devm_reset_control_get(vop->dev, "axi");
> + if (IS_ERR(axi_rst)) {
> + dev_err(vop->dev, "failed to get axi reset\n");
> + ret = PTR_ERR(axi_rst);
> + goto err_disable_aclk;
> + }
> + reset_control_assert(axi_rst);
> + usleep_range(10, 20);
> + reset_control_deassert(axi_rst);
> +
> + /*
> * do hclk_reset, reset all vop registers.
> */
> ahb_rst = devm_reset_control_get(vop->dev, "ahb");
--
Mark Yao
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/rockchip: vop: do axi reset in vop initial time
2016-06-01 9:19 [PATCH] drm/rockchip: vop: do axi reset in vop initial time Yakir Yang
2016-06-01 9:49 ` Mark yao
@ 2016-06-01 15:19 ` Thierry Reding
2016-06-02 3:11 ` Yakir Yang
1 sibling, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2016-06-01 15:19 UTC (permalink / raw)
To: Yakir Yang
Cc: Mark Yao, Heiko Stuebner, tfiga, David Airlie, daniel.vetter,
dianders, linux-kernel, dri-devel, linux-rockchip
[-- Attachment #1: Type: text/plain, Size: 2045 bytes --]
On Wed, Jun 01, 2016 at 05:19:12PM +0800, Yakir Yang wrote:
> There is a bug in RK3399 VOP, when bootloader/kernel only enable
> VOP Big or VOP Little to display, then VOP IOMMU would failed to
> reset at the initial time and VOP register couldn't write rightly.
>
> After do the pure reset of VOP module, then things back to right.
>
> Signed-off-by: Yakir Yang <ykk@rock-chips.com>
> ---
> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 1c4d5b5..4150323 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1292,7 +1292,7 @@ static int vop_initial(struct vop *vop)
> {
> const struct vop_data *vop_data = vop->data;
> const struct vop_reg_data *init_table = vop_data->init_table;
> - struct reset_control *ahb_rst;
> + struct reset_control *ahb_rst, *axi_rst;
> int i, ret;
>
> vop->hclk = devm_clk_get(vop->dev, "hclk_vop");
> @@ -1331,6 +1331,19 @@ static int vop_initial(struct vop *vop)
> }
>
> /*
> + * do aclk_reset, reset all vop registers.
> + */
> + axi_rst = devm_reset_control_get(vop->dev, "axi");
I don't think you want the managed version here since you only store
this in a local variable and hence aren't going to need it afterwards.
Just use reset_control_get() and ...
> + if (IS_ERR(axi_rst)) {
> + dev_err(vop->dev, "failed to get axi reset\n");
> + ret = PTR_ERR(axi_rst);
> + goto err_disable_aclk;
> + }
> + reset_control_assert(axi_rst);
> + usleep_range(10, 20);
> + reset_control_deassert(axi_rst);
call reset_control_put() here.
> +
> + /*
> * do hclk_reset, reset all vop registers.
> */
> ahb_rst = devm_reset_control_get(vop->dev, "ahb");
This uses the same pattern, so you might want to consider reworking this
as well, though it should be a separate patch.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/rockchip: vop: do axi reset in vop initial time
2016-06-01 15:19 ` Thierry Reding
@ 2016-06-02 3:11 ` Yakir Yang
0 siblings, 0 replies; 4+ messages in thread
From: Yakir Yang @ 2016-06-02 3:11 UTC (permalink / raw)
To: Thierry Reding
Cc: Mark Yao, Heiko Stuebner, tfiga, David Airlie, daniel.vetter,
dianders, linux-kernel, dri-devel, linux-rockchip
On 06/01/2016 11:19 PM, Thierry Reding wrote:
> On Wed, Jun 01, 2016 at 05:19:12PM +0800, Yakir Yang wrote:
>> There is a bug in RK3399 VOP, when bootloader/kernel only enable
>> VOP Big or VOP Little to display, then VOP IOMMU would failed to
>> reset at the initial time and VOP register couldn't write rightly.
>>
>> After do the pure reset of VOP module, then things back to right.
>>
>> Signed-off-by: Yakir Yang <ykk@rock-chips.com>
>> ---
>> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 15 ++++++++++++++-
>> 1 file changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
>> index 1c4d5b5..4150323 100644
>> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
>> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
>> @@ -1292,7 +1292,7 @@ static int vop_initial(struct vop *vop)
>> {
>> const struct vop_data *vop_data = vop->data;
>> const struct vop_reg_data *init_table = vop_data->init_table;
>> - struct reset_control *ahb_rst;
>> + struct reset_control *ahb_rst, *axi_rst;
>> int i, ret;
>>
>> vop->hclk = devm_clk_get(vop->dev, "hclk_vop");
>> @@ -1331,6 +1331,19 @@ static int vop_initial(struct vop *vop)
>> }
>>
>> /*
>> + * do aclk_reset, reset all vop registers.
>> + */
>> + axi_rst = devm_reset_control_get(vop->dev, "axi");
> I don't think you want the managed version here since you only store
> this in a local variable and hence aren't going to need it afterwards.
> Just use reset_control_get() and ...
Great, but seems Mark would not accept this fix now :(
Maybe I should found the root cause why my bootloader/kernel would
broken the VOP.
Thanks,
- Yakir
>> + if (IS_ERR(axi_rst)) {
>> + dev_err(vop->dev, "failed to get axi reset\n");
>> + ret = PTR_ERR(axi_rst);
>> + goto err_disable_aclk;
>> + }
>> + reset_control_assert(axi_rst);
>> + usleep_range(10, 20);
>> + reset_control_deassert(axi_rst);
> call reset_control_put() here.
>
>> +
>> + /*
>> * do hclk_reset, reset all vop registers.
>> */
>> ahb_rst = devm_reset_control_get(vop->dev, "ahb");
> This uses the same pattern, so you might want to consider reworking this
> as well, though it should be a separate patch.
>
> Thierry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-02 3:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-01 9:19 [PATCH] drm/rockchip: vop: do axi reset in vop initial time Yakir Yang
2016-06-01 9:49 ` Mark yao
2016-06-01 15:19 ` Thierry Reding
2016-06-02 3:11 ` Yakir Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox