From: Haylen Chu <heylenay@4d2.org>
To: Krzysztof Kozlowski <krzk@kernel.org>, Alex Elder <elder@riscstar.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Haylen Chu <heylenay@outlook.com>, Yixun Lan <dlan@gentoo.org>,
linux-riscv@lists.infradead.org, linux-clk@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Inochi Amaoto <inochiama@outlook.com>,
Chen Wang <unicornxdotw@foxmail.com>,
Jisheng Zhang <jszhang@kernel.org>,
Meng Zhang <zhangmeng.kevin@linux.spacemit.com>,
Guodong Xu <guodong@riscstar.com>
Subject: Re: [PATCH v4 2/4] dt-bindings: soc: spacemit: Add spacemit,k1-syscon
Date: Mon, 24 Feb 2025 10:17:40 +0000 [thread overview]
Message-ID: <Z7xHRAFE4-QEA6PO@ketchup> (raw)
In-Reply-To: <6ea8ac17-42c8-46fa-b970-77ba89de66c4@kernel.org>
On Sat, Feb 22, 2025 at 12:50:13PM +0100, Krzysztof Kozlowski wrote:
> On 22/02/2025 11:48, Haylen Chu wrote:
> > On Sat, Feb 22, 2025 at 10:59:09AM +0100, Krzysztof Kozlowski wrote:
> >> On 22/02/2025 00:40, Alex Elder wrote:
> >>> I have a general proposal on how to represent this, but I'd
> >>> like to know whether it makes sense. It might be what Krzysztof
> >>> is suggesting, but in any case, I hope this representation would
> >>> work, because it could simplify the code, and compartmentalizes
> >>> things.
> >>>
> >>> Part of what motivates this is that I've been looking at the
> >>> downstream reset code this week. It contains a large number of
> >>> register offset definitions identical to what's used for the
> >>> clock driver. The reset driver uses exactly the same registers
> >>> as the clock driver does. Downstream they are separate drivers,
> >>> but the clock driver exports a shared spinlock for both drivers
> >>> to use.
> >>>
> >>> These really need to be incorporated into the same driver for
> >>> upstream.
> >>
> >> Why? First, it is not related to the topic here at all. You can design
> >> drivers as you wish and still nothing to do with discussion about binding.
> >> Second, different subsystems justify different drivers and Linux handles
> >> this well already. No need for custom spinlock - regmap already does it.
> >>
> >>
> >>>
> >>> The clock code defines four distinct "units" (a term I'll use
> >>> from here on; there might be a better name):
> >>> MPMU Main Power Management Unit
> >>> APMU Application Power Management Unit
> >>> APBC APB Clock
> >>> APBS APB Spare
> >>>
> >>> The reset code defines some of those, but doesn't use APBS.
> >>> It also defines three more:
> >>> APBC2 Another APB Clock
> >>> RCPU Real-time CPU?
> >>> RCPU2 Another Real-time CPU
> >>>
> >>> Each of these "units" has a distinct I/O memory region that
> >>> contains registers that manage the clocks and reset signals.
> >>
> >> So there are children - mpmu, apmu, apbclock, apbspare, apbclock2, rcpu
> >> 1+2? But previous statements were saying these are intermixed?
> >>
> >> " I'll make APMU/MPMU act as a whole device"
> >
> > My reply seems somehow misleading. The statement means I will merge the
> > children with the syscon into one devicetree node, which applies for
> > both APMU and MPMU. I wasn't going to say that APMU and MPMU are
> > intermixed.
> >
> > As Alex said, all these units have their own distinct and separate MMIO
> > regions.
> >
> >>>
> >>> I suggest a single "k1-clocks" device be created, which has
> >>
> >> For four devices? Or for one device?
> >
> > By Alex's example, I think he means a device node taking all these
> > distinct MMIO regions as resource.
>
>
> You still do not answer about the hardware: how many devices is there?
In my understanding, the series covers four devices, APBC, APMU, MPMU
and APBS, each comes with its separate MMIO region and is clearly
described in the datasheet. I stated this in the later part of the
reply,
> > For APBC, MPMU, APBS and APMU, I'm pretty
> > sure they're standalone blocks with distinct and separate MMIO regions,
> > this could be confirmed by the address mapping[1].
Thus I don't agree on Alex's solution, since it creates fake devices not
mentioned by the datasheet (spacemit,k1-clocks and all its children in
the example devicetree).
> >
> > clock {
> > compatible = "spacemit,k1-clocks";
> >
> > reg = <0x0 0xc0880000 0x0 0x2050>,
> > <0x0 0xc0888000 0x0 0x30>,
> > <0x0 0xd4015000 0x0 0x1000>,
> > <0x0 0xd4050000 0x0 0x209c>,
> > <0x0 0xd4090000 0x0 0x1000>,
> > <0x0 0xd4282800 0x0 0x400>,
> > <0x0 0xf0610000 0x0 0x20>;
> > reg-names = "rcpu",
> > "rcpu2",
> > "apbc",
> > "mpmu",
> > "apbs",
> > "apmu",
> > "apbc2";
> >
> > /* ... */
> > };
> >
> >> No, it's again going to wrong direction. I already said:
> >>
> >> "You need to define what is the device here. Don't create fake nodes ust
> >> for your drivers. If registers are interleaved and manual says "this is
> >> block APMU/MPMU" then you have one device, so one node with 'reg'."
> >>
> >> So what is the device here? Can you people actually answer?
> >>
> >
> > I'm not sure about the apbc2, rcpu and rcpu2 regions; they aren't
> > related to the thread, either. For APBC, MPMU, APBS and APMU, I'm pretty
> > sure they're standalone blocks with distinct and separate MMIO regions,
> > this could be confirmed by the address mapping[1].
>
> They were brought here to discuss for some reason. Long discussions,
> long emails, unrelated topics like hardware or different devices - all
> this is not making it easier for me to understand.
>
> Best regards,
> Krzysztof
By the way, I made a summary on the hardware covered by this series in
one of my earlier reply[1]. Could you please comment further on my
proposal[2] according it, or pointing out anything that's unclear or
missing? It will be helpful for things to improve.
Thanks,
Haylen Chu
[1]: https://lore.kernel.org/all/Z7m2oNXbwJ06KtLQ@ketchup/
[2]: https://lore.kernel.org/all/Z7BTVu10EKHMqOnJ@ketchup/
next prev parent reply other threads:[~2025-02-24 10:18 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-03 21:56 [PATCH v4 0/4] Add clock controller support for SpacemiT K1 Haylen Chu
2025-01-03 21:56 ` [PATCH v4 1/4] dt-bindings: clock: spacemit: Add clock controllers of Spacemit K1 SoC Haylen Chu
2025-01-04 9:58 ` Krzysztof Kozlowski
2025-01-15 7:29 ` Haylen Chu
2025-01-03 21:56 ` [PATCH v4 2/4] dt-bindings: soc: spacemit: Add spacemit,k1-syscon Haylen Chu
2025-01-04 10:07 ` Krzysztof Kozlowski
2025-02-11 5:15 ` Haylen Chu
2025-02-11 8:03 ` Krzysztof Kozlowski
2025-02-13 11:14 ` Haylen Chu
2025-02-13 18:07 ` Krzysztof Kozlowski
2025-02-15 8:41 ` Haylen Chu
2025-02-21 23:40 ` Alex Elder
2025-02-22 9:59 ` Krzysztof Kozlowski
2025-02-22 10:48 ` Haylen Chu
2025-02-22 11:50 ` Krzysztof Kozlowski
2025-02-24 10:17 ` Haylen Chu [this message]
2025-02-25 8:12 ` Krzysztof Kozlowski
2025-02-25 21:14 ` Alex Elder
2025-02-22 9:52 ` Krzysztof Kozlowski
2025-02-22 11:36 ` Haylen Chu
2025-01-03 21:56 ` [PATCH v4 3/4] clk: spacemit: Add clock support for Spacemit K1 SoC Haylen Chu
2025-01-16 5:25 ` Samuel Holland
2025-01-21 17:01 ` Haylen Chu
2025-02-14 4:04 ` Alex Elder
2025-02-16 11:34 ` Haylen Chu
2025-02-21 21:10 ` Alex Elder
2025-02-22 9:57 ` Haylen Chu
2025-02-22 9:40 ` Haylen Chu
2025-03-03 9:41 ` Haylen Chu
2025-03-03 14:10 ` Alex Elder
2025-01-03 21:56 ` [PATCH v4 4/4] riscv: dts: spacemit: Add clock controller for K1 Haylen Chu
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=Z7xHRAFE4-QEA6PO@ketchup \
--to=heylenay@4d2.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlan@gentoo.org \
--cc=elder@riscstar.com \
--cc=guodong@riscstar.com \
--cc=heylenay@outlook.com \
--cc=inochiama@outlook.com \
--cc=jszhang@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=unicornxdotw@foxmail.com \
--cc=zhangmeng.kevin@linux.spacemit.com \
/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;
as well as URLs for NNTP newsgroup(s).