From patchwork Wed Sep 13 20:32:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 139355 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp154953vqi; Wed, 13 Sep 2023 23:47:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0sahyHDcT36IJ+APcmMWs53oEWjJnmGbjNzhEnd+M0/AecNlbtuOt2maWKqk5ZonAjt9e X-Received: by 2002:a17:902:7892:b0:1c0:e6e1:4a11 with SMTP id q18-20020a170902789200b001c0e6e14a11mr4061386pll.54.1694674054701; Wed, 13 Sep 2023 23:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694674054; cv=none; d=google.com; s=arc-20160816; b=Sc6EhU6rP1HUppMEJiqEE4UiQif+AndTEEF7RDt0Ara++628jPZB6IouCsYFZRUg2S dqCUx218r834rw6UE033GrILtwHK1p/nKEfwedJ0t7bRnj8jhGd0B1kXEyvouHy+vXQz spjjc2J/MdCD/kS/qSfQgKFgf71YpR+T8FdnOKvwttoFIx2RA2dCtNSCgJAjVH4ykWlM WeRPHMR/aY8wO4tAc0XWvErri+oUjFmL3bmHv77hObx8hGTyfNbaPK6lIc9vZrEBrsvb gAzPQoud9Kfv1isIFZO6mT3iQ0LjsCbA9hcqt+HZ2N9mxYk/HRnzsFr0Bu3xDLGMiwfZ rIFA== 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=jI4vgN2cr90+cfd1v21EoE5zyLzqOPeYwv4iYO6HXXk=; fh=EbkhgF/uCO7SSlo3sug3Cu1sQoSyT0yNSDDj0A1P9Ek=; b=Z2j4z84L7Mn1rZ5xOrUwBD1DHdjIRr0lkR1L99KaHboGZA3X/CkyRb+g+yBjdHRRCH tiwkRTEqQKLWl9fHlrUitFgOtRHAfmd6+LoCu+hUzzpc0dAYWnSKyQgceHBDNrNqI8my QW/3Ig7wO9fdBSjDSqfPMCjWxZJ+OiUUAaBsTFx8S+QK+vjQvtubt0EtitI8lefGrPnp xS64thwZ5rVjD20YXmCjaroKV7d3q4Ta9Em0y2xXC7a8CzqlNKxULVSXSVgImczmuKYD EjieyVtv1Mm/WgIzfiNqlvrhX4XZNUppKlZb1SAhsArmFagA8zXnzvYaMMH1EEnYpTud k0yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=HUXVlhXv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id z2-20020a170903018200b001b8a8f7af21si1041543plg.557.2023.09.13.23.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 23:47:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=HUXVlhXv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id A7BA28315C8F; Wed, 13 Sep 2023 13:33:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232555AbjIMUc5 (ORCPT + 34 others); Wed, 13 Sep 2023 16:32:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232406AbjIMUcz (ORCPT ); Wed, 13 Sep 2023 16:32:55 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 066D01BCB for ; Wed, 13 Sep 2023 13:32:50 -0700 (PDT) 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=jI4vgN2cr90+cfd1v21EoE5zyLzqOPeYwv4iYO6HXXk=; b=HUXVlh Xv1Tn/Ax9P6M7vBd/x26viftksC9y0Z1h3d5C6IbU+FPVWSKgIzWyJszASmy4KoN 7l/8uCmgAKy/8/de0JTPK/hDNeEyFJXkKagtEvTdxlo5WQ5BhduE01tQT26+E80W g5W1DMqVvHQ+pEpyjCIc9+2IaD5tDOmlLzZKhbrnX+aSHjlVcEdGkZ2A2om0JTyU WGd299nXTI+B2HTs4gZ+0O65RsV2f0RgCS9oe1bQr1N1ImXLGS9L7jIWoFXG/uAR 8dvHMbuDkp8l7oXt1a0QuzVUJKZ9or87LZrDVQ6xC0DvkcHSq9j3BxhSPq6OwGyw MeNOCVq4ZvhmzkSA== Received: (qmail 715830 invoked from network); 13 Sep 2023 22:32:48 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 13 Sep 2023 22:32:48 +0200 X-UD-Smtp-Session: l3s3148p1@54ZtdkMFVo0ujnuS From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Yoshihiro Shimoda , Wolfram Sang , Andi Shyti , Geert Uytterhoeven , Magnus Damm , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] i2c: rcar: introduce Gen4 devices Date: Wed, 13 Sep 2023 22:32:40 +0200 Message-Id: <20230913203242.31505-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230913203242.31505-1-wsa+renesas@sang-engineering.com> References: <20230913203242.31505-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 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 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 13:33:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776994541906235220 X-GMAIL-MSGID: 1776994541906235220 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 --- drivers/i2c/busses/i2c-rcar.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index bc5c7a0050eb..5aa6fd777276 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 { @@ -429,8 +430,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; @@ -884,8 +885,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) @@ -1070,10 +1071,12 @@ static const struct of_device_id rcar_i2c_dt_ids[] = { { .compatible = "renesas,i2c-r8a7794", .data = (void *)I2C_RCAR_GEN2 }, { .compatible = "renesas,i2c-r8a7795", .data = (void *)I2C_RCAR_GEN3 }, { .compatible = "renesas,i2c-r8a7796", .data = (void *)I2C_RCAR_GEN3 }, + /* S4 has no FM+ bit */ + { .compatible = "renesas,i2c-r8a779f0", .data = (void *)I2C_RCAR_GEN3 }, { .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); @@ -1140,7 +1143,7 @@ static int rcar_i2c_probe(struct platform_device *pdev) irqhandler = rcar_i2c_gen2_irq; } - 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)) return dev_err_probe(&pdev->dev, PTR_ERR(priv->rstc),