Skip to contentSkip to conversation

Add power monitor support on sama7d65-curiosity board

PATCH Applied Mihai Sain 3 participants 5 messages Feb 11, 2025 – Feb 17, 2025

Subsystems (2)
lore
Share & tools
lore

Mihai Sain

author
#0 lore raw

cover Add power monitor support on sama7d65-curiosity board

This patch series adds power monitor support on Microchip SAMA7D65 Curiosity board.

[root@SAMA7D65 ~]$ lsiio
Device 001: pac1934
Device 000: e1000000.adc

[root@SAMA7D65 ~]$ awk -f pac1934.awk
VDD3V3 current: 146.173 mA, voltage: 3302.73 mV
VDDIODDR current: 62.1356 mA, voltage: 1353.96 mV
VDDCORE current: 242.248 mA, voltage: 1204.36 mV
VDDCPU current: 213.565 mA, voltage: 1303.05 mV

Mihai Sain (2):
ARM: dts: microchip: sama7d65: Add flexcom 10 node
ARM: dts: microchip: sama7d65_curiosity: Add power monitor support

 .../dts/microchip/at91-sama7d65_curiosity.dts | 52 +++++++++++++++++++
 arch/arm/boot/dts/microchip/sama7d65.dtsi     | 21 ++++++++
 2 files changed, 73 insertions(+)

base-commit: febbc555cf0fff895546ddb8ba2c9a523692fb55

Signature · 1 line
2.48.1
author
#1 lore raw

PATCH 1/2 ARM: dts: microchip: sama7d65: Add flexcom 10 node

Add flexcom 10 node and its i2c-controller subnode for usage on the SAMA7D65 Curiosity board.

---
 arch/arm/boot/dts/microchip/sama7d65.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm/boot/dts/microchip/sama7d65.dtsi +21 -0
index 854b30d15dcd..a38e04a86b6d 100644
@@ -132,6 +132,27 @@ uart6: serial@200 {
 			};
 		};
 
