From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 7E0683DC850; Thu, 6 Aug 2026 08:46:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006017; cv=none; b=u2ckfwRFVSGhLxXhP0AnqfM50KTMFACHllX0D4k/jPZeXEcpCgmq9XPs5VSIPKUi70NrKOH3eDeCNe2NOwmi5gaPDCVGrc6suK60OXvk157M/ZjnZIva1V+/u1UDGai5RB/7jravw3e++d/eowJtgJ3qATV/GLf9ZlTgLl2LK3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006017; c=relaxed/simple; bh=G59VGDA6rhTXCxCP3iHlNCuRW3WqGdznOrZvREZZi/0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n0Ip45bPUua7+0ir9dTJtj/qAX71v7QhM0c7I/QzXUCkXeki0KNb3thHSDEZTsgggdp/NlS4TkGPf4mg5qzlAXwYgxp2fsr5npzjkx8YPlgLmV1qlpp7aJAQsk8bfiqn1bAN+0vVUxW7Lu5fsPc1Xn7l+0TiaeLnA27gkJhYmmk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=ge7ahfSA; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="ge7ahfSA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006015; x=1817542015; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G59VGDA6rhTXCxCP3iHlNCuRW3WqGdznOrZvREZZi/0=; b=ge7ahfSAq+O9FsNezs9QaEzahnq8G0M2a+8NIuWSaG3kg7hn9x+DCNne RxXNk0eCFm5IX4JM6ouhf1jj9Xgqr64eo/dE8oblTvv1Uuc+RqWW/YuRw v6rJXqzvWlaqGdbZskYUUyF6ju/3fgke1aATeUnfr2ogI40naTgGrGn9U rcW8meah44t08xoz040oWLvKwbAbH9JI5YW3/vkyKF3QP3LJdCNvS/A2B Jjuauud1ivyzEQdrzonx9rQtNRvQLxZvZo3aHI7vL1+xo9uuzg8riRx5N WPwiQSMxxTxPipNGNmapcE5/O4kcWds97q9M9mMpGx/WoFNpq3+SJ3jBz g==; X-CSE-ConnectionGUID: ixmKcRJUSUqx/8+EoaHqZw== X-CSE-MsgGUID: xiUz6Ng2QMOWtNXMvUTKtQ== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="62050862" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2026 01:46:54 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Thu, 6 Aug 2026 01:46:53 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:46:44 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , CC: Krzysztof Kozlowski Subject: [PATCH v6 01/17] dt-bindings: iio: adc: at91-sama5d2: document sama7d65 Date: Thu, 6 Aug 2026 13:10:08 +0530 Message-ID: <20260806074024.531259-2-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add dt-binding documentation for sama7d65 ADC. sama7d65 requires an individual compatible to address the differences from its predecessor sama7g5. The main difference is the temperature calibration layout and its handling. Acked-by: Krzysztof Kozlowski Signed-off-by: Varshini Rajendran --- Documentation/devicetree/bindings/iio/adc/atmel,sama5d2-adc.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/iio/adc/atmel,sama5d2-adc.ya= ml b/Documentation/devicetree/bindings/iio/adc/atmel,sama5d2-adc.yaml index 4817b840977a..e8a65fdcd018 100644 --- a/Documentation/devicetree/bindings/iio/adc/atmel,sama5d2-adc.yaml +++ b/Documentation/devicetree/bindings/iio/adc/atmel,sama5d2-adc.yaml @@ -15,6 +15,7 @@ properties: - atmel,sama5d2-adc - microchip,sam9x60-adc - microchip,sama7g5-adc + - microchip,sama7d65-adc =20 reg: maxItems: 1 --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 9288541DE18; Thu, 6 Aug 2026 08:47:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006026; cv=none; b=tRKQ9taP6Nxm6jkFvmToiwBg+rnurlaZFP8X5HPpAfhkfaKgZcHH08zCiMUWNmmRV/vlJZkp27b2Evv4wz9ZuYKNipCCBAkt1TOcl/VgtTcbsZ/NHS+NswFTwSYNi4886AOoUovVbybK3CM76xCfwwQIBFCLhjg7DiYJ7Og8Pjg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006026; c=relaxed/simple; bh=MgNz0ew/hB8/oQgEHR3uHQozOSw31+4UIzG+VwzCIq8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NRAoemZSUU506H3IHWSZubNxEMRmjPGGxbiIjG0VLXVa4fxjTpObHTO1JR3sFmdFxqWpE9AHYaZ3ZB20CX9z94OkCFwHhQvp/cgs7t02IIJGCS6Ptg9vdilKitavtCqHVuoOxd3gAD5OYxfYb01saoJ1rc4hvfnuFCemcjcsq0I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=Fpz1tCiN; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="Fpz1tCiN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006024; x=1817542024; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=MgNz0ew/hB8/oQgEHR3uHQozOSw31+4UIzG+VwzCIq8=; b=Fpz1tCiNhGQmgP56aIdUMZSi49QCOOhYrIGe8pB2mmFzJwuF5gRlKsEY /PAaPabYIg8bCs3wJY8nIabK8o+0udM1aYsBRLWWrQWl53o80LwRpr7ct jrGJ51CsIuG5RpEgT6Clt3GmoCBZA8+G3IoScLfMHQKJ37MdnYf+M3Oa0 Krl6Z9SYIZHRZm4mtKRSYdLq81JjD8OeZlGkGFZxTOToNDtS7/vFs4afl UE26HPVnvRH928a/NuwvFTzUOC/by2iT7wnOJ38cBfzqcMHLEGWGKC3nv WUlUGRPi3z+MQGWtLO6KMxhhFjpGEE8MMHQf7DMMyvej2RGKfJu9ukGca w==; X-CSE-ConnectionGUID: feqVjCi7SHWDKao9a8++uQ== X-CSE-MsgGUID: YKrLMB+nSSiAs893eQV/cQ== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="228880353" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2026 01:47:03 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex3.mchp-main.com (10.10.87.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Thu, 6 Aug 2026 01:47:03 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:46:54 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 02/17] nvmem: add DEFINE_FREE for nvmem_cell_put cleanup Date: Thu, 6 Aug 2026 13:10:09 +0530 Message-ID: <20260806074024.531259-3-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add cleanup.h helper for nvmem_cell_put() to enable automatic resource cleanup using __free(nvmem_cell_put) annotation. Use IS_ERR_OR_NULL() since nvmem_cell_get() can return error pointers, and passing an ERR_PTR to nvmem_cell_put() would cause issues. Signed-off-by: Varshini Rajendran Acked-by: Srinivas Kandagatla --- include/linux/nvmem-consumer.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index 34c0e58dfa26..5315bd862f5f 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -9,6 +9,7 @@ #ifndef _LINUX_NVMEM_CONSUMER_H #define _LINUX_NVMEM_CONSUMER_H =20 +#include #include #include #include @@ -243,6 +244,8 @@ static inline struct nvmem_device *nvmem_device_find(vo= id *data, =20 #endif /* CONFIG_NVMEM */ =20 +DEFINE_FREE(nvmem_cell_put, struct nvmem_cell *, if (!IS_ERR_OR_NULL(_T)) = nvmem_cell_put(_T)) + #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, const char *id); --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 EC82E412C17; Thu, 6 Aug 2026 08:47:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006037; cv=none; b=UdD1Pwzxmt7ln+McRY1fxPIru29JphT01QMMHZ1APMEs2PaqNbgzXJqR4jMQgfij/aheDx200v349ND+UPGV37NE6EHGImroWiblvNtj5R8hYyPgqIygkbBJL1wKxDmdgEIxr9oEo+YE8uQfE1Aj0QG34fjPHqlK9Tk8+Lxc1CM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006037; c=relaxed/simple; bh=5L04fm8dXyW6Qb/yl6MetSQ5Bfk/JYbRIvYAJ4AiOu0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Es3BpqfgO8Wc1cRKEcuX77NwxLtEyPNcgzz3bzjcbnEtmifoTEmplEYvIRyXxAz8kv7odgc5vOoCSFpWogU5j/WozGaLf/khvUk11s4j6KbR1WdV+kYiu4IhqwQXYjCMwl1h4bEsmOiIwYtHKdISrm+RaxBIE506ZAHCQNHmu8g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=sb0KMkR2; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="sb0KMkR2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006039; x=1817542039; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5L04fm8dXyW6Qb/yl6MetSQ5Bfk/JYbRIvYAJ4AiOu0=; b=sb0KMkR2OCpVfBdsF5D6kyl0JK56aVQ6ZGWL8o5PITB9s5xv9YDfJvtK r9qa4kdylutUBVwiDFP+ryWd6lmlNVdqusBcQFuYNH7lbChNcNynDGxVg GjGbPiAqlpDa0QPTaUNcR95lqb2Ep41efCCIM6z+AJ3Ul0GeDDZKPrkUy B8CjTEFYcdaUI9p1V+vVQtmYy8wpMN4QvvQ6/U6bYE3Bglj43xMPIbK0r wxiWS+Ztvse6NXu2bNaB8D+uuCD/txET9gacfz7LV9mY3Kh7vML3fUyDU bh7oEd618PAHZQTVMCRCPI713ro6I87mXnO2MqZFcICetCc44DYeYuvSB A==; X-CSE-ConnectionGUID: wf4YWoMsT2eGlH+1bLVYDQ== X-CSE-MsgGUID: XU5AHxb4QkmA2dVRiSTzZg== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="71343301" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2026 01:47:18 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Thu, 6 Aug 2026 01:47:14 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:47:03 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , CC: Andy Shevchenko Subject: [PATCH v6 03/17] iio: adc: at91-sama5d2_adc: use cleanup.h for NVMEM buffer Date: Thu, 6 Aug 2026 13:10:10 +0530 Message-ID: <20260806074024.531259-4-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Use __free(kfree) and __free(nvmem_cell_put) cleanup helpers in at91_adc_temp_sensor_init() to simplify error handling paths. Reviewed-by: Andy Shevchenko Signed-off-by: Varshini Rajendran --- drivers/iio/adc/at91-sama5d2_adc.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama= 5d2_adc.c index e8a5285bb6d4..09390f082fc4 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -2249,8 +2249,6 @@ static int at91_adc_temp_sensor_init(struct at91_adc_= state *st, struct device *dev) { struct at91_adc_temp_sensor_clb *clb =3D &st->soc_info.temp_sensor_clb; - struct nvmem_cell *temp_calib; - u32 *buf; size_t len; int ret =3D 0; =20 @@ -2258,7 +2256,8 @@ static int at91_adc_temp_sensor_init(struct at91_adc_= state *st, return 0; =20 /* Get the calibration data from NVMEM. */ - temp_calib =3D nvmem_cell_get(dev, "temperature_calib"); + struct nvmem_cell *temp_calib __free(nvmem_cell_put) =3D + nvmem_cell_get(dev, "temperature_calib"); if (IS_ERR(temp_calib)) { ret =3D PTR_ERR(temp_calib); if (ret !=3D -ENOENT) @@ -2266,16 +2265,14 @@ static int at91_adc_temp_sensor_init(struct at91_ad= c_state *st, return ret; } =20 - buf =3D nvmem_cell_read(temp_calib, &len); - nvmem_cell_put(temp_calib); - if (IS_ERR(buf)) { - dev_err(dev, "Failed to read calibration data!\n"); - return PTR_ERR(buf); - } - if (len < AT91_ADC_TS_CLB_IDX_MAX * 4) { + u32 *buf __free(kfree) =3D nvmem_cell_read(temp_calib, &len); + if (IS_ERR(buf)) + return dev_err_probe(dev, PTR_ERR(buf), + "Failed to read calibration data!\n"); + + if (len < AT91_ADC_TS_CLB_IDX_MAX * sizeof(*buf)) { dev_err(dev, "Invalid calibration data!\n"); - ret =3D -EINVAL; - goto free_buf; + return -EINVAL; } =20 /* Store calibration data for later use. */ @@ -2288,9 +2285,7 @@ static int at91_adc_temp_sensor_init(struct at91_adc_= state *st, */ clb->p1 =3D clb->p1 * 1000; =20 -free_buf: - kfree(buf); - return ret; + return 0; } =20 static int at91_adc_probe(struct platform_device *pdev) --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 0CD1B41DEE0; Thu, 6 Aug 2026 08:47:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006047; cv=none; b=uOdGNt/e591HpCVYuncwDAX6FFsEzEO91UvQ/fEGVO0WBdDb2Uj06N/VoaHQBM0tcXofTT5Uk4U3Kow5xumO/ASVN151DraiONcQZdas7j9d85V94BjTluFK78sG1SGbeew46bdxnv0q08wEw5/MPOrba2RiUg9I23kXqW4me8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006047; c=relaxed/simple; bh=WMbz2x0oy9U6MHDiryFzAYvYHXh9EzXZWymCLH/WBvQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pAsoC+L2C1P5HB/pkd4AVMfMy41D4Vsl1NNJJ+fH0osCVS+zQYf5NKHhM4IQBE4XbEAlQvcVpYHZxd6mdTExLznXYadmFYdg0XvO7XvEBQJY3/cFgC9pDJ6c3qoM1od2RUP9DveJTXogYKwlff+BlGzHru0uCvTV4AJAocu3WQo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=IuwaaECw; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="IuwaaECw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006046; x=1817542046; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=WMbz2x0oy9U6MHDiryFzAYvYHXh9EzXZWymCLH/WBvQ=; b=IuwaaECwGdfDcNNyWMj6T8SWir6z7CfbOdRPxT3WpNrLzq3Uc8BFN0Eo weeEH9SvVmcgeh/YvQSKEnm8rjYsng8tTSyw2h67QMnhJ3ABNUEin2f0+ /woo5mUZEpeYQVXm/uxYU91Gy+/9DCLbi0A5yHQYKpoSpjUYGBM7YKDDG /U0RyT+0cD7ETF7VACXv7pZaO8x+8Js/Kl+j7vdJa/W2MRKfDoZWKmbUc LuF5jmxqreMfcAVJKVQ/E/nPZfGr1uLa09w7auKhDLqVaa03JrbkyGXNj ViDwyw9yg2CCDR7ndEYJNWjkS0ekhje9LrEn5SAwmTgBTbzDV20hlZyoD w==; X-CSE-ConnectionGUID: 6nyZD9YrRwOUDGq3SChm/A== X-CSE-MsgGUID: gPDyfDrBTDOngd2OKLbjLg== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="228880362" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2026 01:47:25 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Thu, 6 Aug 2026 01:47:24 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:47:14 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 04/17] iio: adc: at91-sama5d2_adc: rework temp calibration layout handling Date: Thu, 6 Aug 2026 13:10:11 +0530 Message-ID: <20260806074024.531259-5-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Extend support to handle different temperature calibration layouts. Add a temperature calibration data layout structure to describe indexes of the factors P1, P4, P6, tag, minimum length of the packet and the scaling factors for P1 (p1_scale) which are SoC-specific instead of the older non scalable id structure. This helps handle the differences in the same function flow and prepare the calibration data to be applied. Reviewed-by: Eugen Hristev Signed-off-by: Varshini Rajendran --- drivers/iio/adc/at91-sama5d2_adc.c | 66 ++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama= 5d2_adc.c index 09390f082fc4..82db8f2f4db0 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -444,6 +445,27 @@ static const struct at91_adc_reg_layout sama7g5_layout= =3D { #define at91_adc_writel(st, reg, val) \ writel_relaxed(val, (st)->base + (st)->soc_info.platform->layout->reg) =20 +/* Temperature calibration tag "ACST" in ASCII */ +#define AT91_TEMP_CALIB_TAG_ACST 0x41435354 + +/** + * struct at91_adc_temp_calib_layout - temperature calibration packet layo= ut + * @tag_idx: index of Packet tag in the NVMEM cell buffer + * @p1_idx: index of FT1_TEMP, equivalent to P1 in the NVMEM cell buffer + * @p4_idx: index of FT1_VPAT, equivalent to P4 in the NVMEM cell buffer + * @p6_idx: index of FT2_VBG, equivalent to P6 in the NVMEM cell buffer + * @min_len: minimum number of u32 words expected in the NVMEM cell buffer + * @p1_scale: scaling factor applied to P1 to convert to millicelcius + */ +struct at91_adc_temp_calib_layout { + unsigned int tag_idx; + unsigned int p1_idx; + unsigned int p4_idx; + unsigned int p6_idx; + unsigned int min_len; + struct u32_fract p1_scale; +}; + /** * struct at91_adc_platform - at91-sama5d2 platform information struct * @layout: pointer to the reg layout struct @@ -462,6 +484,7 @@ static const struct at91_adc_reg_layout sama7g5_layout = =3D { * @oversampling_avail_no: number of available oversampling values * @chan_realbits: realbits for registered channels * @temp_chan: temperature channel index + * @temp_calib_layout: temperature calibration packet layout * @temp_sensor: temperature sensor supported */ struct at91_adc_platform { @@ -479,6 +502,7 @@ struct at91_adc_platform { unsigned int oversampling_avail_no; unsigned int chan_realbits; unsigned int temp_chan; + const struct at91_adc_temp_calib_layout *temp_calib_layout; bool temp_sensor; }; =20 @@ -495,18 +519,13 @@ struct at91_adc_temp_sensor_clb { u32 p6; }; =20 -/** - * enum at91_adc_ts_clb_idx - calibration indexes in NVMEM buffer - * @AT91_ADC_TS_CLB_IDX_P1: index for P1 - * @AT91_ADC_TS_CLB_IDX_P4: index for P4 - * @AT91_ADC_TS_CLB_IDX_P6: index for P6 - * @AT91_ADC_TS_CLB_IDX_MAX: max index for temperature calibration packet = in OTP - */ -enum at91_adc_ts_clb_idx { - AT91_ADC_TS_CLB_IDX_P1 =3D 2, - AT91_ADC_TS_CLB_IDX_P4 =3D 5, - AT91_ADC_TS_CLB_IDX_P6 =3D 7, - AT91_ADC_TS_CLB_IDX_MAX =3D 19, +static const struct at91_adc_temp_calib_layout sama7g5_temp_calib =3D { + .tag_idx =3D 1, + .p1_idx =3D 2, + .p4_idx =3D 5, + .p6_idx =3D 7, + .min_len =3D 19, + .p1_scale =3D { .numerator =3D 1000, .denominator =3D 1 }, }; =20 /* Temperature sensor calibration - Vtemp voltage sensitivity to temperatu= re. */ @@ -744,6 +763,7 @@ static const struct at91_adc_platform sama7g5_platform = =3D { .chan_realbits =3D 16, .temp_sensor =3D true, .temp_chan =3D AT91_SAMA7G5_ADC_TEMP_CHANNEL, + .temp_calib_layout =3D &sama7g5_temp_calib, }; =20 static int at91_adc_chan_xlate(struct iio_dev *indio_dev, int chan) @@ -2249,12 +2269,19 @@ static int at91_adc_temp_sensor_init(struct at91_ad= c_state *st, struct device *dev) { struct at91_adc_temp_sensor_clb *clb =3D &st->soc_info.temp_sensor_clb; + const struct at91_adc_temp_calib_layout *layout; size_t len; int ret =3D 0; =20 if (!st->soc_info.platform->temp_sensor) return 0; =20 + layout =3D st->soc_info.platform->temp_calib_layout; + if (!layout) + return -ENODEV; + if (!layout->p1_scale.denominator) + return -EINVAL; + /* Get the calibration data from NVMEM. */ struct nvmem_cell *temp_calib __free(nvmem_cell_put) =3D nvmem_cell_get(dev, "temperature_calib"); @@ -2270,20 +2297,23 @@ static int at91_adc_temp_sensor_init(struct at91_ad= c_state *st, return dev_err_probe(dev, PTR_ERR(buf), "Failed to read calibration data!\n"); =20 - if (len < AT91_ADC_TS_CLB_IDX_MAX * sizeof(*buf)) { + if (len < layout->min_len * sizeof(*buf)) { dev_err(dev, "Invalid calibration data!\n"); return -EINVAL; } =20 /* Store calibration data for later use. */ - clb->p1 =3D buf[AT91_ADC_TS_CLB_IDX_P1]; - clb->p4 =3D buf[AT91_ADC_TS_CLB_IDX_P4]; - clb->p6 =3D buf[AT91_ADC_TS_CLB_IDX_P6]; + clb->p1 =3D buf[layout->p1_idx]; + clb->p4 =3D buf[layout->p4_idx]; + clb->p6 =3D buf[layout->p6_idx]; =20 /* - * We prepare here the conversion to milli to avoid doing it on hotpath. + * Here we prepare the conversion to milli to avoid doing it on hotpath. + * The p1 value is multiplied and divided with a scaling factor as per + * the SoC storage format described by per-platform calibration layout. */ - clb->p1 =3D clb->p1 * 1000; + clb->p1 *=3D layout->p1_scale.numerator; + clb->p1 /=3D layout->p1_scale.denominator; =20 return 0; } --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 B41F141D65E; Thu, 6 Aug 2026 08:47:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006057; cv=none; b=AxyOnoCc6mXHT2tz5SumXgj3N7rrSpZFxZnHutVHfPL2Wsvsm66MJjBL+JlitJBHjymULRVGn0ziV7NoHs6/lqw3ua4HdcUbYEcm1OdndC0sPXEPwhsF7Tua/302CfeP2rX3OxE4VmSaIdEVOfBztXCiVS6Fho3r9GfNK4nZYfk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006057; c=relaxed/simple; bh=HAGc0aQvGQ6xckPzuGtbesPxW4BhT95FbIaJJrF46dg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bGESwqcVrSLc3oa0eU1rYJJwTMkMaHOTvNq9kt4V6zdN0ONrNg2mHlT9GXNct8iqtt2iVxMeedRLMCvS8c97cAycqCTQfbDWHQoXAtqFagGjyNAOV28Q93Sbv/Rdtxeh0shPm6E816LWEEtY795NvbeZ9sUG/m2NX9Wn5cf79Wo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=gFbV6f2y; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="gFbV6f2y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006055; x=1817542055; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=HAGc0aQvGQ6xckPzuGtbesPxW4BhT95FbIaJJrF46dg=; b=gFbV6f2yvWROJ7xP6j/LRVmRVF6o078Jn+/y9YqK1PN0uQYkt+HfHVke ISKccoiJ0zJpMT5KqbkHR5Aa00RYv3AlhLmty+xzcviJa+HW+NO8HPg4z NgB7nuTMvC68HhrPUoqQQWaBnk8WqsQH17+5lj64OWvd7/NK1tmsGOmXj LIPuNkqlOKmuq/ZCgs3bFT/rP7y/otgwP+TE5kYj8NbaLEguvyC1/eKiE Lyq8AhGpQO33ciMz0858pUXUUgRPizszdq6pMpqAJvr+v+Vl8ar/u43ol I/igfyuktgGOLxZavRWVWjrifXIC2S17q5DzeRvr1W78zAPVGny3T7iiX g==; X-CSE-ConnectionGUID: wnHrijeJRjKZik9IHqX1Ig== X-CSE-MsgGUID: Hy9L2xaLT8mnDkh/AMrrlQ== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="228880366" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2026 01:47:34 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex4.mchp-main.com (10.10.87.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Thu, 6 Aug 2026 01:47:34 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:47:25 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 05/17] iio: adc: at91-sama5d2_adc: add condition to validate calibration data Date: Thu, 6 Aug 2026 13:10:12 +0530 Message-ID: <20260806074024.531259-6-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add additional condition to validate the calibration data read from the NVMEM cell using the TAG of the packet. Signed-off-by: Varshini Rajendran --- drivers/iio/adc/at91-sama5d2_adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama= 5d2_adc.c index 82db8f2f4db0..5b21367cf6b4 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -2297,7 +2297,8 @@ static int at91_adc_temp_sensor_init(struct at91_adc_= state *st, return dev_err_probe(dev, PTR_ERR(buf), "Failed to read calibration data!\n"); =20 - if (len < layout->min_len * sizeof(*buf)) { + if (len < layout->min_len * sizeof(*buf) || + buf[layout->tag_idx] !=3D AT91_TEMP_CALIB_TAG_ACST) { dev_err(dev, "Invalid calibration data!\n"); return -EINVAL; } --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 356182DCBF8; Thu, 6 Aug 2026 08:47:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006067; cv=none; b=L8yGWZILFgxcnfsItcgdVp/RLkOWXIiHyY08kjTVNtTx/fNBWhs0dJj+F/ho67wC+iwux+IAeNbkhtFfyQ6YO+Wb1ntF30glx1Y/pDE2mcQCN24IsaAYMfQuQRz3/LjrHt7Ef0HpmHCKPdavQzSjUUjuxJ4W1sppkVauEeGTP7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006067; c=relaxed/simple; bh=qCks5QmHaWli0znQDgqe7ceH6hFdVyHKYF2/F2T/0N0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rAiV5rd5Oq1DgfBH+uvOgK980WBtbfp4nYRv7EG0goL5A1b7MtA7NvjrwMgSx/qKxiangdqPjigke08Vi6PIRUfr5PoTjnAuWlLrlvi+gylPJVIZzyIxqLVgEu4I6EmCmZUSuzF4T2PWmrLB6cFTMFyyez5jq8pjRB+Mob2rhBU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=iIckpWvf; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="iIckpWvf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006069; x=1817542069; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=qCks5QmHaWli0znQDgqe7ceH6hFdVyHKYF2/F2T/0N0=; b=iIckpWvf8Wn41C+eo/S7WsOevSdGB/jvEdFYkuU+flMfHajyR1FuBF+Q Y3WGdTbCr0y8WWKVK8oife3180VGtyjh+PdhwmyejScTIN5RyrKgZPGKN odLap7MBnfofiFA1e7+j83S46NcfpQEjgZT7YS2VPpDAAuHZR+BGl30iP x8U5GDsBkJVeqoCWp5NUOySYex0HbHz/MwroS4OOGNVteSx+fLFiRn0TY aKvlj2qwC3Rems06kiMPUcZzwRXWHeLnuMcHl24tLpLIgLaOYzMLdwczc DBPbb+L7y4n5vVgB0rdkYmyPmoJcqF94fp/TwdN6obrePwCy+sKlnm8ey w==; X-CSE-ConnectionGUID: mb0tXTfvT/iY9DC6oUULLQ== X-CSE-MsgGUID: 1QwlM/TuQTqvGgCK0uZpFQ== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="71343314" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2026 01:47:48 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Thu, 6 Aug 2026 01:47:44 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:47:34 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 06/17] iio: adc: at91-sama5d2_adc: remove unnecessary casts in of_device_id Date: Thu, 6 Aug 2026 13:10:13 +0530 Message-ID: <20260806074024.531259-7-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" The .data field in struct of_device_id is 'const void *', so explicit casts are unnecessary when assigning addresses of const structs. Reviewed-by: Eugen Hristev Signed-off-by: Varshini Rajendran --- drivers/iio/adc/at91-sama5d2_adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama= 5d2_adc.c index 5b21367cf6b4..3e9feb824a66 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -2628,10 +2628,10 @@ static const struct dev_pm_ops at91_adc_pm_ops =3D { static const struct of_device_id at91_adc_dt_match[] =3D { { .compatible =3D "atmel,sama5d2-adc", - .data =3D (const void *)&sama5d2_platform, + .data =3D &sama5d2_platform, }, { .compatible =3D "microchip,sama7g5-adc", - .data =3D (const void *)&sama7g5_platform, + .data =3D &sama7g5_platform, }, { /* sentinel */ } --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 1162D30E84F; Thu, 6 Aug 2026 08:47:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006077; cv=none; b=f9TtJS7XG2f6oxiq86PMzAU2apw1UQI9r1Trp4lZPWq+IB6Qfio6hAneTCShe6YiWqjkp9iR+3qwQbLYcATEQ8f/CH4Tk6ojb6GKceyUUbfHa/yACjD4z7DOI7PzvyrhtW5iEBDmwtxAsX6MTAczfdR/+PyZE7pEIdeUM9YnRAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006077; c=relaxed/simple; bh=9TV+tsofy6TCtX8zVKSBqg0wGh2pcJEEZrqQnPraG7U=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=k1URwJY2ZzKlMxLxCFWJnfd0HvgHlQJ7MQ0tVh3UHghe26QRXDX2KQNiMsqCERFOOgPumDER0BCG9ZDO6vCNAcgfbtp57ZjwwxNJjWSTb2ZCSDvlxIpkZdIQh59RX1mbTpfV+cv7N/IMvbJbQQyIKVgUH/EeKJgK4JpLx4mCNY4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=wyeVV8Tn; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="wyeVV8Tn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006076; x=1817542076; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=9TV+tsofy6TCtX8zVKSBqg0wGh2pcJEEZrqQnPraG7U=; b=wyeVV8TnUjaobRPsgxLygP9zF3gxfe2qXZyYEj5l+h9Ev8ZrgtPfdrkO CFOoEP5Kh0S3F9s5Ug2ZRbHW8IWcd4d8HhD6ojBZr4PUZ/VQkfsQQk8LT YCgvC9/aoXb4bhDi+VdNF7Ndc3L3OHSDbvctjmm7e30rahMPD06AMv9oz FyFkcxFipWPnMmgUvgK+0aBQAfNU9YmF21WmY+goH/0lfW5h/q1G/EgSi l6yGuUuZFGeusLTQ4VWxmYmQF51D+VUeqQ+jYx2gwRFfbpIryCI700LvI wy4Q5ST+jPmK2pLaqVoc61rAvhUDfCfcbNohZFKKGJodpzmdMjv/JCHIw w==; X-CSE-ConnectionGUID: dLx6FcJJTU68ufzJ4BcPDg== X-CSE-MsgGUID: 3Sl4veB/RH+ZX1I+jniI1g== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="60854103" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2026 01:47:54 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Thu, 6 Aug 2026 01:47:54 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:47:45 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 07/17] iio: adc: at91-sama5d2_adc: adapt the driver for sama7d65 Date: Thu, 6 Aug 2026 13:10:14 +0530 Message-ID: <20260806074024.531259-8-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add support for sama7d65 ADC. The differences are highlighted with the compatible. The calibration data layout is the main difference. Update Kconfig help text to mention SAMA7 SoC family support. Signed-off-by: Varshini Rajendran --- drivers/iio/adc/Kconfig | 2 +- drivers/iio/adc/at91-sama5d2_adc.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 3755a81c1efd..85b443853a08 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -647,7 +647,7 @@ config AT91_SAMA5D2_ADC select IIO_TRIGGERED_BUFFER help Say yes here to build support for Atmel SAMA5D2 ADC which is - available on SAMA5D2 SoC family. + available on SAMA5D2 and SAMA7 SoC families. =20 To compile this driver as a module, choose M here: the module will be called at91-sama5d2_adc. diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama= 5d2_adc.c index 3e9feb824a66..c1e5139a058c 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -528,6 +528,15 @@ static const struct at91_adc_temp_calib_layout sama7g5= _temp_calib =3D { .p1_scale =3D { .numerator =3D 1000, .denominator =3D 1 }, }; =20 +static const struct at91_adc_temp_calib_layout sama7d65_temp_calib =3D { + .tag_idx =3D 1, + .p1_idx =3D 3, + .p4_idx =3D 2, + .p6_idx =3D 5, + .min_len =3D 11, + .p1_scale =3D { .numerator =3D 1, .denominator =3D 1000 }, +}; + /* Temperature sensor calibration - Vtemp voltage sensitivity to temperatu= re. */ #define AT91_ADC_TS_VTEMP_DT (2080U) =20 @@ -766,6 +775,24 @@ static const struct at91_adc_platform sama7g5_platform= =3D { .temp_calib_layout =3D &sama7g5_temp_calib, }; =20 +static const struct at91_adc_platform sama7d65_platform =3D { + .layout =3D &sama7g5_layout, + .adc_channels =3D &at91_sama7g5_adc_channels, + .nr_channels =3D AT91_SAMA7G5_SINGLE_CHAN_CNT + + AT91_SAMA7G5_DIFF_CHAN_CNT + + AT91_SAMA7G5_TEMP_CHAN_CNT, + .max_channels =3D ARRAY_SIZE(at91_sama7g5_adc_channels), + .max_index =3D AT91_SAMA7G5_MAX_CHAN_IDX, + .hw_trig_cnt =3D AT91_SAMA7G5_HW_TRIG_CNT, + .osr_mask =3D GENMASK(18, 16), + .oversampling_avail =3D { 1, 4, 16, 64, 256 }, + .oversampling_avail_no =3D 5, + .chan_realbits =3D 16, + .temp_sensor =3D true, + .temp_chan =3D AT91_SAMA7G5_ADC_TEMP_CHANNEL, + .temp_calib_layout =3D &sama7d65_temp_calib, +}; + static int at91_adc_chan_xlate(struct iio_dev *indio_dev, int chan) { int i; @@ -2632,6 +2659,9 @@ static const struct of_device_id at91_adc_dt_match[] = =3D { }, { .compatible =3D "microchip,sama7g5-adc", .data =3D &sama7g5_platform, + }, { + .compatible =3D "microchip,sama7d65-adc", + .data =3D &sama7d65_platform, }, { /* sentinel */ } --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 96A9241CB39; Thu, 6 Aug 2026 08:48:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006087; cv=none; b=Jz810PqYAKxdAfof+HW8/YbckZXUYAYjEaSL0Ai67VyTJ5FQB+6RMc647STXe65bG2QiQeg/l1UUJhgNJI4BzMF+OemfsfTvhWPQ4R8C7rOsjVVApMlGh9/YCueBF+LiFwPFfUJLivqjLz9fYbSabqYOvdWcOLMf44t3k4BMc/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006087; c=relaxed/simple; bh=bCA8BUnUCacAeM9L4GkNBcOulMHRN3ZMV7gjy96hcXs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=siyChZALwSrzEipGrzY5kRvB8poIgz6wKNWUuM9HtVxTm6LbFG7XVVRXfL7CvIopqumCIVDg10M1pGOzKMkj8gbMpLVbx48c0UVRyizwUbtpYvlfNVRnSsxykLPbo/6onPFSTRyTTFE2eogB44r0QVXTblZkRfSCxCr0JDfbwHo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=iVkqdiNi; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="iVkqdiNi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006086; x=1817542086; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bCA8BUnUCacAeM9L4GkNBcOulMHRN3ZMV7gjy96hcXs=; b=iVkqdiNicSKM0AgwOVNRsXZ83bPtbvQBRb1aFSRXuiRfxcrRjXKCPk7d GuDeGbvYCdaT6L3UjqB3Nd8XE/fswbipcW5Y9gsJqYEfFLrTZ82Nyt1Dy BWK1yDFpeAOF8yK+2+OwFvU6upHf2C139hn/vrZVMfPuIjaDjdYh+bXAW 3Wtl89R003n39GndcLKKirQqtfzJGBqLefr4m74dCSJ2FkS9iaHjHLMAc pfxKd9/K/rCchlWGUgU0IbXTXGWEM34atYp3eWrNNF2X8aG6JPR0xXXJE 0a1kFahzAkGdEyQ9nD+nkPXDIM8Un3NVeeBYXiGdPcfKjPNqfN7iKhsv9 A==; X-CSE-ConnectionGUID: SP0wRg71Tc+6ntZ+lvX79w== X-CSE-MsgGUID: h/SNKm7qSmqEOdQiGk+FIw== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="61741619" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2026 01:48:05 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Thu, 6 Aug 2026 01:48:04 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:47:55 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , CC: Conor Dooley Subject: [PATCH v6 08/17] dt-bindings: nvmem: microchip,sama7g5-otpc: add sama7d65 and dt node example Date: Thu, 6 Aug 2026 13:10:15 +0530 Message-ID: <20260806074024.531259-9-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add support for sama7d65 and a dt node example that shows tag can be used to reference a packet stored in the OTP memory. Signed-off-by: Varshini Rajendran Acked-by: Conor Dooley Reviewed-by: Claudiu Beznea --- .../nvmem/microchip,sama7g5-otpc.yaml | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc= .yaml b/Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml index cc25f2927682..04b44660554e 100644 --- a/Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml +++ b/Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml @@ -20,9 +20,15 @@ allOf: =20 properties: compatible: - items: - - const: microchip,sama7g5-otpc - - const: syscon + oneOf: + - items: + - const: microchip,sama7g5-otpc + - const: syscon + - items: + - enum: + - microchip,sama7d65-otpc + - const: microchip,sama7g5-otpc + - const: syscon =20 reg: maxItems: 1 @@ -48,4 +54,20 @@ examples: }; }; =20 + - | + efuse@e8c00000 { + compatible =3D "microchip,sama7d65-otpc", "microchip,sama7g5-otpc"= , "syscon"; + reg =3D <0xe8c00000 0x100>; + + nvmem-layout { + compatible =3D "fixed-layout"; + #address-cells =3D <1>; + #size-cells =3D <1>; + + calib@41435354 { + reg =3D <0x41435354 0x2c>; /* Temp calib data packet TA= G */ + }; + }; + }; + ... --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 56BD341E6CD; Thu, 6 Aug 2026 08:48:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006096; cv=none; b=bDD4SACQBR4wGtsS/oQ1+Ka7mpJ8laY7/9wlWP0wiiCR0VSD/WezIWw28vYuipT87pVCLB7vUtuNrKvkv0PQry395vhii98nf+nFGxV84gb1PExGCAHpGTjsOeQaZ31Egu+jKV2hiFctbNTCWfByKnHoxC3xJqphqbT2A0VoMWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006096; c=relaxed/simple; bh=dG6ESQyQOwjAmFrHt474u7r/XzkQZj9i23i/nKYLZDs=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q1khQhiqDjScdKOh8eBVpziHVNuS4EwWWWJDSznS/AcDcGuhvtti7Y5TzGz3f/+gJEHI1Bo2hCb1Jft6Db1wheju/ikXHXKFJsJ9KfshpXc/XahNf5vUeyBSlLdXAalRd2Kd0jurzE6TeBiWINLLTpTAghbzRH2vL6813IrHLVM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=gYhiei+W; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="gYhiei+W" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006098; x=1817542098; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=dG6ESQyQOwjAmFrHt474u7r/XzkQZj9i23i/nKYLZDs=; b=gYhiei+WQmZDaIyuTEKYmKfKvxjP2oqS1vwm9LF7GIo5PXK06/Cm7KRo dC3OtwT4lARzQcVYegMd21mf3CqP0RdYiFO3GkOmxzAyLaT0WKu8DEFlh RvK8zBST4b/RE/Xrv7woBu71TTHbHKCzrtwHrJjPTH0lfW7deJqLAgqVa upGosZUUrp3LOKMlYvnWOEcmwT4LhRdRWMCZG+eOPQSQbxSQOyaGHGcQj nEi55mHcR1qB6SITM01COfprr0egtbS4kaA7dpZ1MKjzE0or2NRk7KNdh oRd9aiHlnGxFMZ7WWM5E0B0bii0tWGOefk8KmaliPzMMaEA2A5dkqUZNy w==; X-CSE-ConnectionGUID: 69xNHFenSxiM/ftyCrg/Zw== X-CSE-MsgGUID: zbiMInBHTzG8RV1ADLVwBA== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="71343324" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2026 01:48:17 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex4.mchp-main.com (10.10.87.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Thu, 6 Aug 2026 01:48:13 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:48:04 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 09/17] nvmem: microchip-otpc: nvmem: microchip-otpc: add tag-based packet lookup Date: Thu, 6 Aug 2026 13:10:16 +0530 Message-ID: <20260806074024.531259-10-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add support for accessing OTP packets by their tag which is a FourCC while preserving backward compatibility with the existing ID-based lookup. The OTP memory layout can vary across devices and may change over time, making the packet ID approach unreliable when the memory map is not known in advance. The packet tag provides a reliable way to identify and access packets without prior knowledge of the OTP memory layout. Two offset encodings are now supported: 1. Legacy ID-based: offset =3D OTP_PKT(id) =3D id * 4 Used in DT as: reg =3D ; 2. TAG-based: offset =3D 4-byte ASCII packet tag (FourCC) Used in DT as: reg =3D <0x41435354 0x4c>; (tag "ACST") The driver resolves offsets matching valid legacy selectors (multiples of 4 within the packet count) through ID lookup, falling back to tag lookup for other valid values. This ensures existing device trees continue to work while enabling new tag-based access. During probe, packet meta data including the tag is read and cached. The stride of the nvmem memory is set to 1 in order to support tag based offsets, comment in the header file is updated accordingly. Signed-off-by: Varshini Rajendran --- drivers/nvmem/microchip-otpc.c | 117 ++++++++++++++++-- .../nvmem/microchip,sama7g5-otpc.h | 4 +- 2 files changed, 110 insertions(+), 11 deletions(-) diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c index df979e8549fd..a17f82afdc37 100644 --- a/drivers/nvmem/microchip-otpc.c +++ b/drivers/nvmem/microchip-otpc.c @@ -23,6 +23,8 @@ #define MCHP_OTPC_SR_READ BIT(6) #define MCHP_OTPC_HR (0x20) #define MCHP_OTPC_HR_SIZE GENMASK(15, 8) +#define MCHP_OTPC_HR_PACKET GENMASK(2, 0) +#define MCHP_OTPC_HR_PACKET_REGULAR 1 #define MCHP_OTPC_DR (0x24) =20 #define MCHP_OTPC_NAME "mchp-otpc" @@ -47,11 +49,13 @@ struct mchp_otpc { * @list: list head * @id: packet ID * @offset: packet offset (in words) in OTP memory + * @tag: 4-byte ASCII (FourCC) tag of the packet */ struct mchp_otpc_packet { struct list_head list; u32 id; u32 offset; + u32 tag; }; =20 static struct mchp_otpc_packet *mchp_otpc_id_to_packet(struct mchp_otpc *o= tpc, @@ -70,6 +74,52 @@ static struct mchp_otpc_packet *mchp_otpc_id_to_packet(s= truct mchp_otpc *otpc, return NULL; } =20 +static struct mchp_otpc_packet *mchp_otpc_tag_to_packet(struct mchp_otpc *= otpc, u32 tag) +{ + struct mchp_otpc_packet *packet; + + list_for_each_entry(packet, &otpc->packets, list) { + if (packet->tag =3D=3D tag) + return packet; + } + + return NULL; +} + +static bool mchp_otpc_is_valid_fourcc(u32 tag) +{ + int i; + u8 c; + + for (i =3D 0; i < 4; i++) { + c =3D (tag >> (i * 8)) & 0xff; + if (c < 0x20 || c > 0x7e) + return false; + } + + return true; +} + +static struct mchp_otpc_packet *mchp_otpc_resolve_packet(struct mchp_otpc = *otpc, u32 off) +{ + /* + * Legacy id based packet access: offset =3D id * 4 + * Inside the driver we use continuous unsigned integer numbers + * for packet id, thus divide off by 4 before passing it to + * mchp_otpc_id_to_packet(). + */ + u32 remainder =3D off % 4; + u32 id =3D off / 4; + + if (!remainder && id < otpc->npackets) + return mchp_otpc_id_to_packet(otpc, id); + + /* + * TAG-based packet access: offset is a 4-byte ASCII tag (FourCC) + */ + return mchp_otpc_tag_to_packet(otpc, off); +} + static int mchp_otpc_prepare_read(struct mchp_otpc *otpc, unsigned int offset) { @@ -140,8 +190,29 @@ static int mchp_otpc_prepare_read(struct mchp_otpc *ot= pc, * offset returned by hardware. * * For this, the read function will return the first requested bytes in the - * packet. The user will have to be aware of the memory footprint before d= oing - * the read request. + * packet. + * + * Two offset encodings are supported: + * + * 1. Legacy ID-based: offset =3D OTP_PKT(id) =3D id * 4 + * Used in DT as: reg =3D ; + * 2. TAG-based: offset =3D 4-byte ASCII packet tag (FourCC) + * Used in DT as: reg =3D <0x41435354 0x4c>; (tag "ACST") + * + * To use the legacy ID based packet lookup the user will have to be aware= of + * the memory footprint before doing the read request. + * + * But by using the TAG based packet lookup, the user won't have to be awa= re + * of the memory footprint before doing the read request since this driver= has + * it abstracted and taken care of. + * + * Practically, there is no way of knowing the mapping of the OTP memory t= able + * in advance for every device. But by using the packet tag - the identifi= er + * ASCII value (FourCC), the packets can be recognized without being aware= of the + * flashed OTP memory map table and the payload can be acquired reliably. + * + * While the legacy ID based lookup is still supported, TAG based approach= is + * recommended. */ static int mchp_otpc_read(void *priv, unsigned int off, void *val, size_t bytes) @@ -154,12 +225,11 @@ static int mchp_otpc_read(void *priv, unsigned int of= f, void *val, int ret, payload_size; =20 /* - * We reach this point with off being multiple of stride =3D 4 to - * be able to cross the subsystem. Inside the driver we use continuous - * unsigned integer numbers for packet id, thus divide off by 4 - * before passing it to mchp_otpc_id_to_packet(). + * From this point the offset has to be translated into the actual + * packet. For this we traverse the table of contents stored in a list + * "packet" based on the access type - packet id or tag. */ - packet =3D mchp_otpc_id_to_packet(otpc, off / 4); + packet =3D mchp_otpc_resolve_packet(otpc, off); if (!packet) return -EINVAL; offset =3D packet->offset; @@ -190,10 +260,25 @@ static int mchp_otpc_read(void *priv, unsigned int of= f, void *val, return 0; } =20 +static int mchp_otpc_read_packet_tag(struct mchp_otpc *otpc, unsigned int = offset, + unsigned int *tag) +{ + int ret; + + ret =3D mchp_otpc_prepare_read(otpc, offset); + if (ret) + return ret; + + writel_relaxed(0, otpc->base + MCHP_OTPC_AR); + *tag =3D readl_relaxed(otpc->base + MCHP_OTPC_DR); + + return 0; +} + static int mchp_otpc_init_packets_list(struct mchp_otpc *otpc, u32 *size) { struct mchp_otpc_packet *packet; - u32 word, word_pos =3D 0, id =3D 0, npackets =3D 0, payload_size; + u32 word, word_pos =3D 0, id =3D 0, npackets =3D 0, payload_size, type; int ret; =20 INIT_LIST_HEAD(&otpc->packets); @@ -215,6 +300,20 @@ static int mchp_otpc_init_packets_list(struct mchp_otp= c *otpc, u32 *size) =20 packet->id =3D id++; packet->offset =3D word_pos; + type =3D FIELD_GET(MCHP_OTPC_HR_PACKET, word); + + if (type =3D=3D MCHP_OTPC_HR_PACKET_REGULAR) { + ret =3D mchp_otpc_read_packet_tag(otpc, packet->offset, + &packet->tag); + if (ret) + return ret; + + if (!mchp_otpc_is_valid_fourcc(packet->tag)) + packet->tag =3D 0; + } else { + packet->tag =3D 0; + } + INIT_LIST_HEAD(&packet->list); list_add_tail(&packet->list, &otpc->packets); =20 @@ -236,7 +335,7 @@ static struct nvmem_config mchp_nvmem_config =3D { .type =3D NVMEM_TYPE_OTP, .read_only =3D true, .word_size =3D 4, - .stride =3D 4, + .stride =3D 1, .reg_read =3D mchp_otpc_read, }; =20 diff --git a/include/dt-bindings/nvmem/microchip,sama7g5-otpc.h b/include/d= t-bindings/nvmem/microchip,sama7g5-otpc.h index f570b23165a2..5f72e75ad091 100644 --- a/include/dt-bindings/nvmem/microchip,sama7g5-otpc.h +++ b/include/dt-bindings/nvmem/microchip,sama7g5-otpc.h @@ -4,8 +4,8 @@ #define _DT_BINDINGS_NVMEM_MICROCHIP_OTPC_H =20 /* - * Need to have it as a multiple of 4 as NVMEM memory is registered with - * stride =3D 4. + * Need to have it as a multiple of 4 for the legacy id based packet + * access. */ #define OTP_PKT(id) ((id) * 4) =20 --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 400B640EBA1; Thu, 6 Aug 2026 08:48:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006105; cv=none; b=flVmFPTzm4kNnVloYGZMT7fiR7LoQs0Sm6Tq5tsxcrehg98itEy4qdO9d2SL24EW9N6m/S02QSOCogYoLCCf3EpYbUFePqJKeEkjaNA3cG5h4SOAle82piriA3zjz/JRJosKJvhVyRrN6eCA1ZTWT/imuaWAf4sPlugdNCw0gLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006105; c=relaxed/simple; bh=Av6eeg2ekqj+HOs2zrQPFQA1RnGOcXg/+B9uTPlD7J8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gcvXPx/ZuKUgDB/QSes6b9duKWAcVRaWhOdsaqeREUEO84Uv7UJI6Xs7QVsGD7/ep7jc7rb3lrZnd5jvIdcdiqRlFGODTvPzV93tvb8OZUdUB4Guc3Y0ixoDoKpZNaU7pcPdXPdQWh9rs/a6r6gPZJgoqUhTzmOKvJ8IMaMIAhM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=yk28ZaYu; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="yk28ZaYu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006104; x=1817542104; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=Av6eeg2ekqj+HOs2zrQPFQA1RnGOcXg/+B9uTPlD7J8=; b=yk28ZaYuELxWDDVmzkdYml8yg/pN9rjRtrYyMyb5sj7OWoWXTVmsUFZZ 8v2BKZcOnf78GpMWp9OnDIE/HddEJiUEjt+M+inkso4K8n+/7h3FugQxe 1borcNBSIMb94meF8uys8Yr1RMuvaqfUQqQIFSU+VR79y/h5118apQcUI HURrKRVCuQDkZFRAjcOgo3TJiv8SqV08axlypIXfZEJ8nDT4T+S4JYTSS h0s0mlEDBJGe28lJjF5hDoiwAS1cQ+sDFmD0hEzB9N3hYtb4x6JEbyLe1 z1RDv2dgtrvQQWabPBNReMycgOtMTTRv2NJ7SM/RVtp8j8lfEM4OmAzql g==; X-CSE-ConnectionGUID: yzc83y/kShyu5EyMOZukiw== X-CSE-MsgGUID: JFqw/C8BSrGRhFMPXS0v5w== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="60854115" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2026 01:48:23 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex4.mchp-main.com (10.10.87.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Thu, 6 Aug 2026 01:48:22 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:48:14 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 10/17] nvmem: microchip-otpc: nvmem: add emulation mode and OTP access validation Date: Thu, 6 Aug 2026 13:10:17 +0530 Message-ID: <20260806074024.531259-11-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add validation of OTP memory accessibility and emulation mode status during probe. When the boot packet is not configured, emulation mode allows access to the other packets. When both are not available an informational message is logged to help with debugging. Signed-off-by: Varshini Rajendran Reviewed-by: Claudiu Beznea --- drivers/nvmem/microchip-otpc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c index a17f82afdc37..6b0184423463 100644 --- a/drivers/nvmem/microchip-otpc.c +++ b/drivers/nvmem/microchip-otpc.c @@ -18,6 +18,7 @@ #define MCHP_OTPC_CR_READ BIT(6) #define MCHP_OTPC_MR (0x4) #define MCHP_OTPC_MR_ADDR GENMASK(31, 16) +#define MCHP_OTPC_MR_EMUL BIT(7) #define MCHP_OTPC_AR (0x8) #define MCHP_OTPC_SR (0xc) #define MCHP_OTPC_SR_READ BIT(6) @@ -343,7 +344,8 @@ static int mchp_otpc_probe(struct platform_device *pdev) { struct nvmem_device *nvmem; struct mchp_otpc *otpc; - u32 size; + bool emul_enable; + u32 size, mr_val; int ret; =20 otpc =3D devm_kzalloc(&pdev->dev, sizeof(*otpc), GFP_KERNEL); @@ -355,10 +357,22 @@ static int mchp_otpc_probe(struct platform_device *pd= ev) return PTR_ERR(otpc->base); =20 otpc->dev =3D &pdev->dev; + + mr_val =3D readl_relaxed(otpc->base + MCHP_OTPC_MR); + emul_enable =3D mr_val & MCHP_OTPC_MR_EMUL; + if (emul_enable) + dev_info(otpc->dev, "Emulation mode enabled\n"); + ret =3D mchp_otpc_init_packets_list(otpc, &size); if (ret) return ret; =20 + if (!size) { + dev_warn(otpc->dev, "Cannot access OTP memory\n"); + if (!emul_enable) + dev_info(otpc->dev, "Boot packet not programmed and emulation mode disa= bled\n"); + } + mchp_nvmem_config.dev =3D otpc->dev; mchp_nvmem_config.add_legacy_fixed_of_cells =3D true; mchp_nvmem_config.size =3D size; --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 142AE412C17; Thu, 6 Aug 2026 08:48:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006115; cv=none; b=oia+ZDtztmI+gl2c+GviNXldvu238DjMYwJRX8FgF/nKgdVqVsOFFSMx7sJZz7zdLSUQiAp91IxUjuIdEzrqkEYjykJLZAOv4X4HKbxhiEJMVR7gxQr5Hd/h0rPtjtpMbnn730FH91n21DwFe1CtpSs3HMzagDyzHIZwWSYEtMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006115; c=relaxed/simple; bh=lDo397Z36GO5xj/mcw2tiDDKm6eDwSGNrKDHn0UvbBw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pNkIetUOZQc3KpfssBofaWZrOe9+PXdAwIKKjKcf6tTtt+5G58r9oYaP1wSoGLIoRqoc9L8bRv5qNNnU+HSWiWBNLRlA98fe4p+7m0KS/uTxnXiIz36fwRuODLJlSbzPnnXvTtCjsszfo6TUdZ2wxtG+KLGVVMYY+YgvGPiVRpQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=oDLCHSCi; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="oDLCHSCi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006114; x=1817542114; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=lDo397Z36GO5xj/mcw2tiDDKm6eDwSGNrKDHn0UvbBw=; b=oDLCHSCi6z5pWKaJrivLG4ivexO1ALVEcxDRpsdkxWu/GYP42oDFuvtA Drx2pZnxow2zhksHICl17Q98oq3nKu2q/YWL6wnCYYs2ttXe8ciJPJDYs PTTLOkmerGBtnKnrCMKRz/gDRHhDX5TjVZRnXAT7xTx6glBaPJ32Gs/D7 2a4Vy6Wq2lk+FD8sbi635bngUvC0elIQQvXLJG41sZzaPHENjo79jzW5J pzKKK6vPxUv5D4dJVvd43h3Mdyfab58kol79CP7LK2qnNaSmgIT53R5Ue 4uA+/8gGt7a4VsW35pyggRxybcgX8wi8ckT0F/NavOEgW+P6u/xURJQ4D g==; X-CSE-ConnectionGUID: 6ZCEtSlXTgS10Dk2DCLjjw== X-CSE-MsgGUID: j/pY/UsSQZ6aMDc4Z2YFmQ== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="293114513" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2026 01:48:33 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Thu, 6 Aug 2026 01:48:32 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:48:23 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 11/17] ARM: dts: microchip: sama7d65: add cpu opps Date: Thu, 6 Aug 2026 13:10:18 +0530 Message-ID: <20260806074024.531259-12-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add CPU OPPs table for SAMA7D65. Signed-off-by: Varshini Rajendran Reviewed-by: Claudiu Beznea --- arch/arm/boot/dts/microchip/sama7d65.dtsi | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arch/arm/boot/dts/microchip/sama7d65.dtsi b/arch/arm/boot/dts/= microchip/sama7d65.dtsi index ec200848c153..dfac17e34e65 100644 --- a/arch/arm/boot/dts/microchip/sama7d65.dtsi +++ b/arch/arm/boot/dts/microchip/sama7d65.dtsi @@ -35,6 +35,7 @@ cpu0: cpu@0 { d-cache-size =3D <0x8000>; // L1, 32 KB i-cache-size =3D <0x8000>; // L1, 32 KB next-level-cache =3D <&L2>; + operating-points-v2 =3D <&cpu_opp_table>; =20 L2: l2-cache { compatible =3D "cache"; @@ -45,6 +46,41 @@ L2: l2-cache { }; }; =20 + cpu_opp_table: opp-table { + compatible =3D "operating-points-v2"; + + opp-90000000 { + opp-hz =3D /bits/ 64 <90000000>; + opp-microvolt =3D <1050000 1050000 1225000>; + clock-latency-ns =3D <320000>; + }; + + opp-250000000 { + opp-hz =3D /bits/ 64 <250000000>; + opp-microvolt =3D <1050000 1050000 1225000>; + clock-latency-ns =3D <320000>; + }; + + opp-600000000 { + opp-hz =3D /bits/ 64 <600000000>; + opp-microvolt =3D <1050000 1050000 1225000>; + clock-latency-ns =3D <320000>; + opp-suspend; + }; + + opp-800000000 { + opp-hz =3D /bits/ 64 <800000000>; + opp-microvolt =3D <1150000 1125000 1225000>; + clock-latency-ns =3D <320000>; + }; + + opp-1000000002 { + opp-hz =3D /bits/ 64 <1000000002>; + opp-microvolt =3D <1250000 1225000 1300000>; + clock-latency-ns =3D <320000>; + }; + }; + clocks { main_xtal: clock-mainxtal { compatible =3D "fixed-clock"; --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 945CC3D905F; Thu, 6 Aug 2026 08:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006124; cv=none; b=ml5RI5o7z2rgLfOJyhGJvdhk7KAl9X7aTOHg0cQf1WYT+neTSAeh5nA9Eifqh8RSuNXi4C2VO0j/B8Zars+7GDsb2TEJx07wSN+vX0Y39VS2zUfbx9k5Z+foD4V7FWp3tUlwT3mvqYYR7KOktJ51roooIQW/WK+AkDg1mJJjQcc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006124; c=relaxed/simple; bh=/eM8hz28shrnbpDK7y2SGL0KHfDbbCGmq4bnAalgeqk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QSiyWI7TFPH6MQ1xi3nshh9m3bNjsVqaoS3f7Jh43CNwrFqiCkoUUMDsWIpLhp4PQTsgUxHI4yR0o8lWnsCcf97Ve8JDszwz+pdCQ23tYWTkwbqhrH6U0kAWC2uTr/UsLQeoaLiT0AhEZqdbWrSakSs8hpRUKIY3H/JjbMgi2eI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=0RisCRMx; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="0RisCRMx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006126; x=1817542126; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=/eM8hz28shrnbpDK7y2SGL0KHfDbbCGmq4bnAalgeqk=; b=0RisCRMxBIaOY2FlPzMKLjG00Nc+V93Z/hSPRE83lYQrKGsFB1QSK7Xi L/7C02dFFOI1HOpf4rSuq+O5F8yGB5M9qd3boMRR9q7TWTO4V9siEtDc9 52CL4h8ebkMwj0kJzQlxY4MPD0GOZNrMh5045ura7TTTTCsS3KRaofPek EK4AUQEb5KF5qVwff7SHUgnppPtI5rM+FQDqkRhSdsoZuerjaLD3gPawD xgdFVYQ56nIq6Mnm0p3qxuyCxS6PewL8Royv10IS4NVkSOu6YMqiDSqMh lR4J6bfLWSuFk68oGwjoS54kPC8aTy5VQCg771T7QVMargKieJKHvjmaw A==; X-CSE-ConnectionGUID: 2Eu9x+MhQfuluoh9zbcWSQ== X-CSE-MsgGUID: 43zT3IMqT8+7KE6Wh1rX+Q== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="71343337" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2026 01:48:45 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Thu, 6 Aug 2026 01:48:42 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:48:33 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 12/17] ARM: dts: microchip: sama7d65: Add ADC node Date: Thu, 6 Aug 2026 13:10:19 +0530 Message-ID: <20260806074024.531259-13-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add node for the ADC controller in sama7d65 SoC. Add the vddout25 fixed regulator node which provides the 2.5V reference voltage for the ADC. Signed-off-by: Varshini Rajendran Reviewed-by: Claudiu Beznea --- arch/arm/boot/dts/microchip/sama7d65.dtsi | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm/boot/dts/microchip/sama7d65.dtsi b/arch/arm/boot/dts/= microchip/sama7d65.dtsi index dfac17e34e65..c35f27615bc4 100644 --- a/arch/arm/boot/dts/microchip/sama7d65.dtsi +++ b/arch/arm/boot/dts/microchip/sama7d65.dtsi @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -95,6 +96,15 @@ slow_xtal: clock-slowxtal { }; }; =20 + vddout25: fixed-regulator-vddout25 { + compatible =3D "regulator-fixed"; + regulator-name =3D "VDDOUT25"; + regulator-min-microvolt =3D <2500000>; + regulator-max-microvolt =3D <2500000>; + regulator-boot-on; + status =3D "disabled"; + }; + ns_sram: sram@100000 { compatible =3D "mmio-sram"; reg =3D <0x100000 0x20000>; @@ -296,6 +306,24 @@ can4: can@e0838000 { status =3D "disabled"; }; =20 + adc: adc@e1000000 { + compatible =3D "microchip,sama7d65-adc"; + reg =3D <0xe1000000 0x200>; + interrupts =3D ; + clocks =3D <&pmc PMC_TYPE_GCK 25>; + clock-names =3D "adc_clk"; + assigned-clocks =3D <&pmc PMC_TYPE_GCK 25>; + assigned-clock-rates =3D <100000000>; + dmas =3D <&dma0 AT91_XDMAC_DT_PERID(0)>; + dma-names =3D "rx"; + #io-channel-cells =3D <1>; + atmel,min-sample-rate-hz =3D <200000>; + atmel,max-sample-rate-hz =3D <20000000>; + atmel,trigger-edge-type =3D ; + atmel,startup-time-ms =3D <4>; + status =3D "disabled"; + }; + dma2: dma-controller@e1200000 { compatible =3D "microchip,sama7d65-dma", "microchip,sama7g5-dma"; reg =3D <0xe1200000 0x1000>; --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 815943E2740; Thu, 6 Aug 2026 08:48:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006135; cv=none; b=Mh1K1s81ReW1+q/7Kli4i9+MHR0HwrRs3/lg3kYeuo178EmOYGh9F/6wezvvP5wv1HXUja9SWyPPjQladYtZLpeIYFWycQOuDAQXLq0jVcqUq7ciL0rKYz/9B2Zf1N5fy0cn0EO5mdYhLcRkJuKmceh+Pj1rknQATnWLPZ+JNMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006135; c=relaxed/simple; bh=JkNlRyaOOV3pTgI7mHQS2o4Wmw7D4SylfoNccbioFoY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Bd/ZK9ENtHB7vtyZl1JHpyInyetVkf4VDvwzOw9y7mn62ACWzJUvNC3z9JRb70ZiepDwKah/ycmtz9qOhGebsURjUJEzD9k9CAnkcMnkwPw1IdFs56EL/3GOEcKWs7V1gJ5iqIMRJbeDgzZhYwMaZkcMRVwDXeeyVgKGd1x3q0w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=p/n+Mcmo; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="p/n+Mcmo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006133; x=1817542133; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=JkNlRyaOOV3pTgI7mHQS2o4Wmw7D4SylfoNccbioFoY=; b=p/n+McmoKDOj+qG0LQD/yLUUwTbB7K8GtGoP1xjM0lTX49EG1Sjw1VUH iLJq6cgnvN/si0MAQYZJh9Olj3AAVkC8JJ3/PboXJ29/WZgqAirzaCxPl nhHUKEL0M/3uGk0RVgkYYKrT6FzdPRHOMfFdfsHLf5nJUI+1zbTpB1AFu 45zkfL8QYZg1LLxATn8w+GZQCK9rMdoDPZZTlOg+mSm5KOY8TRbdeQFFe 8oxk8PkYmu0O+SCqE+6/2eUV4xqIllq+cXAtbNwN5bP8eTsUyRU6dQVp4 mxwi1Ck7JrtESUNcHVNpC1zBqoAP5sl3U5HjMwnmwd1ioBAWYMSVus96w g==; X-CSE-ConnectionGUID: r1th4OAjSsi+Ep5SuUld9w== X-CSE-MsgGUID: YJiZZQPITaeclZRP3KznCA== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="60854124" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2026 01:48:52 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex4.mchp-main.com (10.10.87.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Thu, 6 Aug 2026 01:48:52 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:48:42 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 13/17] ARM: dts: microchip: sama7d65_curiosity: Enable ADC, DVFS Date: Thu, 6 Aug 2026 13:10:20 +0530 Message-ID: <20260806074024.531259-14-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Enable ADC and DVFS on SAMA7D65 Curiosity board. Configure the necessary power supply (vddana, vref) for the ADC, and enable cpu-supply for DVFS. Signed-off-by: Varshini Rajendran Reviewed-by: Claudiu Beznea --- .../dts/microchip/at91-sama7d65_curiosity.dts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/boot/dts/microchip/at91-sama7d65_curiosity.dts b/arch= /arm/boot/dts/microchip/at91-sama7d65_curiosity.dts index 927c27260b6c..c2d1e5308170 100644 --- a/arch/arm/boot/dts/microchip/at91-sama7d65_curiosity.dts +++ b/arch/arm/boot/dts/microchip/at91-sama7d65_curiosity.dts @@ -79,6 +79,14 @@ reg_5v: regulator-5v { }; }; =20 +&adc { + vddana-supply =3D <&vddout25>; + vref-supply =3D <&vddout25>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pinctrl_adc_default &pinctrl_adtrg_default>; + status =3D "okay"; +}; + &can1 { pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_can1_default>; @@ -97,6 +105,10 @@ &can3 { status =3D "okay"; }; =20 +&cpu0 { + cpu-supply =3D <&vddcpu>; +}; + &dma0 { status =3D "okay"; }; @@ -334,6 +346,16 @@ &main_xtal { }; =20 &pioa { + pinctrl_adc_default: adc-default { + pinmux =3D ; + bias-disable; + }; + + pinctrl_adtrg_default: adtrg-default { + pinmux =3D ; + bias-pull-up; + }; + pinctrl_can1_default: can1-default { pinmux =3D , ; @@ -457,3 +479,8 @@ input@0 { &slow_xtal { clock-frequency =3D <32768>; }; + +&vddout25 { + vin-supply =3D <&vdd_3v3>; + status =3D "okay"; +}; --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 790AA31E845; Thu, 6 Aug 2026 08:49:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006144; cv=none; b=swHr9AMPKy5v8hmJjeHhr/UhY+1lep52Xq4x/gBgZ/xqsyMPr+VjnfV5ZJByTy1dt594KwW1tabo8gznpkiuCgGF9duPJBDG3HU+iezVO2py7ERDD4JX2IKdUHK4b/co6uF1bD58gs4DQ1zJcPckkFpR7uEnMevi+RoeM1zRHHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006144; c=relaxed/simple; bh=hsE5rRxh7bAlqAndFRsVAqeW+FM8vR2AklWBZ8dt6v0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Zr80VxhrCVuN5gQahONVa8PnpixihsO5weHV1081YotsoZsms3VnUg1bpM3x57ny7Afrb9UsKgbY1NklrMg1HB4Plh8SOJ8f0kNN6gz3iGP4UnISi9e7R/+XxUU03OuycxZMmpRM3FyL3I8w0jhL552xNermnh1LcsMZVl5niHs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=PoNC+ViX; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="PoNC+ViX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006146; x=1817542146; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=hsE5rRxh7bAlqAndFRsVAqeW+FM8vR2AklWBZ8dt6v0=; b=PoNC+ViXYIDRBMr6j+jEH3XuHjOCoecgiS0bov1Fx/nvX8YQ0/mMMZaW A0K1zLfB6Dwk6ohPEbAPzzQMhDN/AjhfUgyilHo059Zc3pEDf2Qd11YEr fQCYP3BC6EkbxhM+5lmIUUlXM4ZdMOHLM6hC1c8bmONPNrX4sHGsw9BO5 qLKrixsR0HDAWKF2KIg+xnsG+m/cuJnzGJiDMnpYVz6gmjtkEOZATDlPi dax3qqZdIdZ1aypfbHL7jhDl0COiZgP7WYcbxVkf1zX78J4DAqCTJoPo5 gVObzEYEMDBjElz9wTab3NITUONjEMZnyimLAqY77iIVvhnESsq665Z4l Q==; X-CSE-ConnectionGUID: ENZSoASLQWeZsm6byR7nEQ== X-CSE-MsgGUID: vFO1HFdfQ/S+/l3RprNI5g== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="71343347" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2026 01:49:05 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Thu, 6 Aug 2026 01:49:01 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:48:52 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 14/17] ARM: dts: microchip: sama7d65: add otpc node Date: Thu, 6 Aug 2026 13:10:21 +0530 Message-ID: <20260806074024.531259-15-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add OTPC node along with temperature calibration cell. Signed-off-by: Varshini Rajendran Reviewed-by: Claudiu Beznea --- arch/arm/boot/dts/microchip/sama7d65.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/boot/dts/microchip/sama7d65.dtsi b/arch/arm/boot/dts/= microchip/sama7d65.dtsi index c35f27615bc4..aac2e22d96cb 100644 --- a/arch/arm/boot/dts/microchip/sama7d65.dtsi +++ b/arch/arm/boot/dts/microchip/sama7d65.dtsi @@ -15,6 +15,7 @@ #include #include #include +#include =20 / { model =3D "Microchip SAMA7D65 family SoC"; @@ -1111,6 +1112,21 @@ ddr3phy: ddr3phy@e3804000 { reg =3D <0xe3804000 0x1000>; }; =20 + otpc: efuse@e8c00000 { + compatible =3D "microchip,sama7d65-otpc", "microchip,sama7g5-otpc", "sy= scon"; + reg =3D <0xe8c00000 0x100>; + + nvmem-layout { + compatible =3D "fixed-layout"; + #address-cells =3D <1>; + #size-cells =3D <1>; + + temperature_calib: calib@41435354 { + reg =3D <0x41435354 0x2c>; /* Temp calib data packet TAG */ + }; + }; + }; + gic: interrupt-controller@e8c11000 { compatible =3D "arm,cortex-a7-gic"; reg =3D <0xe8c11000 0x1000>, --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 BCEA441F7EB; Thu, 6 Aug 2026 08:49:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006154; cv=none; b=L9No7n7PBGPKH5r20EgbkZcMo/Smje/3dQQQnsLH1TY5p9bmgnjV9erc8p7xMBMbYn8TRAtuE2rEQwvkAJITjdie3vGUwaMYyD10/BQhhSygjsM/gQGHxgg5E+iwh0aH2QaQ5jRoRrj1lzs+wwJThY8Zlhy7xBMayT4QrKtRUqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006154; c=relaxed/simple; bh=ytkQl2qucpM7xa0UdkODTCkBUd467sNXQVdKVB1xcag=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V33wFJnB/4xrbrqVN0mCNGzhL7DQQmuvsi8ThzF9m/RGNsBdw6dIw9mBJV0BuAZaYGEb3ua9FbJrmh5r6WQDKgMfVBxV3OgkcCM6OjcQS5E9f/gLdnSIP2An7m4k1XZoqDn5ziKVBsXfqf3YlisvfHb5rZ3/lzj8XOYoMbF8UZ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=btFXYNKN; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="btFXYNKN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006155; x=1817542155; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ytkQl2qucpM7xa0UdkODTCkBUd467sNXQVdKVB1xcag=; b=btFXYNKN//zcy3NjhYIyNdRNguOTvRAwuB5bWNyExTYie+ozErb+5P/E tUoM25U+n7QGK00OLhnsSoDdunP2Hqe1PSIs3reEptEaCvdEIvOR5XTdF 0QYJ1TkxwxF+XQuecdtrf6P5YX1pRJtV/ZmJvXbovsMA+0Ciw9YfIkVsu s2dhbf9T3MKTGdrD2sZz+cZQ1rXxEmoCPLhW7bUB9N60o7ofjVgx+zpcx DYMWYyeRyvJ5K+TrU6T2+GU+qjkuB4YTT/gM73WZg5CEhsdJ6ZRnsC1j+ 0pdz52sX+70YJ3ffH+ZmL0EepRwthLqerNN2flVS2dp7jGQ/BI/OI3RH5 g==; X-CSE-ConnectionGUID: YydEj9LITdaDMnTonKM7Qg== X-CSE-MsgGUID: NU0hnE9bRCWtZMFFZo4V6Q== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="71343352" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Aug 2026 01:49:14 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.87.152) by chn-vm-ex2.mchp-main.com (10.10.87.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.45; Thu, 6 Aug 2026 01:49:11 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:49:02 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 15/17] ARM: dts: microchip: sama7d65: add cells for temperature calibration Date: Thu, 6 Aug 2026 13:10:22 +0530 Message-ID: <20260806074024.531259-16-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add nvmem-cells for temperature calibration data to the ADC node. The calibration data is read from the OTPC. Signed-off-by: Varshini Rajendran Reviewed-by: Claudiu Beznea --- arch/arm/boot/dts/microchip/sama7d65.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/microchip/sama7d65.dtsi b/arch/arm/boot/dts/= microchip/sama7d65.dtsi index aac2e22d96cb..a8b18ad0ef7f 100644 --- a/arch/arm/boot/dts/microchip/sama7d65.dtsi +++ b/arch/arm/boot/dts/microchip/sama7d65.dtsi @@ -318,6 +318,8 @@ adc: adc@e1000000 { dmas =3D <&dma0 AT91_XDMAC_DT_PERID(0)>; dma-names =3D "rx"; #io-channel-cells =3D <1>; + nvmem-cells =3D <&temperature_calib>; + nvmem-cell-names =3D "temperature_calib"; atmel,min-sample-rate-hz =3D <200000>; atmel,max-sample-rate-hz =3D <20000000>; atmel,trigger-edge-type =3D ; --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (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 4BFA441E6D5; Thu, 6 Aug 2026 08:49:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006163; cv=none; b=lZnpvfqotbjGsy6bVYOeQGHtnNgU5KavXLN4I4S1rrFh+F73pKgupecPq87mU7V954Q7RGwVMoYHTalVpA7E4BRQnEeYNAZFy4Jypx5OMOeipncz2ctYrdIrCwqsBNgUZf+5ALevSp8v6NuJZH4M7I5wP+bkVC22aeRKZvTxQOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006163; c=relaxed/simple; bh=vtCrC8enOD/kvPEdYL79acFvpqmjSRWeBQpWufU1kl0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OfBbYJYgECrMHjjqQoqEFfRnaJkZ3TOqGRk0Zoy7mgKPctmCw6Bg0iNzTpWuJ3XsHs2SYn7uFQ4Lma5aaSZ59Xew9yyqAQZMpsNKIMJi5rEZ7ARyUJJLOqOXActDRy6sp5vNZz0jx0UdCJQcUHNIWeIEu4XaLv20kmxe/drf1JQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=C0bIICRr; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="C0bIICRr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006165; x=1817542165; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=vtCrC8enOD/kvPEdYL79acFvpqmjSRWeBQpWufU1kl0=; b=C0bIICRrod/HZUO1VZvlWp2axIPkv0M+8FJi4P7dP6Yxt6oVImLEK3De znWscKeN+cqqN+C5up7fr5x1oTF7f4gq32LU4Nv+M7FIi3jFri13e3L15 iEiFDSO7HYmYhcSVhkIEptsUReef1JqfdK8epir86nSCCLDDF3uUIuqZM kTAHpfsDZXzMIHQT57HqaBSInZ9/t+xht35GZ1qQwUEoI6YogWWb1oGBm PUe9a22InrOX2zvG1AapZQ+C/9MfMCEzK6CIu0Zn3jEtEdq70v358Y9Ux DOM0Otdrsm+qbthTkmv+b7sQgF3Xq9FIPqubb0f3QQGt057fRVogFLPES w==; X-CSE-ConnectionGUID: Zv2G35yLQiGdI6PdOlli4A== X-CSE-MsgGUID: mP/+BNZIRL6isoA00PCAnQ== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="71343361" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2026 01:49:24 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Thu, 6 Aug 2026 01:49:20 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:49:11 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 16/17] ARM: dts: microchip: sama7d65: add temperature sensor Date: Thu, 6 Aug 2026 13:10:23 +0530 Message-ID: <20260806074024.531259-17-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add the generic-adc-thermal temperature sensor node for SAMA7D65. Signed-off-by: Varshini Rajendran Reviewed-by: Claudiu Beznea --- arch/arm/boot/dts/microchip/sama7d65.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/microchip/sama7d65.dtsi b/arch/arm/boot/dts/= microchip/sama7d65.dtsi index a8b18ad0ef7f..3aba73983c79 100644 --- a/arch/arm/boot/dts/microchip/sama7d65.dtsi +++ b/arch/arm/boot/dts/microchip/sama7d65.dtsi @@ -119,6 +119,13 @@ pmu { interrupts =3D ; }; =20 + thermal_sensor: thermal-sensor { + compatible =3D "generic-adc-thermal"; + #thermal-sensor-cells =3D <0>; + io-channels =3D <&adc AT91_SAMA7G5_ADC_TEMP_CHANNEL>; + io-channel-names =3D "sensor-channel"; + }; + soc { compatible =3D "simple-bus"; ranges; --=20 2.34.1 From nobody Fri Oct 2 03:37:46 2026 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 C6ECE41F37D; Thu, 6 Aug 2026 08:49:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006173; cv=none; b=PtQYxTXVx2RhDxg3QbC2xgGRxmz+C5NzxoiwrcMZYCElqmQMLGSqTQrR6/DiTrhmVa2dr/K9nbShAKNussj0ExXcbs1BsxCTgQZPUuF6IRI3okas/P+EoXi24ObMi72vNsTTxvgCM2Ge2Jq4Oicu7Z/Djr2NoDw7hXjBK+wlavg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786006173; c=relaxed/simple; bh=XNeG3M4dWAfIsmDBbwjWj2IXhD+Qtz4KOR6R5jwR+jw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IH+XjRx+IofyUtS1xkD+OxkjwYpRIFdoTgGBWed+AOf9yVDX6o0VbtvZJAHfPPyZYP/9oR/jFVtedaZDIzEOesDQmdQubpAKHMncdeK8lDy35+WupRrFhq9HFU5o60jXO53o9UjUWK6tLlgSGaGB2pKZZbxLiKNlJcTwlNylTpw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=H+evpy9l; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="H+evpy9l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1786006172; x=1817542172; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=XNeG3M4dWAfIsmDBbwjWj2IXhD+Qtz4KOR6R5jwR+jw=; b=H+evpy9lbLfpEMY/AzjKKWSAW7vpH192XAfVwwZxw4UQDsVA2gogMFnJ Epd/sz4jbqVw3HugF15BlJBX2Uq5gbwXyctGe+nzma7wEexPWuemFlq51 qNpPEQjPXKsmx6J5jgg9+Ohq6S53w3szeUlvyS2eN97Fhiv01xIDt3MXb Re2C1WrRY3iyfOBamarDdUkLkb9e/JyL/e6P0X5MnfQMaQjTo4jny0cpN lgGE8l8cwj1mw0a10Jhkx69/kEqfB/3FSvB6gIgTvptslXzfssGmmegKC +p9JyCQtI2ONOz/8K/R3bdIibprYt0O3r7CycDjmHwRCB9/Pj26+tRQg1 g==; X-CSE-ConnectionGUID: fSnijaBeTzGVn5jrl+q6+w== X-CSE-MsgGUID: bF4lcckWRjCECWByfLDleg== X-IronPort-AV: E=Sophos;i="6.25,208,1779174000"; d="scan'208";a="62050920" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2026 01:49:31 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Thu, 6 Aug 2026 01:49:30 -0700 Received: from che-ll-i67070.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Thu, 6 Aug 2026 01:49:21 -0700 From: Varshini Rajendran To: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 17/17] ARM: dts: microchip: sama7d65: add thermal zones node Date: Thu, 6 Aug 2026 13:10:24 +0530 Message-ID: <20260806074024.531259-18-varshini.rajendran@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806074024.531259-1-varshini.rajendran@microchip.com> References: <20260806074024.531259-1-varshini.rajendran@microchip.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" Add thermal zones node for SAMA7D65 with trip points for passive cooling and critical shutdown. Signed-off-by: Varshini Rajendran Reviewed-by: Claudiu Beznea --- arch/arm/boot/dts/microchip/sama7d65.dtsi | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/arch/arm/boot/dts/microchip/sama7d65.dtsi b/arch/arm/boot/dts/= microchip/sama7d65.dtsi index 3aba73983c79..7743f9e8f692 100644 --- a/arch/arm/boot/dts/microchip/sama7d65.dtsi +++ b/arch/arm/boot/dts/microchip/sama7d65.dtsi @@ -16,6 +16,7 @@ #include #include #include +#include =20 / { model =3D "Microchip SAMA7D65 family SoC"; @@ -38,6 +39,7 @@ cpu0: cpu@0 { i-cache-size =3D <0x8000>; // L1, 32 KB next-level-cache =3D <&L2>; operating-points-v2 =3D <&cpu_opp_table>; + #cooling-cells =3D <2>; /* min followed by max */ =20 L2: l2-cache { compatible =3D "cache"; @@ -126,6 +128,46 @@ thermal_sensor: thermal-sensor { io-channel-names =3D "sensor-channel"; }; =20 + thermal-zones { + cpu_thermal: cpu-thermal { + polling-delay-passive =3D <1000>; + polling-delay =3D <5000>; + thermal-sensors =3D <&thermal_sensor>; + + trips { + cpu_normal: cpu-alert0 { + temperature =3D <90000>; + hysteresis =3D <0>; + type =3D "passive"; + }; + + cpu_hot: cpu-alert1 { + temperature =3D <95000>; + hysteresis =3D <0>; + type =3D "passive"; + }; + + cpu_critical: cpu-critical { + temperature =3D <100000>; + hysteresis =3D <0>; + type =3D "critical"; + }; + }; + + cooling-maps { + map0 { + trip =3D <&cpu_normal>; + cooling-device =3D <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + map1 { + trip =3D <&cpu_hot>; + cooling-device =3D <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; + }; + soc { compatible =3D "simple-bus"; ranges; --=20 2.34.1