From: Li Chen <me@linux.beauty>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Li Chen <lchen@ambarella.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
"moderated list:ARM/Ambarella SoC support"
<linux-arm-kernel@lists.infradead.org>,
"open list:COMMON CLK FRAMEWORK" <linux-clk@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH 07/15] dt-bindings: clock: Add Ambarella clock bindings
Date: Wed, 25 Jan 2023 21:40:19 +0800 [thread overview]
Message-ID: <87sffyhgvw.wl-me@linux.beauty> (raw)
In-Reply-To: <ec9fc589-2612-3315-3550-83b68bead926@linaro.org>
On Wed, 25 Jan 2023 20:14:16 +0800,
Hi Krzysztof,
Krzysztof Kozlowski wrote:
>
> On 25/01/2023 13:06, Li Chen wrote:
> >>> Feel free to correct me if you think this
> >>> is not a good idea.
> >>
> >> This is bad idea. Compatibles should be specific. Devices should not use
> >> syscons to poke other registers, unless strictly necessary, but have
> >> strictly defined MMIO address space and use it.
> >
> > Ok, I will convert syscon-based regmaps to SoC-specific compatibles and of_device_id->data.
> >
> > But I have three questions:
> >
> > 0. why syscon + offsets is a bad idea copared to specific compatibles?
>
> Specific compatibles are a requirement. They are needed to match device
> in exact way, not some generic and unspecific. The same with every other
> interface, it must be specific to allow only correct usage.
>
> It's of course different with generic fallbacks, but we do not talk
> about them here...
>
> > 1. when would it be a good idea to use syscon in device tree?
>
> When your device needs to poke one or few registers from some
> system-controller block.
>
> > 2. syscon VS reg, which is preferred in device tree?
>
> There is no such choice. Your DTS *must* describe the hardware. The
> hardware description is for example clock controller which has its own
> address space. If you now do not add clock controller's address space to
> the clock controller, it is not a proper hardware description. The same
> with every other property. If your device has interrupts, but you do not
> add them, it is not correct description.
Got it. But Ambarella hardware design is kind of strange. I want to add mroe
expalaination about why Ambarella's downstream kernel
use so much syscon in device trees:
For most SoCs from other vendors, they have seperate address space regions
for different peripherals, like
axi address space A: ENET
axi address space B: PCIe
axi address space B: USB
...
Ambarella is somewhat **different**, its SoCs have two system controllers regions:
RCT and scratchpad, take RCT for example:
"The S6LM system software
interacts with PLLs, PHYs and several other low-level hardware blocks using APB reset clock and test (RCT)
registers with a system-layer application programming interface (API).
This includes the setting of clock frequencies."
There are so many peripherals registers located inside RCT and scratchpad
(like usb/phy, gpio, sd, dac, enet, rng), and some peripherals even have no their
own modules for register definitions.
So most time(for a peripheral driver), the only differences between different
Ambarella SoCs are just the syscon(rct or scratchpad) offsets get changed.
I don't think such lazy hardware design is common in vendors other than ambarella.
If I switch to SoC-specific compatibles, and remove these syscon from device tree,
of_device_id->data may only contain system controller(rct or scratchpad) offset for many Ambarella drivers,
and ioremap/devm_ioremap carefully.
The question is: can upstream kernel accept such codes?
If yes, I will switch to SoC-specific compatibles and remove syscon without hesitation.
Regards,
Li
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-01-25 13:42 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-23 7:32 [PATCH 00/15] Ambarella S6LM SoC bring-up Li Chen
2023-01-23 7:32 ` [PATCH 05/15] arm64: Kconfig: Introduce CONFIG_ARCH_AMBARELLA Li Chen
2023-01-23 8:32 ` Arnd Bergmann
[not found] ` <20230123073305.149940-4-lchen@ambarella.com>
2023-01-23 8:03 ` [PATCH 03/15] dt-bindings: arm: ambarella: Add binding for Ambarella ARM platforms Krzysztof Kozlowski
2023-01-23 13:58 ` Li Chen
[not found] ` <20230123073305.149940-5-lchen@ambarella.com>
2023-01-23 8:07 ` [PATCH 04/15] dt-bindings: arm: add support for Ambarella SoC Krzysztof Kozlowski
2023-01-23 15:09 ` Li Chen
2023-01-23 15:52 ` Krzysztof Kozlowski
[not found] ` <20230123073305.149940-8-lchen@ambarella.com>
2023-01-23 8:11 ` [PATCH 07/15] dt-bindings: clock: Add Ambarella clock bindings Krzysztof Kozlowski
2023-01-25 9:28 ` Li Chen
2023-01-25 9:55 ` Krzysztof Kozlowski
2023-01-25 12:06 ` Li Chen
2023-01-25 12:14 ` Krzysztof Kozlowski
2023-01-25 13:40 ` Li Chen [this message]
2023-01-26 11:29 ` Krzysztof Kozlowski
2023-01-27 14:48 ` Li Chen
2023-01-27 15:08 ` Krzysztof Kozlowski
2023-01-28 9:42 ` Li Chen
2023-01-28 10:08 ` Krzysztof Kozlowski
2023-01-28 10:11 ` Li Chen
2023-02-06 11:28 ` Li Chen
2023-02-06 13:41 ` Krzysztof Kozlowski
2023-02-06 14:57 ` Li Chen
2023-02-08 10:27 ` Krzysztof Kozlowski
2023-01-27 15:11 ` Krzysztof Kozlowski
2023-01-28 9:45 ` Li Chen
[not found] ` <20230123073305.149940-10-lchen@ambarella.com>
2023-01-23 8:11 ` [PATCH 09/15] dt-bindings: serial: add support for Ambarella Krzysztof Kozlowski
2023-01-25 9:54 ` Li Chen
2023-01-25 9:56 ` Krzysztof Kozlowski
2023-01-28 9:22 ` Li Chen
[not found] ` <20230123073305.149940-12-lchen@ambarella.com>
2023-01-23 8:13 ` [PATCH 11/15] dt-bindings: mtd: Add binding " Krzysztof Kozlowski
[not found] ` <20230123073305.149940-14-lchen@ambarella.com>
2023-01-23 8:13 ` [PATCH 13/15] dt-bindings: pinctrl: add support " Krzysztof Kozlowski
2023-01-23 12:32 ` Linus Walleij
2023-01-28 10:05 ` Li Chen
[not found] ` <20230123073305.149940-16-lchen@ambarella.com>
2023-01-23 8:20 ` [PATCH 15/15] arm64: dts: ambarella: introduce Ambarella s6lm SoC Krzysztof Kozlowski
[not found] ` <20230123073305.149940-13-lchen@ambarella.com>
2023-01-23 8:32 ` [PATCH 12/15] mtd: nand: add Ambarella nand support Miquel Raynal
2023-01-23 8:39 ` [PATCH 00/15] Ambarella S6LM SoC bring-up Arnd Bergmann
2023-01-24 2:08 ` Bagas Sanjaya
2023-01-25 2:24 ` Li Chen
[not found] ` <20230123073305.149940-11-lchen@ambarella.com>
2023-01-23 9:50 ` [PATCH 10/15] serial: ambarella: add support for Ambarella uart_port Greg Kroah-Hartman
2023-01-23 9:51 ` Greg Kroah-Hartman
2023-01-25 10:01 ` Li Chen
[not found] ` <20230123073305.149940-7-lchen@ambarella.com>
2023-01-23 8:29 ` [PATCH 06/15] soc: add Ambarella driver Arnd Bergmann
2023-01-24 7:58 ` Li Chen
2023-01-24 15:46 ` Arnd Bergmann
2023-01-29 7:21 ` Li Chen
2023-01-23 11:48 ` Conor.Dooley
2023-01-24 8:27 ` Li Chen
2023-01-24 8:46 ` Conor.Dooley
2023-01-24 14:24 ` Li Chen
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=87sffyhgvw.wl-me@linux.beauty \
--to=me@linux.beauty \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lchen@ambarella.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@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;
as well as URLs for NNTP newsgroup(s).