Skip to contentSkip to conversation

Add Amlogic Meson GX SoC Clock Measure Driver

PATCH In review Neil Armstrong 4 participants 9 messages Nov 18, 2018 – Nov 29, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover Add Amlogic Meson GX SoC Clock Measure Driver

The Amlogic Meson GX SoCs embeds a clock measurer IP to measure the internal clocks frequencies.
The precision is determined by stepping into the duration until the counter overflows.
The debugfs shows a pretty summary and each clock can be measured individually aswell.

This patchset includes the dt-bindings, driver and the DT node added to the meson-gx dtsi.

Changes since v2 at [2]:
- Removed all reference to GX
- Added compatibles for meson8/meson8b
- Used Martin's suggestions on the divider naming
- Added Martin's meson8/meson8b clk id table
- Added Martin's fixes to support 32bit SoCs

Changes since v1 at [1]:
- fixed clock names
- added summary in debugfs and moved indivudual clocks into a subdirectory
- added the GX table to the match data

[1] https://lkml.kernel.org/r/1530624110-4687-1-git-send-email-narmstrong at baylibre.com
[2] https://lkml.kernel.org/r/20181114131627.17766-1-narmstrong at baylibre.com

Neil Armstrong (3):
dt-bindings: amlogic: Add Internal Clock Measurer bindings
soc: amlogic: Add Meson Clock Measure driver
ARM64: dts: meson-gx: Add Internal Clock Measurer node

 .../bindings/soc/amlogic/clk-measure.txt      |  18 +
 arch/arm64/boot/dts/amlogic/meson-gx.dtsi     |   5 +
 drivers/soc/amlogic/Kconfig                   |   8 +
 drivers/soc/amlogic/Makefile                  |   1 +
 drivers/soc/amlogic/meson-clk-measure.c       | 350 ++++++++++++++++++
 5 files changed, 382 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/amlogic/clk-measure.txt
 create mode 100644 drivers/soc/amlogic/meson-clk-measure.c
Signature · 1 line
2.19.1
#1 lore raw

PATCH v3 1/3 dt-bindings: amlogic: Add Internal Clock Measurer bindings

The Amlogic Meson SoCs embeds a clock measurer IP to measure the internal clock paths frequencies.

---
Rob,

I didn't take your v2 Reviewed-by since I changed the compatible list, tell me if i can still keep the tag.

Thanks,
Neil

 .../bindings/soc/amlogic/clk-measure.txt       | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/amlogic/clk-measure.txt
Documentation/devicetree/bindings/soc/amlogic/clk-measure.txt new file +18 -0
new file mode 100644
index 000000000000..205a54bcd7c7
@@ -0,0 +1,18 @@
+Amlogic Internal Clock Measurer
+===============================
+
+The Amlogic SoCs contains an IP to measure the internal clocks.
+The precision is multiple of MHz, useful to debug the clock states.
+
+Required properties:
+- compatible: Shall contain one of the following :
+			"amlogic,meson-gx-clk-measure" for GX SoCs
+			"amlogic,meson8-clk-measure" for Meson8 SoCs
+			"amlogic,meson8b-clk-measure" for Meson8b SoCs
+- reg: base address and size of the Clock Measurer register space.
+
+Example:
+	clock-measure at 8758 {
+		compatible = "amlogic,meson-gx-clk-measure";
+		reg = <0x0 0x8758 0x0 0x10>;
+	};
Signature · 1 line
2.19.1
maintainer Reviewed-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] dt-bindings: amlogic: Add Internal Clock Measurer bindings

Quoted 10 lines · Neil Armstrong

The Amlogic Meson SoCs embeds a clock measurer IP to measure the internal clock paths frequencies.

---
Rob,

I didn't take your v2 Reviewed-by since I changed the compatible list, tell me if i can still keep the tag.

Quoted 7 lines

Thanks,
Neil

 .../bindings/soc/amlogic/clk-measure.txt       | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/amlogic/clk-measure.txt
