From nobody Mon Feb 9 15:26:57 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 4D813288C94 for ; Thu, 24 Apr 2025 15:48:10 +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=1745509692; cv=none; b=UIXbcJZznHtrhz3TLZfGnCaSxwiCFWLN8hByxJ5zowdjK9PeGtZYlToYDlo6NmC7d+1bqVD95g9VPZrmDJ1EbPqrqIInb52Wg7YuZYqdQtCxAg7HOyJqPm5j7tIjW8+smS6zOA0+jaJnhBLFDyW324LBkkBqQpHYnTQJDcAi1UY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745509692; c=relaxed/simple; bh=uSxfYU+alZ+sYCvxTB+/8v0JU7I2q/gK2ZemiaPNsK8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vxso9tCPN2PmYTOsQRVHZyScXUwmKa58qyRFNKTKFGGWxU13VnOun7tMcc8RjmyY+1DsmzgYzkY8xXDmh/35Er5TEIqK3KprryFuMGGRg3fHlnLeI3gvNDSYTckZTgKHMU/ZvC6IBapftfoXJuuY2d0ydiRjgB7HkgS9LRJQa24= 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=Hnrs8rr0; 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="Hnrs8rr0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1745509690; 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=HJ3ESh836Q1m0vn5b+38c3tvO5uha8Mw417YRBDXs/M=; b=Hnrs8rr0v8S08HW/LRU0SEs1jvwdfUFWQYh50Je4Z4+Qz7t5Y0Zupfoux9eGQX9z8aALYC lhCNnzJsTx3IUxE3LElDPXzJQOR8dGzTqEQ2SnTMLIxHmU2+CP2lvpmE3ANghXu74B8frt KTt+x0XTFEVBGLHYfDB7vm4qydUeJII= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-xrNaEUdpMQeva-BySMvYZA-1; Thu, 24 Apr 2025 11:48:08 -0400 X-MC-Unique: xrNaEUdpMQeva-BySMvYZA-1 X-Mimecast-MFC-AGG-ID: xrNaEUdpMQeva-BySMvYZA_1745509686 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EB5251800980; Thu, 24 Apr 2025 15:48:05 +0000 (UTC) Received: from p16v.luc.cera.cz (unknown [10.44.32.28]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4343C19560A3; Thu, 24 Apr 2025 15:48:01 +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 net-next v4 7/8] mfd: zl3073x: Add clock_id field Date: Thu, 24 Apr 2025 17:47:21 +0200 Message-ID: <20250424154722.534284-8-ivecera@redhat.com> In-Reply-To: <20250424154722.534284-1-ivecera@redhat.com> References: <20250424154722.534284-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.0 on 10.30.177.40 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 required for DPLL device registration. To generate this ID, use chip ID read during device initialization. In case where multiple zl3073x based chips are present, the chip ID is shifted and lower bits are filled by an unique value - using the I2C device address for I2C connections and the chip-select value for SPI connections. 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 b6058de04f954..d0022dfb0236c 100644 --- a/drivers/mfd/zl3073x-core.c +++ b/drivers/mfd/zl3073x-core.c @@ -914,13 +914,14 @@ zl3073x_dev_state_fetch(struct zl3073x_dev *zldev) * 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; @@ -964,6 +965,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; + /* Fetch device state */ rc =3D zl3073x_dev_state_fetch(zldev); if (rc) diff --git a/drivers/mfd/zl3073x-i2c.c b/drivers/mfd/zl3073x-i2c.c index da8bbd702d76c..e00277f87de92 100644 --- a/drivers/mfd/zl3073x-i2c.c +++ b/drivers/mfd/zl3073x-i2c.c @@ -27,7 +27,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 962b6845c0325..368001ae19db9 100644 --- a/drivers/mfd/zl3073x-spi.c +++ b/drivers/mfd/zl3073x-spi.c @@ -27,7 +27,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 43171246093f2..ca6785ff9ecc9 100644 --- a/include/linux/mfd/zl3073x.h +++ b/include/linux/mfd/zl3073x.h @@ -51,6 +51,7 @@ struct zl3073x_synth { * struct zl3073x_dev - zl3073x device * @dev: pointer to device * @regmap: regmap to access device registers + * @clock_id: clock id of the device * @input: array of inputs' invariants * @output: array of outputs' invariants * @synth: array of synthesizers' invariants @@ -58,6 +59,7 @@ struct zl3073x_synth { struct zl3073x_dev { struct device *dev; struct regmap *regmap; + u64 clock_id; =20 /* Invariants */ struct zl3073x_input input[ZL3073X_NUM_INPUTS]; --=20 2.49.0