From nobody Wed Dec 17 19:41:17 2025 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEB62154C11 for ; Tue, 25 Jun 2024 12:14:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317665; cv=none; b=g+nv/9qU7oN/uEfBNSsgI16vQjoKMT5n34PpIu18PN0pYH1UDG2rhfY0B9WH01qk00pnGhCmfgHjDeIwNQD8f/BS87b3d91/a4z2VH7UWraQBCzMfAcamVgs+ELCCCvhLjTlOLvZ7NuGLqZJz5fbHzKBz2TlG6UVllWCsvVX+ck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317665; c=relaxed/simple; bh=T8XZYUFwr0fl77CV1haV2KzudHykqK1Q+kmvWqF4LOs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pVEVmjQDkF5bmTgWS1/FajiG/JthHUHSRxOCNbmQAEo7ETn8lvB9KPhckk8WgRdftuPTgJDnw1mJq6PLHNKAN/SmpU0DnslGKN+hoW6jSd0z7ugQarxe+pN6+/Q2pn1uo0dJoBzlgd5X5vZToI0FFtBh0ms165oWFASZp335qG8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=rTu7PYZs; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="rTu7PYZs" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-35f2c9e23d3so4008223f8f.0 for ; Tue, 25 Jun 2024 05:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317662; x=1719922462; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M9F4AOalFvQYDDoL4qqXuaXBdt8EmcihponRzH2IlUU=; b=rTu7PYZs1wYIR6uTTAv3Z5Rnd8JY7rUE2DRmRWf1xgbHn+FYGERm3fqZx/jENexQzR 2ClEf0T+xO0aLlCrlaMFGUM2ls+oYHaA9kB2naULswQy1UBWR4AuNPYihVVFRfPl4q6h iA2OEKqGZgSXQ7bC2oEER2v8h5+RYdTXB3m0d2KKKqnQhyOw62TnDgaSQwu5xbGRRne7 EbQTi50sM/ZILFkDYRRhMtnJDMVwhP8znfGwDJ7fY4uHzYfwkzYxCQTAdXzmWAufPTLs KpQFPlYPzirzS+E8o0UP5dghjna/RqxxBzzRG9rif2qs6koylbGkLO9rU7fq8EA7LlH+ I7CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317662; x=1719922462; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M9F4AOalFvQYDDoL4qqXuaXBdt8EmcihponRzH2IlUU=; b=Kr3HAr5aB6iVriLbMOUKLIfJ/Tk5oKIAn7EepUvg3MgPcopFa4FUFvkTqlvHLlM++4 749w8cIOFKskNc4of46pYENcMSsOGL07YgpbQwDrkBuGndJNBnszCZcEHC3hnntt9Npg ZolNFquKGT+wR2waF5D0N8fbcpNlw1IMXtFPNjVysSz0Yq3EejjYnAEVTj8r47uPWI/D 3oXfBZu1fhxpQOs2VHPh+QxUd6fWkwH8k5BteHqZSwgHrdWfWCKiDIkcVNHoSQHpVyeD mi6nGqr6rLO55K9ZpwztjjcRJjNSht+CSf8TrPdtMu9PyMH286RyaEDeEGMH/JLHZq6Q elpg== X-Forwarded-Encrypted: i=1; AJvYcCUX48qQYZyq0haIjkAUYTwmKmcSthzx6d65Uf5rcFMFjCmbQ5369Zod41xIJNcHkRAfFoLbtAdjzGUYXc/zYwF/r9AxhEHXrIVdtlxW X-Gm-Message-State: AOJu0YwTTwMNt35NLH9giRyMJDbzR2OoImD0uYjOKtEnotgcSb+PcT4E D1oC6w+LR6SsL2y+rWw+Xeg/+NY30Vy0nqQTHNuSLY9+GE0BxmRUcH6XVR0emv0= X-Google-Smtp-Source: AGHT+IEE/PBalVNidpzCZi3TH9Ixmm5Dqm5Mw84zjF1Ae1Sf7MDJWhsBzzlFtUkGDJS+OXDydg9Uzg== X-Received: by 2002:a5d:6486:0:b0:366:e9fa:17b with SMTP id ffacd0b85a97d-366e9fa0233mr6828334f8f.1.1719317662089; Tue, 25 Jun 2024 05:14:22 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:21 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 01/12] clk: renesas: r9a08g045: Add clock, reset and power domain support for I2C Date: Tue, 25 Jun 2024 15:13:47 +0300 Message-Id: <20240625121358.590547-2-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add clock, reset and power domain support for the I2C channels available on the Renesas RZ/G3S SoC. Signed-off-by: Claudiu Beznea Reviewed-by: Geert Uytterhoeven --- Changes in v2: - updated clock names to match the documentation drivers/clk/renesas/r9a08g045-cpg.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/clk/renesas/r9a08g045-cpg.c b/drivers/clk/renesas/r9a0= 8g045-cpg.c index b068733b145f..5f372d73c3ac 100644 --- a/drivers/clk/renesas/r9a08g045-cpg.c +++ b/drivers/clk/renesas/r9a08g045-cpg.c @@ -213,6 +213,10 @@ static const struct rzg2l_mod_clk r9a08g045_mod_clks[]= =3D { DEF_COUPLED("eth1_axi", R9A08G045_ETH1_CLK_AXI, R9A08G045_CLK_M0, 0x57c,= 1), DEF_COUPLED("eth1_chi", R9A08G045_ETH1_CLK_CHI, R9A08G045_CLK_ZT, 0x57c,= 1), DEF_MOD("eth1_refclk", R9A08G045_ETH1_REFCLK, R9A08G045_CLK_HP, 0x57c, 9= ), + DEF_MOD("i2c0_pclk", R9A08G045_I2C0_PCLK, R9A08G045_CLK_P0, 0x580, 0), + DEF_MOD("i2c1_pclk", R9A08G045_I2C1_PCLK, R9A08G045_CLK_P0, 0x580, 1), + DEF_MOD("i2c2_pclk", R9A08G045_I2C2_PCLK, R9A08G045_CLK_P0, 0x580, 2), + DEF_MOD("i2c3_pclk", R9A08G045_I2C3_PCLK, R9A08G045_CLK_P0, 0x580, 3), DEF_MOD("scif0_clk_pck", R9A08G045_SCIF0_CLK_PCK, R9A08G045_CLK_P0, 0x584= , 0), DEF_MOD("gpio_hclk", R9A08G045_GPIO_HCLK, R9A08G045_OSCCLK, 0x598, 0), }; @@ -227,6 +231,10 @@ static const struct rzg2l_reset r9a08g045_resets[] =3D= { DEF_RST(R9A08G045_SDHI2_IXRST, 0x854, 2), DEF_RST(R9A08G045_ETH0_RST_HW_N, 0x87c, 0), DEF_RST(R9A08G045_ETH1_RST_HW_N, 0x87c, 1), + DEF_RST(R9A08G045_I2C0_MRST, 0x880, 0), + DEF_RST(R9A08G045_I2C1_MRST, 0x880, 1), + DEF_RST(R9A08G045_I2C2_MRST, 0x880, 2), + DEF_RST(R9A08G045_I2C3_MRST, 0x880, 3), DEF_RST(R9A08G045_SCIF0_RST_SYSTEM_N, 0x884, 0), DEF_RST(R9A08G045_GPIO_RSTN, 0x898, 0), DEF_RST(R9A08G045_GPIO_PORT_RESETN, 0x898, 1), @@ -272,6 +280,18 @@ static const struct rzg2l_cpg_pm_domain_init_data r9a0= 8g045_pm_domains[] =3D { DEF_PD("eth1", R9A08G045_PD_ETHER1, DEF_REG_CONF(CPG_BUS_PERI_COM_MSTOP, BIT(3)), RZG2L_PD_F_NONE), + DEF_PD("i2c0", R9A08G045_PD_I2C0, + DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(10)), + RZG2L_PD_F_NONE), + DEF_PD("i2c1", R9A08G045_PD_I2C1, + DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(11)), + RZG2L_PD_F_NONE), + DEF_PD("i2c2", R9A08G045_PD_I2C2, + DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(12)), + RZG2L_PD_F_NONE), + DEF_PD("i2c3", R9A08G045_PD_I2C3, + DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(13)), + RZG2L_PD_F_NONE), DEF_PD("scif0", R9A08G045_PD_SCIF0, DEF_REG_CONF(CPG_BUS_MCPU2_MSTOP, BIT(1)), RZG2L_PD_F_NONE), --=20 2.39.2 From nobody Wed Dec 17 19:41:17 2025 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B044C1553A2 for ; Tue, 25 Jun 2024 12:14:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317667; cv=none; b=SF4SyrkNtlrKrngqw804d+kUmNxiCu9DYWq+z4jrwegbAdRrYnfIBzW5NZEeyAMl3XC8RQmJNNBOz/qRTY240F3VcrcOh+NFnVgb5Xp7IlK0p4Zwp/icXAiOsu+rmn0sd/KEmBS1g11x3ABo6PtXtLXgdMKVzMpo3Vh5Ox/JU2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317667; c=relaxed/simple; bh=bR4Nt/dqr+OGkz7HRH6QPG335EHNGx1yj6lckvyqy/8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PUYyLOsizNDBo4UXDBV9Tys/EAcTHDgz/fOMwEHdvCQ7HUAX1rjq8zD/BtySqL3rL/RsaVYp9dyIFO9GhwWuUQ1PRO/opbT56NNXcpl0KksPlfM4bWg00AlLpor0rJ/nhRvnBu4blKGrPPSX5qf+jdAy5mvIDW7sBO+KVLgInD0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=UMFUbKMX; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="UMFUbKMX" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-52cdf579dd2so2890065e87.3 for ; Tue, 25 Jun 2024 05:14:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317664; x=1719922464; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xPJe111c35qT0vgsGi1skaghnu2sv9Jy0VK3xrLcV2k=; b=UMFUbKMXlPDikHp8HuqBxftSadG7F5d80rgh43NuxEo8FlaFctPQV6uFYdQUnLScMF D9P69mwDRf8uqBWlFjePqiogOLR6PTbnedjVO7fnWHlvLAC6gItUQMLEyhj0r7Ov8u5x 6WQ2dXuR/VDMEEe7AGveSvhVFY5oQhXyVQ/HfAcNJX4CggOZoaohP7sShFi6OoMKfHQq 7oCXTDdSAB5Rgt1t2vsHw/FB4rTUqzeMQhaBvMndwz9/dTWysXQKR0fxqTiDgTHweBK5 NLib8Yhj0DUfdqroQJbfq75dnxIZdDyR3Q/IXNsjs2NxTVPyKQxL5Sy6YvOeO9EARQvz iOXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317664; x=1719922464; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xPJe111c35qT0vgsGi1skaghnu2sv9Jy0VK3xrLcV2k=; b=Nc+tVyOWIrRPhMaupQymtjrmNDFPsTzqfO+vOM7a+Z9qp2lObCQuIGg17/t/yzdW8l JidLnOgHpz5JozeohaIuy7Ki0vGEtcpJWPbwpvQEF3fk5UCjKk/tVTNWuEtWW6DfzbYx Ubyhp7J4m65pT9DQsUW6C253RU/mTfzSlMd1/qrnUtUdaC7aywmU0iP832ywuCMADBg/ 0ku3QW4VzAYQW3JreGCwM6vGILYIDW0L21C0dGACqeN8EvOiaHao7hf0cjMcllKImiCO 9ipgST7a/u0jhSo16UO2mHWhFiECgHuCKFtYHd6KqLAk0gZ9GaiUJ8l1jL/C6shPFU5S HpYA== X-Forwarded-Encrypted: i=1; AJvYcCXIDe2PbwT+3EOh1wPVuOYUMTmAEhoifsdDqE5KYg230OL2xWFzA0cDdEWy/fkWQVHp++g0mPpKP/gN5ukpTXPAyqacJc8uCQYsunnt X-Gm-Message-State: AOJu0Ywu4BxQVFr85caOBwPLrLp6jMssEE61l+klW4HHpsnXEHo4fXF7 gUzX9XmNWMXYq0RVQmLWosun2//b+hgfDzhIY2/H79Tk2VCZh1fhykCLmRxREC8= X-Google-Smtp-Source: AGHT+IF8i0XtFegYVMkDlPScRz5RnYvbtVl15nutQRpgido0c97wQN5tzJwW/dwq0ey3xSW0IYWouw== X-Received: by 2002:a19:6a10:0:b0:52b:c089:4579 with SMTP id 2adb3069b0e04-52cdf8209c4mr5362782e87.49.1719317663816; Tue, 25 Jun 2024 05:14:23 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:23 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 02/12] i2c: riic: Use temporary variable for struct device Date: Tue, 25 Jun 2024 15:13:48 +0300 Message-Id: <20240625121358.590547-3-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Use a temporary variable for the struct device pointers to avoid dereferencing. While at it, replace riic->adapter.dev argument of dev_err() from riic_init_hw() with the temporary variable (pointing to riic->adapter.dev.parent). Signed-off-by: Claudiu Beznea --- Changes in v2: - updated commit description to reflect all the changes done drivers/i2c/busses/i2c-riic.c | 53 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index f608b1838cad..c08c988f50c7 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -131,11 +131,12 @@ static inline void riic_clear_set_bit(struct riic_dev= *riic, u8 clear, u8 set, u static int riic_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int = num) { struct riic_dev *riic =3D i2c_get_adapdata(adap); + struct device *dev =3D adap->dev.parent; unsigned long time_left; int i; u8 start_bit; =20 - pm_runtime_get_sync(adap->dev.parent); + pm_runtime_get_sync(dev); =20 if (riic_readb(riic, RIIC_ICCR2) & ICCR2_BBSY) { riic->err =3D -EBUSY; @@ -168,7 +169,7 @@ static int riic_xfer(struct i2c_adapter *adap, struct i= 2c_msg msgs[], int num) } =20 out: - pm_runtime_put(adap->dev.parent); + pm_runtime_put(dev); =20 return riic->err ?: num; } @@ -303,11 +304,12 @@ static int riic_init_hw(struct riic_dev *riic, struct= i2c_timings *t) int ret =3D 0; unsigned long rate; int total_ticks, cks, brl, brh; + struct device *dev =3D riic->adapter.dev.parent; =20 - pm_runtime_get_sync(riic->adapter.dev.parent); + pm_runtime_get_sync(dev); =20 if (t->bus_freq_hz > I2C_MAX_FAST_MODE_FREQ) { - dev_err(&riic->adapter.dev, + dev_err(dev, "unsupported bus speed (%dHz). %d max\n", t->bus_freq_hz, I2C_MAX_FAST_MODE_FREQ); ret =3D -EINVAL; @@ -347,7 +349,7 @@ static int riic_init_hw(struct riic_dev *riic, struct i= 2c_timings *t) } =20 if (brl > (0x1F + 3)) { - dev_err(&riic->adapter.dev, "invalid speed (%lu). Too slow.\n", + dev_err(dev, "invalid speed (%lu). Too slow.\n", (unsigned long)t->bus_freq_hz); ret =3D -EINVAL; goto out; @@ -396,7 +398,7 @@ static int riic_init_hw(struct riic_dev *riic, struct i= 2c_timings *t) riic_clear_set_bit(riic, ICCR1_IICRST, 0, RIIC_ICCR1); =20 out: - pm_runtime_put(riic->adapter.dev.parent); + pm_runtime_put(dev); return ret; } =20 @@ -415,13 +417,14 @@ static void riic_reset_control_assert(void *data) =20 static int riic_i2c_probe(struct platform_device *pdev) { + struct device *dev =3D &pdev->dev; struct riic_dev *riic; struct i2c_adapter *adap; struct i2c_timings i2c_t; struct reset_control *rstc; int i, ret; =20 - riic =3D devm_kzalloc(&pdev->dev, sizeof(*riic), GFP_KERNEL); + riic =3D devm_kzalloc(dev, sizeof(*riic), GFP_KERNEL); if (!riic) return -ENOMEM; =20 @@ -429,22 +432,22 @@ static int riic_i2c_probe(struct platform_device *pde= v) if (IS_ERR(riic->base)) return PTR_ERR(riic->base); =20 - riic->clk =3D devm_clk_get(&pdev->dev, NULL); + riic->clk =3D devm_clk_get(dev, NULL); if (IS_ERR(riic->clk)) { - dev_err(&pdev->dev, "missing controller clock"); + dev_err(dev, "missing controller clock"); return PTR_ERR(riic->clk); } =20 - rstc =3D devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); + rstc =3D devm_reset_control_get_optional_exclusive(dev, NULL); if (IS_ERR(rstc)) - return dev_err_probe(&pdev->dev, PTR_ERR(rstc), + return dev_err_probe(dev, PTR_ERR(rstc), "Error: missing reset ctrl\n"); =20 ret =3D reset_control_deassert(rstc); if (ret) return ret; =20 - ret =3D devm_add_action_or_reset(&pdev->dev, riic_reset_control_assert, r= stc); + ret =3D devm_add_action_or_reset(dev, riic_reset_control_assert, rstc); if (ret) return ret; =20 @@ -453,29 +456,29 @@ static int riic_i2c_probe(struct platform_device *pde= v) if (ret < 0) return ret; =20 - ret =3D devm_request_irq(&pdev->dev, ret, riic_irqs[i].isr, + ret =3D devm_request_irq(dev, ret, riic_irqs[i].isr, 0, riic_irqs[i].name, riic); if (ret) { - dev_err(&pdev->dev, "failed to request irq %s\n", riic_irqs[i].name); + dev_err(dev, "failed to request irq %s\n", riic_irqs[i].name); return ret; } } =20 - riic->info =3D of_device_get_match_data(&pdev->dev); + riic->info =3D of_device_get_match_data(dev); =20 adap =3D &riic->adapter; i2c_set_adapdata(adap, riic); strscpy(adap->name, "Renesas RIIC adapter", sizeof(adap->name)); adap->owner =3D THIS_MODULE; adap->algo =3D &riic_algo; - adap->dev.parent =3D &pdev->dev; - adap->dev.of_node =3D pdev->dev.of_node; + adap->dev.parent =3D dev; + adap->dev.of_node =3D dev->of_node; =20 init_completion(&riic->msg_done); =20 - i2c_parse_fw_timings(&pdev->dev, &i2c_t, true); + i2c_parse_fw_timings(dev, &i2c_t, true); =20 - pm_runtime_enable(&pdev->dev); + pm_runtime_enable(dev); =20 ret =3D riic_init_hw(riic, &i2c_t); if (ret) @@ -487,24 +490,24 @@ static int riic_i2c_probe(struct platform_device *pde= v) =20 platform_set_drvdata(pdev, riic); =20 - dev_info(&pdev->dev, "registered with %dHz bus speed\n", - i2c_t.bus_freq_hz); + dev_info(dev, "registered with %dHz bus speed\n", i2c_t.bus_freq_hz); return 0; =20 out: - pm_runtime_disable(&pdev->dev); + pm_runtime_disable(dev); return ret; } =20 static void riic_i2c_remove(struct platform_device *pdev) { struct riic_dev *riic =3D platform_get_drvdata(pdev); + struct device *dev =3D &pdev->dev; =20 - pm_runtime_get_sync(&pdev->dev); + pm_runtime_get_sync(dev); riic_writeb(riic, 0, RIIC_ICIER); - pm_runtime_put(&pdev->dev); + pm_runtime_put(dev); i2c_del_adapter(&riic->adapter); - pm_runtime_disable(&pdev->dev); + pm_runtime_disable(dev); } =20 static const struct riic_of_data riic_rz_a_info =3D { --=20 2.39.2 From nobody Wed Dec 17 19:41:17 2025 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53DFE156C72 for ; Tue, 25 Jun 2024 12:14:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317669; cv=none; b=BJM1P6KyktIMmFPjmaxg86ZEiw6UuFe/ohx0Dn3L78Rp932V47xUCXsIQ1gHu2Ehk7IkZqhyTp2ysWwJB9cnriljh/IO8HpoPbvwer3ouegPzu0WsbvML8jG8z8GqUr4/uVETM9sXq/CrAyHPsj/sEYJsM4R5AZgjraP6FvTbRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317669; c=relaxed/simple; bh=aVioSRzJqXlczjHmYmBjJBu7oq6xmwTohrZmb+gYSbU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CoXoKYJ6hn68Q+mFZDUIRiZ+/UPL8jca2qWQPAVKI1N+WIsJ/dhQkeptuP/mL4iTztae5pzWAiR9U1wxga2DqfJEjCMF1+D3tRf5qdJoKNYApery8ciK3ZX4woIdr17BmhNUcnsN4+WxrioInVX+fXn6U0t50QR6IQL711nNx2I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=CLOglOsj; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="CLOglOsj" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4217990f997so40662725e9.2 for ; Tue, 25 Jun 2024 05:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317666; x=1719922466; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j3mhaGF+KU5yeMisjPIARpLxwyj1AMM2/2N+WRoELhI=; b=CLOglOsjSD93t2ALtumKBY822qS/ALq8kVsKTFR6+BgXCwDb7ucCy6wJwQRr/Prmus 5wnjEdfI/0MdBNRhHyeDP2fMmf20XGXLH4eHVFPU34A42Lv1emuW2WwdzlnOh4EBhjUb 2iP/zyev7mILSvTRaD1rF0H04o6k30C+6YFP2+Q29i1XRIv5okEP5brmKVnYo6vWpnDD VloHNlOmLc5RnKf4x2J7wAqwc4YcQf3bIATdXt+VJ9JXgA+YzFzYK1UaFBjbQa1v3534 EAJL35whdUwQJp8EzFJEZtReX8Z7SKknUl54dhPwFIg1S/nIzEzHnaG4rhDAMtM3Etzm iXFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317666; x=1719922466; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j3mhaGF+KU5yeMisjPIARpLxwyj1AMM2/2N+WRoELhI=; b=ajnnbEBJq9lbT29/8kVy4IB6kCJysyD+7ZppNcry3qEFJUlTWqxqwUnpUfQSMyGU6Y 8Xf3Tc8bU9ScDBuF8gr/rVxg0bSsoQhCrVO86QIWolhZxnlvnUEBiws/WPuYuUeFPwud ac/jedX56LOqe52XBjvxr+VRgj3OqO1VfEUbKSRMsLo3L39AkVZPUee2CyzOn3f7Q28w g1dnpa/kzTbJGARGbZ2n1U8sN0+7ptx2AaomTE2A/BEerwFE1Kv+EGeWdpWDGO2GRl0o Cybc6ZYDt+fMz+CuPyNpSR/Rq/1MLVdpzRemPo3WKNDwfTxaTRarwnLpDwUbxg3GY5YS h+fw== X-Forwarded-Encrypted: i=1; AJvYcCV91sE1Z1i5ngVfQBkcXjjqzXeIUs9SaxNUL8wOISaz4b8J5gu9WYe2j/Y6aQxFiVrwV6LM9+l/T/N7gxqIbJJtPAv5CfSDPYdwNmGH X-Gm-Message-State: AOJu0YyPm6bkP59CScAUJmypR+OR4YZxsMRyXNwTY6mYkQ/3wc67ZjNc ZaQey4gHNFeWOwHjE+cqNMR7KbzaLzX0gqWYVWWJ43sQA9N4kquqSgScduCNu24= X-Google-Smtp-Source: AGHT+IFK5iuAO1YBTxjhIGSX7Q8KoOhjQXwLGyqLocsV4KY5Z057M7ZH3/y+fDPFPY63w1kZ1xsu8Q== X-Received: by 2002:a05:600c:4b1f:b0:424:a5d8:ac83 with SMTP id 5b1f17b1804b1-424a5d8acafmr6070375e9.41.1719317665539; Tue, 25 Jun 2024 05:14:25 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:25 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 03/12] i2c: riic: Call pm_runtime_get_sync() when need to access registers Date: Tue, 25 Jun 2024 15:13:49 +0300 Message-Id: <20240625121358.590547-4-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea There is no need to runtime resume the device as long as the IP registers are not accessed. Calling pm_runtime_get_sync() at the register access time leads to a simpler error path. Signed-off-by: Claudiu Beznea Reviewed-by: Andi Shyti --- Changes in v2: - none drivers/i2c/busses/i2c-riic.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index c08c988f50c7..83e4d5e14ab6 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -301,19 +301,15 @@ static const struct i2c_algorithm riic_algo =3D { =20 static int riic_init_hw(struct riic_dev *riic, struct i2c_timings *t) { - int ret =3D 0; unsigned long rate; int total_ticks, cks, brl, brh; struct device *dev =3D riic->adapter.dev.parent; =20 - pm_runtime_get_sync(dev); - if (t->bus_freq_hz > I2C_MAX_FAST_MODE_FREQ) { dev_err(dev, "unsupported bus speed (%dHz). %d max\n", t->bus_freq_hz, I2C_MAX_FAST_MODE_FREQ); - ret =3D -EINVAL; - goto out; + return -EINVAL; } =20 rate =3D clk_get_rate(riic->clk); @@ -351,8 +347,7 @@ static int riic_init_hw(struct riic_dev *riic, struct i= 2c_timings *t) if (brl > (0x1F + 3)) { dev_err(dev, "invalid speed (%lu). Too slow.\n", (unsigned long)t->bus_freq_hz); - ret =3D -EINVAL; - goto out; + return -EINVAL; } =20 brh =3D total_ticks - brl; @@ -384,6 +379,8 @@ static int riic_init_hw(struct riic_dev *riic, struct i= 2c_timings *t) t->scl_fall_ns / (1000000000 / rate), t->scl_rise_ns / (1000000000 / rate), cks, brl, brh); =20 + pm_runtime_get_sync(dev); + /* Changing the order of accessing IICRST and ICE may break things! */ riic_writeb(riic, ICCR1_IICRST | ICCR1_SOWP, RIIC_ICCR1); riic_clear_set_bit(riic, 0, ICCR1_ICE, RIIC_ICCR1); @@ -397,9 +394,8 @@ static int riic_init_hw(struct riic_dev *riic, struct i= 2c_timings *t) =20 riic_clear_set_bit(riic, ICCR1_IICRST, 0, RIIC_ICCR1); =20 -out: pm_runtime_put(dev); - return ret; + return 0; } =20 static struct riic_irq_desc riic_irqs[] =3D { --=20 2.39.2 From nobody Wed Dec 17 19:41:17 2025 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C580D158A23 for ; Tue, 25 Jun 2024 12:14:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317670; cv=none; b=bv17ezlSgip6lEbmSUvV3suoosm+vITHibmWPmddSTYSBZSo7jEttUybrQzm0Sv6jb1iXddPsYu42I+l+LVRckXY6CtQtHQ0oePCeBeV2xm8ByMMe9EO0MNKH5VWf+0KeuD2DwU6xtACh98vC/76sjnf7XAzrAoJkUTczFBxTzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317670; c=relaxed/simple; bh=828UGT6zhpaGNswO3hfQPfQnNxDFtEsdkXTLcG7yUMU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qkB3mszHH8l3SmqIaj41abTfWDwPUu/fRfWYoNpQ0OaQHSgVu1gQVFt1lTPXYNCM+1/ovvdbRA+EQGrX5w3TcuvgmvhOy5MKzBYxembdPzus4TiwE8+YFgnTRHrPeq972VNINkM7pa+rD/uKRjbTfHXW2i4VWVVATVh++8Qs5mE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=endkamt9; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="endkamt9" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-36532d177a0so3551372f8f.2 for ; Tue, 25 Jun 2024 05:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317667; x=1719922467; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rALKwMQZYGMYLdvqGe1Q48GEOVu0KYS1mAaod52Tej0=; b=endkamt9Lu401q94haRXg0t1QzGRHLsD2kyS8GmHotGZFg1Oy8+ko0YdpXbxu5jvEm SdgZq3+BxjRAgxcde7SrohHUosIH/5Wt99Cs3ULsnjXN5t8aKCHmjO/pWvVWP91xk+4d Gg9Jjh+WJrFejcTeh3jDFQP22lM4gEvAcsC1beTyQqm0DwfRb5V/QNgdZGBJwb7K1fJk yBcX6YgVoXtkqjTEdbue4cAsJbq5Lvkx0IzSaxCJ7AM4hAAidC74tRpt5MpMShU9M4N8 QjgJ5BZwWN5RV8y0c6COW3VMTiz5t6jnfM9o9OgyNOGDdBE/nuASRHh6nnmEshRsSYN+ +GBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317667; x=1719922467; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rALKwMQZYGMYLdvqGe1Q48GEOVu0KYS1mAaod52Tej0=; b=Ov2iOo2ziVNeT30uE1C3wdvI15p3LlH4ngEtHKSdUCW3tBhmi3pZyl4OIfdceV1oiG m6sdcEVmYaddPxeB0J8Xr96tg8t5I6sN8LZ1NUzy7HOnBbGWSXwb1+AL0aJsG0h0eDvL Gqdy+ul2+bvHor/5DFblAouSSjIcXq7rFakFINtpIgk17e8p9HLJuRsS63uGWbb/wtMt TnJai5OVwRplrTZiOxAJJaB5GL3oEhH+XmpnkaiW6WFTUMS33TiL3Jfb+NwADtGqPEOZ pSO3b2+bvGy3TIWtJqnnmz6TT6Acyz8umj0nrwLeT6Nv+tbf477tr9DEWpAbvbYJveXE o80g== X-Forwarded-Encrypted: i=1; AJvYcCW0XgOYnDEBMtUCpXTJysfE7Hp3GwLVRzWnS8KJpL7K34F4GORXhbw3F/0xdkku8boqSuVNynqgF0e6tsO0YMz/GTxI35M3JCk78OBK X-Gm-Message-State: AOJu0YxbW35HfRiLdpZZPuSSHV9soboB2yzXAx3yjR5Zgdj2M4sQy75H IX5xEY8ENFL1/DAk7hTx67pbSdeB9wSI9JB6ovLWfFH/ah3rnQPi7S74I9EaObA= X-Google-Smtp-Source: AGHT+IGScbs50O3Ozp643JLI2AN2mHjwH2camaqLoFd/JY6fZABGocXFvofQtMKZTI+bOWqi4WqmVg== X-Received: by 2002:a5d:4e8c:0:b0:360:8dba:af69 with SMTP id ffacd0b85a97d-366e4f0ce68mr4943484f8f.61.1719317667156; Tue, 25 Jun 2024 05:14:27 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:26 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 04/12] i2c: riic: Use pm_runtime_resume_and_get() Date: Tue, 25 Jun 2024 15:13:50 +0300 Message-Id: <20240625121358.590547-5-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea pm_runtime_get_sync() may return with error. In case it returns with error dev->power.usage_count needs to be decremented. pm_runtime_resume_and_get() takes care of this. Thus use it. Signed-off-by: Claudiu Beznea --- Changes in v2: - delete i2c adapter all the time in remove drivers/i2c/busses/i2c-riic.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index 83e4d5e14ab6..002b11b020fa 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -113,6 +113,8 @@ struct riic_irq_desc { char *name; }; =20 +static const char * const riic_rpm_err_msg =3D "Failed to runtime resume"; + static inline void riic_writeb(struct riic_dev *riic, u8 val, u8 offset) { writeb(val, riic->base + riic->info->regs[offset]); @@ -133,10 +135,14 @@ static int riic_xfer(struct i2c_adapter *adap, struct= i2c_msg msgs[], int num) struct riic_dev *riic =3D i2c_get_adapdata(adap); struct device *dev =3D adap->dev.parent; unsigned long time_left; - int i; + int i, ret; u8 start_bit; =20 - pm_runtime_get_sync(dev); + ret =3D pm_runtime_resume_and_get(dev); + if (ret) { + dev_err(dev, riic_rpm_err_msg); + return ret; + } =20 if (riic_readb(riic, RIIC_ICCR2) & ICCR2_BBSY) { riic->err =3D -EBUSY; @@ -301,6 +307,7 @@ static const struct i2c_algorithm riic_algo =3D { =20 static int riic_init_hw(struct riic_dev *riic, struct i2c_timings *t) { + int ret; unsigned long rate; int total_ticks, cks, brl, brh; struct device *dev =3D riic->adapter.dev.parent; @@ -379,7 +386,11 @@ static int riic_init_hw(struct riic_dev *riic, struct = i2c_timings *t) t->scl_fall_ns / (1000000000 / rate), t->scl_rise_ns / (1000000000 / rate), cks, brl, brh); =20 - pm_runtime_get_sync(dev); + ret =3D pm_runtime_resume_and_get(dev); + if (ret) { + dev_err(dev, riic_rpm_err_msg); + return ret; + } =20 /* Changing the order of accessing IICRST and ICE may break things! */ riic_writeb(riic, ICCR1_IICRST | ICCR1_SOWP, RIIC_ICCR1); @@ -498,11 +509,18 @@ static void riic_i2c_remove(struct platform_device *p= dev) { struct riic_dev *riic =3D platform_get_drvdata(pdev); struct device *dev =3D &pdev->dev; + int ret; =20 - pm_runtime_get_sync(dev); - riic_writeb(riic, 0, RIIC_ICIER); - pm_runtime_put(dev); i2c_del_adapter(&riic->adapter); + + ret =3D pm_runtime_resume_and_get(dev); + if (ret) { + dev_err(dev, riic_rpm_err_msg); + } else { + riic_writeb(riic, 0, RIIC_ICIER); + pm_runtime_put(dev); + } + pm_runtime_disable(dev); } =20 --=20 2.39.2 From nobody Wed Dec 17 19:41:17 2025 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8793A15A87A for ; Tue, 25 Jun 2024 12:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317672; cv=none; b=V5bqxxqrPEBCb8kFw3SgHw8lvDPg562VGE/1zhPDw98+tJnie12TrCbrzJlt8sySOw0qu6yZStVca+UUy07m+eGKLO3wICCbAwNW0aMldvzN9wvCckPVf5XkJDrbcv9zbr6skI+Qw8GTy/jEwjmhB+26aPmXa+fXUnJzVgxXAbY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317672; c=relaxed/simple; bh=SZFI7ieRlfDHIKjUHJb4mAmP9g299cNGVbuTRzb5QhQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UvAovRy2FMHRYQexlOJAHRmVOY+bqUB8KsxA01XyaqTQSkQTMbIVsFs2QHSnD+B4GsHoP9WV9OrkD9IuLHA3Pn5y5AxYn4uvEFJC+Xc8sXXSU0aVIrTAeYgnzfo4yR7bYAWS+5RAv9zmYK2xsWIliqZQJFk04oD423qglqYHDXw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=nvheh0W+; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="nvheh0W+" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4217d808034so44399525e9.3 for ; Tue, 25 Jun 2024 05:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317669; x=1719922469; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r/s4zhle7xfM5JgZ6DVzSJAJxVkhzCO478oqgIVbef0=; b=nvheh0W+tCwhGR9F4YIII7JDMbs+0KqPXogFCHq+En1VWvmkk1rPbtWFUI2QiY9TwO /LaKKhIEZFLe4bFVBFqN9aK8hxXL5ce43ppfWLhpfQH/5iskRyVjsX9m7h4nr1pKLPWm v35tCQ5H9VEKe9OnHxCFSZEaxQoe80pt6N2hZWdMYbkflUX+QK5YxS3WY/STtvJ4Yepe 8ftUIqRT7WF7dMgolAQeBri5AuPPRT2m8YnoYyr4ACS3IbrpthH7ZfHr5Yt2tY/CxplI MhWKM22Qeq0iQ8LU4F70msOQX3gvAlbezq33WPkTdL+84/01jCjkRzEDvNoGxzGUNpXh Skfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317669; x=1719922469; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r/s4zhle7xfM5JgZ6DVzSJAJxVkhzCO478oqgIVbef0=; b=jD32dlxLNLxeLXRL68TJXpIi0s/KXaQBJAK/cD2Cf/ZyFaLDHhHhXucUFCzRUj3aSw iCfPsQyl4TwS0wItDX8Do7eUj0jhsFR4bG+qRt8KmwzyF/p2+s7kLR7N45C7wXhe/xNI 1t2xA7h3zLAMeE60E6dgzVPly5CnPOsXx3HpBo+viBBq78WXimkkfpM9jgTBS6RZVO5u W0f7JPhEOtisODXxKWiLTlMiYDKy9rO9G9epkdKqxbdI1N/XGwRmXaYFpaOm/vZ46fky EGh+s6YyT8xYRcl+8ERr7iXLJGqENjvK0znUfLyJkxRLbxRef3iCECfuvCOC64OhAQFW uPRA== X-Forwarded-Encrypted: i=1; AJvYcCX0UGb1ngGubyS9l10npHijC4EBVJ0ha1v65nCT7sxoiyVYsurvBFrRiHKV8JTx9HzZnRv5haXWQGk35VUPfsiABHfHPsnRZYdyDsos X-Gm-Message-State: AOJu0YxhU4/aSSiC9mcEnNHtwDsxD1zm10DaUyD57ZLUX/bXm/F7QUG7 shbo12qh2GlJHQMDkbQ3q6qK0BTLt16z33UtIZWE1AJLE6frGx2nW/IW8SL3WKI= X-Google-Smtp-Source: AGHT+IGpK4KFob/8uwg9NoIk3lwn/csQ1kMUYHL5YqxKv1iS3jSCBr+2jObM0uKgM6FoY7LcYXKjjQ== X-Received: by 2002:a05:600c:4185:b0:424:a516:13f8 with SMTP id 5b1f17b1804b1-424a516147cmr8586235e9.35.1719317669074; Tue, 25 Jun 2024 05:14:29 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:28 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 05/12] i2c: riic: Enable runtime PM autosuspend support Date: Tue, 25 Jun 2024 15:13:51 +0300 Message-Id: <20240625121358.590547-6-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Enable runtime PM autosuspend support for the RIIC driver. With this, in case there are consecutive xfer requests the device wouldn't be runtime enabled/disabled after each consecutive xfer but after the the delay configured by user. With this, we can avoid touching hardware registers involved in runtime PM suspend/resume saving in this way some cycles. The default chosen autosuspend delay is zero to keep the previous driver behavior. Signed-off-by: Claudiu Beznea --- Changes in v2: - none drivers/i2c/busses/i2c-riic.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index 002b11b020fa..24c0d62544fb 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -175,7 +175,8 @@ static int riic_xfer(struct i2c_adapter *adap, struct i= 2c_msg msgs[], int num) } =20 out: - pm_runtime_put(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); =20 return riic->err ?: num; } @@ -405,7 +406,8 @@ static int riic_init_hw(struct riic_dev *riic, struct i= 2c_timings *t) =20 riic_clear_set_bit(riic, ICCR1_IICRST, 0, RIIC_ICCR1); =20 - pm_runtime_put(dev); + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); return 0; } =20 @@ -485,6 +487,8 @@ static int riic_i2c_probe(struct platform_device *pdev) =20 i2c_parse_fw_timings(dev, &i2c_t, true); =20 + pm_runtime_set_autosuspend_delay(dev, 0); + pm_runtime_use_autosuspend(dev); pm_runtime_enable(dev); =20 ret =3D riic_init_hw(riic, &i2c_t); @@ -502,6 +506,7 @@ static int riic_i2c_probe(struct platform_device *pdev) =20 out: pm_runtime_disable(dev); + pm_runtime_dont_use_autosuspend(dev); return ret; } =20 @@ -522,6 +527,7 @@ static void riic_i2c_remove(struct platform_device *pde= v) } =20 pm_runtime_disable(dev); + pm_runtime_dont_use_autosuspend(dev); } =20 static const struct riic_of_data riic_rz_a_info =3D { --=20 2.39.2 From nobody Wed Dec 17 19:41:17 2025 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E71015FA8A for ; Tue, 25 Jun 2024 12:14:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317674; cv=none; b=JnxOl/u1tkf6e2Ndn4jYqZpGj/ZQxed3oRY444lSERS3mZ4c0wLhjH2xAwi+e71nniUVdiAB2arJ2/ddwghG7ygVcJ4xyHIcnEcCogZSlBA6638r9zEpgNcr8xGm54cskQ2BPBa6DWtXMpWaoL7wB8GONQj5iuJ/xfXqaM2Wpz0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317674; c=relaxed/simple; bh=j7dkVvZJkMISZi+SvUCBhPCTJNFvFvFSMSe87GL2tW8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KfVI7YgFVkCLqEO2V0fImG5BUUqVnYMsbD9vJhStvyyHHOsgPMoojyfeoimXG9mj7Qyy5dGKewSnnflVSkW9rDM9yz+8QgMdX3/ICSj44ePF9B8v3SsO4CZZOp7D6WNBBb4+qhEEyN43hL3N3sTYIXfEH8Sa6Inh8RtoQKi4JyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=Zm8t6Azv; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="Zm8t6Azv" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-36226e98370so3397825f8f.3 for ; Tue, 25 Jun 2024 05:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317671; x=1719922471; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZZfyuc5aqmErcgh+6XpbZS6EIvq8ly/eWpn3GGn9YRA=; b=Zm8t6AzvtuUsdtmQ2ftjRkfN2DgpKnor3ixTvatgL6c0/TUA1zkqsPsSd1Ydvz18TX 5xlhWzyo0+BvLuf7rQNN9sxkZMXouDARf+Fmyc28vfEhgphLKuJpTUisl8khqYvQftbd CXRACytCej5Uzp5wpQFjjGaWEI2w/BJC4OR0dETi1XSg9di2e8NKCAuiaOngMvPJWXEp FnkdiUQqcNapw+2SRhlR3q/xtPmtbINIHEo5Yt+wMKEmqq2GUnfYnbqEjQm7sFLBfsj9 BY/FOVZBx6d9/Aj12njDx6qwinPTqEIzhbQgBp+Ywmh4MTD3TN5/Bwlph5fvS+gtxe+a 6S+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317671; x=1719922471; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZZfyuc5aqmErcgh+6XpbZS6EIvq8ly/eWpn3GGn9YRA=; b=j67gyrB6MN0og+SiaH6EwV5YZGiQzcBcZxNLrbD6dxzezPbw/DBXzOKgwAoAugu7Nw lz3l2F3/LvG1lHJS0C66UAFCmiVumrxE0hYkIxnQLJ8A4lS53o6vIQFr/vbzkAEd4bUF C/UbZLwQLylQY/fwbEudENwDKz4/egLa2RR9+OgUpzeTC5fUrViSCvw2+Ih4eH6r4hTr buqHn+qM0nAyTcahV0/A9WhxMqkPY0f52S/Y0X1YPXneaSN8HJvH8Xt831xE+gtyUgBX f2henDORLq9dLN7qc15O9R7aQ2U9febT9WL3WexjHXxk2EZOuBxebY6GQqluN0rwaz2d mrKQ== X-Forwarded-Encrypted: i=1; AJvYcCX0IXedBFHW9LhV/fEq3aQfmTTL76/52q8h34MGIxr6Nbv/F4bQKvYrhf7ZTpUm7T884VfCOZWXbyD4tsisYl6svw3+/2uMb1ZkhnL3 X-Gm-Message-State: AOJu0YwNR8fMRlTXEwNQIuZYAA4j+7Uj2UVIRmn6KO9QDMUDc6u/88U1 nfsxigbV/ALxeuyVzBXkq76KpY8ft3AIH8o1qaIDj4/8aeHxA41LpS4hDpNmB4k= X-Google-Smtp-Source: AGHT+IFptP1g8C3mH8LnZscvuZHFC2sJKKpBw7yrePF7MEn+4CbMDUaBWXcS6+gb+rLzwh1zH/k8HQ== X-Received: by 2002:a5d:5591:0:b0:362:2111:4816 with SMTP id ffacd0b85a97d-366e95e7178mr5327658f8f.55.1719317670831; Tue, 25 Jun 2024 05:14:30 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:30 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 06/12] i2c: riic: Add suspend/resume support Date: Tue, 25 Jun 2024 15:13:52 +0300 Message-Id: <20240625121358.590547-7-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Add suspend/resume support for the RIIC driver. This is necessary for the Renesas RZ/G3S SoC which support suspend to deep sleep state where power to most of the SoC components is turned off. As a result the I2C controller needs to be reconfigured after suspend/resume. For this, the reset line was stored in the driver private data structure as well as i2c timings. The reset line and I2C timings are necessary to re-initialize the controller after resume. Signed-off-by: Claudiu Beznea --- Changes in v2: - deassert the reset line in resume if riic_init_hw() fails as if that happens there is no way to recover the controller drivers/i2c/busses/i2c-riic.c | 68 +++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index 24c0d62544fb..9fe007609076 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -105,6 +105,8 @@ struct riic_dev { struct completion msg_done; struct i2c_adapter adapter; struct clk *clk; + struct reset_control *rstc; + struct i2c_timings i2c_t; }; =20 struct riic_irq_desc { @@ -306,11 +308,12 @@ static const struct i2c_algorithm riic_algo =3D { .functionality =3D riic_func, }; =20 -static int riic_init_hw(struct riic_dev *riic, struct i2c_timings *t) +static int riic_init_hw(struct riic_dev *riic) { int ret; unsigned long rate; int total_ticks, cks, brl, brh; + struct i2c_timings *t =3D &riic->i2c_t; struct device *dev =3D riic->adapter.dev.parent; =20 if (t->bus_freq_hz > I2C_MAX_FAST_MODE_FREQ) { @@ -429,8 +432,6 @@ static int riic_i2c_probe(struct platform_device *pdev) struct device *dev =3D &pdev->dev; struct riic_dev *riic; struct i2c_adapter *adap; - struct i2c_timings i2c_t; - struct reset_control *rstc; int i, ret; =20 riic =3D devm_kzalloc(dev, sizeof(*riic), GFP_KERNEL); @@ -447,16 +448,16 @@ static int riic_i2c_probe(struct platform_device *pde= v) return PTR_ERR(riic->clk); } =20 - rstc =3D devm_reset_control_get_optional_exclusive(dev, NULL); - if (IS_ERR(rstc)) - return dev_err_probe(dev, PTR_ERR(rstc), + riic->rstc =3D devm_reset_control_get_optional_exclusive(dev, NULL); + if (IS_ERR(riic->rstc)) + return dev_err_probe(dev, PTR_ERR(riic->rstc), "Error: missing reset ctrl\n"); =20 - ret =3D reset_control_deassert(rstc); + ret =3D reset_control_deassert(riic->rstc); if (ret) return ret; =20 - ret =3D devm_add_action_or_reset(dev, riic_reset_control_assert, rstc); + ret =3D devm_add_action_or_reset(dev, riic_reset_control_assert, riic->rs= tc); if (ret) return ret; =20 @@ -485,13 +486,13 @@ static int riic_i2c_probe(struct platform_device *pde= v) =20 init_completion(&riic->msg_done); =20 - i2c_parse_fw_timings(dev, &i2c_t, true); + i2c_parse_fw_timings(dev, &riic->i2c_t, true); =20 pm_runtime_set_autosuspend_delay(dev, 0); pm_runtime_use_autosuspend(dev); pm_runtime_enable(dev); =20 - ret =3D riic_init_hw(riic, &i2c_t); + ret =3D riic_init_hw(riic); if (ret) goto out; =20 @@ -501,7 +502,7 @@ static int riic_i2c_probe(struct platform_device *pdev) =20 platform_set_drvdata(pdev, riic); =20 - dev_info(dev, "registered with %dHz bus speed\n", i2c_t.bus_freq_hz); + dev_info(dev, "registered with %dHz bus speed\n", riic->i2c_t.bus_freq_hz= ); return 0; =20 out: @@ -562,6 +563,50 @@ static const struct riic_of_data riic_rz_v2h_info =3D { }, }; =20 +static int riic_i2c_suspend(struct device *dev) +{ + struct riic_dev *riic =3D dev_get_drvdata(dev); + int ret; + + ret =3D pm_runtime_resume_and_get(dev); + if (ret) + return ret; + + i2c_mark_adapter_suspended(&riic->adapter); + + /* Disable output on SDA, SCL pins. */ + riic_clear_set_bit(riic, ICCR1_ICE, 0, RIIC_ICCR1); + + pm_runtime_mark_last_busy(dev); + pm_runtime_put_sync(dev); + + return reset_control_assert(riic->rstc); +} + +static int riic_i2c_resume(struct device *dev) +{ + struct riic_dev *riic =3D dev_get_drvdata(dev); + int ret; + + ret =3D reset_control_deassert(riic->rstc); + if (ret) + return ret; + + ret =3D riic_init_hw(riic); + if (ret) { + reset_control_assert(riic->rstc); + return ret; + } + + i2c_mark_adapter_resumed(&riic->adapter); + + return 0; +} + +static const struct dev_pm_ops riic_i2c_pm_ops =3D { + SYSTEM_SLEEP_PM_OPS(riic_i2c_suspend, riic_i2c_resume) +}; + static const struct of_device_id riic_i2c_dt_ids[] =3D { { .compatible =3D "renesas,riic-rz", .data =3D &riic_rz_a_info }, { .compatible =3D "renesas,riic-r9a09g057", .data =3D &riic_rz_v2h_info }, @@ -574,6 +619,7 @@ static struct platform_driver riic_i2c_driver =3D { .driver =3D { .name =3D "i2c-riic", .of_match_table =3D riic_i2c_dt_ids, + .pm =3D pm_ptr(&riic_i2c_pm_ops), }, }; =20 --=20 2.39.2 From nobody Wed Dec 17 19:41:17 2025 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D48D158A23 for ; Tue, 25 Jun 2024 12:14:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317676; cv=none; b=Ekjc4vLdhCXihgRW1VdX1Xw6P7errUVUNz0vRZsibaUoj/H+So8siOUQdRjnK0vhaFCLbt9o6UiCocns8H7rixi0RbELsTaiUtDoRLy8HzJkbvLNEMN/Lqq63+69UrnBULTr6TZzIyzkeNQ96FvWiHMPamgDQ08j9bDbQrMdr6c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317676; c=relaxed/simple; bh=rr0lgEBLkmAXsCiSlTXgBt/no/AR92gtWozf/BUgBJw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qfRQ3xBEBvt3m1yv8+MAuIP9Cq2ptIhYlE7Rfl7Ks8gLScrqmtK0DoDpLyst+MIUjTENc4YEpBi7oWFnoxomh5YtrPU5vpVNPhLPNrDx16j/31ZfPQalPQJJThG1UVDagw8tFP5UbAeNa2u1PiMiNiUas0FEvz8Rz2StOv886FE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=NXKZWhsM; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="NXKZWhsM" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2eaae2a6dc1so88195191fa.0 for ; Tue, 25 Jun 2024 05:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317673; x=1719922473; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jRze9YXE4oJAbB9LOUs5rXXSGUTHGLWP5SsCaSBey6I=; b=NXKZWhsMkBX+r41JCgIibsEt0XCPB0VF1BUBzoNT+cMOg9P34C8EzT4Ty1BoZXsPd0 wZfUimoGclnxxklgNI5O64ifYjSv/wWX+B0RFFQxQy16BHIIAp21XtlCYco90vKu0dyB j/VrmJBgRgIqK8vAkZgeRHgNZp5TzQHUrIaKtik+jiC18i6/cImARZ5Or5MYXELD+nVF fMpgVmebrnQP3xki+nrLmQVS05biBZgUgQs7QkQaT6rs9h22F831rtrNdeCHIvRIZEJ5 B8z/rLyVDdN4FaNPvqD9yIg54ZFOgPZ4W15McU9XFTFe469mqLiQdchpr5RiDzXDEZUC CZ4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317673; x=1719922473; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jRze9YXE4oJAbB9LOUs5rXXSGUTHGLWP5SsCaSBey6I=; b=eTARyLnNqAoZ4uPkJC/01oIhsnXov7FFHu+5UIT7mlnn+VYd5O0+Mi/uycfmy+CwQq z87efoIU8f9fMu4bbVM99vWq46mqGRjCNpn8M5RRSbHME4NY1bdDErz17DbSKlvAlJ2F CgGJ9AXSv2BJUBAKBpRt6rPEcsIDoSdw7BqjPMsSsVSpSNFpbm8i5tp3gz0Dd+t2YUkv ttY8rjWXQF/bLiCyd8BhN7pmnZvODQo4cOqx/4TN6q09or53ThQ2lXmFWDWm1B5QnUrJ pTzQ+MM7ANhnSjSrf/WawZBdvbyTDKENJGhokROZb07iBg4jXnOAV1rTdpOSejHGeBLT 6mmw== X-Forwarded-Encrypted: i=1; AJvYcCXCX1i0o7tDjCkbp8z67HZu2/+RbC5B1jtCyehnB60e4vZ0KIIJZGs2yKIcdstCDr49TAP31NqiNjYY0QP6eCFK2luw3MwN/C0ubqB+ X-Gm-Message-State: AOJu0YxzbTb8lm4kwGIHtj3HrKw4W2sn3QKfQArtQlgzWwvxiRWr0X96 mQcYY9W6cTmPu6RJxa+8yBheB57doqxMa0T1QUfiE48WGjcxJzLaMKSj6LfG6Fw= X-Google-Smtp-Source: AGHT+IGYT+z595GKvgUGt9vUUVbcDQtV2IC7YkMuRBlJD2y/+YjkQ2HgvlUA0wAqAKIBNsXZdL+8HA== X-Received: by 2002:a2e:994f:0:b0:2ec:541b:4b3d with SMTP id 38308e7fff4ca-2ec5b31d5e4mr52153491fa.41.1719317672811; Tue, 25 Jun 2024 05:14:32 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:32 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 07/12] i2c: riic: Define individual arrays to describe the register offsets Date: Tue, 25 Jun 2024 15:13:53 +0300 Message-Id: <20240625121358.590547-8-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Define individual arrays to describe the register offsets. In this way we can describe different IP variants that share the same register offsets but have differences in other characteristics. Commit prepares for the addition of fast mode plus. Signed-off-by: Claudiu Beznea --- Changes in v2: - none drivers/i2c/busses/i2c-riic.c | 58 +++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index 9fe007609076..8ffbead95492 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -91,7 +91,7 @@ enum riic_reg_list { }; =20 struct riic_of_data { - u8 regs[RIIC_REG_END]; + const u8 *regs; }; =20 struct riic_dev { @@ -531,36 +531,40 @@ static void riic_i2c_remove(struct platform_device *p= dev) pm_runtime_dont_use_autosuspend(dev); } =20 +static const u8 riic_rz_a_regs[RIIC_REG_END] =3D { + [RIIC_ICCR1] =3D 0x00, + [RIIC_ICCR2] =3D 0x04, + [RIIC_ICMR1] =3D 0x08, + [RIIC_ICMR3] =3D 0x10, + [RIIC_ICSER] =3D 0x18, + [RIIC_ICIER] =3D 0x1c, + [RIIC_ICSR2] =3D 0x24, + [RIIC_ICBRL] =3D 0x34, + [RIIC_ICBRH] =3D 0x38, + [RIIC_ICDRT] =3D 0x3c, + [RIIC_ICDRR] =3D 0x40, +}; + static const struct riic_of_data riic_rz_a_info =3D { - .regs =3D { - [RIIC_ICCR1] =3D 0x00, - [RIIC_ICCR2] =3D 0x04, - [RIIC_ICMR1] =3D 0x08, - [RIIC_ICMR3] =3D 0x10, - [RIIC_ICSER] =3D 0x18, - [RIIC_ICIER] =3D 0x1c, - [RIIC_ICSR2] =3D 0x24, - [RIIC_ICBRL] =3D 0x34, - [RIIC_ICBRH] =3D 0x38, - [RIIC_ICDRT] =3D 0x3c, - [RIIC_ICDRR] =3D 0x40, - }, + .regs =3D riic_rz_a_regs, +}; + +static const u8 riic_rz_v2h_regs[RIIC_REG_END] =3D { + [RIIC_ICCR1] =3D 0x00, + [RIIC_ICCR2] =3D 0x01, + [RIIC_ICMR1] =3D 0x02, + [RIIC_ICMR3] =3D 0x04, + [RIIC_ICSER] =3D 0x06, + [RIIC_ICIER] =3D 0x07, + [RIIC_ICSR2] =3D 0x09, + [RIIC_ICBRL] =3D 0x10, + [RIIC_ICBRH] =3D 0x11, + [RIIC_ICDRT] =3D 0x12, + [RIIC_ICDRR] =3D 0x13, }; =20 static const struct riic_of_data riic_rz_v2h_info =3D { - .regs =3D { - [RIIC_ICCR1] =3D 0x00, - [RIIC_ICCR2] =3D 0x01, - [RIIC_ICMR1] =3D 0x02, - [RIIC_ICMR3] =3D 0x04, - [RIIC_ICSER] =3D 0x06, - [RIIC_ICIER] =3D 0x07, - [RIIC_ICSR2] =3D 0x09, - [RIIC_ICBRL] =3D 0x10, - [RIIC_ICBRH] =3D 0x11, - [RIIC_ICDRT] =3D 0x12, - [RIIC_ICDRR] =3D 0x13, - }, + .regs =3D riic_rz_v2h_regs, }; =20 static int riic_i2c_suspend(struct device *dev) --=20 2.39.2 From nobody Wed Dec 17 19:41:17 2025 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66C1B16A935 for ; Tue, 25 Jun 2024 12:14:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317678; cv=none; b=F2PfrC6Bkj4Ei6PWA9FXubtGfYjRnwW4IOzAozScdMdiMYry+J7cGpZkyn5UYGsYMU73fsbRHdWFBSTczg4hPydMqVCtKnHHDUnsvqW9NjBmkz7qw2a2G8FuYwo3NpceRFePQOdBs9fZko10/M2NP6zWfxhJkc2T3XlXIWi+b8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317678; c=relaxed/simple; bh=G+BtkmivEpWKO42JZ/b2nYWC06K1BWJ8enlG6hWRiGk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=V9H0pX7PkxPCaI1PLvDtgdNXATVgAwLVXoFCKXK3H4MffXPwqq/V2i6YdZiwM6FfkKycGeyAxVOCAIvbKxdlcl5lCDhE0hlonH9JhUCfJqgaRbR4343umgePtsuPInAA3K8dcm/RvpJmKnFJTYzQE2VJLdt1ogJSoz0eKEA+oY4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=h/gHlTGI; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="h/gHlTGI" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-36532d177a0so3551462f8f.2 for ; Tue, 25 Jun 2024 05:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317675; x=1719922475; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tmpNHRRU2OSWCKd+hVEeWAEb1vupeZqAg8vsnXJHwhU=; b=h/gHlTGIDkFVEDFq1QHC6bePIxIIx2MqnlMCnhGfqXVYAJxJHaZY1ipDS4Xt/b5tAB tdA87XfdbEaUwquSKwsn6B9kKR/wuiNOLDJlcVue+jsJFYd01tKBev5ly+R6u9/5wLll aHH06pO5E6NIKeGN6V4YVStV8PObjoY+Hqgcc4EHGcg+Wmz91ec0069F/bxzcm4vzueN sc7v8FIgg7OZ0BTJw1Kxh11adZVuhM4nUUWXV7E6ZYi8E2DS7xcKFak8tH6K3ETDTAcv hbsPa8664U3Qz3kMy4WgfTv0MQsBFJJh7N0euKqrj+buN3N7aziFf4PjhlKkweYUYnfy u7mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317675; x=1719922475; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tmpNHRRU2OSWCKd+hVEeWAEb1vupeZqAg8vsnXJHwhU=; b=dh64ttdIlR6BL7E49UwzOGG+U+YaUTgwbVQAPDQytIS5coN7YZSx3AaG//Z6NLLemn DleXbMAUWyYhaOg1yMKS1G3s/RtlgTRo3ncoEQqngcenWqVE3xQ5ms76mBOnlyTqkqAR AkeOqQVjVBLJSnfMudIKO89wXu79Ox51diPgfF6zao+xB4jHyjs5yj5nLGTWUdrXWlWE dssQiUqUrHbEBxwB62nGbuyJcEj7C9auMU64kL3zl2cjRhVQ6May6JiPLvMUAG45zURk b10veJ4QfrHXbRcZBo2QIR4WSR91gD8qZvi5K/sXYXHjRcVRUKkZaYptkSpkQfxtoVMr vLig== X-Forwarded-Encrypted: i=1; AJvYcCUTi1CFKPCzx276O2d6vGzvpt0bndm9MO5NoO03Ox/g70jOEM6g1rhLDQ4RKzmx9Y6SLdjO6K7sFo0zmzJKykJ4yP7ZlebUbqjncPBQ X-Gm-Message-State: AOJu0Yz0iuyNxVG38gQRnr6GmqvKGiQh2IPfuB732HeSZzzGhAqt08Xq W7zywUiaDoWE2Y31uyQNKOMOMkxqCGC5mLSafXxZzvsPqVBuY1WpByDoZvTK9i8= X-Google-Smtp-Source: AGHT+IGAVzLeqxpQgHotNBmPQhFcmvugsk6GvG5kW90f7EiAkNWBop3X/RiZQeIe6Ry3+t47rKzRVg== X-Received: by 2002:a5d:6483:0:b0:366:ea17:94de with SMTP id ffacd0b85a97d-366ea17953amr6038644f8f.5.1719317674869; Tue, 25 Jun 2024 05:14:34 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:34 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 08/12] dt-bindings: i2c: renesas,riic: Document the R9A08G045 support Date: Tue, 25 Jun 2024 15:13:54 +0300 Message-Id: <20240625121358.590547-9-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Document the Renesas RZ/G3S (R9A08G045) RIIC IP. This is compatible with the version available on Renesas RZ/V2H (R9A09G075). Signed-off-by: Claudiu Beznea Acked-by: Conor Dooley --- Changes in v2: - dropped the renesas,riic-no-fast-mode-plus - updated commit description Documentation/devicetree/bindings/i2c/renesas,riic.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml b/Docu= mentation/devicetree/bindings/i2c/renesas,riic.yaml index 91ecf17b7a81..dde37a209b6e 100644 --- a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml +++ b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml @@ -25,6 +25,10 @@ properties: - renesas,riic-r9a07g054 # RZ/V2L - const: renesas,riic-rz # RZ/A or RZ/G2L =20 + - items: + - const: renesas,riic-r9a08g045 # RZ/G3S + - const: renesas,riic-r9a09g057 + - const: renesas,riic-r9a09g057 # RZ/V2H(P) =20 reg: --=20 2.39.2 From nobody Wed Dec 17 19:41:17 2025 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52CB416C696 for ; Tue, 25 Jun 2024 12:14:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317681; cv=none; b=PqtGbiuSbM5LkGb+5QUaQKS4UUbn9zEEVF3tvGsQ/nN1/UJNO7TTODUw/0pahuxcL6ld0oQBBDa/vt6NZ7konIyw772xolfWaKw+3wK+ZAI9BLrw8VjR1RaEbt7L2zR+fY4cx6/PbvSxyQNEXeK0Q/eASdlDmPHbUHhiDMZ95qs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317681; c=relaxed/simple; bh=8OOGQkFNrKja+OgdNYNCZMmYErNv7LdtJ9ioV2LOyqk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mKxpy/WgCSJqYdohjOzXhqZ/cX6dUjHT2dP49BZ6M+tLuOT3k1Vaqsov7E5B7PB0gbqPJ6Xp4wAkK7gJWtmybw03CplSH3CrNmxxHYD/2nF3R8q8Jdexw+idPXiDd9lkGYTTEDhc38PKI+9Rh+UDHGRzNyTf70p41TUwBGjw6pw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=U4n+pnlQ; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="U4n+pnlQ" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5295e488248so6187451e87.2 for ; Tue, 25 Jun 2024 05:14:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317677; x=1719922477; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FBC9PF/qNCadSMYXHpaAT5j9fObF5TmfHpetsQabb4M=; b=U4n+pnlQNxaQnevAUXEpXBspaHMu5UmPrj3oKYTQ2od7j0WP3K7jbBrw/f35dyneEj +lo/WUuymj1V/BMZyPLfTLV4FHP2A1MiPsN+F+tGiXNtfD5M7V4Gm+Aae8/qeC6AmGQr ZZfHejKNs09ffp+r9F11VkbAaFvqpvDVvsnpcsSNAkfc9ZR0ROhXpU92wQtIql5p5rbx J3lNA+DdWwL0BD7V2NEIREu/VHXuqpcXa4woI8XMHT9v8t948vnxvRQpVFRC6/8TTdfk tLomM5AdQjkJ6NOQ7M0Er5iJv3zh+JH88gCwQRodel9r/M55o58kZC0eAnY68WzV1AoB dQPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317677; x=1719922477; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FBC9PF/qNCadSMYXHpaAT5j9fObF5TmfHpetsQabb4M=; b=IYkE//dLzVmfCmECC5udNd94B2ZOupG0PfO5djX8zfDXIMw6F2PlJu/v4ttNUyEVEN hDDg94qbC5X8FJe1SUuEsqfj0MV2NwuXDOSS0GFdKvvVz9uhtZ+H+Xk/i/mRTvuBrtKF DrdPQs/zdyzjlEbZbyC/H3yU88miBdL37cUatD/JuZKA6G4PelQXhR/zQ02YAsCkPvWB pLCRJkZ6bmRtYe6Edp/9ndQU42pZgs88umuOL0v1PCDcVqJK89EfnmGqd0OQYIDKfU0u MsUH4Ii24/T09XybzHkv3/ndBc0U0UvVOjmAC6KOmoLfWKnNZNwPqEtjVHUcrfSYJfax ZNEQ== X-Forwarded-Encrypted: i=1; AJvYcCUkfqgHAtNoNUMXQ1p1UDno2BRGKywh/zL82Ofim0nOv8v/smHbbwCeYsvWMtcwwUnh5k04UV5gAZui5oTGYB5n3/geiAVfXjOl+J7F X-Gm-Message-State: AOJu0Yx4M3uOgYt1GJzC4SpVKBrJ1r3DWikW57hzdeTrTjZE0U05OCQh 3QW0ttHUo6UZPls3b4RUhhNVglqpVv6Vlw9REG4jnzma98FTSMVeKs9Nt6Zxf4A= X-Google-Smtp-Source: AGHT+IHMqb4IEfdfY2dYV4JrjRaSTKsUzUM7nebCXduc+8dWlesGPxQ88MnLQCHwrnG1emHWvn/XPA== X-Received: by 2002:a05:6512:402a:b0:52c:8051:5799 with SMTP id 2adb3069b0e04-52ce1832b57mr5353096e87.11.1719317677627; Tue, 25 Jun 2024 05:14:37 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:36 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 09/12] i2c: riic: Add support for fast mode plus Date: Tue, 25 Jun 2024 15:13:55 +0300 Message-Id: <20240625121358.590547-10-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Fast mode plus is available on most of the IP variants that RIIC driver is working with. The exception is (according to HW manuals of the SoCs where this IP is available) the Renesas RZ/A1H. For this, patch introduces the struct riic_of_data::fast_mode_plus. Fast mode plus was tested on RZ/G3S, RZ/G2{L,UL,LC}, RZ/Five by instantiating the RIIC frequency to 1MHz and issuing i2c reads on the fast mode plus capable devices (and the i2c clock frequency was checked on RZ/G3S). Signed-off-by: Claudiu Beznea --- Changes in v2: - dropped code that handles the renesas,riic-no-fast-mode-plus - updated commit description drivers/i2c/busses/i2c-riic.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c index 8ffbead95492..c07317f95e82 100644 --- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c @@ -63,6 +63,8 @@ #define ICMR3_ACKWP 0x10 #define ICMR3_ACKBT 0x08 =20 +#define ICFER_FMPE 0x80 + #define ICIER_TIE 0x80 #define ICIER_TEIE 0x40 #define ICIER_RIE 0x20 @@ -80,6 +82,7 @@ enum riic_reg_list { RIIC_ICCR2, RIIC_ICMR1, RIIC_ICMR3, + RIIC_ICFER, RIIC_ICSER, RIIC_ICIER, RIIC_ICSR2, @@ -92,6 +95,7 @@ enum riic_reg_list { =20 struct riic_of_data { const u8 *regs; + bool fast_mode_plus; }; =20 struct riic_dev { @@ -315,11 +319,13 @@ static int riic_init_hw(struct riic_dev *riic) int total_ticks, cks, brl, brh; struct i2c_timings *t =3D &riic->i2c_t; struct device *dev =3D riic->adapter.dev.parent; + const struct riic_of_data *info =3D riic->info; =20 - if (t->bus_freq_hz > I2C_MAX_FAST_MODE_FREQ) { - dev_err(dev, - "unsupported bus speed (%dHz). %d max\n", - t->bus_freq_hz, I2C_MAX_FAST_MODE_FREQ); + if ((!info->fast_mode_plus && t->bus_freq_hz > I2C_MAX_FAST_MODE_FREQ) || + (info->fast_mode_plus && t->bus_freq_hz > I2C_MAX_FAST_MODE_PLUS_FREQ= )) { + dev_err(dev, "unsupported bus speed (%dHz). %d max\n", t->bus_freq_hz, + info->fast_mode_plus ? I2C_MAX_FAST_MODE_PLUS_FREQ : + I2C_MAX_FAST_MODE_FREQ); return -EINVAL; } =20 @@ -407,6 +413,9 @@ static int riic_init_hw(struct riic_dev *riic) riic_writeb(riic, 0, RIIC_ICSER); riic_writeb(riic, ICMR3_ACKWP | ICMR3_RDRFS, RIIC_ICMR3); =20 + if (info->fast_mode_plus && t->bus_freq_hz =3D=3D I2C_MAX_FAST_MODE_PLUS_= FREQ) + riic_clear_set_bit(riic, 0, ICFER_FMPE, RIIC_ICFER); + riic_clear_set_bit(riic, ICCR1_IICRST, 0, RIIC_ICCR1); =20 pm_runtime_mark_last_busy(dev); @@ -536,6 +545,7 @@ static const u8 riic_rz_a_regs[RIIC_REG_END] =3D { [RIIC_ICCR2] =3D 0x04, [RIIC_ICMR1] =3D 0x08, [RIIC_ICMR3] =3D 0x10, + [RIIC_ICFER] =3D 0x14, [RIIC_ICSER] =3D 0x18, [RIIC_ICIER] =3D 0x1c, [RIIC_ICSR2] =3D 0x24, @@ -549,11 +559,17 @@ static const struct riic_of_data riic_rz_a_info =3D { .regs =3D riic_rz_a_regs, }; =20 +static const struct riic_of_data riic_rz_g2_info =3D { + .regs =3D riic_rz_a_regs, + .fast_mode_plus =3D true, +}; + static const u8 riic_rz_v2h_regs[RIIC_REG_END] =3D { [RIIC_ICCR1] =3D 0x00, [RIIC_ICCR2] =3D 0x01, [RIIC_ICMR1] =3D 0x02, [RIIC_ICMR3] =3D 0x04, + [RIIC_ICFER] =3D 0x05, [RIIC_ICSER] =3D 0x06, [RIIC_ICIER] =3D 0x07, [RIIC_ICSR2] =3D 0x09, @@ -565,6 +581,7 @@ static const u8 riic_rz_v2h_regs[RIIC_REG_END] =3D { =20 static const struct riic_of_data riic_rz_v2h_info =3D { .regs =3D riic_rz_v2h_regs, + .fast_mode_plus =3D true, }; =20 static int riic_i2c_suspend(struct device *dev) @@ -613,6 +630,9 @@ static const struct dev_pm_ops riic_i2c_pm_ops =3D { =20 static const struct of_device_id riic_i2c_dt_ids[] =3D { { .compatible =3D "renesas,riic-rz", .data =3D &riic_rz_a_info }, + { .compatible =3D "renesas,riic-r9a07g043", .data =3D &riic_rz_g2_info, = }, + { .compatible =3D "renesas,riic-r9a07g044", .data =3D &riic_rz_g2_info, = }, + { .compatible =3D "renesas,riic-r9a07g054", .data =3D &riic_rz_g2_info, = }, { .compatible =3D "renesas,riic-r9a09g057", .data =3D &riic_rz_v2h_info }, { /* Sentinel */ }, }; --=20 2.39.2 From nobody Wed Dec 17 19:41:17 2025 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E85516D303 for ; Tue, 25 Jun 2024 12:14:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317683; cv=none; b=PKsMcEpF6JTA5pR32gAkPktsGHYpa9FFiJxx13WD69KlEtXNGWHvf12gLADmgxEWWZ03a4IROMMd+yLpQOdfZl+z/XyYFD/rFa0s9DF8uK35AMdfRAOP7eslDbPswrsp6fjAW8TsKqKXcUcmTV2sjEwcKTIQPAjTfGeKe8VlQZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317683; c=relaxed/simple; bh=lsfBNFQ9DmRpBMeKzNXKtURy1leztUKXyhzbvbyq2bQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fqjbNJepVrzDq/dyRSJSOjcz9/vlhaPSBqJzvc5goVzp4BAipjsNaxGt8wS/D7Tc6tFtFzAZmniPU8mcM02quPcyCKHOjjqVWSUwwdF/HgXfNi9P415x1QWccabfVtnGHucx4fUfkPKYz8I7LT/0EQfq0qjK1XMxMcKaM9RBcwk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=MPdjVFL8; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="MPdjVFL8" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-52cdcd26d61so3524114e87.2 for ; Tue, 25 Jun 2024 05:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317680; x=1719922480; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iGa2XEUZ3aGMxNf/RbkZrRoN3t//RPW1fRR4sB6rLbI=; b=MPdjVFL8+GclraT31nyS5OkJ6RgFqAxJj/Jfy+w/4gWIla8KBAxCKwquSi3isW1a53 RMDdhC4Llyo2aeOT+N0y8yFU/L2SOLaPJqNntZMx36e64Qgw+VMgScU2uz4NmMMmRdE7 OFlTOd0PRNBODsnEfQx6mtYNwlReBTEmsNMIkR7KVvY97CK1jtIXlgVmdc1EO/ispJUS /nGFwranqjM5fYO8wTAuTfSRQfKx6B9yAkX6bAmwC0YqXgs95n7+lp2zwaFHcOSQw5c+ U7onbKjp/XYMuzcL1ytXZCaYLNthWZCYfV61HuzbTE5zViK9mqreFjRy5UMEdeCU67cy 53Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317680; x=1719922480; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iGa2XEUZ3aGMxNf/RbkZrRoN3t//RPW1fRR4sB6rLbI=; b=eVQfaDi8r1FEFlMF94m/JTsZceVKrAfN4Yv/BPpXMr0G5fSXdlq/opfRxHlPNup5I8 SCGj3gE9Nx6lHIq9FBDt/XyDHfTnpOdc6TU4iYywE4cl8Y5J33Q5J5wv6YQlaWyJPWJd Z/oAQgyF/6px20w1qgWZ6Ir8eBpSLqjwW5lRv4JqVdO/qNYPuS4hSI1HIoRX78AH17CP LxJQ3dS8i77qB9shFhKEsijwGDbLa6kx4UMsiQk+N/CnKVtUPffnpjjZvJl1mfpmchKD P8bfon0qpsRMiVHQSThZTCgW8VYdnvCtTiSYtYbL3RvUPbSfFWK+uOUcwdlp0sAfOajX xdfg== X-Forwarded-Encrypted: i=1; AJvYcCUPrR+9dQBMDZUo+E/UUBjg+al6IF5taHQralgoV9VY9U5DgOjqJgNFqnBXqHd+Rqas0hwhFOP+7Wzvpn+NvKz+o+WaVU7yBNud1AJm X-Gm-Message-State: AOJu0YxYz74DrG48tsuDUM4McvlSIyvzo18HW1RAvainWtLhmJrqiwGU K4MYV86MAobcP8y10Qdg+JWONY52jpILjxZwcx0U3l2PjowACw6koscDyuotnPY= X-Google-Smtp-Source: AGHT+IG7qwUVXtOpVeWmNHvAVr0+00yi4DiXEY92run2OPUw5io4ErYjJwJWFwRWIN5UafV00vAnuA== X-Received: by 2002:ac2:5b4c:0:b0:52c:dcd4:8953 with SMTP id 2adb3069b0e04-52ce1839881mr4175573e87.36.1719317680669; Tue, 25 Jun 2024 05:14:40 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:39 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 10/12] arm64: dts: renesas: r9a08g045: Add I2C nodes Date: Tue, 25 Jun 2024 15:13:56 +0300 Message-Id: <20240625121358.590547-11-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea The Renesas RZ/G3S has 4 I2C channels. Add DT nodes for it. Signed-off-by: Claudiu Beznea --- Changes in v2: - dropped renesas,riic-no-fast-mode-plus arch/arm64/boot/dts/renesas/r9a08g045.dtsi | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r9a08g045.dtsi b/arch/arm64/boot/d= ts/renesas/r9a08g045.dtsi index 2162c247d6de..387d74a163ee 100644 --- a/arch/arm64/boot/dts/renesas/r9a08g045.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a08g045.dtsi @@ -72,6 +72,94 @@ scif0: serial@1004b800 { status =3D "disabled"; }; =20 + i2c0: i2c@10090000 { + compatible =3D "renesas,riic-r9a08g045", "renesas,riic-r9a09g057"; + reg =3D <0 0x10090000 0 0x400>; + interrupts =3D , + , + , + , + , + , + , + ; + interrupt-names =3D "tei", "ri", "ti", "spi", "sti", + "naki", "ali", "tmoi"; + clocks =3D <&cpg CPG_MOD R9A08G045_I2C0_PCLK>; + clock-frequency =3D <100000>; + resets =3D <&cpg R9A08G045_I2C0_MRST>; + power-domains =3D <&cpg>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + + i2c1: i2c@10090400 { + compatible =3D "renesas,riic-r9a08g045", "renesas,riic-r9a09g057"; + reg =3D <0 0x10090400 0 0x400>; + interrupts =3D , + , + , + , + , + , + , + ; + interrupt-names =3D "tei", "ri", "ti", "spi", "sti", + "naki", "ali", "tmoi"; + clocks =3D <&cpg CPG_MOD R9A08G045_I2C1_PCLK>; + clock-frequency =3D <100000>; + resets =3D <&cpg R9A08G045_I2C1_MRST>; + power-domains =3D <&cpg>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + + i2c2: i2c@10090800 { + compatible =3D "renesas,riic-r9a08g045", "renesas,riic-r9a09g057"; + reg =3D <0 0x10090800 0 0x400>; + interrupts =3D , + , + , + , + , + , + , + ; + interrupt-names =3D "tei", "ri", "ti", "spi", "sti", + "naki", "ali", "tmoi"; + clocks =3D <&cpg CPG_MOD R9A08G045_I2C2_PCLK>; + clock-frequency =3D <100000>; + resets =3D <&cpg R9A08G045_I2C2_MRST>; + power-domains =3D <&cpg>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + + i2c3: i2c@10090c00 { + compatible =3D "renesas,riic-r9a08g045", "renesas,riic-r9a09g057"; + reg =3D <0 0x10090c00 0 0x400>; + interrupts =3D , + , + , + , + , + , + , + ; + interrupt-names =3D "tei", "ri", "ti", "spi", "sti", + "naki", "ali", "tmoi"; + clocks =3D <&cpg CPG_MOD R9A08G045_I2C3_PCLK>; + clock-frequency =3D <100000>; + resets =3D <&cpg R9A08G045_I2C3_MRST>; + power-domains =3D <&cpg>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + cpg: clock-controller@11010000 { compatible =3D "renesas,r9a08g045-cpg"; reg =3D <0 0x11010000 0 0x10000>; --=20 2.39.2 From nobody Wed Dec 17 19:41:17 2025 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8D9E16D9DA for ; Tue, 25 Jun 2024 12:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317690; cv=none; b=qiBHsobhKY+P8zZ7KwLNtDHQyAAxIuWsD3BpYu7pC6XMEstgDpCHLd2h0DlB/v2c5hL0oFzytHYEt/L6GVQHOkFYhM57O5jWfnkBcv1R2oSE6kAQn8rTumBvjDXgNRnH7zgIVZbmFb+aayLaOPOLnhgp4S5UGPj7j3QRiltCieQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317690; c=relaxed/simple; bh=d+cxdUc/kawXknja28l908DWiM43QePkYourTSwGSCU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ab7wN5H8nj8hjzpbwzPba4lsRLaaPbytyY4bXT/yAt4qRNMNJ4CmjplpQKhjZj8OWTTvv2LFcf71nXPlXTbO9E3vVzldTYBLM/ctmHxhavWQOxnAZg1Nt8XdURpP4CYNo8M55NB4qSdzj8e/hYEB3U1mbA1V7gbHlO/5RNz+kYM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=j8arj/u/; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="j8arj/u/" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-3645e9839b3so4213934f8f.3 for ; Tue, 25 Jun 2024 05:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317686; x=1719922486; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MSaReodlEhPLrYROJulVi8oEC9WlvggFVpDF15BFghc=; b=j8arj/u/PgfR3VVw60l7In0l1XMmp5o3JLdEnP+w0Mvx01+zcQsS3r2NgqaBbCoRsr RCKbSynZAIlzfX3TS2Vp5C0bcQOVRYj2X9RnochMvFjel1xWS+q+w8C57jwvQoRDRYbu +v5K2pttdStEVOkgAborIYvd/P3Zbvjo7FjFctSxhFUS/hgRLO4U5QLFuFzVk1nU+pYw zNUXmJFiw5rqkNURJzE+McjmU5xFObWPS4wS8/cWOu5yrzN+jkZu2LUkhV1ED7Rd3BSV IOF6WoiJnev0u0rIGRG5ZULpO4O6qp7JiyF7jRV8qUgoSV4lNHHKGw5ooO0ZiSTTZUzf YxsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317686; x=1719922486; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MSaReodlEhPLrYROJulVi8oEC9WlvggFVpDF15BFghc=; b=WFqBErPNiypuWOf/A2l7sZIrDV7QAMxiPyJiKu/8p5ELgfw3uJTaEauzO8/cZlKDG2 U9VVjgQf7pDTr43/carq5oUgGmVeItA5ggjSv4XypV+61RcN1zb9jcyjR0jhNNO05ma1 ar0uR8af4T5JRjvMPqY5HnTxng4BA1LULpR2xWc4UvvvvYPG1vYWMi6PCcpOqUL7L3b5 /gPbDwWeo046u820LMbX9Ufy6yatZ7iJVjYkuzYcYgCefo7pspZD9W6+0Mqtj/wpRnTf Q/sgkKsKlEhkPKPm18R2PQoso+QlezxOp/uI7eIcPFu1Eqf+8LczXcSHxvwTS8r/fNEn qTCg== X-Forwarded-Encrypted: i=1; AJvYcCUbSajz31oK5V0IbIarMjFyPjLPJQbuovCVeLhpP5KifLm+XWQ8MpUNhgV+1EINAER38NzpWr+Px5L+ofBZaavwCjPRp9eTHxOHn7A+ X-Gm-Message-State: AOJu0YwgKKdNfiVjlJThS2p33QKIfJiqx6d4YjmLNF/EgurYawdpJv0e 8vbgTqPN0EF4YkNft9wZUdnUALAAJSHMzSrUzmzQRkCfAgMiCT7HXadD3GmlM4s= X-Google-Smtp-Source: AGHT+IEYBeG/knw9uoE5gl1YMNW1sVyFEHk5gBsye8670o9+6zQy6z/xZPkF9T+W23ZQtZ/7hVx1gQ== X-Received: by 2002:a5d:4112:0:b0:362:41a4:974a with SMTP id ffacd0b85a97d-366e7a52149mr4911034f8f.66.1719317686218; Tue, 25 Jun 2024 05:14:46 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:41 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 11/12] arm64: dts: renesas: rzg3s-smarc: Enable i2c0 node Date: Tue, 25 Jun 2024 15:13:57 +0300 Message-Id: <20240625121358.590547-12-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Enable i2c0 node. Signed-off-by: Claudiu Beznea --- Changes in v2: - none arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi b/arch/arm64/boot= /dts/renesas/rzg3s-smarc.dtsi index deb2ad37bb2e..7945d44e6ee1 100644 --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi @@ -11,6 +11,7 @@ =20 / { aliases { + i2c0 =3D &i2c0; serial0 =3D &scif0; mmc1 =3D &sdhi1; }; @@ -66,6 +67,12 @@ vccq_sdhi1: regulator-vccq-sdhi1 { }; }; =20 +&i2c0 { + status =3D "okay"; + + clock-frequency =3D <1000000>; +}; + &pinctrl { key-1-gpio-hog { gpio-hog; --=20 2.39.2 From nobody Wed Dec 17 19:41:17 2025 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2584D16DEB8 for ; Tue, 25 Jun 2024 12:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317691; cv=none; b=KXbAHSJqfuJx7trrL/6AbIKaXwdYwQ8uxi+z7a6Yd89kcko2uN8EtQpWAlpDwJC/cYCd0ok3PwNz8ORTLewnxT1npmzxAZl11TM+VsWa6xwaQelr30YyFCfbr9IDyUgBvbULkOTur0d6G3EMsxBO28Xgd07H+ZGv1q6eMjxITxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719317691; c=relaxed/simple; bh=up+CKCw3ZtFCZT/R1IA59eXhUiHBrn4jrvl8EMaiQVI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=b4u/bkGEhBJAm6M2UHB/Y/8hGVczLMNGl+dLVyv0Pev6MC/pOSQKWhvzBhPhQK3gYUQpfRz7M6kSyjr/khOunXvbgJierPJmDtm4ZIGKPdXm1hkY4l+gYXciBQUEU27NuSGvUhkryDGhvYyIUEAx1PaqOwWQibYgJXq60Jjohvk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=XK9Eqwz3; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="XK9Eqwz3" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-363826fbcdeso4006175f8f.0 for ; Tue, 25 Jun 2024 05:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1719317687; x=1719922487; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6GKJ24v9TVtuWhV14muRJU3eBIqlecW/qbwYzBi7wQ4=; b=XK9Eqwz36RcCgONU1DSVXSLa5fkTGq0t3D6igMER+Rd8d0nQyGfrfnWpaIVJMV6Qwf 2Z5t7ERPwN7J8/hnm+di/9zwSPzWXk/4NIkIrJ5NVfdYgkTktAqp+NSL3Wb62x20DEyR 3Ot0328/oQc4GzufJAGpvn5UPMy2jYa9L+sgCn5ahWR88vQNzLvsACh6YjcAJ/dqTHhs CSvP9frn0mfDmbmPK8g+Xl+KPZ5UN6YBoEBSaU2jF3+ID2/qhH68d4h+g2cQJPZ/l6AI 5EWg4LSup/Q+yUDnj5KaG4O5L59ZCcJSgxTgzJpIu7FH0jiiasJ1T3U1Ocqc+HgghsXd o27A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719317687; x=1719922487; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6GKJ24v9TVtuWhV14muRJU3eBIqlecW/qbwYzBi7wQ4=; b=w66Q8Zjth6ZJnv4lljO04I/48tepnO6PO+15EnhSVQDzZsPK+jPHSZxB3cBxfQCSnR 9iWF6yLWZ6Pj+JHuFdC/aLoa1RQ/PC+noARcEhzrewQorOHe3aSnc5GMYgArRE1ChYGU nNMxhihvHrDr8Ogf6qwekDu1hlH8BQ9VZC+/TqFmFip/9jQfJOUKA9zmoIyCwm//wPfU 5Yq/Wks9HE1lwnCbvDIKg9oFfDcONcPv6eGuX3olFqamYyQ1A5feUn/Db8elurOLyN6o NXnz5H2JNxgDJiRqkV4mS0d5nNS1Ww8ygE8aFrkwQQSphGHCNu16rppvZHMN4XHNuvzL JWDg== X-Forwarded-Encrypted: i=1; AJvYcCXyN7WC1HPQAWHV9GnAZo9o0pCySakQ9JfqeWNZpq9xS9fTEiskNGv7eLqS07jPEGizH2CoPnMtljiOuzBkjlJnmbu7QmqhYU+DXpKX X-Gm-Message-State: AOJu0Yzs8cT4M20civAIqYKqyIlObkS1XpdwCsPmXEOdQwxtzRl70SCY DY3KayYtMVlPvHqdC9xr11d73Cp26s1Hiiz3SbcQrZrlP0PW68KfMI/E2kI1XvA= X-Google-Smtp-Source: AGHT+IE0bik9VVIosKI1k5PcnDWp8XNvIEpEQaNWzDyB3Cpn8xenkx4I1ZQz7IJ1AZgs6x8KmksV/g== X-Received: by 2002:a5d:4ac9:0:b0:35f:1bb2:4354 with SMTP id ffacd0b85a97d-366e7a1065bmr4390465f8f.35.1719317687632; Tue, 25 Jun 2024 05:14:47 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.70]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663a8c8b32sm12798437f8f.92.2024.06.25.05.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 05:14:47 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: chris.brandt@renesas.com, andi.shyti@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v2 12/12] arm64: dts: renesas: rzg3s-smarc-som: Enable i2c1 node Date: Tue, 25 Jun 2024 15:13:58 +0300 Message-Id: <20240625121358.590547-13-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> References: <20240625121358.590547-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Enable i2c1 node. Signed-off-by: Claudiu Beznea --- Changes in v2: - none arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi b/arch/arm64/= boot/dts/renesas/rzg3s-smarc-som.dtsi index 8a3d302f1535..21bfa4e03972 100644 --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi @@ -32,6 +32,7 @@ / { compatible =3D "renesas,rzg3s-smarcm", "renesas,r9a08g045s33", "renesas,r= 9a08g045"; =20 aliases { + i2c1 =3D &i2c1; mmc0 =3D &sdhi0; #if SW_CONFIG3 =3D=3D SW_OFF mmc2 =3D &sdhi2; @@ -150,6 +151,10 @@ &extal_clk { clock-frequency =3D <24000000>; }; =20 +&i2c1 { + status =3D "okay"; +}; + #if SW_CONFIG2 =3D=3D SW_ON /* SD0 slot */ &sdhi0 { --=20 2.39.2