From nobody Fri Dec 19 07:03:51 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