[PATCH 1/3] aiodev: rockchip_saradc: Add reset control support
Sascha Hauer
s.hauer at pengutronix.de
Tue Jan 21 00:27:32 PST 2025
Hi Alexander,
On Thu, Jan 16, 2025 at 08:01:52PM +0300, Alexander Shiyan wrote:
> This adds reset control support for the Rockchip ADC driver.
>
> Signed-off-by: Alexander Shiyan <eagle.alexander923 at gmail.com>
> ---
> drivers/aiodev/rockchip_saradc.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/aiodev/rockchip_saradc.c b/drivers/aiodev/rockchip_saradc.c
> index 3c5c0e94da..b31804fc39 100644
> --- a/drivers/aiodev/rockchip_saradc.c
> +++ b/drivers/aiodev/rockchip_saradc.c
> @@ -8,8 +8,9 @@
>
> #include <common.h>
> #include <aiodev.h>
> -#include <linux/clk.h>
> #include <regulator.h>
> +#include <linux/clk.h>
> +#include <linux/reset.h>
>
> #define SARADC_DATA 0x00
>
> @@ -37,6 +38,7 @@ struct rockchip_saradc_data {
> struct clk *pclk;
> struct aiodevice aiodev;
> struct aiochannel *channels;
> + struct reset_control *reset;
> };
>
> static inline void rockchip_saradc_reg_wr(struct rockchip_saradc_data *data,
> @@ -51,6 +53,13 @@ static inline u32 rockchip_saradc_reg_rd(struct rockchip_saradc_data *data,
> return readl(data->base + reg);
> }
>
> +static void rockchip_saradc_reset_controller(struct reset_control *reset)
> +{
> + reset_control_assert(reset);
> + udelay(20);
> + reset_control_deassert(reset);
> +}
> +
> static int rockchip_saradc_read(struct aiochannel *chan, int *val)
> {
> struct rockchip_saradc_data *data;
> @@ -163,14 +172,20 @@ static int rockchip_saradc_probe(struct device *dev)
>
> rockchip_saradc_reg_wr(data, 0, SARADC_CTRL);
>
> + data->reset = reset_control_get(dev, "saradc-apb");
reset_control_get() might return an error pointer. You need to check
that before passing it to reset_control_assert().
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list