mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Li Chen" <me@linux.beauty>
Cc: "Li Chen" <lchen@ambarella.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Lubomir Rintel" <lkundrak@v3.sk>,
	"Conor.Dooley" <conor.dooley@microchip.com>,
	"Robert Jarzmik" <robert.jarzmik@free.fr>,
	"Sven Peter" <sven@svenpeter.dev>,
	"Yinbo Zhu" <zhuyinbo@loongson.cn>,
	"Brian Norris" <briannorris@chromium.org>,
	"Hitomi Hasegawa" <hasegawa-hitomi@fujitsu.com>,
	"open list" <linux-kernel@vger.kernel.org>,
	"moderated list:ARM/Ambarella SoC support"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 06/15] soc: add Ambarella driver
Date: Tue, 24 Jan 2023 16:46:06 +0100	[thread overview]
Message-ID: <8e404cef-52fb-49a2-a91b-8e3c60407ddd@app.fastmail.com> (raw)
In-Reply-To: <871qnkicsi.wl-me@linux.beauty>

On Tue, Jan 24, 2023, at 08:58, Li Chen wrote:
> On Mon, 23 Jan 2023 16:29:06 +0800,
> Arnd Bergmann wrote:
>> On Mon, Jan 23, 2023, at 08:32, Li Chen wrote:
>> > +static struct ambarella_soc_id {
>> > +	unsigned int id;
>> > +	const char *name;
>> > +	const char *family;
>> > +} soc_ids[] = {
>> > +	{ 0x00483245, "s6lm",  "10nm", },
>> > +};
>>
>> I would suggest something more descriptive in the "family"
>> field to let users know they are on an Ambarella SoC.
>>
>> Maybe just "Ambarella 10nm".
>
> There is a "pr_info("Ambarella SoC %s detected\n", 
> soc_dev_attr->soc_id);" in this file,
> I think this should be enough, right?

The pr_info() can probably be removed here, or reworded
based on the changed contents, those are just meant for
humans reading through the log rather than parsed by
software.

The soc_id fields on the other hand need to be parsable
by scripts looking at the sysfs files, in a way that lets
them identify the system. Usually the script would look
at the "family" as the primary key before looking up the
"name", so you have to make sure that the family uniquely
identifies this as one of yours rather than a 10nm chip
from some other company.

>> If there are other unrelated registers in there, the compatible
>> string should probably be changed to better describe the
>> entire area based on the name in the datasheet.
>
> Yeah, this block is only used for identification bits. In datasheet,
> it is also named "CPU ID".

ok.

> Other than cpuid_regmap, this driver also looks for "model" name as soc 
> machine name:
> of_property_read_string(np, "model", &soc_dev_attr->machine);
>
> So I think it is not a good idea to conver it to into a platform driver.

I don't understand what you mean. A lot of soc_id drivers put
the model string into soc_dev_attr->machine, this makes no
difference here.

> As for "syscon", I think it is still very helpful to get regmap easily. 
> Generally speaking,
> I prefer regmap over void*, because it has debugfs support, so I can 
> get its value more easily.

What value would you get through debugfs that is not already in
the soc_device?

>> > +static unsigned int ambsys_config;
>> > +
>> > +unsigned int ambarella_sys_config(void)
>> > +{
>> > +	return ambsys_config;
>> > +}
>> > +EXPORT_SYMBOL(ambarella_sys_config);
>>
>> Which drivers use this bit? Can they be changed to
>> use soc_device_match() instead to avoid the export?
>
> sys_config is used by our nand and sd drivers. I also don't want to export,
> but struct soc_device_attribute/soc_device don't have private data to store it,
> I think there is no better way.

The nand and sd drivers should not rely on any private data
from another driver. What information do they actually
need here that is not already in their own DT nodes or
in the soc_device_attributes?

>> > +static int __init ambarella_soc_init(void)
>> > +{
>> > +	struct regmap *rct_regmap;
>> > +	int ret;
>> > +
>> > +	rct_regmap = syscon_regmap_lookup_by_compatible("ambarella,rct");
>> > +	if (IS_ERR(rct_regmap)) {
>> > +		pr_err("failed to get ambarella rct regmap\n");
>> > +		return PTR_ERR(rct_regmap);
>> > +	}
>> ...
>> > +arch_initcall(ambarella_soc_init);
>>
>> It is not an error to use a chip from another manufacturer,
>> please drop the pr_err() and return success here.
>
> Ok, good to know, thanks. But we don't have other manufacturers at 
> least for now,

I care a lot about supporting multiple SoC vendors, it would seem
very rude to assume that we stop supporting everything else after
merging Ambarella support.

> and rct_regmap is need to be updated here, like sys_config and soft 
> reboot. So I think this rct regmap is still needed.

It is certainly only needed on Ambarella SoCs, no other one
has this device at the moment.

      Arnd

  reply	other threads:[~2023-01-24 15:46 UTC|newest]

Thread overview: 53+ 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 02/15] dt-bindings: vendor-prefixes: add Ambarella prefix Li Chen
2023-01-23  8:02   ` Krzysztof Kozlowski
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
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-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
     [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 [this message]
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
     [not found] ` <20230123073305.149940-2-lchen@ambarella.com>
2023-01-23 11:52   ` [PATCH 01/15] debugfs: allow to use regmap for print regs Greg Kroah-Hartman
2023-01-23 13:47     ` Li Chen
     [not found] ` <20230123073305.149940-14-lchen@ambarella.com>
2023-01-23  8:13   ` [PATCH 13/15] dt-bindings: pinctrl: add support for Ambarella Krzysztof Kozlowski
2023-01-23 12:32   ` Linus Walleij
2023-01-28 10:05     ` 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=8e404cef-52fb-49a2-a91b-8e3c60407ddd@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=briannorris@chromium.org \
    --cc=conor.dooley@microchip.com \
    --cc=hasegawa-hitomi@fujitsu.com \
    --cc=heiko@sntech.de \
    --cc=lchen@ambarella.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkundrak@v3.sk \
    --cc=me@linux.beauty \
    --cc=robert.jarzmik@free.fr \
    --cc=sven@svenpeter.dev \
    --cc=zhuyinbo@loongson.cn \
    /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®