Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp760298ybd; Wed, 26 Jun 2019 05:43:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZ3qOM2YFzc5jmzW6DdGAwyWDykiVaPNw68O8c5dAcs3WboEi4S9+/qgb3UgnHm7hIwYeT X-Received: by 2002:a17:90a:360c:: with SMTP id s12mr4654890pjb.30.1561552998303; Wed, 26 Jun 2019 05:43:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561552998; cv=none; d=google.com; s=arc-20160816; b=nCod81JXBKCpyIkXSDob7WOCfKKY1M9Jx3I/OUK4Hzmhp4HPXmG5Ys/Xoo5BGmjIMm aQzYH0Ao1H6e6NRnWVMLHkn9Ffe24aLRjZS60sVMu1Xqgom2ZyKY0XrvKS5aF90ZNjFg ABIToAplOyQTZ5RGoFE5GnlEX/20EvwfwDObLI/JI7UQJoSshE4ScFO1Yw0k/55sizO1 mZDPdcfTpfRef9wanu8h8aYifTaWL4GO1/oB3il4QjB5z+P0Cr1LPZyS3c/1IS7nIaok ODOws506Ynvo7Vs9wNflbLXpsKqAlbeXJgJIgwhaldALweUmUf+fZ3TMGTOr0dR2vdID 8wLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/89S57mpuhANqW7P0SQuk594h6BbB5jqPDSQ9Ds3jmA=; b=Pz8LamYW9MSyDGwMCvwbOLfdEgFiNriCkR0vbaHXAhARMbBs5o1ybj57lWo13BHUjS 3XYh50IspGj0b6G/NaYgZBD1WbySwry+z3fO4T/xZCNXg9ucyepfGyWAKmUK+OIHXkA0 q5+5C0evru9BaCJLGmpfm11bL25UILGT+ExiQhxKqBz7/+DCGsgK4EUBYerG4PZqWzCl 3nmXgTWFFwkP/BcOI3zNllqB8gyT4zUNPrzHDavM6BzABtXNiADiKAx7W6dNlCFBVOue v5ci+3ehrQMYghY+TYGLSvwGxS/yG6Sz8gui051ox7p4lWEIf3WwQcAhsatu9OA4RVAD F9/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=telupOue; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1si1924178pju.84.2019.06.26.05.43.00; Wed, 26 Jun 2019 05:43:18 -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=@gmail.com header.s=20161025 header.b=telupOue; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727468AbfFZMmI (ORCPT + 99 others); Wed, 26 Jun 2019 08:42:08 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:38099 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbfFZMmI (ORCPT ); Wed, 26 Jun 2019 08:42:08 -0400 Received: by mail-wm1-f65.google.com with SMTP id s15so1952625wmj.3 for ; Wed, 26 Jun 2019 05:42:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/89S57mpuhANqW7P0SQuk594h6BbB5jqPDSQ9Ds3jmA=; b=telupOueO49ezANV6MQ9EP6YOmXIXr3OEqq4W2xMbkHOazxjKzw6L5r+7c3baP7aQw Dy0tp1ggBs4bVBadpnGIQ9dkM+WLRGom/doa5TEgaRI2VYef8ZRiytfaVUaTg0G4BUzk 0BbUel2tFKFOJ/xiwl2uTdiG1JgTb0beJ65TZRC+iDFzCizZ+mmDIQ77RutpM4d5mIC2 1ygaaz5tnB7cv3SUQV0+W5NbCbzdpp/uc+FY51Dg6cGyY7geNRpWjX/Zxu+jj2xwhgoo 4ub8y+pd1gCHMlwMy0SGFnSpG5VQMMbPdbx02mkw+e/jRv26oy7C4WlaZUjet4Za+u0Z avfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/89S57mpuhANqW7P0SQuk594h6BbB5jqPDSQ9Ds3jmA=; b=LlegymJm82vfgBmysYS1byaTw6YJbDcIAjFJbIC2MDaN4MoOG9b2omTxqksrrl0s35 AjtO4o+NKc8gCgYUE855QWFk9ze5HOSr09ahetqbgTSF0CTB/s7wBfYfOiatfLrjrT9t IuJKfiNFYdUa3a18cLodK8lDso8Yw11LYJ50Pxprp8Yf/hQa7pMQexYdyndfvMZtc9rm z1WbBZOYO8dKmDzv/3KyHSl0ImXuiiTFkQ2g4CFRS8Fp1MQsjuSBgsmnsXKhiQz3IQkU jfQ/KxZs7EdXaPdJBY5p1b7lCjrTSO/bJcTMsNZC6p6p4H/VJ4V5hAbleib57vms5FH4 J/Hw== X-Gm-Message-State: APjAAAUjwuCnzSccmG6sDIWwkWZ+0nsyEXVOWe3pvoK7/ZwLK1TZ/o8L vZRXlu4lrTD6uzvPN9C72OkSC8Nt7eBr0GFMcd8= X-Received: by 2002:a7b:c051:: with SMTP id u17mr2584418wmc.25.1561552926103; Wed, 26 Jun 2019 05:42:06 -0700 (PDT) MIME-Version: 1.0 References: <20190626070706.24930-1-Anson.Huang@nxp.com> In-Reply-To: <20190626070706.24930-1-Anson.Huang@nxp.com> From: Daniel Baluta Date: Wed, 26 Jun 2019 15:41:54 +0300 Message-ID: Subject: Re: [PATCH] soc: imx-scu: Add SoC UID(unique identifier) support To: Anson Huang Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Aisheng Dong , Abel Vesa , linux-arm-kernel , Linux Kernel Mailing List , dl-linux-imx , Daniel Baluta Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 26, 2019 at 10:06 AM 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 > --- > drivers/soc/imx/soc-imx-scu.c | 35 +++++++++++++++++++++++++++++++++++ > 1 file changed, 35 insertions(+) > > diff --git a/drivers/soc/imx/soc-imx-scu.c b/drivers/soc/imx/soc-imx-scu.c > index 676f612..8d322a1 100644 > --- a/drivers/soc/imx/soc-imx-scu.c > +++ b/drivers/soc/imx/soc-imx-scu.c > @@ -27,6 +27,36 @@ 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; > + > + hdr->ver = IMX_SC_RPC_VERSION; > + hdr->svc = IMX_SC_RPC_SVC_MISC; > + hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID; > + hdr->size = 1; > + > + /* the return value of SCU FW is in correct, skip return value check */ Why do you mean by "in correct"? > + imx_scu_call_rpc(soc_ipc_handle, &msg, true); > + > + soc_uid = msg.uid_high; > + soc_uid <<= 32; > + soc_uid |= msg.uid_low; > + > + return sprintf(buf, "%016llX\n", soc_uid); snprintf? > +} > + > +static DEVICE_ATTR_RO(soc_uid); > + > static int imx_scu_soc_id(void) > { > struct imx_sc_msg_misc_get_soc_id msg; > @@ -102,6 +132,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 >