From nobody Fri Sep 25 13:55:50 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 4ED0E36197F; Fri, 11 Sep 2026 18:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152541; cv=none; b=YKBEU23NTld3/mEgTWoLiFSoy7kINKwBOjTtSSeQMBWw2n5VV58izxuz6cgQrd2JRgAc9PSvJJ94MOp7bGfLJy2cDBN/xa5toiTSlXp9EB/lKSac61QYjmqBGh4KT7sT2rVdX9GMbqw6N9cZlehCrFGDRqY2sx8303JdHQOtHNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152541; c=relaxed/simple; bh=gb+fwROmnOkLdeNycb9l18F0EWuU7KY89ynmb/WqDF4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AXpdw7YW+3+MYnlIzIYAfHbZr8fFxMuVXD2+F4z22iKceGUBgqObswZgKwkPjj59xkrbsy6+4HNeyken9qLt4aLNWYhiZTp+rhNsFoAYHlSThgzpCJJDzNr9x7gWcnqsrGLFbiTFhnqfpNHcp3g1tujJTZvkRkRaeIlKUkC0ODM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=J+7+GmB+; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="J+7+GmB+" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 6D3524E4022B; Fri, 11 Sep 2026 18:48:56 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 41B6360580; Fri, 11 Sep 2026 18:48:56 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7181711C7A9DC; Fri, 11 Sep 2026 20:48:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789152535; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=HAyABBQS0V8BnfnIm9rFYNSgw2zlmJq/eAOs916odWA=; b=J+7+GmB+338+VQHqECaqqirV9Yc/RPKRZFgjF3rRxzCFtFazoxouTUNTWXiTkisPryWLD8 mi4HxufURS5pCFu9zFRH5pZOmUmUCxmYf5cxJGeSfCULwr7RNohR9AynusGwhgS+1sCToA 7clPfr3GbPqXC4gkkFAomRe9FZw7rXADi2ZwANd3vgb/Rx+lnQ3awe//ssFYxFQveuCNW8 XBBAuOSQNQbH6gdJ1vJSqfDb8Rpj6feQK1JNyRflMfIZL8mnnSd1Yn/P09e8ROv7GxeDnf AXfwnUQ6WlZQxJg8R74q161VgnXKLEBmEnhJijpg7QA0pSL/JNNE6LaG7URRAQ== From: "Thomas Richard (congatec GmbH)" Date: Fri, 11 Sep 2026 20:48:03 +0200 Subject: [PATCH v3 1/9] mfd: cgbc: Fix use of negative error code as valid session handle Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-cgbc-i2c-storage-devices-support-v3-1-594b53fbc5ea@bootlin.com> References: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> In-Reply-To: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> To: Lee Jones , Andi Shyti Cc: Thomas Petazzoni , Werner Gartner , mfd@lists.linux.dev, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, "Thomas Richard (congatec GmbH)" , stable@vger.kernel.org, Sashiko X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 The cgbc_session_command() return value was directly cast to u8 and used as session handle without error checking. Casting a negative error to u8 produces a valid-looking session handle. So check if return value is positive before to cast and use it. Cc: stable@vger.kernel.org Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260713-cgbc-core-fix-cgbc-remove-v= 1-1-79274ad62b3a%40bootlin.com?part=3D1 Fixes: 6f1067cfbee7 ("mfd: Add Congatec Board Controller driver") Signed-off-by: Thomas Richard (congatec GmbH) --- drivers/mfd/cgbc-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c index 2becaf797646..4a409234e66c 100644 --- a/drivers/mfd/cgbc-core.c +++ b/drivers/mfd/cgbc-core.c @@ -103,7 +103,11 @@ static int cgbc_session_request(struct cgbc_device_dat= a *cgbc) if (ret) return dev_err_probe(cgbc->dev, ret, "device not found or not ready\n"); =20 - cgbc->session =3D cgbc_session_command(cgbc, CGBC_SESSION_CMD_REQUEST); + ret =3D cgbc_session_command(cgbc, CGBC_SESSION_CMD_REQUEST); + if (ret < 0) + return dev_err_probe(cgbc->dev, ret, "session handle request timed out\n= "); + + cgbc->session =3D ret; =20 /* The Board Controller sent us a wrong session handle, we cannot communi= cate with it */ if (cgbc->session < CGBC_SESSION_VALID_MIN || cgbc->session > CGBC_SESSIO= N_VALID_MAX) --=20 2.53.0 From nobody Fri Sep 25 13:55:50 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 04EE93EA963 for ; Fri, 11 Sep 2026 18:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152541; cv=none; b=jH+ZvKRFd6R0+HNvPs3Y5lgO9ee6/6ndM1Qv2qG21ejyn1E+ieizBzLzAWdCFl7BQTUWBQQycoBAMiWYOA0sYx4j5bet2vfBf4b7SuGT8vnlISzPNkGfPuKP427zeCnBi0P3Q5TDlTssoSRKBBwQ8xS3Fl9v9R3dOKLMgIgnFbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152541; c=relaxed/simple; bh=FJCibY2SED60UC7aA/RHHoDR3FiG1f9oWqf3gR4Jrf0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jr3eirliUwWgqyR+mQNmXdFruPxKJk21XAhrVPA03twC2ow1NfMcenQgJZfkIELY5IXFr7fXNE3tFoPkitgyOfKM5cIVkBj2IwVxbVbqVIXqKoBudTq9afNJt269gs9tqVu1D2fMnjJ5fZ52Du+8wvDsB98mlxA7BpR6xxAC+bI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=kx2j/Izp; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="kx2j/Izp" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 989DB1A022B; Fri, 11 Sep 2026 18:48:57 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 66B8B60649; Fri, 11 Sep 2026 18:48:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D23B011C7AFB3; Fri, 11 Sep 2026 20:48:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789152536; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=c14SyQODhVDxLqVpTYDDs1C8FIYSas61YZ9h2+viO6U=; b=kx2j/IzppZIaUFiicpKsivQ36NBNzzGdqOdnSzR2STMOhjH0FOYgJ0wu4a3YJyhV85A194 Sne7zq4uNhjMkpDVOxoWwmxpaUQtfnmpiE6EJmXz+RkxFC1M0Jl7/VGBTk/8oyFm1uqi9Z uyLsFKKg3Is8/RIX4L2cbvu8e9S+n0eajWcN8SDaS/OmKSBP7inAun3HMvkWDyBQp3AMfY +VZo6ykj7FeHSb+peOcYvy1f/esikKu8aFtqibv/e3pod3G5tPywwobD53yWJ3YrFWktDe nq1XmI9GNfNqOuv491dQiE/xh7hwD5MMSS3yy+lGUT9NVYbR+IO6K+1z+9RW9g== From: "Thomas Richard (congatec GmbH)" Date: Fri, 11 Sep 2026 20:48:04 +0200 Subject: [PATCH v3 2/9] mfd: cgbc: Add I2C platform data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-cgbc-i2c-storage-devices-support-v3-2-594b53fbc5ea@bootlin.com> References: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> In-Reply-To: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> To: Lee Jones , Andi Shyti Cc: Thomas Petazzoni , Werner Gartner , mfd@lists.linux.dev, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, "Thomas Richard (congatec GmbH)" X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Define I2C platform data for each I2C bus in the cgbc MFD driver. Platform data passes per-bus parameters to the I2C driver, rather than being defined inside the i2c-cgbc driver itself. This makes the i2c-cgbc driver more generic. Signed-off-by: Thomas Richard (congatec GmbH) --- MAINTAINERS | 1 + drivers/mfd/cgbc-core.c | 39 ++++++++++++++++++++++++++----= ---- include/linux/platform_data/i2c-cgbc.h | 22 +++++++++++++++++++ 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 6215fcb07770..561f102c2541 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6621,6 +6621,7 @@ F: drivers/mfd/cgbc-core.c F: drivers/video/backlight/cgbc_bl.c F: drivers/watchdog/cgbc_wdt.c F: include/linux/mfd/cgbc.h +F: include/linux/platform_data/i2c-cgbc.h =20 CONSOLE SUBSYSTEM M: Greg Kroah-Hartman diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c index 4a409234e66c..321fa3fff2ac 100644 --- a/drivers/mfd/cgbc-core.c +++ b/drivers/mfd/cgbc-core.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include =20 @@ -55,6 +56,35 @@ =20 static struct platform_device *cgbc_pdev; =20 +static const struct cgbc_i2c_platform_data cgbc_i2c_gp_pdata =3D { + .name =3D "Congatec General Purpose I2C adapter", + .cgbc_bus_id =3D 0, +}; + +static const struct cgbc_i2c_platform_data cgbc_i2c_pm_pdata =3D { + .name =3D "Congatec Power Management I2C adapter", + .cgbc_bus_id =3D 4, +}; + +static const struct mfd_cell cgbc_devs[] =3D { + { .name =3D "cgbc-backlight" }, + { .name =3D "cgbc-gpio" }, + { .name =3D "cgbc-hwmon" }, + { + .name =3D "cgbc-i2c", + .id =3D 1, + .platform_data =3D &cgbc_i2c_gp_pdata, + .pdata_size =3D sizeof(cgbc_i2c_gp_pdata), + }, + { + .name =3D "cgbc-i2c", + .id =3D 2, + .platform_data =3D &cgbc_i2c_pm_pdata, + .pdata_size =3D sizeof(cgbc_i2c_pm_pdata), + }, + { .name =3D "cgbc-wdt" }, +}; + /* Wait the Board Controller is ready to receive some session commands */ static int cgbc_wait_device(struct cgbc_device_data *cgbc) { @@ -235,15 +265,6 @@ int cgbc_command(struct cgbc_device_data *cgbc, void *= cmd, unsigned int cmd_size } EXPORT_SYMBOL_GPL(cgbc_command); =20 -static struct mfd_cell cgbc_devs[] =3D { - { .name =3D "cgbc-wdt" }, - { .name =3D "cgbc-gpio" }, - { .name =3D "cgbc-i2c", .id =3D 1 }, - { .name =3D "cgbc-i2c", .id =3D 2 }, - { .name =3D "cgbc-hwmon" }, - { .name =3D "cgbc-backlight" }, -}; - static int cgbc_map(struct cgbc_device_data *cgbc) { struct device *dev =3D cgbc->dev; diff --git a/include/linux/platform_data/i2c-cgbc.h b/include/linux/platfor= m_data/i2c-cgbc.h new file mode 100644 index 000000000000..4465e8a7b40e --- /dev/null +++ b/include/linux/platform_data/i2c-cgbc.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * i2c-cgbc interface to platform code + * + * Copyright (C) 2026 congatec GmbH + * Author: Thomas Richard + */ + +#ifndef _LINUX_I2C_CGBC_H +#define _LINUX_I2C_CGBC_H + +/** + * struct cgbc_platform_data - Platform data of the CGBC I2C driver + * @name: I2C adapter name + * @cgbc_bus_id: I2C bus ID (from Board Controller point of view) + */ +struct cgbc_i2c_platform_data { + const char *name; + int cgbc_bus_id; +}; + +#endif /* _LINUX_I2C_CGBC_H */ --=20 2.53.0 From nobody Fri Sep 25 13:55:50 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 485223F326C for ; Fri, 11 Sep 2026 18:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152543; cv=none; b=ePo1PVp38NJNhb1UdwzUfUF4W80wYjjyigB6wBmnX0FB6nbOi97X1hgwyoX6k7agB+N+n/GAZ5kgBru9eC2UkmStO1656Z/b+dC4Phra78xZpyfeb2jKERyC4rT6owOXbsZ+jf51u/2KNlBe/zi62GsGNCnUquxhHSLRnio+D28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152543; c=relaxed/simple; bh=6uasUWW1Pv1/xpJBGur7yYwGOxREfBAI108G7qkQuAg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gn8kT/qILDsQkmqqME4d3PbckijKLTJYtxvuzB5zhtZEo/N9vbLb75eqtfC7SdkmK5JXdN1mZIp7dQ/64Dt/G8/UAkSNDhpByxAuRtlKSab3m9vshnk9MwWBQzXAUidOvXE50SqLbwVwvnC0eu+lZvVrNn9vqyTHcVKbwcDsBe4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=iMYHrUoJ; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="iMYHrUoJ" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 84B3C4E401F2; Fri, 11 Sep 2026 18:48:58 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 59B4E606CC; Fri, 11 Sep 2026 18:48:58 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D00DB11C7AF95; Fri, 11 Sep 2026 20:48:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789152537; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=bNkNZ5mloq/4pMyL1jbXsxWjswvGDcsH+OiZ0h0Oy3Y=; b=iMYHrUoJVpblkuwm11R+0W8/WiGQn6f6llQp8P5oNlVTGvTWlGvY9ubjDSLVLE8SxjRD// 45lPNrXhMMRPRKOO3eHc2khHhzvOYPE6VjyiXz2+BzHCujvjEGILQc1FcZwVd5fBm2a8BV AwxbwP3UKqwtRoLs58cO5tYoMwKYACWYYTaM7xDNyoyG3cNehv4I8rLY6C+G0hxhm1/m61 uVSbYz2PvVGNbEnfMQfVYG+bHddIuzMo8lTUMjqXnBiAaVLU5HgzZP1WeLNd+bDMnhldZ9 xznJil4mLNTgAQ49XdWIDOrPVrTfZjT/D4j6OKEtfKk5NgTHSbfTeneBcuQoJQ== From: "Thomas Richard (congatec GmbH)" Date: Fri, 11 Sep 2026 20:48:05 +0200 Subject: [PATCH v3 3/9] i2c: cgbc: Use plateform data to get bus ID and adapter name Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-cgbc-i2c-storage-devices-support-v3-3-594b53fbc5ea@bootlin.com> References: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> In-Reply-To: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> To: Lee Jones , Andi Shyti Cc: Thomas Petazzoni , Werner Gartner , mfd@lists.linux.dev, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, "Thomas Richard (congatec GmbH)" X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Obtain the bus ID (from the BC point of view) and adapter name from platform data. This allows the specific definitions to be removed, leaving only a generic adapter definition. Signed-off-by: Thomas Richard (congatec GmbH) --- drivers/i2c/busses/i2c-cgbc.c | 69 ++++++++++++++++-----------------------= ---- 1 file changed, 26 insertions(+), 43 deletions(-) diff --git a/drivers/i2c/busses/i2c-cgbc.c b/drivers/i2c/busses/i2c-cgbc.c index 25a74fa51aa0..d388e07aad84 100644 --- a/drivers/i2c/busses/i2c-cgbc.c +++ b/drivers/i2c/busses/i2c-cgbc.c @@ -10,11 +10,9 @@ #include #include #include +#include #include =20 -#define CGBC_I2C_PRIMARY_BUS_ID 0 -#define CGBC_I2C_PM_BUS_ID 4 - #define CGBC_I2C_CMD_START 0x40 #define CGBC_I2C_CMD_STAT 0x48 #define CGBC_I2C_CMD_DATA 0x50 @@ -60,11 +58,6 @@ enum cgbc_i2c_state { CGBC_I2C_STATE_ERROR, }; =20 -struct i2c_algo_cgbc_data { - u8 bus_id; - unsigned long read_maxtime_us; -}; - struct cgbc_i2c_data { struct device *dev; struct cgbc_device_data *cgbc; @@ -73,6 +66,8 @@ struct cgbc_i2c_data { int nmsgs; int pos; enum cgbc_i2c_state state; + u8 bus_id; + unsigned long read_maxtime_us; }; =20 struct cgbc_i2c_transfer { @@ -115,10 +110,9 @@ static unsigned int cgbc_i2c_reg_to_freq(u8 reg) =20 static int cgbc_i2c_get_status(struct i2c_adapter *adap) { - struct i2c_algo_cgbc_data *algo_data =3D adap->algo_data; struct cgbc_i2c_data *i2c =3D i2c_get_adapdata(adap); struct cgbc_device_data *cgbc =3D i2c->cgbc; - u8 cmd =3D CGBC_I2C_CMD_STAT | algo_data->bus_id; + u8 cmd =3D CGBC_I2C_CMD_STAT | i2c->bus_id; u8 status; int ret; =20 @@ -132,7 +126,6 @@ static int cgbc_i2c_get_status(struct i2c_adapter *adap) static int cgbc_i2c_set_frequency(struct i2c_adapter *adap, unsigned int bus_frequency) { - struct i2c_algo_cgbc_data *algo_data =3D adap->algo_data; struct cgbc_i2c_data *i2c =3D i2c_get_adapdata(adap); struct cgbc_device_data *cgbc =3D i2c->cgbc; u8 cmd[2], data; @@ -144,7 +137,7 @@ static int cgbc_i2c_set_frequency(struct i2c_adapter *a= dap, bus_frequency =3D I2C_MAX_STANDARD_MODE_FREQ; } =20 - cmd[0] =3D CGBC_I2C_CMD_SPEED | algo_data->bus_id; + cmd[0] =3D CGBC_I2C_CMD_SPEED | i2c->bus_id; cmd[1] =3D cgbc_i2c_freq_to_reg(bus_frequency); =20 ret =3D cgbc_command(cgbc, &cmd, sizeof(cmd), &data, 1, NULL); @@ -170,7 +163,7 @@ static int cgbc_i2c_set_frequency(struct i2c_adapter *a= dap, * can be read by a command is CGBC_I2C_READ_MAX_LEN. * Therefore, calculate the max time to properly size the timeout. */ - algo_data->read_maxtime_us =3D (BITS_PER_BYTE + 1) * CGBC_I2C_READ_MAX_LEN + i2c->read_maxtime_us =3D (BITS_PER_BYTE + 1) * CGBC_I2C_READ_MAX_LEN * USEC_PER_SEC / bus_frequency; =20 return 0; @@ -200,7 +193,6 @@ static unsigned int cgbc_i2c_xfer_to_cmd(struct cgbc_i2= c_transfer xfer, u8 *cmd) =20 static int cgbc_i2c_xfer_msg(struct i2c_adapter *adap) { - struct i2c_algo_cgbc_data *algo_data =3D adap->algo_data; struct cgbc_i2c_data *i2c =3D i2c_get_adapdata(adap); struct cgbc_device_data *cgbc =3D i2c->cgbc; struct i2c_msg *msg =3D i2c->msg; @@ -210,7 +202,7 @@ static int cgbc_i2c_xfer_msg(struct i2c_adapter *adap) u8 cmd_data; =20 struct cgbc_i2c_transfer xfer =3D { - .bus_id =3D algo_data->bus_id, + .bus_id =3D i2c->bus_id, .addr =3D i2c_8bit_addr_from_msg(msg), }; =20 @@ -268,11 +260,11 @@ static int cgbc_i2c_xfer_msg(struct i2c_adapter *adap) =20 ret =3D read_poll_timeout(cgbc_i2c_get_status, ret, ret !=3D CGBC_I2C_STAT_BUSY, 0, - 2 * algo_data->read_maxtime_us, false, adap); + 2 * i2c->read_maxtime_us, false, adap); if (ret < 0) goto err; =20 - cmd_data =3D CGBC_I2C_CMD_DATA | algo_data->bus_id; + cmd_data =3D CGBC_I2C_CMD_DATA | i2c->bus_id; ret =3D cgbc_command(cgbc, &cmd_data, sizeof(cmd_data), msg->buf + i2c->pos, len, NULL); if (ret) @@ -335,44 +327,35 @@ static const struct i2c_algorithm cgbc_i2c_algorithm = =3D { .functionality =3D cgbc_i2c_func, }; =20 -static struct i2c_algo_cgbc_data cgbc_i2c_algo_data[] =3D { - { .bus_id =3D CGBC_I2C_PRIMARY_BUS_ID }, - { .bus_id =3D CGBC_I2C_PM_BUS_ID }, -}; - -static const struct i2c_adapter cgbc_i2c_adapter[] =3D { - { - .owner =3D THIS_MODULE, - .name =3D "Congatec General Purpose I2C adapter", - .class =3D I2C_CLASS_DEPRECATED, - .algo =3D &cgbc_i2c_algorithm, - .algo_data =3D &cgbc_i2c_algo_data[0], - .nr =3D -1, - }, - { - .owner =3D THIS_MODULE, - .name =3D "Congatec Power Management I2C adapter", - .class =3D I2C_CLASS_DEPRECATED, - .algo =3D &cgbc_i2c_algorithm, - .algo_data =3D &cgbc_i2c_algo_data[1], - .nr =3D -1, - }, +static const struct i2c_adapter cgbc_i2c_adapter =3D { + .owner =3D THIS_MODULE, + .class =3D I2C_CLASS_DEPRECATED, + .algo =3D &cgbc_i2c_algorithm, + .nr =3D -1, }; =20 static int cgbc_i2c_probe(struct platform_device *pdev) { - struct cgbc_device_data *cgbc =3D dev_get_drvdata(pdev->dev.parent); + struct device *dev =3D &pdev->dev; + struct cgbc_device_data *cgbc =3D dev_get_drvdata(dev->parent); + struct cgbc_i2c_platform_data *pdata; struct cgbc_i2c_data *i2c; int ret; =20 - i2c =3D devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL); + i2c =3D devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); if (!i2c) return -ENOMEM; =20 + pdata =3D dev_get_platdata(dev); + if (!pdata) + return dev_err_probe(dev, -ENODEV, "missing platform_data\n"); + i2c->cgbc =3D cgbc; - i2c->dev =3D &pdev->dev; - i2c->adap =3D cgbc_i2c_adapter[pdev->id]; + i2c->dev =3D dev; + i2c->adap =3D cgbc_i2c_adapter; i2c->adap.dev.parent =3D i2c->dev; + i2c->bus_id =3D pdata->cgbc_bus_id; + strscpy(i2c->adap.name, pdata->name, sizeof(i2c->adap.name)); i2c_set_adapdata(&i2c->adap, i2c); platform_set_drvdata(pdev, i2c); =20 --=20 2.53.0 From nobody Fri Sep 25 13:55:50 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 5087F4078FE for ; Fri, 11 Sep 2026 18:49:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152548; cv=none; b=n1aB5UlKW7XmxZhugaDMFDvtCruX/LrWJTgDNMqHHFKN6XjQTdm/v4ct9IQKf6MahQkt6yxSgRTp81J4X5PGXDdbQKN8wfyEifQh1OHxw7GhsRDu98VBHpc0A5QDS3y2gzceSs6w8caCStsYmL5b/4bqEGnevLSNfezkb/QH2og= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152548; c=relaxed/simple; bh=18qWW3RTW3gbNpD6yD1sScGuT7/roe5IdWoYPFCAUY8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bCoJ60OJT+VkG86lIV44QURoHGPCthJtF0bSWuNQeHTCKgZuHooSmRPu2HOF+VdmKoSd9u1nJp1pzSZF2CXKVUaO7bsRDwX+thQ7WANeszRsiz5mQcmdqPHrDx9pVZZnSinYi5Sf7kUlVa9cyC8ZmZ5cyGNMtsH1xLfjQSPrRAk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=hCYWr3eS; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="hCYWr3eS" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id D0BAEC63A0F for ; Fri, 11 Sep 2026 18:49:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 4F545606CC; Fri, 11 Sep 2026 18:48:59 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EDC7F11C7AFAD; Fri, 11 Sep 2026 20:48:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789152538; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=MpKgVlL6pZuspcUVghBf8UNZYhdMFqssWfvyazmQE/U=; b=hCYWr3eSsK4T81GNMJ+bCMZUMEcQfelUUqbljgxpTwnOEHcRV8K0IZum56Sz4L1C3Sg7H+ uppghw/xOoePbref0Kx4YeMDYxYvOwZRn5xS3PAn+KlZ6gHGTBzPbqaATOYzsRj2tRqnYf u/cHPWVF9iU6UrbYRRQwdwFEoIdFh1f2W4bDIRhn9CFKkhJsrAAMkLHu8dxd/kW9+PmCnv lmJI7+CcdpQYItjxBN4m+HSd5nNYgWljdm0A9EX/Y/2ZN4T8gXZeBIKksnC0K9VZ156F/x CcI5X43x4gc7qF4yniAyPwDSh85ViV0pNLvYDHsssejqPsMbrO8A5DOjQTgayw== From: "Thomas Richard (congatec GmbH)" Date: Fri, 11 Sep 2026 20:48:06 +0200 Subject: [PATCH v3 4/9] mfd: cgbc: Use PLATFORM_DEVID_AUTO for child device registration Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-cgbc-i2c-storage-devices-support-v3-4-594b53fbc5ea@bootlin.com> References: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> In-Reply-To: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> To: Lee Jones , Andi Shyti Cc: Thomas Petazzoni , Werner Gartner , mfd@lists.linux.dev, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, "Thomas Richard (congatec GmbH)" X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Since parameters are now passed to the i2c-cgbc driver via platform data, the I2C driver no longer depends on the platform device ID to probe the correct I2C buses. Drop the hardcoded cell ID in favor of PLATFORM_DEVID_AUTO. Signed-off-by: Thomas Richard (congatec GmbH) --- drivers/mfd/cgbc-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c index 321fa3fff2ac..bb26b358da26 100644 --- a/drivers/mfd/cgbc-core.c +++ b/drivers/mfd/cgbc-core.c @@ -72,13 +72,11 @@ static const struct mfd_cell cgbc_devs[] =3D { { .name =3D "cgbc-hwmon" }, { .name =3D "cgbc-i2c", - .id =3D 1, .platform_data =3D &cgbc_i2c_gp_pdata, .pdata_size =3D sizeof(cgbc_i2c_gp_pdata), }, { .name =3D "cgbc-i2c", - .id =3D 2, .platform_data =3D &cgbc_i2c_pm_pdata, .pdata_size =3D sizeof(cgbc_i2c_pm_pdata), }, @@ -350,8 +348,8 @@ static int cgbc_init_device(struct cgbc_device_data *cg= bc) if (ret) goto release_session; =20 - ret =3D mfd_add_devices(cgbc->dev, -1, cgbc_devs, ARRAY_SIZE(cgbc_devs), - NULL, 0, NULL); + ret =3D mfd_add_devices(cgbc->dev, PLATFORM_DEVID_AUTO, cgbc_devs, + ARRAY_SIZE(cgbc_devs), NULL, 0, NULL); if (ret) goto release_session; =20 --=20 2.53.0 From nobody Fri Sep 25 13:55:50 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 A752A3F328C; Fri, 11 Sep 2026 18:49:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152545; cv=none; b=hd3Z5s3ZMGaoDL2dfDdWmfv1dvCKKtTTI1TCfSCcMpRcR0pP3E3tRVcxn0DzYxw0L5x4B0gnq9m8wVwnG2K9tlJZfpKrJuFFiCUmGnkTKZ5DxbkKxj4E3JolTTeHefdRbYTVbveqAzMwf7dvQ56Rs1rnyYv7eZlrLeGI7Sr6Ngk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152545; c=relaxed/simple; bh=ChRDlnowrHBTyQOyHPBrLY9OaP/SjK6/nMboVF04o4E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ag6J4OLP7fQ+qpAJp1ZdwCwPYV7UrDBnw2AOh5KZau9PmMvCjWVn2D6W+A2aXIuTcPPWrSY2a9spDRQwyFExM9uN20vUsgYubbdcHYWuFjk4Nmtc2lx900c+///ToyTXUJHndTPGdd3GCWnS3qWJVUT77dho8ehAeTzGfLyilMM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=dNskOCmB; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="dNskOCmB" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 81A6E4E4023E; Fri, 11 Sep 2026 18:49:00 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 56575606D2; Fri, 11 Sep 2026 18:49:00 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D738111C7A23F; Fri, 11 Sep 2026 20:48:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789152539; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Am4haarr/NpR5iw1+rTp6Nr/xWwoCkxN2vOAeKnE8cs=; b=dNskOCmBEApm+5kmAmk5reCLbdG+D0/8ItlMud6xlCwqdqt8OpC5h0YPezM9J7y3YMZg3D Yxgnr6/7THSo6ySnx4RuGsU8GUs+6hDI4Omwk+UA6gmEUXqt82ohMhLDIgGCX+PG/jLJTj VxX+wfWbxm3Ke3gv2jSqdoMdjHp65vD6PJMgaAjPpoWtsp71VnshBcvd5NZHMSeBhupNKI W/7Emxs5SjT5NuJssA26xvBReW8DO9piWZHnl4JPyk8T84Jfk4NSKNUNdyIYwVvLmEEMrc o3ksqWSGTj5s74iVvhhU2/pArsLebdJ1mDJXianUQ8/ELBeAM3YvuJKRy4xatQ== From: "Thomas Richard (congatec GmbH)" Date: Fri, 11 Sep 2026 20:48:07 +0200 Subject: [PATCH v3 5/9] mfd: cgbc: Use real I2C bus names Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-cgbc-i2c-storage-devices-support-v3-5-594b53fbc5ea@bootlin.com> References: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> In-Reply-To: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> To: Lee Jones , Andi Shyti Cc: Thomas Petazzoni , Werner Gartner , mfd@lists.linux.dev, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, "Thomas Richard (congatec GmbH)" X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 The adapter names described the expected purpose of the buses ("General Purpose I2C adapter", "Power Management I2C adapter") on conga-sa7 board rather than their actual names on the Board Controller. Rename them to the real bus names "cgbc-i2c0" and "cgbc-ddc0", matching the naming used by Congatec, and update the variable names accordingly. Signed-off-by: Thomas Richard (congatec GmbH) --- drivers/mfd/cgbc-core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c index bb26b358da26..dff14cd98271 100644 --- a/drivers/mfd/cgbc-core.c +++ b/drivers/mfd/cgbc-core.c @@ -56,13 +56,13 @@ =20 static struct platform_device *cgbc_pdev; =20 -static const struct cgbc_i2c_platform_data cgbc_i2c_gp_pdata =3D { - .name =3D "Congatec General Purpose I2C adapter", +static const struct cgbc_i2c_platform_data cgbc_i2c_i2c0_pdata =3D { + .name =3D "cgbc-i2c0", .cgbc_bus_id =3D 0, }; =20 -static const struct cgbc_i2c_platform_data cgbc_i2c_pm_pdata =3D { - .name =3D "Congatec Power Management I2C adapter", +static const struct cgbc_i2c_platform_data cgbc_i2c_ddc0_pdata =3D { + .name =3D "cgbc-ddc0", .cgbc_bus_id =3D 4, }; =20 @@ -72,13 +72,13 @@ static const struct mfd_cell cgbc_devs[] =3D { { .name =3D "cgbc-hwmon" }, { .name =3D "cgbc-i2c", - .platform_data =3D &cgbc_i2c_gp_pdata, - .pdata_size =3D sizeof(cgbc_i2c_gp_pdata), + .platform_data =3D &cgbc_i2c_i2c0_pdata, + .pdata_size =3D sizeof(cgbc_i2c_i2c0_pdata), }, { .name =3D "cgbc-i2c", - .platform_data =3D &cgbc_i2c_pm_pdata, - .pdata_size =3D sizeof(cgbc_i2c_pm_pdata), + .platform_data =3D &cgbc_i2c_ddc0_pdata, + .pdata_size =3D sizeof(cgbc_i2c_ddc0_pdata), }, { .name =3D "cgbc-wdt" }, }; --=20 2.53.0 From nobody Fri Sep 25 13:55:50 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 4CB394078E8 for ; Fri, 11 Sep 2026 18:49:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152548; cv=none; b=glhDIMzLyQMxSvgIyQUOQzEaiM/dZUVDt19kHQvlFwScPEikn/dUGCx+r0qg0P9E0z8OuETOYXQLdCsMQqrYzGAUMwOWE7KrY8KSCro0jV/REbuzq6kAjYM8obdxsQTykpJ72wrVF/+kG6KxmJUGdL1VOgAUjzYaNCTrP6LB3fg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152548; c=relaxed/simple; bh=MLXlkWvAz2reCSNezaXmeowtTnYNrr3l0Mg0DQtTtKk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iQ/ERDQh5WzjzyKGWdIwl6VhV6wgq4sMwx75HBoDIt/i/cesmhbHYQ2hhZ7yvBTcOg8qh51CrDSh94ygsB+jtweSuYe1UeE+3vS68+62qmNsePe+K08MxYnZQi2w6Y7HKM6aoOPjq3b/KPtLCDwrHhvL/iHn5wROsPpnVlQdnHE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=BDKaNuqZ; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="BDKaNuqZ" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id E567BC63440; Fri, 11 Sep 2026 18:49:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 4A7B5606E3; Fri, 11 Sep 2026 18:49:01 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 09A3111C7AFB3; Fri, 11 Sep 2026 20:48:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789152540; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=qb0jmvppUUTsrwnBOJ07ToDzPzb3JhdaJ8as8Vej6mY=; b=BDKaNuqZsRe2nd5FatX4ifvigzPmM0GWscsZa7I2+E4EU1R7L1azLxsJwzTclu2k8dyq1J UkF85YotvMUYg0215TKev7p1mSz6g99uSk32jciuWm88oAgZ9RcXvlxiR1yI1RytqMJU28 XcM/bJYUrhrznEhh2cSZXja+sAbwDpKNJb3aQ4D0sTLYiuWiMcwCwoX5jm6YEdMmAUbBy3 lBYBwgcfS5VQ7/oR4j8BQ6ZGtim3r5nSkjlvkvUDvKoR6j/qMBJBtOK5hH8B9lkC0CAX5k V6UCvJJRbo9EIECrOHAD0nBV2H+rCSJnRxq+NwUsxzL4sNSN86E5uAVfi2+i4w== From: "Thomas Richard (congatec GmbH)" Date: Fri, 11 Sep 2026 20:48:08 +0200 Subject: [PATCH v3 6/9] i2c: cgbc: Add support for fixed frequency buses Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-cgbc-i2c-storage-devices-support-v3-6-594b53fbc5ea@bootlin.com> References: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> In-Reply-To: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> To: Lee Jones , Andi Shyti Cc: Thomas Petazzoni , Werner Gartner , mfd@lists.linux.dev, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, "Thomas Richard (congatec GmbH)" X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Some I2C buses run at a fixed frequency. Add a fixed_freq flag to struct cgbc_i2c_platform_data to identify them. But the frequency is still needed to compute read_maxtime_us, so split cgbc_i2c_set_frequency() into two functions: - cgbc_i2c_set_frequency(): sets the bus frequency (skipped for fixed-frequency busses). - cgbc_i2c_get_frequency(): reads the bus frequency and computes read_maxtime_us. Signed-off-by: Thomas Richard (congatec GmbH) --- drivers/i2c/busses/i2c-cgbc.c | 30 +++++++++++++++++++----------- include/linux/platform_data/i2c-cgbc.h | 2 ++ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/i2c/busses/i2c-cgbc.c b/drivers/i2c/busses/i2c-cgbc.c index d388e07aad84..cb0435b3cc5f 100644 --- a/drivers/i2c/busses/i2c-cgbc.c +++ b/drivers/i2c/busses/i2c-cgbc.c @@ -129,7 +129,6 @@ static int cgbc_i2c_set_frequency(struct i2c_adapter *a= dap, struct cgbc_i2c_data *i2c =3D i2c_get_adapdata(adap); struct cgbc_device_data *cgbc =3D i2c->cgbc; u8 cmd[2], data; - int ret; =20 if (bus_frequency > CGBC_I2C_FREQ_MAX_HZ || bus_frequency < CGBC_I2C_FREQ_MIN_HZ) { @@ -140,18 +139,21 @@ static int cgbc_i2c_set_frequency(struct i2c_adapter = *adap, cmd[0] =3D CGBC_I2C_CMD_SPEED | i2c->bus_id; cmd[1] =3D cgbc_i2c_freq_to_reg(bus_frequency); =20 - ret =3D cgbc_command(cgbc, &cmd, sizeof(cmd), &data, 1, NULL); - if (ret) - return dev_err_probe(i2c->dev, ret, - "Failed to initialize I2C bus %s", - adap->name); + return cgbc_command(cgbc, &cmd, sizeof(cmd), &data, 1, NULL); +} =20 - cmd[1] =3D 0x00; +static int cgbc_i2c_get_frequency(struct i2c_adapter *adap) +{ + struct cgbc_i2c_data *i2c =3D i2c_get_adapdata(adap); + struct cgbc_device_data *cgbc =3D i2c->cgbc; + u8 cmd[2] =3D { CGBC_I2C_CMD_SPEED | i2c->bus_id }; + unsigned int bus_frequency; + u8 data; + int ret; =20 ret =3D cgbc_command(cgbc, &cmd, sizeof(cmd), &data, 1, NULL); if (ret) - return dev_err_probe(i2c->dev, ret, - "Failed to get I2C bus frequency"); + return ret; =20 bus_frequency =3D cgbc_i2c_reg_to_freq(data); =20 @@ -359,9 +361,15 @@ static int cgbc_i2c_probe(struct platform_device *pdev) i2c_set_adapdata(&i2c->adap, i2c); platform_set_drvdata(pdev, i2c); =20 - ret =3D cgbc_i2c_set_frequency(&i2c->adap, I2C_MAX_STANDARD_MODE_FREQ); + if (!pdata->fixed_freq) { + ret =3D cgbc_i2c_set_frequency(&i2c->adap, I2C_MAX_STANDARD_MODE_FREQ); + if (ret) + return dev_err_probe(dev, ret, "Failed to set I2C bus frequency"); + } + + ret =3D cgbc_i2c_get_frequency(&i2c->adap); if (ret) - return ret; + return dev_err_probe(i2c->dev, ret, "Failed to get I2C bus frequency"); =20 return i2c_add_numbered_adapter(&i2c->adap); } diff --git a/include/linux/platform_data/i2c-cgbc.h b/include/linux/platfor= m_data/i2c-cgbc.h index 4465e8a7b40e..224926c12070 100644 --- a/include/linux/platform_data/i2c-cgbc.h +++ b/include/linux/platform_data/i2c-cgbc.h @@ -13,10 +13,12 @@ * struct cgbc_platform_data - Platform data of the CGBC I2C driver * @name: I2C adapter name * @cgbc_bus_id: I2C bus ID (from Board Controller point of view) + * @fixed_freq: I2C bus has a fixed frequency */ struct cgbc_i2c_platform_data { const char *name; int cgbc_bus_id; + bool fixed_freq; }; =20 #endif /* _LINUX_I2C_CGBC_H */ --=20 2.53.0 From nobody Fri Sep 25 13:55:50 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 ADB373CB544; Fri, 11 Sep 2026 18:49:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152546; cv=none; b=NnXd+PHU+G+kenXtckocYdrtmdQYelnizBa8rIuK6KjVoU/LJJH1qXaOHtmHz4fFBKnvuD91eXoKzIkFBAB+70Kai3vj5Arh8OGIOxiv0eZw27R5jAVA3pZZccw13TyRQYvrCCSyIUfRuy02Btle/wEfYwiwW5OzuFIUZVwpvdU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152546; c=relaxed/simple; bh=yPKpAyMldxqpCT9O7miczpE28O/GeHwma9x0pTHhBqE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cENmueit3gbAWGZDwKzuGjhLEOQwJ1nWrTckxfnR0ygwe7zMD7fJGRk2xMzk0p88cXMV4e4RKXNpeLi+06KuNC8ei1pIvRcZBuRvel7KHcz6bQKtFd+xBj6goUd+rMpGD7rOJuaxrpedC1XxDiCEsnp1K4eywdnz+V/zfFy1sgo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=L6y/TV2r; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="L6y/TV2r" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id B81211A0226; Fri, 11 Sep 2026 18:49:02 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 8536560735; Fri, 11 Sep 2026 18:49:02 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0210711C7A9DC; Fri, 11 Sep 2026 20:49:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789152541; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=NsrDGn7EOh4dNRz/sOT1dQVDqqvsvxFmaCzhKqKNUwc=; b=L6y/TV2rkXuvdyzIhSlbJri5+vyE5iAYoI05iMS+vM3L2yMPOYg6WLBQ4HsUN2CukaaYJg 8OXhetoI2v6/iZ8pi0CluxMa+9gw2odDifw/OFSalwWsXObpRMmVYqIhMsfYuoXVW4rXaI pp96syhr1E9sGZnGcEpMAf0eAmlcgUuOjPxkP1Z057FhW90FtEDi5b8eZ9h/MUJ6C0zPUt IYmWLGwQkmD+oi0xBkLpsqTgwrJtE1Q7E5aOl25rGY9zsd6xsDyJfJu9zwx48qNg3x5Bf8 1jJ55HfDjJCUko1z1hYx8ZTghhtlIKUbNIfyli7/j6FW/C7P9OjfoOJy3Uskpw== From: "Thomas Richard (congatec GmbH)" Date: Fri, 11 Sep 2026 20:48:09 +0200 Subject: [PATCH v3 7/9] mfd: cgbc: Add virtual I2C bus support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-cgbc-i2c-storage-devices-support-v3-7-594b53fbc5ea@bootlin.com> References: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> In-Reply-To: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> To: Lee Jones , Andi Shyti Cc: Thomas Petazzoni , Werner Gartner , mfd@lists.linux.dev, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, "Thomas Richard (congatec GmbH)" X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Internally the Board Controller has a virtual I2C bus with some virtual storage devices (EEPROM and RAM). So add a new I2C cell for this I2C virtual bus. Signed-off-by: Thomas Richard (congatec GmbH) --- drivers/mfd/cgbc-core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c index dff14cd98271..90fa0e657385 100644 --- a/drivers/mfd/cgbc-core.c +++ b/drivers/mfd/cgbc-core.c @@ -66,6 +66,12 @@ static const struct cgbc_i2c_platform_data cgbc_i2c_ddc0= _pdata =3D { .cgbc_bus_id =3D 4, }; =20 +static const struct cgbc_i2c_platform_data cgbc_i2c_i2cv_pdata =3D { + .name =3D "cgbc-i2cv", + .cgbc_bus_id =3D 3, + .fixed_freq =3D true, +}; + static const struct mfd_cell cgbc_devs[] =3D { { .name =3D "cgbc-backlight" }, { .name =3D "cgbc-gpio" }, @@ -80,6 +86,11 @@ static const struct mfd_cell cgbc_devs[] =3D { .platform_data =3D &cgbc_i2c_ddc0_pdata, .pdata_size =3D sizeof(cgbc_i2c_ddc0_pdata), }, + { + .name =3D "cgbc-i2c", + .platform_data =3D &cgbc_i2c_i2cv_pdata, + .pdata_size =3D sizeof(cgbc_i2c_i2cv_pdata), + }, { .name =3D "cgbc-wdt" }, }; =20 --=20 2.53.0 From nobody Fri Sep 25 13:55:50 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 5BA883EDAAE; Fri, 11 Sep 2026 18:49:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152551; cv=none; b=tjk8IEsLhhIboLoYvWaMwid8PXftFQSc+RLl3O6P+mw5yv9IUj9IagUpUL0Gqb8H1gYlEbfjNinUkibMtyjUnZ60A1B6xxZtxfq3Ei7utAGLELH8GH7J0seCaiF/XfEx/7HR6xnksjadaQONrhbrQcz2RRP2w2VYnwnO+8VBa7I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152551; c=relaxed/simple; bh=GNNzSTLbgpHykj/Jyzbjs1Z5IOBldeOKxShjDx3id9g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MpmYeDsV5Jmf+PDlK2jXI+/v4BRSKKtBo6Rq0dgOjhWljb7JMSXUSvbJymxzyB5TuHdUXHrqQIzZaGR4yfvP4rhgIRiVToy1T1hNMMu0hq74+0EPxk5/HMZikQcLqg+E7uxQPZ42wf9NoENQclKH2UyGT8M7ps5ihAOJMn0DARU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=aoWfWH9p; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="aoWfWH9p" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id EAE2CC63442; Fri, 11 Sep 2026 18:49:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id BEC7060737; Fri, 11 Sep 2026 18:49:03 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1C3FD11C7AFAD; Fri, 11 Sep 2026 20:49:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789152542; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=FtWqilX0/XJZ8szdotwy1h9xODOL04sHT1uvbcJkTbc=; b=aoWfWH9p/yAMQ04WVnv0gSjfaGEpfXyrRWq1me6fmM9g+f0lTvpH1S7zFRf8F65nHEzXzZ yMRlr198ROXQ12VCeMBx93HR4QeZaVDYLb/+JzMvz1P96LUfI5hS++w5v/oKWM62doJEEH sAKjEI1ETYw1ja98I6Omee2TdqIZ/6uYsgtpOfu29dYJ5XA/ZnTkcoR8HzmKA5JLqy0jnG sClxgNHvioedRl9xmCx11UF/3PX/ocQK6tVBe4yekmB0NCQw/hzd+NWEbBiEEgVeP9a0z6 gv/Ac2CX5lQPtuhkNYwVSBYvSFJ/K9/FQs+L4ysOprMnATShSSxUbD3fqjYuqA== From: "Thomas Richard (congatec GmbH)" Date: Fri, 11 Sep 2026 20:48:10 +0200 Subject: [PATCH v3 8/9] mfd: cgbc: Add virtual storage devices on the virtual I2C bus Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-cgbc-i2c-storage-devices-support-v3-8-594b53fbc5ea@bootlin.com> References: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> In-Reply-To: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> To: Lee Jones , Andi Shyti Cc: Thomas Petazzoni , Werner Gartner , mfd@lists.linux.dev, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, "Thomas Richard (congatec GmbH)" X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Add support for virtual storage devices exposed by the Board Controller on its virtual I2C bus. There are two device types: EEPROM for persistent storage and RAM for non-persistent storage: - Secure Data EEPROM (64 bytes, RO): static and dynamic board info - BIOS EEPROM (32 bytes, RW): reserved for BIOS applications - BC EEPROM (32 bytes, RO): Board Controller operational params - User EEPROM (32 bytes, RW): user applications - BIOS RAM (32 bytes, RW): reserved for BIOS applications - BC RAM (8 bytes, RO): Board Controller operational params - User RAM (16 bytes, RW): user applications Use the at24 driver with the 24c01 entry (the most generic one) for all virtual storage devices, customizing parameters via software_node properties (size, pagesize, read-only flag, label). Signed-off-by: Thomas Richard (congatec GmbH) --- drivers/mfd/cgbc-core.c | 129 +++++++++++++++++++++++++++++= ++++ include/linux/platform_data/i2c-cgbc.h | 4 + 2 files changed, 133 insertions(+) diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c index 90fa0e657385..097b7309a400 100644 --- a/drivers/mfd/cgbc-core.c +++ b/drivers/mfd/cgbc-core.c @@ -13,11 +13,13 @@ =20 #include #include +#include #include #include #include #include #include +#include #include =20 #define CGBC_IO_SESSION_BASE 0x0E20 @@ -56,6 +58,131 @@ =20 static struct platform_device *cgbc_pdev; =20 +static const struct property_entry cgbc_secure_data_eeprom_props[] =3D { + PROPERTY_ENTRY_U32("size", 64), + PROPERTY_ENTRY_U32("pagesize", 1), + PROPERTY_ENTRY_BOOL("read-only"), + PROPERTY_ENTRY_STRING("label", "cgbc-secure-data-eeprom"), + { } +}; + +static const struct software_node cgbc_secure_data_eeprom_node =3D { + .properties =3D cgbc_secure_data_eeprom_props, +}; + +static const struct property_entry cgbc_bc_eeprom_props[] =3D { + PROPERTY_ENTRY_U32("size", 32), + PROPERTY_ENTRY_U32("pagesize", 1), + PROPERTY_ENTRY_BOOL("read-only"), + PROPERTY_ENTRY_STRING("label", "cgbc-bc-eeprom"), + { } +}; + +static const struct software_node cgbc_bc_eeprom_node =3D { + .properties =3D cgbc_bc_eeprom_props, +}; + +static const struct property_entry cgbc_user_eeprom_props[] =3D { + PROPERTY_ENTRY_U32("size", 32), + PROPERTY_ENTRY_U32("pagesize", 1), + PROPERTY_ENTRY_STRING("label", "cgbc-user-eeprom"), + { } +}; + +static const struct software_node cgbc_user_eeprom_node =3D { + .properties =3D cgbc_user_eeprom_props, +}; + +static const struct property_entry cgbc_bios_eeprom_props[] =3D { + PROPERTY_ENTRY_U32("size", 32), + PROPERTY_ENTRY_U32("pagesize", 1), + PROPERTY_ENTRY_STRING("label", "cgbc-bios-eeprom"), + { } +}; + +static const struct software_node cgbc_bios_eeprom_node =3D { + .properties =3D cgbc_bios_eeprom_props, +}; + +static const struct property_entry cgbc_bc_ram_props[] =3D { + PROPERTY_ENTRY_U32("size", 8), + PROPERTY_ENTRY_U32("pagesize", 1), + PROPERTY_ENTRY_BOOL("read-only"), + PROPERTY_ENTRY_STRING("label", "cgbc-bc-ram"), + { } +}; + +static const struct software_node cgbc_bc_ram_node =3D { + .properties =3D cgbc_bc_ram_props, +}; + +static const struct property_entry cgbc_user_ram_props[] =3D { + PROPERTY_ENTRY_U32("size", 16), + PROPERTY_ENTRY_U32("pagesize", 1), + PROPERTY_ENTRY_STRING("label", "cgbc-user-ram"), + { } +}; + +static const struct software_node cgbc_user_ram_node =3D { + .properties =3D cgbc_user_ram_props, +}; + +static const struct property_entry cgbc_bios_ram_props[] =3D { + PROPERTY_ENTRY_U32("size", 32), + PROPERTY_ENTRY_U32("pagesize", 1), + PROPERTY_ENTRY_STRING("label", "cgbc-bios-ram"), + { } +}; + +static const struct software_node cgbc_bios_ram_node =3D { + .properties =3D cgbc_bios_ram_props, +}; + +static const struct i2c_board_info cgbc_i2c_i2cv_board_info[] =3D { + { + .type =3D "24c01", + .addr =3D 0x40, + .dev_name =3D "cgbc-secure-data-eeprom", + .swnode =3D &cgbc_secure_data_eeprom_node, + }, + { + .type =3D "24c01", + .addr =3D 0x48, + .dev_name =3D "cgbc-bc-eeprom", + .swnode =3D &cgbc_bc_eeprom_node, + }, + { + .type =3D "24c01", + .addr =3D 0x50, + .dev_name =3D "cgbc-user-eeprom", + .swnode =3D &cgbc_user_eeprom_node, + }, + { + .type =3D "24c01", + .addr =3D 0x58, + .dev_name =3D "cgbc-bios-eeprom", + .swnode =3D &cgbc_bios_eeprom_node, + }, + { + .type =3D "24c01", + .addr =3D 0x60, + .dev_name =3D "cgbc-bc-ram", + .swnode =3D &cgbc_bc_ram_node, + }, + { + .type =3D "24c01", + .addr =3D 0x68, + .dev_name =3D "cgbc-user-ram", + .swnode =3D &cgbc_user_ram_node, + }, + { + .type =3D "24c01", + .addr =3D 0x70, + .dev_name =3D "cgbc-bios-ram", + .swnode =3D &cgbc_bios_ram_node, + } +}; + static const struct cgbc_i2c_platform_data cgbc_i2c_i2c0_pdata =3D { .name =3D "cgbc-i2c0", .cgbc_bus_id =3D 0, @@ -70,6 +197,8 @@ static const struct cgbc_i2c_platform_data cgbc_i2c_i2cv= _pdata =3D { .name =3D "cgbc-i2cv", .cgbc_bus_id =3D 3, .fixed_freq =3D true, + .devices =3D cgbc_i2c_i2cv_board_info, + .nb_devices =3D ARRAY_SIZE(cgbc_i2c_i2cv_board_info), }; =20 static const struct mfd_cell cgbc_devs[] =3D { diff --git a/include/linux/platform_data/i2c-cgbc.h b/include/linux/platfor= m_data/i2c-cgbc.h index 224926c12070..5f20503ce858 100644 --- a/include/linux/platform_data/i2c-cgbc.h +++ b/include/linux/platform_data/i2c-cgbc.h @@ -14,11 +14,15 @@ * @name: I2C adapter name * @cgbc_bus_id: I2C bus ID (from Board Controller point of view) * @fixed_freq: I2C bus has a fixed frequency + * @nb_devices: number of devices to add when the driver is probed + * @devices: devices to add */ struct cgbc_i2c_platform_data { const char *name; int cgbc_bus_id; bool fixed_freq; + int nb_devices; + struct i2c_board_info const *devices; }; =20 #endif /* _LINUX_I2C_CGBC_H */ --=20 2.53.0 From nobody Fri Sep 25 13:55:50 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 6662D3EB0FB for ; Fri, 11 Sep 2026 18:49:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152551; cv=none; b=mXZPytrJBDii1DeDAs/KL5IOw3to28inPpXy3nqO89VxVCm3enInYMintjv9KMg2WU0T+3WhSdXZiOhxKjtty/a6l0IZCEbmTDtz9QJoootd5EQ85MP7HafLYfBwmaEQ1F1B4Dd12LgAydx70/Ukh9bjXFnEiVNulVDHzXPVZQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789152551; c=relaxed/simple; bh=6T/CkIco8t/8QR2WTz2/va7KX29MxOslKO48ISWBFMQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OTxzGo9LJ86At0m+S1IVFoD14UQInJFmow3By/TEJUPW8onqvaV8F6P/6K4iaRdlUmBAHRa6tsCytaS4TgVSbYc4EpaQ8NMLdB721ulS8zK9RFxQ9H7TS7vgkxO5IAfRYSKpnQWEi9MIMdn9acja7qQhMm9uQjDhxVYfv/gqphg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ISSEVA4T; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ISSEVA4T" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id E3DC41A0238; Fri, 11 Sep 2026 18:49:04 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 8618A601A3; Fri, 11 Sep 2026 18:49:04 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 3373811C7AFC0; Fri, 11 Sep 2026 20:49:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1789152543; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=/FemMgREeoS4d4/1mDYAWJi3rkG9ri6BXfY0Z89wlOc=; b=ISSEVA4T6viT32SjSF5XLfmOCm5x09I7f2CNwVqIYi81q3DYb4n6tEGlbLEmYpbPCH2AZZ 9bR/NYPJfZn37oRaRcx0f0m4d5j74eO451tanUlrVKujBOeuyOl+q/rN2HyotOEF4Q95m/ qszADmuK6K792Tfwglh2SS9kLfHGQ9dAfC1pXpv9x++X44iZp+qJXrX0sxRGCV+xsBLmwQ Vx3TT8+Y9HvTtSQSEguwp4wVtk5Cxtg4h9My73suuQuyPji81gn8uog37XYPMlvGwWLjcD +Ee21c/H/z0pf70V8xve2nCDmP8MFLTkKFVCfdmDagH+9cnjtlD79nlDvddctQ== From: "Thomas Richard (congatec GmbH)" Date: Fri, 11 Sep 2026 20:48:11 +0200 Subject: [PATCH v3 9/9] i2c: cgbc: Register known I2C devices on the bus Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260911-cgbc-i2c-storage-devices-support-v3-9-594b53fbc5ea@bootlin.com> References: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> In-Reply-To: <20260911-cgbc-i2c-storage-devices-support-v3-0-594b53fbc5ea@bootlin.com> To: Lee Jones , Andi Shyti Cc: Thomas Petazzoni , Werner Gartner , mfd@lists.linux.dev, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, "Thomas Richard (congatec GmbH)" X-Mailer: b4 0.16.0 X-Last-TLS-Session-Version: TLSv1.3 Register any I2C devices defined for the bus at probe time. Signed-off-by: Thomas Richard (congatec GmbH) --- drivers/i2c/busses/i2c-cgbc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-cgbc.c b/drivers/i2c/busses/i2c-cgbc.c index cb0435b3cc5f..f20f401f81cb 100644 --- a/drivers/i2c/busses/i2c-cgbc.c +++ b/drivers/i2c/busses/i2c-cgbc.c @@ -342,7 +342,7 @@ static int cgbc_i2c_probe(struct platform_device *pdev) struct cgbc_device_data *cgbc =3D dev_get_drvdata(dev->parent); struct cgbc_i2c_platform_data *pdata; struct cgbc_i2c_data *i2c; - int ret; + int ret, i; =20 i2c =3D devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL); if (!i2c) @@ -371,7 +371,15 @@ static int cgbc_i2c_probe(struct platform_device *pdev) if (ret) return dev_err_probe(i2c->dev, ret, "Failed to get I2C bus frequency"); =20 - return i2c_add_numbered_adapter(&i2c->adap); + ret =3D i2c_add_numbered_adapter(&i2c->adap); + if (ret) + return ret; + + /* Add known devices to the bus */ + for (i =3D 0; i < pdata->nb_devices; i++) + i2c_new_client_device(&i2c->adap, pdata->devices + i); + + return 0; } =20 static void cgbc_i2c_remove(struct platform_device *pdev) --=20 2.53.0