RE: [PATCH 3/5] i2c: riic: Add RZ/G2L support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Philipp,

Thanks for the review.

> Subject: Re: [PATCH 3/5] i2c: riic: Add RZ/G2L support
> 
> Hi Biju,
> 
> On Fri, 2021-06-11 at 17:56 +0100, Biju Das wrote:
> > RZ/G2L i2c controller is compatible with RZ/A i2c controller.
> > By default IP is in reset state, so need to perform release reset
> > before accessing any register.
> >
> > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
> > ---
> >  drivers/i2c/busses/Kconfig    |  1 +
> >  drivers/i2c/busses/i2c-riic.c | 21 +++++++++++++++++++++
> >  2 files changed, 22 insertions(+)
> >
> > diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> > index 281a65d9b44b..5da09288b461 100644
> > --- a/drivers/i2c/busses/Kconfig
> > +++ b/drivers/i2c/busses/Kconfig
> > @@ -941,6 +941,7 @@ config I2C_QUP
> >  config I2C_RIIC
> >  	tristate "Renesas RIIC adapter"
> >  	depends on ARCH_RENESAS || COMPILE_TEST
> > +	select RESET_CONTROLLER
> 
> There's no need for this. The reset API defines inline stubs so this can
> be compiled without RESET_CONTROLLER enabled.

Hope you are ok with Geert's suggestion, as RZ/A boards are resource constrained.
So it is not good to enable for them.

> 
> >  	help
> >  	  If you say yes to this option, support will be included for the
> >  	  Renesas RIIC I2C interface.
> > diff --git a/drivers/i2c/busses/i2c-riic.c
> > b/drivers/i2c/busses/i2c-riic.c index 4eccc0f69861..a3860631c6db
> > 100644
> > --- a/drivers/i2c/busses/i2c-riic.c
> > +++ b/drivers/i2c/busses/i2c-riic.c
> > @@ -42,8 +42,10 @@
> >  #include <linux/io.h>
> >  #include <linux/module.h>
> >  #include <linux/of.h>
> > +#include <linux/of_device.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/pm_runtime.h>
> > +#include <linux/reset.h>
> >
> >  #define RIIC_ICCR1	0x00
> >  #define RIIC_ICCR2	0x04
> > @@ -86,6 +88,11 @@
> >
> >  #define RIIC_INIT_MSG	-1
> >
> > +enum riic_type {
> > +	RIIC_RZ_A,
> > +	RIIC_RZ_G2L,
> > +};
> > +
> >  struct riic_dev {
> >  	void __iomem *base;
> >  	u8 *buf;
> > @@ -395,7 +402,9 @@ static int riic_i2c_probe(struct platform_device
> *pdev)
> >  	struct i2c_adapter *adap;
> >  	struct resource *res;
> >  	struct i2c_timings i2c_t;
> > +	struct reset_control *rstc;
> >  	int i, ret;
> > +	enum riic_type type;
> >
> >  	riic = devm_kzalloc(&pdev->dev, sizeof(*riic), GFP_KERNEL);
> >  	if (!riic)
> > @@ -412,6 +421,17 @@ static int riic_i2c_probe(struct platform_device
> *pdev)
> >  		return PTR_ERR(riic->clk);
> >  	}
> >
> > +	type = (enum riic_type)of_device_get_match_data(&pdev->dev);
> > +	if (type == RIIC_RZ_G2L) {
> > +		rstc = devm_reset_control_get(&pdev->dev, NULL);
> 
> Please use devm_reset_control_get_exclusive().

OK. Will do.

Regards,
Biju

> 
> > +		if (IS_ERR(rstc)) {
> > +			dev_err(&pdev->dev, "Error: missing reset ctrl\n");
> > +			return PTR_ERR(rstc);
> > +		}
> > +
> > +		reset_control_deassert(rstc);
> > +	}
> > +
> >  	for (i = 0; i < ARRAY_SIZE(riic_irqs); i++) {
> >  		res = platform_get_resource(pdev, IORESOURCE_IRQ,
> riic_irqs[i].res_num);
> >  		if (!res)
> > @@ -472,6 +492,7 @@ static int riic_i2c_remove(struct platform_device
> > *pdev)  }
> >
> >  static const struct of_device_id riic_i2c_dt_ids[] = {
> > +	{ .compatible = "renesas,riic-r9a07g044", .data = (void
> > +*)RIIC_RZ_G2L },
> >  	{ .compatible = "renesas,riic-rz" },
> >  	{ /* Sentinel */ },
> >  };
> 
> regards
> Philipp




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux