From nobody Mon Feb 9 11:05:01 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 E824B21129D for ; Wed, 16 Apr 2025 16:22:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744820552; cv=none; b=u/VAjjMz87lKFaX/BcnJfNnShkqLJuGVuRk/2ofPvxSq1mB4TSHXhIOhUU0bI0ivM3KyFISZqqgyYMlGXWTydAB1FI48+jV3vB64kh+0wXzLh5hvqQLIEqRY+15Be3VbaPUc6PsT+3eN/yuNLNrTVFeJvr7lbsJkcrUcCmn2OQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744820552; c=relaxed/simple; bh=0dqG/BGHObDxpCDroZlU6KQBh5h1H5phftiCDFOZ4Dk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mtFSslvXzUeP9kpTuVrZZuJaxBjFLBGkQc5gGrIeQquaG+l8O47ruTTrqTkUra/elEgEgAyqtK7R2ItJLRFYMYqIbHFrA8jnAozQnoS2XMQMWuxtAqD91N7TiHIE4uKky849kDLvw2TMNUftinLiOzbLdzFTUtcrjRWt03ZYads= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=clfROOy5; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="clfROOy5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744820550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aiB1aBtR1yuJyWpVsoB3DbcH3jm+uu0Drkre1B2Skjs=; b=clfROOy5qetGxZxxEpfxK3P/hxr9o20CWcfSPVeh8ymwPg1EgxbSNodRQhTMpPS/k5dp1a B+NwbCWPfnOIRUGGRStKmNUhac+C1V0UNJI/GNO0A2kavuZse+zhD2hs5t+cGxiSGWUeFB sIkMmvEqwllysctfbg9o79rvICmfcpw= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695-vPUb5T6BOfm-PsqSL67Ulg-1; Wed, 16 Apr 2025 12:22:25 -0400 X-MC-Unique: vPUb5T6BOfm-PsqSL67Ulg-1 X-Mimecast-MFC-AGG-ID: vPUb5T6BOfm-PsqSL67Ulg_1744820543 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6C7E6195604F; Wed, 16 Apr 2025 16:22:23 +0000 (UTC) Received: from p16v.luc.cera.cz (unknown [10.44.33.32]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BADCC180045B; Wed, 16 Apr 2025 16:22:18 +0000 (UTC) From: Ivan Vecera To: netdev@vger.kernel.org Cc: Vadim Fedorenko , Arkadiusz Kubalewski , Jiri Pirko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Prathosh Satish , Lee Jones , Kees Cook , Andy Shevchenko , Andrew Morton , Michal Schmidt , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v3 net-next 6/8] mfd: zl3073x: Add clock_id field Date: Wed, 16 Apr 2025 18:21:42 +0200 Message-ID: <20250416162144.670760-7-ivecera@redhat.com> In-Reply-To: <20250416162144.670760-1-ivecera@redhat.com> References: <20250416162144.670760-1-ivecera@redhat.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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Add .clock_id to zl3073x_dev structure that will be used by later commits introducing DPLL driver. The clock ID is necessary for DPLL device registration. To generate such ID use chip ID read during device initialization for this. For the case where are multiple zl3073x based chips the chip ID is shifted and lower bits are filled by an unique value. For I2C case it is I2C device address and for SPI case it is chip-select value. Signed-off-by: Ivan Vecera --- drivers/mfd/zl3073x-core.c | 6 +++++- drivers/mfd/zl3073x-i2c.c | 4 +++- drivers/mfd/zl3073x-spi.c | 4 +++- drivers/mfd/zl3073x.h | 2 +- include/linux/mfd/zl3073x.h | 2 ++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/zl3073x-core.c b/drivers/mfd/zl3073x-core.c index 3d18786c769d2..5a0e2bb1a969f 100644 --- a/drivers/mfd/zl3073x-core.c +++ b/drivers/mfd/zl3073x-core.c @@ -485,13 +485,14 @@ static void zl3073x_devlink_unregister(void *ptr) * zl3073x_dev_probe - initialize zl3073x device * @zldev: pointer to zl3073x device * @chip_info: chip info based on compatible + * @dev_id: device ID to be used as part of clock ID * * Common initialization of zl3073x device structure. * * Returns: 0 on success, <0 on error */ int zl3073x_dev_probe(struct zl3073x_dev *zldev, - const struct zl3073x_chip_info *chip_info) + const struct zl3073x_chip_info *chip_info, u8 dev_id) { u16 id, revision, fw_ver; struct devlink *devlink; @@ -533,6 +534,9 @@ int zl3073x_dev_probe(struct zl3073x_dev *zldev, FIELD_GET(GENMASK(15, 8), cfg_ver), FIELD_GET(GENMASK(7, 0), cfg_ver)); =20 + /* Use chip ID and given dev ID as clock ID */ + zldev->clock_id =3D ((u64)id << 8) | dev_id; + /* Register the device as devlink device */ devlink =3D priv_to_devlink(zldev); devlink_register(devlink); diff --git a/drivers/mfd/zl3073x-i2c.c b/drivers/mfd/zl3073x-i2c.c index 76bc9a0463180..ae0ad6b7b0129 100644 --- a/drivers/mfd/zl3073x-i2c.c +++ b/drivers/mfd/zl3073x-i2c.c @@ -29,7 +29,9 @@ static int zl3073x_i2c_probe(struct i2c_client *client) return PTR_ERR(zldev->regmap); } =20 - return zl3073x_dev_probe(zldev, i2c_get_match_data(client)); + /* Initialize device and use I2C address as dev ID */ + return zl3073x_dev_probe(zldev, i2c_get_match_data(client), + client->addr); } =20 static const struct i2c_device_id zl3073x_i2c_id[] =3D { diff --git a/drivers/mfd/zl3073x-spi.c b/drivers/mfd/zl3073x-spi.c index d0fc2d2221c0d..6e6ec88b40d72 100644 --- a/drivers/mfd/zl3073x-spi.c +++ b/drivers/mfd/zl3073x-spi.c @@ -29,7 +29,9 @@ static int zl3073x_spi_probe(struct spi_device *spi) return PTR_ERR(zldev->regmap); } =20 - return zl3073x_dev_probe(zldev, spi_get_device_match_data(spi)); + /* Initialize device and use SPI chip select value as dev ID */ + return zl3073x_dev_probe(zldev, spi_get_device_match_data(spi), + spi_get_chipselect(spi, 0)); } =20 static const struct spi_device_id zl3073x_spi_id[] =3D { diff --git a/drivers/mfd/zl3073x.h b/drivers/mfd/zl3073x.h index 3a2fea61cf579..abd1ab9a56ded 100644 --- a/drivers/mfd/zl3073x.h +++ b/drivers/mfd/zl3073x.h @@ -26,6 +26,6 @@ extern const struct zl3073x_chip_info zl3073x_chip_info[]; struct zl3073x_dev *zl3073x_devm_alloc(struct device *dev); void zl3073x_dev_init_regmap_config(struct regmap_config *regmap_cfg); int zl3073x_dev_probe(struct zl3073x_dev *zldev, - const struct zl3073x_chip_info *chip_info); + const struct zl3073x_chip_info *chip_info, u8 dev_id); =20 #endif /* __ZL3073X_CORE_H */ diff --git a/include/linux/mfd/zl3073x.h b/include/linux/mfd/zl3073x.h index 53813a8c39660..5074f64a70137 100644 --- a/include/linux/mfd/zl3073x.h +++ b/include/linux/mfd/zl3073x.h @@ -13,11 +13,13 @@ struct regmap; * @dev: pointer to device * @regmap: regmap to access device registers * @mailbox_lock: mutex protecting an access to mailbox registers + * @clock_id: clock id of the device */ struct zl3073x_dev { struct device *dev; struct regmap *regmap; struct mutex mailbox_lock; + u64 clock_id; }; =20 /** --=20 2.48.1