+		flx10: flexcom@e2824000 {
+			compatible = "microchip,sama7d65-flexcom", "atmel,sama5d2-flexcom";
+			reg = <0xe2824000 0x200>;
+			clocks = <&pmc PMC_TYPE_PERIPHERAL 44>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0x0 0xe2824000 0x800>;
+			status = "disabled";
+
+			i2c10: i2c@600 {
+				compatible = "microchip,sama7d65-i2c", "microchip,sam9x60-i2c";
+				reg = <0x600 0x200>;
+				interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&pmc PMC_TYPE_PERIPHERAL 44>;
+				atmel,fifo-size = <32>;
+				status = "disabled";
+			};
+		};
+
 		gic: interrupt-controller@e8c11000 {
 			compatible = "arm,cortex-a7-gic";
 			reg = <0xe8c11000 0x1000>,
Signature · 1 line
2.48.1
author
#2 lore raw

PATCH 2/2 ARM: dts: microchip: sama7d65_curiosity: Add power monitor support

In reply to Mihai Sain

Add PAC1934 support in order to monitor the board power consumption. Device is connected on flexcom10 in twi mode.

[root@SAMA7D65 ~]$ awk -f pac1934.awk
VDD3V3 current: 146.173 mA, voltage: 3302.73 mV
VDDIODDR current: 62.1356 mA, voltage: 1353.96 mV
VDDCORE current: 242.248 mA, voltage: 1204.36 mV
VDDCPU current: 213.565 mA, voltage: 1303.05 mV

---
 .../dts/microchip/at91-sama7d65_curiosity.dts | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/arm/boot/dts/microchip/at91-sama7d65_curiosity.dts +52 -0
index 0f86360fb733..8d826ec4c66c 100644
@@ -43,6 +43,52 @@ &uart6 {
 	status = "okay";
 };
 
+&flx10 {
+	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
+	status = "okay";
+};
+
+&i2c10 {
+	dmas = <0>, <0>;
+	i2c-analog-filter;
+	i2c-digital-filter;
+	i2c-digital-filter-width-ns = <35>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_i2c10_default>;
+	status = "okay";
+
+	power-monitor@10 {
+		compatible = "microchip,pac1934";
+		reg = <0x10>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		channel@1 {
+			reg = <0x1>;
+			shunt-resistor-micro-ohms = <47000>;
+			label = "VDD3V3";
+		};
+
+		channel@2 {
+			reg = <0x2>;
+			shunt-resistor-micro-ohms = <47000>;
+			label = "VDDIODDR";
+		};
+
+		channel@3 {
+			reg = <0x3>;
+			shunt-resistor-micro-ohms = <47000>;
+			label = "VDDCORE";
+		};
+
+		channel@4 {
+			reg = <0x4>;
+			shunt-resistor-micro-ohms = <47000>;
+			label = "VDDCPU";
+		};
+	};
+};
+
 &main_xtal {
 	clock-frequency = <24000000>;
 };
@@ -75,6 +121,12 @@ pinctrl_uart6_default: uart6-default {
 			 <PIN_PD19__FLEXCOM6_IO1>;
 		bias-disable;
 	};
+
+	pinctrl_i2c10_default: i2c10-default{
+		pinmux = <PIN_PB19__FLEXCOM10_IO1>,
+			 <PIN_PB20__FLEXCOM10_IO0>;
+		bias-pull-up;
+	};
 };
 
 &sdmmc1 {
Signature · 1 line
2.48.1
#3 lore raw
In reply to Mihai Sain
Quoted 16 lines · Mihai Sain

This patch series adds power monitor support on Microchip SAMA7D65 Curiosity board.

[root@SAMA7D65 ~]$ lsiio
Device 001: pac1934
Device 000: e1000000.adc

[root@SAMA7D65 ~]$ awk -f pac1934.awk
VDD3V3 current: 146.173 mA, voltage: 3302.73 mV
VDDIODDR current: 62.1356 mA, voltage: 1353.96 mV
VDDCORE current: 242.248 mA, voltage: 1204.36 mV
VDDCPU current: 213.565 mA, voltage: 1303.05 mV

Mihai Sain (2):
ARM: dts: microchip: sama7d65: Add flexcom 10 node
ARM: dts: microchip: sama7d65_curiosity: Add power monitor support

Quoted 10 lines
 .../dts/microchip/at91-sama7d65_curiosity.dts | 52 +++++++++++++++++++
 arch/arm/boot/dts/microchip/sama7d65.dtsi     | 21 ++++++++
 2 files changed, 73 insertions(+)

base-commit: febbc555cf0fff895546ddb8ba2c9a523692fb55 --
2.48.1

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

New warnings running 'make CHECK_DTBS=y for arch/arm/boot/dts/microchip/' for [email protected]:

arch/arm/boot/dts/microchip/at91-sama7d65_curiosity.dtb: flexcom@e2824000: compatible: 'oneOf' conditional failed, one must be fixed:
['microchip,sama7d65-flexcom', 'atmel,sama5d2-flexcom'] is too long
'atmel,sama5d2-flexcom' was expected
'microchip,sam9x7-flexcom' was expected
'microchip,sama7g5-flexcom' was expected
from schema $id: http://devicetree.org/schemas/mfd/atmel,sama5d2-flexcom.yaml#
arch/arm/boot/dts/microchip/at91-sama7d65_curiosity.dtb: /soc/flexcom@e2824000: failed to match any schema with compatible: ['microchip,sama7d65-flexcom', 'atmel,sama5d2-flexcom']

maintainer Applied
#4 lore raw
In reply to Mihai Sain
Quoted 3 lines · Mihai Sain

Mihai Sain (2):
ARM: dts: microchip: sama7d65: Add flexcom 10 node
ARM: dts: microchip: sama7d65_curiosity: Add power monitor support

Applied to at91-dt (with some small adjustments, please check), thanks!