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 X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19339C433ED for ; Fri, 2 Apr 2021 19:38:04 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E50860BD3 for ; Fri, 2 Apr 2021 19:38:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E50860BD3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xg5sd+08t10Du2J4F2/h5SpcmlYETIOL0PUhuQJB97s=; b=qU4LsWJBoWDNdgrKUcvWlEA5w h8W98RedA5u/48nR5FCprsGMF41hyOqbkHghS+JHbqNu+DSZigttpz8yDpHKDa3CBijAZPWiRGmzv foGbAHmITNGTnHRKaoZyAowHbYZ36qQHrykoqzeDnCDVVcu4NGfeLOlQiUK0aJM6Fra0vRG6ck+ms 2Zbp0Zs1ivs1HDsMieyUErnMVdT9IpNkF1OZSW38SX1aepJsZWsb+tbBJSmiloXBl633UcR3Co3i3 TBq6Q6T6qBWkMNwkGsCee2hSWuvOBHcp5XwqjEJd8nrj4iuvyyhL+Gm0G58nGRQFxaL+fET8bhXG/ sv8r7T+Sg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lSPad-00DjTy-1P; Fri, 02 Apr 2021 19:36:19 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lSPaV-00DjTG-GC; Fri, 02 Apr 2021 19:36:13 +0000 Received: by mail-ed1-x534.google.com with SMTP id l18so6372580edc.9; Fri, 02 Apr 2021 12:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Xi+ZyJuMSLaDa1dKwITGdmUDXOKtDig9K+Jaf/axxfk=; b=tcfXhE6EL4zxR1dZRvSAuLtSWcX+tOCYimOzB6/Eb/iGOuK6e6O1dPHcuITeQ2FHzM H/JKxbFyTRwTb2QW4Ul6Bu+86bTNZQkomiw4+NFb3XwJD+96jjY4ulrr9JZ+FI6/kpBk LvfyRR4sE5dkevhMBE875Kr0YOTwIuG+RC9B5P+e0bbUc2ZZ6AcQCXTBcqVOwv2/fvKU QuA4pxAq2mNu3u+5mj/tZ71S/y6bm6Vq4LbCUfiJ0P8fSpyNiKYTfBg+H3EtJ+rmIO6x SiwIJyvXRRHhfiQeU+ehDeZDqgx8B71NSUyq+fbT7FgsGOqvmoCfO9tF2pdE8f6ggcZu qMTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Xi+ZyJuMSLaDa1dKwITGdmUDXOKtDig9K+Jaf/axxfk=; b=hbFumoyT/rkhts2idpIXIGtTa8WSx3h2BH5kBd/S7FDlzXSDZVZRMJG+L8UC8XuSm5 0j8HdW6p54cYTkybqSmcdWsjo5kn/45n13OUIaCOHCUSoBLAcuh71v4oufyVDC5OM3KB cHTA4ntow181F1bTaUrZtn4YB2jNXDuTfxBwQPihioYsBqSgefiPQxcUzW+TFcD4CDO/ rY/UjFpiVv6xcLSV0GUQnXSJZz6qdXkGrAGxL1rF/e9P7yDbR4A7DqNbMpg/FV8leaDY Y8WXDukBFtND8L0BXVAYh4+u5vzushsNrc98Z2ZyuMuWkorZmk5uVThH40fK0x7blEFO duFA== X-Gm-Message-State: AOAM533wfOHOewjL1QUykxadRuTu8zihbnUc9E0CzI8UQpEE04+5ymhI 47+20UMonO5JXztSvLESEus= X-Google-Smtp-Source: ABdhPJyjyvUkydVsh0G7xHKclDnoK9r6BF7X6k5qcAUwqSFMJdjGHxlj54UcTdFEVAHaWmzslcAtTw== X-Received: by 2002:aa7:dd05:: with SMTP id i5mr16979097edv.300.1617392170896; Fri, 02 Apr 2021 12:36:10 -0700 (PDT) Received: from BV030612LT ([188.24.140.160]) by smtp.gmail.com with ESMTPSA id cw14sm6018205edb.8.2021.04.02.12.36.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Apr 2021 12:36:10 -0700 (PDT) Date: Fri, 2 Apr 2021 22:36:08 +0300 From: Cristian Ciocaltea To: Manivannan Sadhasivam Cc: Rob Herring , Andreas =?iso-8859-1?Q?F=E4rber?= , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/6] soc: actions: Add Actions Semi Owl socinfo driver Message-ID: <20210402193608.GB2052516@BV030612LT> References: <75ec4eff3e6113f4e72daa1b428c355b28005297.1617110420.git.cristian.ciocaltea@gmail.com> <20210402181624.GC31906@thinkpad> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210402181624.GC31906@thinkpad> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210402_203611_653235_76A9842D X-CRM114-Status: GOOD ( 35.69 ) 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 On Fri, Apr 02, 2021 at 11:46:24PM +0530, Manivannan Sadhasivam wrote: > On Tue, Mar 30, 2021 at 04:48:18PM +0300, Cristian Ciocaltea wrote: > > The driver provides information about the Action Semi Owl family of > > SoCs (S500, S700 and S900) to user space via sysfs: machine, family, > > soc_id, serial_number. > > > > Note the serial number is currently provided only for the S500 SoC > > variant. > > > > Signed-off-by: Cristian Ciocaltea > > --- > > drivers/soc/actions/Kconfig | 8 + > > drivers/soc/actions/Makefile | 1 + > > drivers/soc/actions/owl-socinfo.c | 152 ++++++++++++++++++ > > include/linux/soc/actions/owl-serial-number.h | 20 +++ > > 4 files changed, 181 insertions(+) > > create mode 100644 drivers/soc/actions/owl-socinfo.c > > create mode 100644 include/linux/soc/actions/owl-serial-number.h > > > > diff --git a/drivers/soc/actions/Kconfig b/drivers/soc/actions/Kconfig > > index 1aca2058a40c..15faade9282d 100644 > > --- a/drivers/soc/actions/Kconfig > > +++ b/drivers/soc/actions/Kconfig > > @@ -14,4 +14,12 @@ config OWL_PM_DOMAINS > > power-gating on Actions Semiconductor S500, S700 and S900 SoCs. > > If unsure, say 'n'. > > > > +config OWL_SOCINFO > > + bool "Actions Semi Owl SoC info driver" > > + default ARCH_ACTIONS > > + select SOC_BUS > > + help > > + Say 'y' here to support the Action Semiconductor Owl socinfo > > Actions Semi > > > + driver, providing information about the SoC to user space. > > + > > endif > > diff --git a/drivers/soc/actions/Makefile b/drivers/soc/actions/Makefile > > index 4db9e7b050e5..4b2591d3089f 100644 > > --- a/drivers/soc/actions/Makefile > > +++ b/drivers/soc/actions/Makefile > > @@ -2,3 +2,4 @@ > > > > obj-$(CONFIG_OWL_PM_DOMAINS_HELPER) += owl-sps-helper.o > > obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o > > +obj-$(CONFIG_OWL_SOCINFO) += owl-socinfo.o > > diff --git a/drivers/soc/actions/owl-socinfo.c b/drivers/soc/actions/owl-socinfo.c > > new file mode 100644 > > index 000000000000..f28eafac3792 > > --- /dev/null > > +++ b/drivers/soc/actions/owl-socinfo.c > > @@ -0,0 +1,152 @@ > > [...] > > > + * Access SoC's serial number stored by the bootloader in DDR memory. > > + */ > > +static int owl_socinfo_read_serial_rmem(struct device *dev) > > +{ > > + struct reserved_mem *rmem; > > + struct device_node *np; > > + int ret = 0; > > + > > + np = of_find_compatible_node(NULL, NULL, "actions,owl-soc-serial"); > > + if (!np) > > + return -ENXIO; > > + > > + rmem = of_reserved_mem_lookup(np); > > If you do this correctly, you could use "pdev->dev.of_node" here instead of > using "of_find_compatible_node()" for getting np. Right, as previously explained, my intention was to avoid binding the driver on the serial number node in order to keep it generic enough. > > + if (!rmem) { > > + dev_err(dev, "failed to acquire reserved memory region\n"); > > + ret = -EINVAL; > > + goto out_put; > > + } > > + > > [...] > > > +static const struct of_device_id owl_socinfo_of_match[] = { > > + { .compatible = "actions,s500-soc", .data = &s500_soc_info, }, > > + { .compatible = "actions,s700-soc", .data = &s700_soc_info, }, > > + { .compatible = "actions,s900-soc", .data = &s900_soc_info, }, > > Please don't add S700/S900 for now. I assumed we can use the driver for S700/S900, even though the serial number is not provided for them. > > + { } > > +}; > > + > > +static struct platform_driver owl_socinfo_platform_driver = { > > + .probe = owl_socinfo_probe, > > + .driver = { > > + .name = "owl-socinfo", > > + .of_match_table = owl_socinfo_of_match, > > + }, > > +}; > > + > > +static int __init owl_socinfo_init(void) > > +{ > > + return platform_driver_register(&owl_socinfo_platform_driver); > > +} > > +subsys_initcall(owl_socinfo_init); > > diff --git a/include/linux/soc/actions/owl-serial-number.h b/include/linux/soc/actions/owl-serial-number.h > > new file mode 100644 > > index 000000000000..f8595417668f > > --- /dev/null > > +++ b/include/linux/soc/actions/owl-serial-number.h > > @@ -0,0 +1,20 @@ > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > +/* > > + * Copyright (c) 2021 Cristian Ciocaltea > > + */ > > + > > +#ifndef __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ > > +#define __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ > > + > > +#if IS_ENABLED(CONFIG_OWL_SOCINFO) > > +u32 owl_get_soc_serial_low(void); > > +u32 owl_get_soc_serial_high(void); > > Where are these APIs used? This will be used by the Ethernet MAC driver to generate a stable address. Initially I used the global 'system_serial_{low,high}' variables to pass this information outside the driver, but that is not portable, i.e. only supported on ARM32, not ARM64. Thanks for the review, Cristi > Thanks, > Mani > > > +#else > > +static inline u32 owl_get_soc_serial_low(void) > > +{ return 0; } > > + > > +static inline u32 owl_get_soc_serial_high(void) > > +{ return 0; } > > +#endif /* CONFIG_OWL_SOCINFO */ > > + > > +#endif /* __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ */ > > -- > > 2.31.1 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel