lkml.org 
[lkml]   [2020]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC PATCH v2 3/3] soc: sprd: Add Spreadtrum special bits updating support
On Thu, Apr 16, 2020 at 3:49 PM Baolin Wang <baolin.wang7@gmail.com> wrote:

>
> OK, I think adding a Spreadtrum compatible string will be an easy and
> clear way, so what about below sample code?
>
> DT:
> ap_ahb_regs: syscon@20210000 {
> compatible = "sprd,sc9860-syscon", "syscon";
> reg = <0 0x20210000 0 0x10000>;
> };
>
> /* The Spreadtrum syscon need register a real physical regmap bus with
> new bits updating method. */
> if (of_device_is_compatible(np, "sprd,sc9860-syscon") && syscon_phy_regmap_bus)
> regmap = regmap_init(NULL, syscon_phy_regmap_bus, base, &syscon_config);
> else
> regmap = regmap_init_mmio(NULL, base, &syscon_config);

Ok, sounds good. Maybe also define another compatible string that
is more generic than "sprd,sc9860-syscon" (but less generic than
"syscon") so you can still identify the chip specific syscon area if
necessary, while not having to list each future chip individually.

Something like

compatible = "sprd,sc9860-syscon", "sprd,atomic-syscon", "syscon";

Also I'd add an IS_ENABLED() check so it gets the 'else' path
at compile-time when CONFIG_ARCH_SPRD is disabled.

Arnd

\
 
 \ /
  Last update: 2020-04-16 16:39    [W:0.890 / U:0.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site