From patchwork Thu Dec 14 07:43:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 178553 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8378398dys; Wed, 13 Dec 2023 23:44:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXfJegttjrdQY0ERp3B8w1d7MJN0f0Kl48iBJgvcFejOmu8VeoCvO9K7WsTW2bSi9T/Rwq X-Received: by 2002:a54:4808:0:b0:3b9:e869:c2ee with SMTP id j8-20020a544808000000b003b9e869c2eemr9628876oij.115.1702539866526; Wed, 13 Dec 2023 23:44:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702539866; cv=none; d=google.com; s=arc-20160816; b=XnsImCSuMQYX3Gpc4P453e4fs1ZnbVuQw7gQmdeLO9+gBD8ZqecITG2TbOi2wnzrBv bgOrbWr2Jjroka9mVSY7HL4inQjLjTuQ4vHqCeEcQ1OU9uQm5HB/WbCxtxAfQUxIsDTy +OqpRiXe5rd6aJ59nt89svGewhCv2kJ/gvqvYBomhQjnHsjsCBgD+mNpHAubfuji6o3N /QacIi+rQkSYdM4rZWUuefMo6UdaUg7VmmQnlTvsd/6fOpOXGIxExeB6PwMpjwHByyUL ZbiqgnoxU/inpIFizsAk1Uh2/oc2KZrs7wqqAZmi0kYKv0FvP8eckcEWzxltiQOf492h o7kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VVjT4+Cf8UWpO5evrM+cr4MAL3lYVdc9S4k3S2b2RlM=; fh=i1WOw0ZSKPvMyou/yY1/XEaTU9VVhN6rFHk4fZad36U=; b=BmMUDnz6jmpkjNLSRHiBKMgDVL8lPlMN22wBT549NHvyg5vSinkXhGHo9YCSEZHSCs yzULZLu80FzAYrmCGE9FboFWTVhvcXVaZCkhM/nakRhliuZT2BIaYraWswIYT09zeVG6 R5cCKUOsmBeQlJrzDohUmEdSFPo+RAGVY7iaLjAkhuQ5lWT/AhvnWp27wtFiMc6t+jX6 XqRRDsm4h6MyBGRhIH3KQ0CLPOwtivkU7FvGx3Ij+sTiM5PWz5Sv3vShWwN95R5qoYkt u7zRlgCdXii3N77HfKTU9Jd1Yc/j2/LH5IWSfV8rJa6quwBQ7E6bw4X14KtyYfvDJA8X wd3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=V2GxAr04; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id t5-20020a62d145000000b006ce72ca697asi10879835pfl.251.2023.12.13.23.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 23:44:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=V2GxAr04; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id EC2E981F3597; Wed, 13 Dec 2023 23:44:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235492AbjLNHoN (ORCPT + 99 others); Thu, 14 Dec 2023 02:44:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235474AbjLNHoL (ORCPT ); Thu, 14 Dec 2023 02:44:11 -0500 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DA75107 for ; Wed, 13 Dec 2023 23:44:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=VVjT4+Cf8UWpO5evrM+cr4MAL3lYVdc9S4k3S2b2RlM=; b=V2GxAr 04gWg0Pm3WkCF8taGYt0SD+yl7ohG17it02O5kv50LdcVrON7dIXgELHWRLtwQh0 aSZ4LywLPmb4SG9irpXFNuRHqFsq00X730cCscQmxk8QepO9cPTJ3QMmFuwEAzMt 2ymgESdec6/fbpJ6M+jHxVIBjsOnD9SWSEX4uGMW4/XNEFjocHk+rhRus2/opoY7 ndurazDmIi9g5LmqBI+1TpH6BrKbsTMRM8Vl+FqcL1T8jWjHPSF+XUTxTgXylsmo TxAapWApsgANHpvnMdaKu3rck/7fSfj5fST5WCziGG78vdmPIvX4vtSECLgi2sMx FXOflEF5zOuIToCg== Received: (qmail 826984 invoked from network); 14 Dec 2023 08:44:13 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 14 Dec 2023 08:44:13 +0100 X-UD-Smtp-Session: l3s3148p1@1CUsc3MMvK8ujnuR From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Andi Shyti , Geert Uytterhoeven , Magnus Damm , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] i2c: rcar: introduce Gen4 devices Date: Thu, 14 Dec 2023 08:43:57 +0100 Message-Id: <20231214074358.8711-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20231214074358.8711-1-wsa+renesas@sang-engineering.com> References: <20231214074358.8711-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 13 Dec 2023 23:44:23 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785242443031734585 X-GMAIL-MSGID: 1785242443031734585 So far, we treated Gen4 as Gen3. But we are soon adding FM+ as a Gen4 specific feature, so prepare the code for the new devtype. Signed-off-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven Reviewed-by: Andi Shyti --- Changes since v1: * rebased to 6.7-rc4 * moved S4 specific handling to patch 2 drivers/i2c/busses/i2c-rcar.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 829ac053bbb7..973811a6c27b 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -132,6 +132,7 @@ enum rcar_i2c_type { I2C_RCAR_GEN1, I2C_RCAR_GEN2, I2C_RCAR_GEN3, + I2C_RCAR_GEN4, }; struct rcar_i2c_priv { @@ -431,8 +432,8 @@ static void rcar_i2c_cleanup_dma(struct rcar_i2c_priv *priv, bool terminate) dma_unmap_single(chan->device->dev, sg_dma_address(&priv->sg), sg_dma_len(&priv->sg), priv->dma_direction); - /* Gen3 can only do one RXDMA per transfer and we just completed it */ - if (priv->devtype == I2C_RCAR_GEN3 && + /* Gen3+ can only do one RXDMA per transfer and we just completed it */ + if (priv->devtype >= I2C_RCAR_GEN3 && priv->dma_direction == DMA_FROM_DEVICE) priv->flags |= ID_P_NO_RXDMA; @@ -886,8 +887,8 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, if (ret < 0) goto out; - /* Gen3 needs a reset before allowing RXDMA once */ - if (priv->devtype == I2C_RCAR_GEN3) { + /* Gen3+ needs a reset. That also allows RXDMA once */ + if (priv->devtype >= I2C_RCAR_GEN3) { priv->flags &= ~ID_P_NO_RXDMA; ret = rcar_i2c_do_reset(priv); if (ret) @@ -1075,7 +1076,7 @@ static const struct of_device_id rcar_i2c_dt_ids[] = { { .compatible = "renesas,rcar-gen1-i2c", .data = (void *)I2C_RCAR_GEN1 }, { .compatible = "renesas,rcar-gen2-i2c", .data = (void *)I2C_RCAR_GEN2 }, { .compatible = "renesas,rcar-gen3-i2c", .data = (void *)I2C_RCAR_GEN3 }, - { .compatible = "renesas,rcar-gen4-i2c", .data = (void *)I2C_RCAR_GEN3 }, + { .compatible = "renesas,rcar-gen4-i2c", .data = (void *)I2C_RCAR_GEN4 }, {}, }; MODULE_DEVICE_TABLE(of, rcar_i2c_dt_ids); @@ -1151,7 +1152,7 @@ static int rcar_i2c_probe(struct platform_device *pdev) if (of_property_read_bool(dev->of_node, "smbus")) priv->flags |= ID_P_HOST_NOTIFY; - if (priv->devtype == I2C_RCAR_GEN3) { + if (priv->devtype >= I2C_RCAR_GEN3) { priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); if (IS_ERR(priv->rstc)) { ret = PTR_ERR(priv->rstc);