Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp718362lqc; Fri, 8 Mar 2024 09:37:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWRGEDwfKMj/9JfM7vyit1+JQgQwtck9gAMDNNMA8LIrBZWp9OQfEQqyBFV2ZNKAnsC/3eMmM0g3lbIdCLzwz4twFOdSxgMvgIlDLh/Xg== X-Google-Smtp-Source: AGHT+IGV+IXlEYjufZJvREyVzSqnMiRSfohmIRSdZTC1h/1Afgxa8MixdfJhRHAq/gooW4/RhFgG X-Received: by 2002:ac8:5845:0:b0:42e:e125:33ef with SMTP id h5-20020ac85845000000b0042ee12533efmr822887qth.33.1709919436687; Fri, 08 Mar 2024 09:37:16 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f5-20020a05620a12e500b007884008c182si5813313qkl.671.2024.03.08.09.37.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 09:37:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97403-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bp.renesas.com header.s=selector1 header.b=f8hRn8W1; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-97403-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97403-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 54F011C20832 for ; Fri, 8 Mar 2024 17:37:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8BBF4F213; Fri, 8 Mar 2024 17:36:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=bp.renesas.com header.i=@bp.renesas.com header.b="f8hRn8W1" Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11011009.outbound.protection.outlook.com [52.101.229.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58C29568A; Fri, 8 Mar 2024 17:36:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.9 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709919409; cv=fail; b=eABZPGnC/Mc9mXotDBtns9E17jF4WPFUfeKBMQEFWDoT1Hli01j6BS5ky0AGs+2XMmaIQVKwgVhVZbmrZY3UprEZt3M8CafAnV5vOyAu/Pg9MsQPpo0OHUNFczvD4EImWMX7wjSFAzSuiNwC5mGhq9uBp0U83gOEbnbV1eB7cJg= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709919409; c=relaxed/simple; bh=zx6tIALMf10UtvePPGLTJEsJZPJXeTOTknl63MYvWPQ=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=NEuQZIPglvBFsB55hVZU9D0tfRLEdtb/kVyXM30otGYAly3uo1vMQMwICDlyNAuas5UifyeV/jQuMkJ8KP8hxOn1RwNzQuTsE436z/76Biyys0KWsMFWWsdlEAsHa8EkH4Eg52X18JfrZc7gMXC7v9jO/5SuN/YDC3o+214pZP0= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; dkim=pass (1024-bit key) header.d=bp.renesas.com header.i=@bp.renesas.com header.b=f8hRn8W1; arc=fail smtp.client-ip=52.101.229.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ToNNOVzdmth225oY5yIe5Fceoq+znDFFysNMYorZReRCQu6zGkBI4ULZXh+wqkrX0MdaJoAH6fWzeWCmKCniPJw00PhDTuxP8wL0D6gyMWbsdLEP/2KAqtY0W3sTyMdLWxYjyGW25KtX9Esufq3ooHT3Xj+Zug9gxnUMYrOMjjZssDpBLm/FxSyjdI4h3w/4QnNXHh4Id0PeZEuIqP1JbA4bhnMko4P2TtNoRTtsGaXE9aMniZtsVQvtKenKQd89OlARyO34KFJ+Vumaltx6BjabqJXqDzqWKomVKGbx4eWuzalp0Kkkp6zwn/g4vdH+W3zWdHFa0xzwEo2NQ0Ekqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4MLo2gvnWifgTmm4HevldVU/SMBLcGmyUaQtJkx7BEM=; b=mRauAl1cgKyuV43KtW9v0j4U5ksAaErXg7Sj1Vt6Z9WlbttyP5k3x4IqyKuV+FtoAx/E83Jl+5HKkKhiQvFcP8ZDLRIBVirCffQke2okmkLTSR8rmHl9Gz4IYk0y+fgXYwl/an1hlBI550pbf8Qe7edMA468NaCQiqz5APSTjfSWhzTpRufqlXIQR01JdO0Dzw84mnRkFkSfkmEcwucBJb8b4M6zP+yfLtXUUR3xbbYTwWM/UZjgY4yhWEqUlhCGvLhG4cuae3ICXUTlD9hDCYpLD4QEEUHRXo4mXOw8UnpXRRaR+OP+J3pEyUsTZvZYPpO2LOA6OR6zgJ6gc0Zm8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=bp.renesas.com; dmarc=pass action=none header.from=bp.renesas.com; dkim=pass header.d=bp.renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bp.renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4MLo2gvnWifgTmm4HevldVU/SMBLcGmyUaQtJkx7BEM=; b=f8hRn8W1xuulsJqKAJ8ZeYx5Ww9s9GUABZ3pDL1x+juaTTmIZEA+Iof0LHP4SLuEF8Y+0nNkCJXwDgvwKBDpEyRqOwYcVC2TERo6ZpG9FUB2J1r4+aMMjk1CIA1NjQ5T5nycGj0VpJl4g8KE7Rkfv6mZ7rZAe3XTndpEWbwOLEo= Received: from OSAPR01MB1587.jpnprd01.prod.outlook.com (2603:1096:603:2e::16) by OS3PR01MB6167.jpnprd01.prod.outlook.com (2603:1096:604:d5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.31; Fri, 8 Mar 2024 17:36:41 +0000 Received: from OSAPR01MB1587.jpnprd01.prod.outlook.com ([fe80::5ff4:8ba7:96e5:7a5b]) by OSAPR01MB1587.jpnprd01.prod.outlook.com ([fe80::5ff4:8ba7:96e5:7a5b%7]) with mapi id 15.20.7362.024; Fri, 8 Mar 2024 17:36:32 +0000 From: Biju Das To: Prabhakar , Geert Uytterhoeven , Chris Brandt , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , Wolfram Sang CC: "linux-renesas-soc@vger.kernel.org" , "linux-i2c@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Fabrizio Castro , Prabhakar Mahadev Lad Subject: RE: [PATCH 4/5] i2c: riic: Pass register offsets and chip details as OF data Thread-Topic: [PATCH 4/5] i2c: riic: Pass register offsets and chip details as OF data Thread-Index: AQHacX4tmFc1CI8ipE+h03wpRb2Q9LEuGoKg Date: Fri, 8 Mar 2024 17:36:32 +0000 Message-ID: References: <20240308172726.225357-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20240308172726.225357-5-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: <20240308172726.225357-5-prabhakar.mahadev-lad.rj@bp.renesas.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=bp.renesas.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: OSAPR01MB1587:EE_|OS3PR01MB6167:EE_ x-ms-office365-filtering-correlation-id: f16e81a0-5e3d-49fb-3837-08dc3f964b9b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WAHZqhOFxK4qV12Nb58gnANhgldOWifpl1Mv4f3KMSihoQ3BHkSRESTNYrYirs2qHZYPjB2sE8YTNgH9GwM4iWIopXTDbg+6Rpe8J5uq4qJfb9y60yfEJVBHLczxE7ZQpwW5uOwuvkxrqi/8kUEDcXOuL14QIWRLLGV/y7h7LKv5xe7c7IcwrsM3+/YHx9dioBqxtSm0siWf4vbytd9fEW3eVEBHaMHOdzfeifWjQpWn+1Rh4fyF7TxwSHyc//fykzbTOOZ285JOYQDqY9Tk/JGiLpeuz1NucGxw1zvraWZfRRI66l7IquGFdstcM7yD4wYiVmTPumF2oNVddAS0PntHdb3Yij+3VoJgPhAdlDS2GP3DkEF7yQMm5Ni4quRTVSi8TpRtJABe+fC7+N6smbpL0RvNvLy3ZejRIS9gFGUIU7rOz2VFT8C9l9NMRP8ESAV0kQQM/uvqaqJe5FuLRPWODHH5JcLleJAmDL0kpC/vvbXK0ASYb7HyQe8EO9onSjdLXvkAa7W0Ofn90lKpBzuN1qKNE86seA22zKKDTY0iULPrbX3o+xRP9ZGleDyIMwRNQZ4rpKzRYM+kSgcm0UbLfOv6rjr9rKs537Eehiniz0DiT3Oroo0J2m1n7YHQbm4fo/tRArLwzzWMNNTyUgVaCpasj77y6WksKwBNoYJVUNpeP+i6I8dbvmGn2YF2rkWXCxo53DLBZsK05PD2PfoPFRdKPsMqNW563iHCx6Q= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:OSAPR01MB1587.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(1800799015)(376005)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?tuBDkR2bH1/jcdac4j77ZrP/SvMY6g4KpqrACXXxHO14Wdsv817j5+bOYNm6?= =?us-ascii?Q?mZw7D2gqkrAMZsGKzlmTtFbzrf58ss7KUsJnDzr1TBE8O1E9APve+yjCtCyK?= =?us-ascii?Q?Zb2ztttdBPGCcWaJcILFWItOQHiFi2jAaVxk7g8LK87Bu99UZ4gwFKh9qFzQ?= =?us-ascii?Q?0kylAxFYjNruPq3a3JC7lbbuUQY8OpxYNzUytHRcwTBWjd33xzL8g35fl49R?= =?us-ascii?Q?c59fc396red+NtGdloq7plZjB6+7XSssr/5yMkTMym4PEyLsdXjg9D+t1aKd?= =?us-ascii?Q?b0CuW/qrrIrDPSdOXjK2aqLlA7H98CZgEj5ot6IdpuZnX29OYgAeAmgqwViR?= =?us-ascii?Q?ET2hF7A2uNS9lkf3JnTMww7V2WIUSSbzzyBXvJFrOAHJT2ZLcC4339YF99De?= =?us-ascii?Q?4EQWXotoIVxRIVCTDH/l/WhAEwKxlstByXbyuZ19/Ez7azQgfZCg30266zLp?= =?us-ascii?Q?MWRWU+pwbEl2TjFbMrQZcQa9iavjJYE5vpFDxQ5SyhTLVpvG0bmoJAeE2UXR?= =?us-ascii?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TNhzWc7J5Y3W6NvUlRRBPoxy?= =?us-ascii?Q?3NYV/zeqoY2La1tD2AkEHqdYUFCWaX7LDxkKXyKCThL0/ZyhhwTzGx7cpEyi?= =?us-ascii?Q?+U03Y3G/2EUUl7tkCc0gzWfmDwhuGvD7iNzH/0Td15OXige1LkIaHR5UIg26?= =?us-ascii?Q?FQBig0AQgWyNBUi8e1r2kF8ZlFz9oJpxCPnwyDNlFG6u+RNnY747Di+Mnvyl?= =?us-ascii?Q?5A=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: bp.renesas.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: OSAPR01MB1587.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f16e81a0-5e3d-49fb-3837-08dc3f964b9b X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2024 17:36:32.5504 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Gc6WWXUQNubB4HGZDdbTbPrjFUM8Qso2T9RKPXk5Punbsv+ivh0s3nsF9kvyFuCYo2abW4b4SWt8vb6fR5VW/Vsi8G/K2XJdNYizrdke4vo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB6167 Hi Prabhakar, Thanks for the patch. > -----Original Message----- > From: Prabhakar > Sent: Friday, March 8, 2024 5:27 PM > Subject: [PATCH 4/5] i2c: riic: Pass register offsets and chip details as= OF data >=20 > From: Lad Prabhakar >=20 > With an increasing number of SoCs reusing this driver, each with slight v= ariations in the RIIC IP, it > becomes necessary to support passing these details as OF data. This appro= ach simplifies the extension > of the driver for other SoCs. >=20 > This patch lays the groundwork for adding support for the Renesas RZ/V2H = SoC. >=20 > Signed-off-by: Lad Prabhakar > Reviewed-by: Fabrizio Castro > --- > drivers/i2c/busses/i2c-riic.c | 59 ++++++++++++++++++++++++++--------- > 1 file changed, 44 insertions(+), 15 deletions(-) >=20 > diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.= c index > 49a12f1ecdf9..3398d639b754 100644 > --- a/drivers/i2c/busses/i2c-riic.c > +++ b/drivers/i2c/busses/i2c-riic.c > @@ -46,18 +46,6 @@ > #include > #include >=20 > -#define RIIC_ICCR1 0x00 > -#define RIIC_ICCR2 0x04 > -#define RIIC_ICMR1 0x08 > -#define RIIC_ICMR3 0x10 > -#define RIIC_ICSER 0x18 > -#define RIIC_ICIER 0x1c > -#define RIIC_ICSR2 0x24 > -#define RIIC_ICBRL 0x34 > -#define RIIC_ICBRH 0x38 > -#define RIIC_ICDRT 0x3c > -#define RIIC_ICDRR 0x40 > - > #define ICCR1_ICE 0x80 > #define ICCR1_IICRST 0x40 > #define ICCR1_SOWP 0x10 > @@ -87,6 +75,13 @@ >=20 > #define RIIC_INIT_MSG -1 >=20 > +#define RIIC_RZ_A_TYPE 0 > + > +struct riic_of_data { > + u8 family; Do you need family as compatible have this information? > + u8 regs[]; > +}; > + > struct riic_dev { > void __iomem *base; > u8 *buf; > @@ -94,6 +89,7 @@ struct riic_dev { > int bytes_left; > int err; > int is_last; > + const struct riic_of_data *info; > struct completion msg_done; > struct i2c_adapter adapter; > struct clk *clk; > @@ -105,14 +101,28 @@ struct riic_irq_desc { > char *name; > }; >=20 > +enum riic_reg_list { > + RIIC_ICCR1 =3D 0, > + RIIC_ICCR2, > + RIIC_ICMR1, > + RIIC_ICMR3, > + RIIC_ICSER, > + RIIC_ICIER, > + RIIC_ICSR2, > + RIIC_ICBRL, > + RIIC_ICBRH, > + RIIC_ICDRT, > + RIIC_ICDRR, > +}; > + > static inline void riic_writeb_reg(u8 val, struct riic_dev *riic, u8 off= set) { > - writeb(val, riic->base + offset); > + writeb(val, riic->base + riic->info->regs[offset]); > } >=20 > static inline u8 riic_readb_reg(struct riic_dev *riic, u8 offset) { > - return readb(riic->base + offset); > + return readb(riic->base + riic->info->regs[offset]); > } >=20 > static inline void riic_clear_set_bit(struct riic_dev *riic, u8 clear, u= 8 set, u8 reg) @@ -453,6 > +463,8 @@ static int riic_i2c_probe(struct platform_device *pdev) > } > } >=20 > + riic->info =3D of_device_get_match_data(&pdev->dev); > + > adap =3D &riic->adapter; > i2c_set_adapdata(adap, riic); > strscpy(adap->name, "Renesas RIIC adapter", sizeof(adap->name)); @@ -49= 7,8 +509,25 @@ static void > riic_i2c_remove(struct platform_device *pdev) > pm_runtime_disable(&pdev->dev); > } >=20 > +static const struct riic_of_data riic_rz_a_info =3D { > + .family =3D RIIC_RZ_A_TYPE, > + .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, > + }, > +}; > + > static const struct of_device_id riic_i2c_dt_ids[] =3D { > - { .compatible =3D "renesas,riic-rz", }, > + { .compatible =3D "renesas,riic-rz", .data =3D &riic_rz_a_info }, > { /* Sentinel */ }, > }; >=20 > -- > 2.34.1 >=20