lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <35ebc7a7c56c86dee523812bfb55d1bac96f4b42.camel@pengutronix.de>
Date:   Tue, 13 Oct 2020 10:11:53 +0200
From:   Philipp Zabel <p.zabel@...gutronix.de>
To:     Adrian Ratiu <adrian.ratiu@...labora.com>,
        Ezequiel Garcia <ezequiel@...labora.com>
Cc:     Mark Brown <broonie@...nel.org>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Fruehberger Peter <Peter.Fruehberger@...bosch.com>,
        kuhanh.murugasen.krishnan@...el.com,
        Daniel Vetter <daniel@...ll.ch>, kernel@...labora.com,
        linux-media@...r.kernel.org, linux-rockchip@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 04/18] media: hantro: add reset controller support

Hi Adrian,

On Mon, 2020-10-12 at 23:59 +0300, Adrian Ratiu wrote:
> Some SoCs might have a reset controller which disables clocks
> by default in reset state which then drivers need to unreset
> before being able to ungate a specific clock.
> 
> In this specific case, the hantro driver needs to ensure the
> peripheral clock can be properly ungated otherwise MMIO reg
> values can't be accessed.
> 
> If the SoC has no reset controller or there is no "resets" DT
> property defined, this new code will have no effect.
> 
> Signed-off-by: Adrian Ratiu <adrian.ratiu@...labora.com>
> Signed-off-by: Ezequiel Garcia <ezequiel@...labora.com>
> ---
>  drivers/staging/media/hantro/hantro.h     | 1 +
>  drivers/staging/media/hantro/hantro_drv.c | 8 ++++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
> index 65f9f7ea7dcf..bb442eb1974e 100644
> --- a/drivers/staging/media/hantro/hantro.h
> +++ b/drivers/staging/media/hantro/hantro.h
> @@ -183,6 +183,7 @@ struct hantro_dev {
>  	struct platform_device *pdev;
>  	struct device *dev;
>  	struct clk_bulk_data *clocks;
> +	struct reset_control *reset;
>  	void __iomem **reg_bases;
>  	void __iomem *enc_base;
>  	void __iomem *dec_base;
> diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
> index 3cd00cc0a364..c2ea54552ce9 100644
> --- a/drivers/staging/media/hantro/hantro_drv.c
> +++ b/drivers/staging/media/hantro/hantro_drv.c
> @@ -17,6 +17,7 @@
>  #include <linux/pm.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/slab.h>
> +#include <linux/reset.h>
>  #include <linux/videodev2.h>
>  #include <linux/workqueue.h>
>  #include <media/v4l2-event.h>
> @@ -747,6 +748,13 @@ static int hantro_probe(struct platform_device *pdev)
>  
>  	INIT_DELAYED_WORK(&vpu->watchdog_work, hantro_watchdog);
>  
> +	vpu->reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
> +							       NULL);
> +	if (IS_ERR(vpu->reset))
> +		vpu->reset = NULL;

Please return the error. If the optional reset is missing from the
device tree, devm_reset_control_get_optional_exclusive() returns NULL
already.

regards
Philipp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