mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Marc Gonzalez <marc.w.gonzalez@free.fr>
To: AML <linux-amlogic@lists.infradead.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
	Kevin Hilman <khilman@baylibre.com>,
	Jiucheng Xu <jiucheng.xu@amlogic.com>,
	Chris Healy <healych@amazon.com>, Will Deacon <will@kernel.org>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Pierre-Hugues Husson <phh@phh.me>
Subject: Conflict between video-lut and pmu on meson-g12
Date: Tue, 28 Feb 2023 17:48:02 +0100	[thread overview]
Message-ID: <cbfd45e3-310b-db40-d52b-daf79ce8743d@free.fr> (raw)

Hello everyone,

Running 6.2.0-rc8 on a S905X2 board, I note the following error
in the kernel log:

[    1.059175] meson-g12-ddr-pmu ff638000.pmu: can't request region for resource [mem 0xff638000-0xff6380ff]
[    1.068647] meson-g12-ddr-pmu: probe of ff638000.pmu failed with error -16

Relevant DT node from decompiled DTB:
(arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi + arch/arm64/boot/dts/amlogic/meson-g12a.dtsi)

	pmu@ff638000 {
		reg = <0x0 0xff638000 0x0 0x100 0x0 0xff638c00 0x0 0x100>;
		interrupts = <0x0 0x34 0x1>;
		compatible = "amlogic,g12a-ddr-pmu";
	};

However, according to /proc/iomem
ff638048-ff63805b : ff638048.video-lut video-lut@48

Corresponding DT node:
(arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi)

	video-lut@48 {
		compatible = "amlogic,canvas";
		reg = <0x0 0x48 0x0 0x14>;
		phandle = <0x22>;
	};

(with a base of 0xff600000 + 0x38000 = 0xff638000)

Unless I'm mistaken, ff638000-0xff6380ff and ff638048-ff63805b
cannot co-exist?

A simple solution might be to specify the "actual" base of
the register set, and count from 0 in the driver?


diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
index 534178eaaf373..cf37eecfba5b2 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
@@ -1712,7 +1712,7 @@ internal_ephy: ethernet-phy@8 {
 		};
 
 		pmu: pmu@ff638000 {
-			reg = <0x0 0xff638000 0x0 0x100>,
+			reg = <0x0 0xff638080 0x0 0x40>,
 			      <0x0 0xff638c00 0x0 0x100>;
 			interrupts = <GIC_SPI 52 IRQ_TYPE_EDGE_RISING>;
 		};
diff --git a/drivers/perf/amlogic/meson_g12_ddr_pmu.c b/drivers/perf/amlogic/meson_g12_ddr_pmu.c
index a78fdb15e26c2..8b643888d5036 100644
--- a/drivers/perf/amlogic/meson_g12_ddr_pmu.c
+++ b/drivers/perf/amlogic/meson_g12_ddr_pmu.c
@@ -21,23 +21,23 @@
 #define DMC_QOS_IRQ		BIT(30)
 
 /* DMC bandwidth monitor register address offset */
-#define DMC_MON_G12_CTRL0		(0x20  << 2)
-#define DMC_MON_G12_CTRL1		(0x21  << 2)
-#define DMC_MON_G12_CTRL2		(0x22  << 2)
-#define DMC_MON_G12_CTRL3		(0x23  << 2)
-#define DMC_MON_G12_CTRL4		(0x24  << 2)
-#define DMC_MON_G12_CTRL5		(0x25  << 2)
-#define DMC_MON_G12_CTRL6		(0x26  << 2)
-#define DMC_MON_G12_CTRL7		(0x27  << 2)
-#define DMC_MON_G12_CTRL8		(0x28  << 2)
-
-#define DMC_MON_G12_ALL_REQ_CNT		(0x29  << 2)
-#define DMC_MON_G12_ALL_GRANT_CNT	(0x2a  << 2)
-#define DMC_MON_G12_ONE_GRANT_CNT	(0x2b  << 2)
-#define DMC_MON_G12_SEC_GRANT_CNT	(0x2c  << 2)
-#define DMC_MON_G12_THD_GRANT_CNT	(0x2d  << 2)
-#define DMC_MON_G12_FOR_GRANT_CNT	(0x2e  << 2)
-#define DMC_MON_G12_TIMER		(0x2f  << 2)
+#define DMC_MON_G12_CTRL0		(0x0  << 2)
+#define DMC_MON_G12_CTRL1		(0x1  << 2)
+#define DMC_MON_G12_CTRL2		(0x2  << 2)
+#define DMC_MON_G12_CTRL3		(0x3  << 2)
+#define DMC_MON_G12_CTRL4		(0x4  << 2)
+#define DMC_MON_G12_CTRL5		(0x5  << 2)
+#define DMC_MON_G12_CTRL6		(0x6  << 2)
+#define DMC_MON_G12_CTRL7		(0x7  << 2)
+#define DMC_MON_G12_CTRL8		(0x8  << 2)
+
+#define DMC_MON_G12_ALL_REQ_CNT		(0x9  << 2)
+#define DMC_MON_G12_ALL_GRANT_CNT	(0xa  << 2)
+#define DMC_MON_G12_ONE_GRANT_CNT	(0xb  << 2)
+#define DMC_MON_G12_SEC_GRANT_CNT	(0xc  << 2)
+#define DMC_MON_G12_THD_GRANT_CNT	(0xd  << 2)
+#define DMC_MON_G12_FOR_GRANT_CNT	(0xe  << 2)
+#define DMC_MON_G12_TIMER		(0xf  << 2)
 
 /* Each bit represent a axi line */
 PMU_FORMAT_ATTR(event, "config:0-7");


With the above patch, /proc/iomem becomes:

ff638048-ff63805b : ff638048.video-lut video-lut@48
ff638080-ff6380bf : ff638080.pmu pmu@ff638000
ff638c00-ff638cff : ff638080.pmu pmu@ff638000

(I didn't test that the driver actually works.
I suppose one needs perf for that?)

Regards.

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

             reply	other threads:[~2023-02-28 16:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28 16:48 Marc Gonzalez [this message]
2023-02-28 21:04 ` Martin Blumenstingl
2023-02-28 21:49   ` Martin Blumenstingl
2023-03-01  7:36     ` Jiucheng Xu
2023-03-01 13:28     ` Marc Gonzalez
2023-03-09  9:48       ` Marc Gonzalez
2023-03-09 21:36         ` Martin Blumenstingl
2023-03-23 16:12           ` [PATCH] arm64: dts: meson-g12-common: specify full DMC range Marc Gonzalez
2023-03-23 16:23             ` [PATCH] perf/amlogic: resolve conflict between canvas & pmu Marc Gonzalez
2023-03-25 20:54               ` Martin Blumenstingl
2023-03-27  7:48                 ` Neil Armstrong
2023-03-25 20:43             ` [PATCH] arm64: dts: meson-g12-common: specify full DMC range Martin Blumenstingl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cbfd45e3-310b-db40-d52b-daf79ce8743d@free.fr \
    --to=marc.w.gonzalez@free.fr \
    --cc=healych@amazon.com \
    --cc=jbrunet@baylibre.com \
    --cc=jiucheng.xu@amlogic.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=phh@phh.me \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®