From patchwork Thu Feb 4 21:44:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1436314 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=secospa.onmicrosoft.com header.i=@secospa.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-secospa-onmicrosoft-com header.b=BVO4Si8A; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DWsXF6FBPz9sWw for ; Fri, 5 Feb 2021 08:44:45 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AEED98269C; Thu, 4 Feb 2021 22:44:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=secospa.onmicrosoft.com header.i=@secospa.onmicrosoft.com header.b="BVO4Si8A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A55AF8293B; Thu, 4 Feb 2021 22:44:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02on0609.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe05::609]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 01F7B827C5 for ; Thu, 4 Feb 2021 22:44:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sean.anderson@seco.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UoI6qUppJd11tvyYNo5YI6JQxgdwyt51/Iu6kfpiRzz7wgbEPLoFkHyKS31s+wWlLjOGA5YYV3b+ouAyMDbj2NyzGl8lL5Ypw8zq9xRVN0dQ9il5oGOzEP1KbwNnAcAMtXuuYse7BjhXN9+duZsUEtjhc4FxM2O0ygFF+lY9YbvFb1avt99T46fwb5SfpjNiP/fjuQEhZjFKl0Gz6VBStdJwovMj+YFZOMPiMFuB8BPWToj+QLablfUkjF9S2k94xQy0Woi47ajqd6et8GKDJQE56Zg7yt2YNKcHYIdpOS0Iy4DlNoXRJ1RCTETdNeEKew75Ae+u5rM6aa+p0pneDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xcQtAAR2P5SxNW25ATZ2bSApGa6QSu8WT13sBSM1R6c=; b=e9BHOVf2yzdvZxo2FOraqBwVzF6vvaWj966uJQbWLFDT8GHeTvSd20GdVa+AJk/G8PmG33I5hShikwcVCZsqkCNwRdbV4uA9d2xugU8YuaLUA3qIZwGwptwvF/ymLiMUoPbmzXBByaUnfAdyF5puwSPq1/0aQt9eTWeAbVT+4b5VRT+2uvim76ISel5iCv7/Hgfv4ktaSk3TM+1Er6VWft+ytFN+guQVwmJwwvgfaU5HaSiS3ymXieOQg9bCJc2wVuRvxKQ7a8ytgUmT3JkYwcYKzcTWIi8dcbPb61/4AFbp1hZ02Q7OvkAePEMeTFKs4J8ge4cy5JOpdP/vh8+ylQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xcQtAAR2P5SxNW25ATZ2bSApGa6QSu8WT13sBSM1R6c=; b=BVO4Si8ATzV9BmCtR8FB0YQ846UWv5bsi0dni/081cTPPz+9xFiUXWPllx3qxD9y4LqyBWpuwMIWWZQwj6le0t9W1DdeTIhM3oDIQDOhiTfij5VqW9BNnmr99KdcQ7i5D8umq/JHRNzf5jeUxmyyPBQSP8D2bApTKyDo2e+I7Do= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=seco.com; Received: from AM9PR03MB7251.eurprd03.prod.outlook.com (2603:10a6:20b:26e::16) by AM0PR03MB5812.eurprd03.prod.outlook.com (2603:10a6:208:158::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.19; Thu, 4 Feb 2021 21:44:35 +0000 Received: from AM9PR03MB7251.eurprd03.prod.outlook.com ([fe80::a8f2:7dd:46e5:8526]) by AM9PR03MB7251.eurprd03.prod.outlook.com ([fe80::a8f2:7dd:46e5:8526%6]) with mapi id 15.20.3825.019; Thu, 4 Feb 2021 21:44:34 +0000 From: Sean Anderson To: u-boot@lists.denx.de, uboot-imx@nxp.com Cc: Fabio Estevam , Simon Glass , Heinrich Schuchardt , Stefano Babic , Jorge Ramirez-Ortiz , Sean Anderson , Tom Rini Subject: [PATCH v2] ARM: mx6: Add function to set serial# Date: Thu, 4 Feb 2021 16:44:22 -0500 Message-Id: <20210204214422.1701664-1-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 X-Originating-IP: [50.195.82.171] X-ClientProxiedBy: BL0PR02CA0113.namprd02.prod.outlook.com (2603:10b6:208:35::18) To AM9PR03MB7251.eurprd03.prod.outlook.com (2603:10a6:20b:26e::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from plantagenet.inhand.com (50.195.82.171) by BL0PR02CA0113.namprd02.prod.outlook.com (2603:10b6:208:35::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.17 via Frontend Transport; Thu, 4 Feb 2021 21:44:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9cd768eb-c7fe-4aff-af44-08d8c9560f9c X-MS-TrafficTypeDiagnostic: AM0PR03MB5812: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KeBXgORP/kOgVtsujF6IGI1Lu38qwhbgn/8O8BeU1Ij5dgAdQFDo9IyljTArNwSi8FCPQPUcna8D8Lwt/AWmCbR8iKGeltl6rrw9rk21JQHcDFbnRib/8PJ2DmCwpq/VXacxr0Kj94BYZwrLLH4Has8PKa2sLQJVCz0bIraDZOj2P82KPPOtioq9xvDR6sbNsgSwmitrmNWvoFhqFq49kSin5Oi8q/KjYR3BTMp2/jInZPpl+s1hKrMcSecLh8IkHh/t7htq/1U75YEd/4XqR4+qaUzdBmGW2/g1qfZLh+tkmabLI6LVTSxgDjlKAd47aJTNvL1SVX510fzDVQZe6lB5M6IyLstZDXZR/liKhrj5rSkBZgErDHileqBj9+3mM9XmOtCxx5rTHlHT1TRYA4ZwDYCd1IG1ecVcNDCZ/Mk0RDx9w/L/s1m1ofA7fn9uunsSRmPwBwrtPcZJzL73Cjm8ykw+3WZD5W+oDUPg3d26Y7qa7A+y2j/5UAmEOFPrqAg9Aeg8gAb3cbbHYMSfyQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR03MB7251.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(396003)(376002)(136003)(346002)(39840400004)(956004)(83380400001)(478600001)(5660300002)(2616005)(186003)(44832011)(6486002)(52116002)(8676002)(54906003)(2906002)(316002)(6666004)(26005)(16526019)(36756003)(66556008)(66476007)(66946007)(6512007)(6506007)(4326008)(8936002)(1076003)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: TG6wFLS1hTivPWyJa4p5dSUOSyEbRBrlOWJSz4cL2lijrSrxx5MIbA68ngX9jh6aWBVAOzAnxFFnuXwL5GkLib6aFOe6plhMzVx7bd7hpEzSs13tazInszR4E4ccECZT88Ovk6QDZYKKk4Au1YrxJu6AbEnu/7d5YDVrkbeQEtANiOr8RpEfCPrLCL9eZUO0jMZIKgoLFk2Gh4ji7YOsz1a994jRTjP4S3Qvu7+pyFUBdDrMxSOvUe9gXC81cQZojAGnNMyL/fYKNjlNtDEw2vDHiD9HdDK6NGB3yrmlyn+Mt1p5d/UPotxBW4kBhOxJWNeoNZXfCJFajphZXRSHmp3cjAD/lf2Fk0ywgPgE/EO6yylQZOLojJxCkGyYT7wdVOZD2uPuo7cfbRNI4Aw89u4Zu76IsY5B6EdgT8fnOQZzk0jeSBA+77tQURFpgFgUTmAFC8csxjT/QqIuOVvUbEWlJZ6XWcAG9j3UOrQXL7vZPuJmvl3KiLHUHZDqpDI1ip81peuGHIqrHMtLRR5F2jSJyteNfCHj+UpuGh2vPKLl0tyNRXRSpypc7jtgVtDk8fpadAAGDjFpigz1StCSB6ltYfzIZaJ8EZ0AXHZ+RJR6ieA4GCAsnrLwduE4ImI1hynRhjKY8XkbfEa55okHmtEXpDbgKkciH2ekAsX6GAKmpK72XDdAU/21PMeBo9uoxFCO+vCtHoGcInOEvcFNAHfxGq+IfrZxcGCgNee8Pe9zjXsFN04titCFY3VAHH1X+5wsEEK0VQie1qgxfpxYelxYd/pOPSQ3w3xt89Fyys0lrA75rFyZYqbEATSWx3DPPwAlJK3o5t7YD0S0bDDL8035PMDrrVgY3QuivCZdiLstHXDhUX1IADJth+7iVxShWPmLCJmKrFy109a8RIFM5lSvW8V5yaxT7n05nmwmgRxk1vlO8DfsR2NmOHmIobbhR97LfgGiKU2y+R99NZ+k90bB7iT468MQwmwNvmm1H9tOqUCfllUXM84Lld0X1OuHG7aW5w8tT3rEK6mstnavm2JqdHYB4qa0h3C/DH0fxF1Jq0Dand1B/OcuFCfcCS8P X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cd768eb-c7fe-4aff-af44-08d8c9560f9c X-MS-Exchange-CrossTenant-AuthSource: AM9PR03MB7251.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2021 21:44:34.0835 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /no5L4KcUgGpwlEikhgq4JTDmvlMv1bi/h08/qJFlj1h4HBNAs6ABDtCqVoFQ67ByQYmEaAg9AYCKyrtpxPE1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR03MB5812 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The serial number OTP is similar to the imx7 version, except that the register names are different. This also sets serial# directly, instead of providing board_get_serial. Signed-off-by: Sean Anderson Reviewed-by: Tom Rini --- Changes in v2: - Populate serial# directly and call this from arch_misc_init arch/arm/mach-imx/mx6/soc.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c index bf6dddfdc9..aacfc854a2 100644 --- a/arch/arm/mach-imx/mx6/soc.c +++ b/arch/arm/mach-imx/mx6/soc.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -696,11 +697,47 @@ void imx_setup_hdmi(void) #endif #ifdef CONFIG_ARCH_MISC_INIT +/* + * UNIQUE_ID describes a unique ID based on silicon wafer + * and die X/Y position + * + * UNIQUE_ID offset 0x410 + * 31:0 fuse 0 + * FSL-wide unique, encoded LOT ID STD II/SJC CHALLENGE/ Unique ID + * + * UNIQUE_ID offset 0x420 + * 31:24 fuse 1 + * The X-coordinate of the die location on the wafer/SJC CHALLENGE/ Unique ID + * 23:16 fuse 1 + * The Y-coordinate of the die location on the wafer/SJC CHALLENGE/ Unique ID + * 15:11 fuse 1 + * The wafer number of the wafer on which the device was fabricated/SJC + * CHALLENGE/ Unique ID + * 10:0 fuse 1 + * FSL-wide unique, encoded LOT ID STD II/SJC CHALLENGE/ Unique ID + */ +static void setup_serial_number(void) +{ + char serial_string[17]; + struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR; + struct fuse_bank *bank = &ocotp->bank[0]; + struct fuse_bank0_regs *fuse = + (struct fuse_bank0_regs *)bank->fuse_regs; + + if (env_get("serial#")) + return; + + snprintf(serial_string, sizeof(serial_string), "%08x%08x", + fuse->uid_low, fuse->uid_high); + env_set("serial#", serial_string); +} + int arch_misc_init(void) { #ifdef CONFIG_FSL_CAAM sec_init(); #endif + setup_serial_number(); return 0; } #endif