Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1978220ybi; Thu, 18 Jul 2019 01:23:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmNmP8Z6ch1ML/V9zP4L8/cb1OpdNDUbXPEjv5IcdMv5Wv+L6/EL+6Tbg3VwsL+IFeDZVX X-Received: by 2002:a17:90a:80c4:: with SMTP id k4mr50180335pjw.74.1563438211810; Thu, 18 Jul 2019 01:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563438211; cv=none; d=google.com; s=arc-20160816; b=Ma1XWDik83faAuwfqgbuE5xPqSaehI+EMsZLS1CDjT3yIGzjrSCygFgO3egsK17Ytw rw0vaNwdWbyDYdetg/tIOaW1SQSLgCYEgddc7uN/1HTZuHgXgrw/PXAnMxt/Yv3VNj2o xeYR8a1Olx57eY7QaFyzeuhWgvmALJVB0ulgkWi57c733OJcYLnUpEyjYxAtYsAPYnJI XTo+Cu3kzLNBL1VOkQHPS64jM8sUx4mIKto6BG9XTNCqIWU5XzbgQ+AwluOWqx/4piQM tMLbo90AnAOijfn6lO2xfSBy+3WSpriGPxwvfLk510E6G7BISZuDvctDLLnRolZI1xrx MlVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Nl6X4p4lXG85ZlM1ptaVvIPE+1N1nxxzKwqnLGJ4yus=; b=FEdonDi3fyLBz0E6QS1yDhwTNw7Lt4EEArtceJyihYVSpfXgDbXm51U3J9GqnbFTyS 0mm+sLLKoittpOD5afZdrTi7Zkk5pax28GdGk1p/XDiPvAXXRTMwhkYfSaBlOQF4YDSG UYUeF5oxAprjclk7GN2HnPsNskUGVuFKwGX+F2vD0XpeVBxwI4Q2N5F83HEBewPSmZfH R3A8h3JskjnIOGJGpE7gjrYAzowAMG3eZLs7SLk0sU4ScweC/w27q3UVuDCGVBS01lG9 053zPAWgEd5VBYD3snobSHHCXM2gedtv4eoubWMwnGGyNZZ7U3ilbvywsGYNp6hKOcRH 5VQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KFLfokf7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si1757629pgj.437.2019.07.18.01.23.15; Thu, 18 Jul 2019 01:23:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KFLfokf7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389247AbfGRIWe (ORCPT + 99 others); Thu, 18 Jul 2019 04:22:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:46798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726000AbfGRIWd (ORCPT ); Thu, 18 Jul 2019 04:22:33 -0400 Received: from dragon (98.142.130.235.16clouds.com [98.142.130.235]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3A1A32173B; Thu, 18 Jul 2019 08:22:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563438153; bh=g4IuIvW9pxmuWhc4yVBUShOQ7C6dIX/1CpC97IThK1A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KFLfokf78OfrmVaEQ82oKyna3QYuK1PvnANlsbLTa+qRGtykWAWvvcCbmMyV85ut6 WFvLS2A/4SWlaVUtLc5HRoCWOLAjfm1OCtvQBZhSVEdtJWMDhva2rX4Q996k46K2eM L8MXo/fdx6oytGFxjHN5iFZGPRaIHRgDcnG4moPQ= Date: Thu, 18 Jul 2019 16:22:17 +0800 From: Shawn Guo To: Anson.Huang@nxp.com, Marco Felsch Cc: s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, aisheng.dong@nxp.com, abel.vesa@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linux-imx@nxp.com Subject: Re: [PATCH V3] soc: imx-scu: Add SoC UID(unique identifier) support Message-ID: <20190718082216.GO3738@dragon> References: <20190702074545.48267-1-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190702074545.48267-1-Anson.Huang@nxp.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 02, 2019 at 03:45:45PM +0800, Anson.Huang@nxp.com wrote: > From: Anson Huang > > Add i.MX SCU SoC's UID(unique identifier) support, user > can read it from sysfs: > > root@imx8qxpmek:~# cat /sys/devices/soc0/soc_uid > 7B64280B57AC1898 > > Signed-off-by: Anson Huang > Reviewed-by: Daniel Baluta @Marco, are you happy with it? Shawn > --- > Change since V2: > - The SCU FW API for getting UID does NOT have response, so we should set > imx_scu_call_rpc()'s 3rd parameter as false and still can check the returned > value, and comment is no needed any more. > --- > drivers/soc/imx/soc-imx-scu.c | 39 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) > > diff --git a/drivers/soc/imx/soc-imx-scu.c b/drivers/soc/imx/soc-imx-scu.c > index 676f612..50831eb 100644 > --- a/drivers/soc/imx/soc-imx-scu.c > +++ b/drivers/soc/imx/soc-imx-scu.c > @@ -27,6 +27,40 @@ struct imx_sc_msg_misc_get_soc_id { > } data; > } __packed; > > +struct imx_sc_msg_misc_get_soc_uid { > + struct imx_sc_rpc_msg hdr; > + u32 uid_low; > + u32 uid_high; > +} __packed; > + > +static ssize_t soc_uid_show(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + struct imx_sc_msg_misc_get_soc_uid msg; > + struct imx_sc_rpc_msg *hdr = &msg.hdr; > + u64 soc_uid; > + int ret; > + > + hdr->ver = IMX_SC_RPC_VERSION; > + hdr->svc = IMX_SC_RPC_SVC_MISC; > + hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID; > + hdr->size = 1; > + > + ret = imx_scu_call_rpc(soc_ipc_handle, &msg, false); > + if (ret) { > + pr_err("%s: get soc uid failed, ret %d\n", __func__, ret); > + return ret; > + } > + > + soc_uid = msg.uid_high; > + soc_uid <<= 32; > + soc_uid |= msg.uid_low; > + > + return sprintf(buf, "%016llX\n", soc_uid); > +} > + > +static DEVICE_ATTR_RO(soc_uid); > + > static int imx_scu_soc_id(void) > { > struct imx_sc_msg_misc_get_soc_id msg; > @@ -102,6 +136,11 @@ static int imx_scu_soc_probe(struct platform_device *pdev) > goto free_revision; > } > > + ret = device_create_file(soc_device_to_device(soc_dev), > + &dev_attr_soc_uid); > + if (ret) > + goto free_revision; > + > return 0; > > free_revision: > -- > 2.7.4 >