#3 lore raw

PATCH v3 2/3 soc: amlogic: Add Meson Clock Measure driver

In reply to Neil Armstrong

The Amlogic Meson SoCs embeds a clock measurer IP to measure the internal clock paths frequencies.
The precision is determined by stepping into the duration until the counter overflows.
The debugfs slows a pretty summary and each clock can be measured individually aswell.

Cc Martin Blumenstingl <[email protected]>
---
 drivers/soc/amlogic/Kconfig             |   8 +
 drivers/soc/amlogic/Makefile            |   1 +
 drivers/soc/amlogic/meson-clk-measure.c | 350 ++++++++++++++++++++++++
 3 files changed, 359 insertions(+)
 create mode 100644 drivers/soc/amlogic/meson-clk-measure.c
drivers/soc/amlogic/Kconfig +8 -0
index 2f282b472912..36633bb6c8bb 100644
@@ -7,6 +7,14 @@ config MESON_CANVAS
 	help
 	  Say yes to support the canvas IP for Amlogic SoCs.
 
+config MESON_CLK_MEASURE
+	bool "Amlogic Meson SoC Clock Measure driver"
+	depends on ARCH_MESON || COMPILE_TEST
+	default ARCH_MESON
+	help
+	  Say yes to support of Measuring a set of internal SoC clocks
+	  from the debugfs interface.
+
 config MESON_GX_SOCINFO
 	bool "Amlogic Meson GX SoC Information driver"
 	depends on ARCH_MESON || COMPILE_TEST
drivers/soc/amlogic/Makefile +1 -0
index 0ab16d35ac36..bf2d109f61e9 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_MESON_CANVAS) += meson-canvas.o
+obj-$(CONFIG_MESON_CLK_MEASURE) += meson-clk-measure.o
 obj-$(CONFIG_MESON_GX_SOCINFO) += meson-gx-socinfo.o
 obj-$(CONFIG_MESON_GX_PM_DOMAINS) += meson-gx-pwrc-vpu.o
 obj-$(CONFIG_MESON_MX_SOCINFO) += meson-mx-socinfo.o
drivers/soc/amlogic/meson-clk-measure.c new file +350 -0

350 lines not on this page · raw message

Signature · 1 line
2.19.1
reviewer Reviewed-by Tested-by on v3 2/3
#4 lore raw

Re: [PATCH v3 2/3] soc: amlogic: Add Meson Clock Measure driver

Quoted 10 lines · Neil Armstrong

The Amlogic Meson SoCs embeds a clock measurer IP to measure the internal clock paths frequencies.
The precision is determined by stepping into the duration until the counter overflows.
The debugfs slows a pretty summary and each clock can be measured individually aswell.

Cc Martin Blumenstingl <[email protected]>

I have successfully tested it on Odroid-C1:

#5 lore raw

PATCH v3 3/3 ARM64: dts: meson-gx: Add Internal Clock Measurer node

In reply to Neil Armstrong

The Amlogic Meson GX SoCs embeds a clock measurer IP to measure the internal clock paths frequencies.
This patch adds the node in the top-level meson-gx dtsi.

---
 arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gx.dtsi +5 -0
index f1e5cdbade5e..ed336c7a98a7 100644
@@ -262,6 +262,11 @@
 				status = "disabled";
 			};
 
