From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89B22C54EB4 for ; Tue, 24 Jan 2023 08:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Z7BM7EMlenff5mSzDwK4Gt4cotyJ89HojTVZN4A6OsY=; b=UcqmD8Zq5txiTM IP+4EKeMOl5iAnelUy3BKIflhM5qS3M8mfqt9QlnJPtB4xPb8s3lXKzcDdPGYlK5M78mRdQh7TLTM osYubyZGh32L0v34OFAvAvOFg6SWlsQRSVt79urfluoFwooxttpBYvtTLK1BWC5PXtEVfxxAACOUc Bne1fn9sJ5KSBpTI+9aoiupB+Q9Mo3+ym50mJUrCKA5D1ywAtw1uRK1hcDcJDsqVyXrMRCOXPIWdj MA0TLe9K+a06570x9FyombjMGQw6M+iTIh5PRUjpWOyp22DN5XJfZ+VP+9xrrxmNQotzE98810S6j 2YcXMiuD1h9CIrLA+Iqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKEEP-002gQw-N0; Tue, 24 Jan 2023 08:00:37 +0000 Received: from sender4-op-o14.zoho.com ([136.143.188.14]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKEEH-002gP0-8Y for linux-arm-kernel@lists.infradead.org; Tue, 24 Jan 2023 08:00:30 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1674547182; cv=none; d=zohomail.com; s=zohoarc; b=SGeRpqUb/UpVpw5MIvNg/ttxmx+6Pu+9GzMy2XQfGXWrE0Ru6MZAyb7KxdSMFUWKcY/43++6qWYpVN9yN2xd1/QXO6ZDxpL8wiwJEErLkle2VSC9Hqt3nhUN8QdGxk8u7bkGP9ZWD+A1m8oLYruHLYdXnQGQx5V3+1iirAqzUdA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674547182; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=/fyEdHbRGpDWfMEi9dn8qZpRjYXX/Uzc+C+RYtUDkZU=; b=Yv3K8uJnzyr4axYNc2IKs6qiDgi5Xr73tmAPP142f03UdkJhx2igZWQoLbtDhJipLLFQTGz4PKKJ6s9aRmYSNaZVb43Rit99uCigtSxXDrwTDbN3E6QiU8RCmBpCCenvBGAqe86DKDB47S6PoPjlc1s16E5STKFzZ1FianiQ0cc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=linux.beauty; spf=pass smtp.mailfrom=me@linux.beauty; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1674547182; s=zmail; d=linux.beauty; i=me@linux.beauty; h=Date:Date:Message-ID:From:From:To:To:Cc:Cc:Subject:Subject:In-Reply-To:References:MIME-Version:Content-Type:Message-Id:Reply-To; bh=/fyEdHbRGpDWfMEi9dn8qZpRjYXX/Uzc+C+RYtUDkZU=; b=URNYEPcx5AjbBGkQupZzLgmTsXmhut5q3OXcQVl+bc0ACsjaRefNgmEIVk0G1pTO ttaBDRPc1U9xi3DGMMxBOO8LyAViJVw+U0ogS0NRkGrjNSuQkzZv7Fh1zrQGIP7mgDw WTqwDU0UgjzzwbrgqG1N2UWb9moMLzlbzEzSU+aY= Received: from lchen-xiaoxin.linux.beauty (122.96.40.54 [122.96.40.54]) by mx.zohomail.com with SMTPS id 1674547180315174.69971912538972; Mon, 23 Jan 2023 23:59:40 -0800 (PST) Date: Tue, 24 Jan 2023 15:58:53 +0800 Message-ID: <871qnkicsi.wl-me@linux.beauty> From: Li Chen To: "Arnd Bergmann" Cc: "Li Chen" , Heiko =?ISO-8859-1?Q?St=FCbner?= , "Lubomir Rintel" , "Conor.Dooley" , "Robert Jarzmik" , "Sven Peter" , "Yinbo Zhu" , "Brian Norris" , "Hitomi Hasegawa" , "open list" , "moderated list:ARM/Ambarella SoC support" Subject: Re: [PATCH 06/15] soc: add Ambarella driver In-Reply-To: <85b86d06-c63c-4481-a3dd-16b72572a5ee@app.fastmail.com> References: <20230123073305.149940-1-lchen@ambarella.com> <20230123073305.149940-7-lchen@ambarella.com> <85b86d06-c63c-4481-a3dd-16b72572a5ee@app.fastmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-ZohoMailClient: External X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230124_000029_398563_B191D408 X-CRM114-Status: GOOD ( 39.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Arnd, On Mon, 23 Jan 2023 16:29:06 +0800, Arnd Bergmann wrote: > > On Mon, Jan 23, 2023, at 08:32, Li Chen wrote: > > This driver add soc_id support for Ambarella, > > which is stored inside "cpuid" AXI address mapping. > > > > Also provide sys_config(POC, aka power on configuration) > > for other drivers. > > > > Signed-off-by: Li Chen > > The soc_id support looks ok > > > Change-Id: I4869a3497366ac7779e792835f8e0309239036a8 > > Please drop these lines in the submission, the IDs are > not reachable outside of your own git, so we don't want > these to show up in the public history. Sorry, I forgot to remove this. > > +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? > > +static int __init ambarella_socinfo_init(void) > > +{ > > + struct soc_device_attribute *soc_dev_attr; > > + struct soc_device *soc_dev; > > + struct device_node *np; > > + struct regmap *cpuid_regmap; > > + unsigned int soc_id; > > + > > + cpuid_regmap = syscon_regmap_lookup_by_compatible("ambarella,cpuid"); > > + if (IS_ERR(cpuid_regmap)) > > + return PTR_ERR(cpuid_regmap); > > Is there anything else in this syscon node? If the block > of registers only contains the identification bits, you > could just make this file a platform_driver that binds to > the node instead of using a syscon. > > 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". 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. 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. > > +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. > > +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, and rct_regmap is need to be updated here, like sys_config and soft reboot. So I think this rct regmap is still needed. > > +#ifndef __SOC_AMBARELLA_MISC_H__ > > +#define __SOC_AMBARELLA_MISC_H__ > > + > > +extern unsigned int ambarella_sys_config(void); > > +extern struct proc_dir_entry *ambarella_proc_dir(void); > > + > > The ambarella_proc_dir looks like a stale entry that should be > removed. Ideally you should not need a private header at all. Oops, my bad. I will remove proc dir in v2. Regards, Li _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel