From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33883C2B9F4 for ; Mon, 14 Jun 2021 13:27:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0CAC560FE5 for ; Mon, 14 Jun 2021 13:27:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232745AbhFNN3v convert rfc822-to-8bit (ORCPT ); Mon, 14 Jun 2021 09:29:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232917AbhFNN3v (ORCPT ); Mon, 14 Jun 2021 09:29:51 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2E0DC061574 for ; Mon, 14 Jun 2021 06:27:48 -0700 (PDT) Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lsmcf-0003s8-VG; Mon, 14 Jun 2021 15:27:25 +0200 Received: from pza by lupine with local (Exim 4.92) (envelope-from ) id 1lsmcc-0004SO-Lr; Mon, 14 Jun 2021 15:27:22 +0200 Message-ID: <67e00c18b71875a0aaa7a8a02b2b0507f5d7a575.camel@pengutronix.de> Subject: Re: [PATCH 3/5] i2c: riic: Add RZ/G2L support From: Philipp Zabel To: Biju Das Cc: Chris Brandt , Wolfram Sang , Arnd Bergmann , Jarkko Nikula , Jean Delvare , Khalil Blaiech , Krzysztof Kozlowski , Bence =?ISO-8859-1?Q?Cs=F3k=E1s?= , Yicong Yang , Mike Rapoport , Uwe =?ISO-8859-1?Q?Kleine-K=F6nig?= , linux-i2c@vger.kernel.org, Geert Uytterhoeven , Chris Paterson , Biju Das , Prabhakar Mahadev Lad , linux-renesas-soc@vger.kernel.org Date: Mon, 14 Jun 2021 15:27:22 +0200 In-Reply-To: <20210611165624.30749-4-biju.das.jz@bp.renesas.com> References: <20210611165624.30749-1-biju.das.jz@bp.renesas.com> <20210611165624.30749-4-biju.das.jz@bp.renesas.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-i2c@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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 > Reviewed-by: Lad Prabhakar > --- > 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. > 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 > #include > #include > +#include > #include > #include > +#include > > #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(). > + 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