+			clock-measure at 8758 {
+				compatible = "amlogic,meson-gx-clk-measure";
+				reg = <0x0 0x8758 0x0 0x10>;
+			};
+
 			i2c_B: i2c at 87c0 {
 				compatible = "amlogic,meson-gx-i2c", "amlogic,meson-gxbb-i2c";
 				reg = <0x0 0x087c0 0x0 0x20>;
Signature · 1 line
2.19.1
#7 lore raw
In reply to Neil Armstrong
Quoted 11 lines · Neil Armstrong

The Amlogic Meson GX SoCs embeds a clock measurer IP to measure the internal clocks frequencies.
The precision is determined by stepping into the duration until the counter overflows.
The debugfs shows a pretty summary and each clock can be measured individually aswell.

This patchset includes the dt-bindings, driver and the DT node added to the meson-gx dtsi.

Quoted 6 lines

Changes since v2 at [2]:
- Removed all reference to GX
- Added compatibles for meson8/meson8b
- Used Martin's suggestions on the divider naming
- Added Martin's meson8/meson8b clk id table
- Added Martin's fixes to support 32bit SoCs

thank you for the updates Neil!

here's the output from Odroid-C1:

# cat /sys/kernel/debug/meson-clk-msr/measure_summary
 clock                     rate    precision
---------------------------------------------
ring_osc_out_ee0              0    +/-3125Hz
ring_osc_out_ee1              0    +/-3125Hz
ring_osc_out_ee2              0    +/-3125Hz
a9_ring_osck                  0    +/-3125Hz
vid_pll               148497596    +/-4807Hz
clk81                 159372396    +/-5208Hz
encp                  148497596    +/-4807Hz
encl                          0    +/-3125Hz
eth_rmii              125000000    +/-3906Hz
amclk                         0    +/-3125Hz
fec_clk_0                     0    +/-3125Hz
fec_clk_1                     0    +/-3125Hz
fec_clk_2                     0    +/-3125Hz
a9_clk_div16           74998438    +/-3125Hz
hdmi_sys                      0    +/-3125Hz
rtc_osc_clk_out           32813    +/-3125Hz
i2s_clk_in_src0               0    +/-3125Hz
clk_rmii_from_pad             0    +/-3125Hz
hdmi_ch0_tmds          74248438    +/-3125Hz
lvds_fifo                     0    +/-3125Hz
sc_clk_int                    0    +/-3125Hz
sar_adc                 1140625    +/-3125Hz
mpll_clk_test_out             0    +/-3125Hz
audac_clkpi                   0    +/-3125Hz
vdac                          0    +/-3125Hz
sdhc_rx                       0    +/-3125Hz
sdhc_sd                       0    +/-3125Hz
mali                          0    +/-3125Hz
hdmi_tx_pixel          74250000    +/-3125Hz
vdin_meas                     0    +/-3125Hz
pcm_sclk                      0    +/-3125Hz
pcm_mclk                      0    +/-3125Hz
eth_rx_tx                     0    +/-3125Hz
pwm_d                         0    +/-3125Hz
pwm_c                  24000000    +/-3125Hz
pwm_b                         0    +/-3125Hz
pwm_a                         0    +/-3125Hz
pcm2_sclk                     0    +/-3125Hz
ddr_dpll_pt                   0    +/-3125Hz
pwm_f                         0    +/-3125Hz
pwm_e                         0    +/-3125Hz
hcodec                        0    +/-3125Hz
usb_32k_alt                   0    +/-3125Hz
gpio                          0    +/-3125Hz
vid2_pll                      0    +/-3125Hz
mipi_csi_cfg                  0    +/-3125Hz
maintainer
#8 lore raw
In reply to Neil Armstrong
Quoted 9 lines · Neil Armstrong

The Amlogic Meson GX SoCs embeds a clock measurer IP to measure the internal clocks frequencies.
The precision is determined by stepping into the duration until the counter overflows.
The debugfs shows a pretty summary and each clock can be measured individually aswell.

This patchset includes the dt-bindings, driver and the DT node added to the meson-gx dtsi.

Queued for v4.21...

[...]

Quoted 3 lines

Neil Armstrong (3):
dt-bindings: amlogic: Add Internal Clock Measurer bindings
soc: amlogic: Add Meson Clock Measure driver

...on branch v4.21/drivers and...

Quoted 1 line

ARM64: dts: meson-gx: Add Internal Clock Measurer node

...on branch v4.21/dt64,

Thanks,

Kevin