From patchwork Wed Oct 11 09:34:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik Rajput X-Patchwork-Id: 151296 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp460615vqb; Wed, 11 Oct 2023 04:17:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJdX7IqPFB4+936f1nICSvjLg5F3W6Keo+resryANAgWHlKH0sw6x63SmUAyztQLyim3FL X-Received: by 2002:a05:6a00:1d8f:b0:692:afaf:32b4 with SMTP id z15-20020a056a001d8f00b00692afaf32b4mr22467702pfw.0.1697023052978; Wed, 11 Oct 2023 04:17:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697023052; cv=pass; d=google.com; s=arc-20160816; b=rYZI+9qZgKI3vD/JO977RY4n0tbBudCkwtKy08g+hTjMlZwHWLBPSVjsQhu1SkQtUJ 2bt9m7TSc8e98vuaKNbvq9OL32g0toZSmo/uGdAT9U0hRPMgCeSF7FgCrV1TBw197ZBR zMj8XuR9J51iUgAR2uPHSlBuhOLtZcV7XVfYe+tQqJw/UM4Mihl9p19EK/MbLay+8vHu hdPwEBLvT4gP3Xq61GoCBliabM37pY40J1Vp+KnQR2rUK4rNKt54WTf+vQ7QKVnwYojm q7v5nXbviaGBERwCVc+z9wQbvuF1RJ20k6DlRxbSoP8tsYBYVGwl0tEWnJRUJhrlRHxY XJUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=FsiujWidagjOqhBsIWaguiqwB5mEQ8hqRjmjmWpKUgc=; fh=d8mWG3NQV2V/hyk7K09+X9SHeVkXjRhQql8E0ax2OHU=; b=zvWqxVWOsX2OGwGlcUwvOSsvqjsnS8xcAP+tULQ+j/M3eLGVnbzHm1veV023m/eXoy vZQ7ZFgWqcdn5Cg1bg+LLZQRo5ix8+5u6FYVNX9UbetEjQVH+cpbVSKpwYEIFaFdsVzv NCPd/JkFC2lC0NY6comkll0pHBM3fDDBJAqBPe0Q2O0IOVL7IULEOCGBeBHzpstm2QTL BmeU2jyHwzqUeN2SGD9O3suYKVw7vQV7CmbJouW67g8tocFaYoP6PvujjvXYhjVByBEu jYT9b+pr/zKhWSdh2OeFmOlX2j05qm5Lhl6H3iDT7s6Kvr7uMpb99RL6/rgAV5FQJdz8 kj1w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=WrXbry7I; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id p39-20020a056a0026e700b0068e47e5f221si10906969pfw.195.2023.10.11.04.17.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:17:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=WrXbry7I; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2EC45802BC0E; Wed, 11 Oct 2023 04:17:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234641AbjJKLRT (ORCPT + 18 others); Wed, 11 Oct 2023 07:17:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234796AbjJKLRL (ORCPT ); Wed, 11 Oct 2023 07:17:11 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2063.outbound.protection.outlook.com [40.107.237.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D41F10E; Wed, 11 Oct 2023 04:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=knrlJPkMCXmS3/S58/86J2FnPDcW4F98MLnMnADXG++gXcx0trb4krtlKElLqkBbQ0LfdI5lkF0KYMZQ6kaa4UIh5C5JEBUaVy0zbESPSv/xaGUXSpwqXE2cyixx5LAextmMGmY+qK3L2PF0t7BrPaKzkM9Pl+cJ4Ft0na1zH8ShVxBe4+AztN9Fq+ckumnlL86hv5/UqlKmi0qRaeAifxS/812zzXBS7S5m6CSlz+GwE9c4I86Hp6QF0GHa9OJUOOm+pv1tj6d2B4jDB9UdZad0yOEHrjWgPhhBuqVwrEevQdamElY7zACDw/6G4ITkxWpsS/YgYAIryRGBtmvhhQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FsiujWidagjOqhBsIWaguiqwB5mEQ8hqRjmjmWpKUgc=; b=It1gYCVAyYpyjoY5v5knXMP7GAJKCED1TRcZ4nsDdCrKJVaZ+Qhs6wBaCSRBaDttA40rKyMEMfWLvYEX96rwOz5amnPVgomsPW1EQocvA+0etge4nRk2RByWE4WxaDfxpEzNpkclrHAmrioIKBxCQM+rvg1Cf1hjGJem5bQS8Pnz+zLsZNNZH+tI4tNuHMHlAG3hfTXuhm5HJr8BI3F1CvTeDAKuz6B+tqbpstdeKYBSOPSSa5azq7iVxSxoDkhrneT9McJ4jK7T/0IC2+v//eqQB2/VDkQ4GgYsVis1aCPzBueB+Lss8P0ceANGiB0/mlpVsPFlI6oNS0oY2tDO8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FsiujWidagjOqhBsIWaguiqwB5mEQ8hqRjmjmWpKUgc=; b=WrXbry7IboRukKA75bPwu6U9j1Z25t8OWC4PNJuzg9oorxmqsiCgRxr4bhJRhSMFbHsuMpu9RR7h66iwtChLvDK2DUK1Zm4i3kGa39a6Xxn5jkjFWnoIfOMiM1EtMsbIVBC5wNIVNCry04nkupMmuQ/CLnobDCGLrCN2ReCgi/qP/qNhFKupns1C6qUhquifJM+HsBbkc1x6Bv/eEZ1hJ5K40j56ndShkSYIr63g42D+oX9pJXEUc2UZUMYQanWvMg4BDabcPH2gBTWroCksCGHzW2HE05TLFWsD6XO0YhclHIxWj9ewKDuF31+F8xGkxEoXhFTmrwQJhes62W9Wdw== Received: from DS7PR05CA0091.namprd05.prod.outlook.com (2603:10b6:8:56::12) by CH2PR12MB4054.namprd12.prod.outlook.com (2603:10b6:610:a6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.41; Wed, 11 Oct 2023 11:17:05 +0000 Received: from DS1PEPF00017099.namprd05.prod.outlook.com (2603:10b6:8:56:cafe::d5) by DS7PR05CA0091.outlook.office365.com (2603:10b6:8:56::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.28 via Frontend Transport; Wed, 11 Oct 2023 11:17:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS1PEPF00017099.mail.protection.outlook.com (10.167.18.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Wed, 11 Oct 2023 11:17:05 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:16:52 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:16:51 -0700 Received: from localhost.localdomain (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 11 Oct 2023 04:16:45 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 1/8] mm/util: Introduce kmemdup_array() to duplicate an array Date: Wed, 11 Oct 2023 15:04:05 +0530 Message-ID: <20231011093412.7994-2-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011093412.7994-1-kkartik@nvidia.com> References: <20231011093412.7994-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017099:EE_|CH2PR12MB4054:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c4edbb4-4a7b-49f0-af2f-08dbca4b99f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vvb/FlIwKidUBc0jPOY6Uw694zQgRhDyEu+bYGvNsOL4pT0oN588ZOXK5iI6a7FXIF9SWl5nyDGWJSWwxM53QtUylQmb6y+W4mtYBTiR20bn7Y1+ZV3PUcTnYNT4Y1y3R4eXEMqCKRPqIZhxpilonDQ0M489Yl909o4VyXNuUl6jud6L0r9sLhDmZbA6RrhWU9qRA5U0NOn9gkY66qTRAibovoxXXf2BfdQ0mv+A2hQGS1TKkyEjLYPoCRB3IJm7t68Eb4NKvrwhPoVC5b5SvcMFZyl5vehft1SWj5usE5jmDlrhLNyJUQe9e6S8EWelwD02+Kf9YvC9jrTqMLYlvbhA5LANHq0cdf0TZWWOUs+tGRERSyRHUEghr++685+P8eCzEvslD0A3LeWTO2+ctv7TzVF6/t1S1WZPu/mwGUWnaigG/ZuFind7n+rrYt4ENKuY0Wo4FnCL5CnD6Y7TBMFvznyzkjhr5Q9pK0tX6HrDiCF8WMJYPBRh3/phpAaxJE5tjXROqNeE/cXXVFQgIxunOnAECQvIc4K/AsxuXtAVRQDpCNzq08Z/bs9Xe9TG00pjYRDEu9N663AwD7bwGvSDCZN+vutF/3oW6r0e1Ccm1IjDFHgeB0rnPKN0QYiFdTov43T0/dgBFWQ2JflFwzrrGT1zXjKXBzFrwVesrhnnJnh3YOd44GnoDJuoWleBLl8F6mPVUKu3SoAuCP/p5/rqe6VnMxU1nFc3runKsWd9B2OiQowGxbI5hT4q/cp92DkvmPxB8F7cNj4D+HJNOP9EJyfBcKJxy5JffgDuvl79FP/3B2vfdNL5ViM4YS6f X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(136003)(376002)(396003)(39860400002)(346002)(230922051799003)(82310400011)(186009)(64100799003)(451199024)(1800799009)(40470700004)(46966006)(36840700001)(83380400001)(36860700001)(47076005)(26005)(6666004)(478600001)(41300700001)(70586007)(70206006)(110136005)(1076003)(426003)(2616005)(316002)(336012)(5660300002)(8936002)(921005)(356005)(8676002)(40460700003)(7636003)(2906002)(7416002)(82740400003)(40480700001)(36756003)(86362001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 11:17:05.5892 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c4edbb4-4a7b-49f0-af2f-08dbca4b99f3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017099.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4054 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:17:30 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779457644667689276 X-GMAIL-MSGID: 1779457644667689276 Introduce function kmemdup_array(), that will copy `n` number of elements from a given array `src` to `dst`. On success, kmemdup_array() returns 0 and copy the elements from `src` to newly allocated array `dst`, it also stores number of elements copied from `src` array to `dst_count` parameter. On failure, this returns a negative integer value containing the error value. Signed-off-by: Kartik --- include/linux/string.h | 2 ++ mm/util.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/linux/string.h b/include/linux/string.h index dbfc66400050..6245a7918b05 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -179,6 +179,8 @@ extern char *kstrndup(const char *s, size_t len, gfp_t gfp); extern void *kmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2); extern void *kvmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2); extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp); +extern int kmemdup_array(void **dst, size_t *dst_count, const void *src, size_t element_size, + size_t count, gfp_t gfp); extern char **argv_split(gfp_t gfp, const char *str, int *argcp); extern void argv_free(char **argv); diff --git a/mm/util.c b/mm/util.c index 6eddd891198e..a7c87a119be1 100644 --- a/mm/util.c +++ b/mm/util.c @@ -135,6 +135,40 @@ void *kmemdup(const void *src, size_t len, gfp_t gfp) } EXPORT_SYMBOL(kmemdup); +/** + * kmemdup_array - duplicate a given array. + * + * @dst: reference to the pointer to store address of duplicated array. + * @dst_count: number of elements in the duplicated array. + * @src: array to duplicate. + * @element_size: size of each element of array. + * @count: number of elements to duplicate from array. + * @gfp: GFP mask to use. + * + * Return: Returns 0 on success, on failure this returns a negative error value. + */ +int kmemdup_array(void **dst, size_t *dst_count, const void *src, size_t element_size, size_t count, + gfp_t gfp) +{ + size_t size; + + *dst_count = 0; + + if (!src || !element_size || !count) + return -EINVAL; + + size = size_mul(element_size, count); + + *dst = kmemdup(src, size, gfp); + if (*dst) + return -ENOMEM; + + *dst_count = size / element_size; + + return 0; +} +EXPORT_SYMBOL(kmemdup_array); + /** * kvmemdup - duplicate region of memory * From patchwork Wed Oct 11 09:34:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik Rajput X-Patchwork-Id: 151295 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp460593vqb; Wed, 11 Oct 2023 04:17:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRLt3dt8zMqPAKASaGAHkZObYJJ8qjSMSkqh0HxE8E4TG7HaIKtLbgvpByTH6u7WoO4P2Q X-Received: by 2002:a05:6a20:43a6:b0:16c:b514:a4bc with SMTP id i38-20020a056a2043a600b0016cb514a4bcmr14319123pzl.4.1697023050779; Wed, 11 Oct 2023 04:17:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697023050; cv=pass; d=google.com; s=arc-20160816; b=q67rYuxn59ZQjXClsG1P92DahBONLLzj30rFvtOG9NVVuOHXkHqdqQ+j4JNicpKYdY XznH3hHJA1ZM4a7H8aYKfzBmdqtUvBqsa6Fe2oyMjKZ4idHuOAYkfVRflhUwqc5hF/w+ HbwzOLFDLtxZLDHs6G8nwHMUCqn+YsbOrde6B4d9wszQfAI52LuChczQti1NoP5IDB/a OVp8CQes/9Mukd7jCEffsDW69ph+6LzB89NK7rNo9X+Xz9XOR/d1T0pX99Per4aQqJC7 cDGzzehG60YLuTc0iobPoVJAIZDHcyGFOHwCDNVFdkrwNXOsOb4aQPoexXtNME+yh49H 6s+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=uAxNN1B8Aq1rvOj2d6rD47BDQcgdbvf1bV0VdIQGpLo=; fh=d8mWG3NQV2V/hyk7K09+X9SHeVkXjRhQql8E0ax2OHU=; b=WNCokpiFeHYHI+ONpYL5JmwSlywFJ2mMnu67F0QbRRArHK0gJTSp5m/19WLsWVVtXn fkWLIPqC38Ntr4Doh0nZdLq874vrz8DuDCPmMw5zY+OrGgWeJUApQ1ATMYrsS0AhkXgp 9kNZIB70VqlofbIHxpiRpXZnkRDGbhYCB3VILrb9IuhDIYDl5bmwQBHuj1XOu67XaF8E 7rpotB74dkEnzmf+o8ZHTVuhatntmjQF8kcKmiAk5fSeIFmZGNcqgXpQ3nWdh1S3v/yg vt2DgLmyJuKgD/Lpg5DMAhOdvNCrufWMqVI1MQ3IXv4iYlWuhO0/WWxVPyVdNancNCRR zehQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=JNUyNRhq; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id co16-20020a17090afe9000b002791d2ce94asi362914pjb.81.2023.10.11.04.17.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:17:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=JNUyNRhq; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D537F809221B; Wed, 11 Oct 2023 04:17:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346103AbjJKLRY (ORCPT + 18 others); Wed, 11 Oct 2023 07:17:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234816AbjJKLRO (ORCPT ); Wed, 11 Oct 2023 07:17:14 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2040.outbound.protection.outlook.com [40.107.223.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A149B0; Wed, 11 Oct 2023 04:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A15J5edtV39g/zg2UvX3slzS0aPXrE9NhAcaPM5zTRQewiIswKcF84pZGGi2AQLQMCldnh3sQrODwhL/gtQNz+E+uYxzf6heEBiA9/7GB7fINyIEw3KSdcjS7crGliX5AQxbEVDz0MOMN5Sk78AnX6Zf3M9WAeXatKm4np5BdrIJnGGlVsOll2kqfdRLlA/1Z/qNf8GWpBUkk2GZR8FXlpowhJo6VdZLhbrJXrWVhZW9+btPfN2K09eoMwY8IIr6zij23uVAOcA60U4A6uNEo8oi8SHe0qADjSARZnIcszUbU2SLvhUVZ4Q8iRfMzzOP7x1zs58k0R98a9v34ps7Uw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uAxNN1B8Aq1rvOj2d6rD47BDQcgdbvf1bV0VdIQGpLo=; b=Y1ApsIpVnNjZs1zPfLvVr9AYPdP1IMf7XkUGGKaB4dSeP6pm6LM0RE3FJ+/q3uvep56dxuRNto0gA5Qei4iVxbzumeG6QmHTk3xkSbpjdHrj8xd3IJV/btA4bPYPi1yX/DjBH1C/jRcR8kjqsn0S09IBBhyLUn/D/0RLqkxpFvoGBMkeq1wW9Ixrfxj4cgYtUWhslqoxmVa3i7OLQfc/myN0xgPFGPHnUVbYClYyTh2uKX0jUfJ0XGcqZei3lMGsUl05930X4G9JTt3bTlXVPmjLkROMJMfB5lWDcdc39J+ttI/BF1qNb+pFTg0VbYKwOYClj216QPq+WPNJUVzmJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uAxNN1B8Aq1rvOj2d6rD47BDQcgdbvf1bV0VdIQGpLo=; b=JNUyNRhq5UVrSdtW3SJ6kpNs06kjQkchI/uTWs+UxYxtAVS0a40Mf5oa2pNQSasUVXVSEL43x641wWBcIeaWnLnJAjaFpRyWYAI91oPN7tXyu1EuFEH49YXcCSlnANxSwMqJ6uErMmi423k+phHIVGDgo9Xsvpx6MtbCvIjghVBvlRRDhWDpYBaNIMUHbGb729od57SruUJpcA92QSoQGjzGx0BmuyeIVHaOlBA93fsZqiNTjMdaAGYhzPLBLlr5+LiWL0sz0R9ggAHP0TehF8UArHZDvpr1VLwINf5YVCuBN4wMSLALhxASrePTtez2CuhmNUx33r/ZbEgZaVA95Q== Received: from DS7PR05CA0094.namprd05.prod.outlook.com (2603:10b6:8:56::11) by PH0PR12MB7886.namprd12.prod.outlook.com (2603:10b6:510:26e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.44; Wed, 11 Oct 2023 11:17:11 +0000 Received: from DS1PEPF00017099.namprd05.prod.outlook.com (2603:10b6:8:56:cafe::9e) by DS7PR05CA0094.outlook.office365.com (2603:10b6:8:56::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.27 via Frontend Transport; Wed, 11 Oct 2023 11:17:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS1PEPF00017099.mail.protection.outlook.com (10.167.18.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Wed, 11 Oct 2023 11:17:11 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:16:59 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:16:58 -0700 Received: from localhost.localdomain (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 11 Oct 2023 04:16:52 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 2/8] soc/tegra: fuse: Use dev_err_probe for probe failures Date: Wed, 11 Oct 2023 15:04:06 +0530 Message-ID: <20231011093412.7994-3-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011093412.7994-1-kkartik@nvidia.com> References: <20231011093412.7994-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017099:EE_|PH0PR12MB7886:EE_ X-MS-Office365-Filtering-Correlation-Id: c8330e9a-3b30-4c8a-4b19-08dbca4b9d5c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b1D9XXqEEDjzDVH8NlzOLxpkWwoN/gnjGsdg5L3hhwdoRYoNfLWJppWPg08zVZ42Kdjvd+LpETi30t3wQV08MGKoyMZWn475qU4kzF+NeKDyiMFlb2/beDqmJBnEn1y+DtCmoN+tfOhL3j9w/oePTAmxCM6/wO1Xdu52U2uGfMMVtOUCtOjD6k8isp+czPolU0nszAtSlQDJFBdqdhyZpYddePQ3yBwNW+zpDI6sh2+3N+psef9+pjwAj0wOmfj7cGhYgexrytxBnLBHA+vDl42nLaTGtsBVYZJ7mUl/IWC0OXjGwNpmwTLErn0XjS1KMR8FXqienkGlSruuQ1uD7fgXdPAvVB8GSfrB1Rc6JM9gITynZQJsRNTpPnXEcEHVL4T3jWh9owr7tGxLH0Nl172z6RjT4dHft8BiXzBogdVVwAQ8qtZ/5NDkkNnsVfY9oGAc/yON7gJOlHVW30XPuXP2lnjawnllNtv+GITWwhdhYrAuaFMnAm9TmWf1TJk6NDcUqFCnTYbmfbxXnlV2F3Lwmrv0d9qToXHp5N9JBN51JOavijSoGOmC6h4P0t0q3a9KqFTugYKYqgy4x0h81L4q5TTKIvXrd0JC9+FPGz4VaOo6FCk/Ze6Fw4q5c5gMFBzb82C89XCFN44cA3xdxjdZ4zZ7Uq7j0FEIMnhcfD1UN3FM9CNErZqP97sYthqk5wtgLL7YCy2gAK+Lsq7bvy4g7eK/OK/wdcKK9XR1VsyOpWIqk3bV6l3I9Nt8lLOm7eMI8suVqhpNOxNEGhv2QvzOipA+ojzqIPyaZ+RiN8E= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(376002)(346002)(39860400002)(136003)(230922051799003)(82310400011)(64100799003)(451199024)(1800799009)(186009)(46966006)(40470700004)(36840700001)(26005)(426003)(336012)(1076003)(83380400001)(2616005)(6666004)(47076005)(478600001)(40480700001)(8936002)(8676002)(36756003)(5660300002)(41300700001)(921005)(82740400003)(7636003)(356005)(86362001)(2906002)(36860700001)(40460700003)(7416002)(110136005)(70586007)(316002)(70206006)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 11:17:11.2767 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8330e9a-3b30-4c8a-4b19-08dbca4b9d5c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017099.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7886 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:17:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779457642625523662 X-GMAIL-MSGID: 1779457642625523662 Currently, in tegra_fuse_probe() if clock/reset get fails, then the driver prints an error if the error is not caused by -EPROBE_DEFER. This can be improved by using dev_err_probe() instead. So, return dev_err_probe() if clock/reset get fails. Signed-off-by: Kartik --- drivers/soc/tegra/fuse/fuse-tegra.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index a2c28f493a75..98805885158e 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -131,13 +131,8 @@ static int tegra_fuse_probe(struct platform_device *pdev) fuse->phys = res->start; fuse->clk = devm_clk_get(&pdev->dev, "fuse"); - if (IS_ERR(fuse->clk)) { - if (PTR_ERR(fuse->clk) != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to get FUSE clock: %ld", - PTR_ERR(fuse->clk)); - - return PTR_ERR(fuse->clk); - } + if (IS_ERR(fuse->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(fuse->clk), "failed to get FUSE clock\n"); platform_set_drvdata(pdev, fuse); fuse->dev = &pdev->dev; @@ -179,12 +174,8 @@ static int tegra_fuse_probe(struct platform_device *pdev) } fuse->rst = devm_reset_control_get_optional(&pdev->dev, "fuse"); - if (IS_ERR(fuse->rst)) { - err = PTR_ERR(fuse->rst); - dev_err(&pdev->dev, "failed to get FUSE reset: %pe\n", - fuse->rst); - return err; - } + if (IS_ERR(fuse->rst)) + return dev_err_probe(&pdev->dev, PTR_ERR(fuse->rst), "failed to get FUSE reset\n"); /* * FUSE clock is enabled at a boot time, hence this resume/suspend From patchwork Wed Oct 11 09:34:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kartik Rajput X-Patchwork-Id: 151297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp460713vqb; Wed, 11 Oct 2023 04:17:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgwYcrlemsI/p2zdS5+kh8733hXriPgOGPC5hKI232T6wgV9K0km+Vm1UMTAOSuMvJ6zNF X-Received: by 2002:a05:6a00:2e87:b0:690:c79c:1912 with SMTP id fd7-20020a056a002e8700b00690c79c1912mr23223385pfb.0.1697023063055; Wed, 11 Oct 2023 04:17:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697023063; cv=pass; d=google.com; s=arc-20160816; b=gW+IT3LtpU5SGZSLfoDCQBitwcPy42mI46x6jd5wC/2PM43R5gQZ/KdI31O5W6Z1PC xF9UkFTQJm/ZuwFYKSlAZgf8dR0a/XYKeyTDzeU48Z6Gcpo1YT6JAHvR8/NMgC0QflcK nk5/pLkM0Jxl9IjhHcCVVRggiyzAWrDok37mQBb/xik4DMbD59ynVulYxRyR5tThRzIY XAxOjonVAWPetzIgiEevtcwauY+JV9rDrlxV5P7NPhMJ997fdLvbpaEgcfZpPi87/12s CdO8awE02b0328rVhYOlDgmZFo6fdHrU7A0nj8hEhirk9OnJjq2DCCJ2/E9/iJtozZ6j dM6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Re29ps3AiOSg4y0WBx8YIBQJTME/7AeggREHZrD4b44=; fh=d8mWG3NQV2V/hyk7K09+X9SHeVkXjRhQql8E0ax2OHU=; b=BqnZ5nmgrjwaLohd5LrN/cl64hSidsFG2yxLz7pOZ5gwsGwKl2zboa6/D8C21H8Bo0 50K0GYIc/ibKD4d5rEJwuEfju6DsekDVGLGLD6hxQea8cYxBP0HUzgblSZj6Tf7r06aC 6/TXf9eoFaLvXu4w6W8gsPaAnlQXaUXtKOh87Z1RbCHq4v7aenM8AC5qzTtxqPJ8ltbw HWOOH7qhzvzjA8DOK6GYUkLxvucHJwml0LkR9fVPT3P+UUayfuChzYcASOtB+Z1rwAbX eivGxzohoz/GR5uGXj/vjYk4IaFMcUH/1m6RMC4FZmLLGWHIJAmJLuvKAmirBNvmp9jF 41/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=clApeNA8; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id g62-20020a636b41000000b005824bad8f81si13746199pgc.853.2023.10.11.04.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:17:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=clApeNA8; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E70F28133D3A; Wed, 11 Oct 2023 04:17:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345736AbjJKLR3 (ORCPT + 18 others); Wed, 11 Oct 2023 07:17:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346014AbjJKLRV (ORCPT ); Wed, 11 Oct 2023 07:17:21 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2051.outbound.protection.outlook.com [40.107.100.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 381A194; Wed, 11 Oct 2023 04:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AFYhdcANQPHz4IVV9NkYO3yXIdlP/wC7TPGYW/9Y70MYNtp4t9+J+xv6qbzRFR5RNMigFAe3OEAdw1UZeIIcNUjuCJPiB3dDySxqndBydzJJXvU5S65n1cOiqZG1W3kzZkl0pLsnsFV2g9FSBd0LhAfIM8q2Fc8XACbs0zX9zi9FSFnnqSZky1Yn5gAuFRMecOXzwbElvUGfzaFpZk4QSU5TtwxLDb7NCql0sOFOxX5Tvk9OZU2vt1fTJxaJGNJvPykdeRAZWt0wlYRrSSlsxhc9uELyDGgEeKyfOejUU71RQ9sKDvpvr9IJCGwFq6xwAe3g3GffPz3CvSJvU9kF/w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Re29ps3AiOSg4y0WBx8YIBQJTME/7AeggREHZrD4b44=; b=X3M+e896WRdpydrK1O0ADRwMXv7TZ0Hul/GfnDCx+82B+avS4F8EUb0B8aY3kF68VddU1qxQZp7gQJs/k71sG2wKZeN6vNcsc7R278HE4eDffCx9IsoXDcpcUV40EBGJ26wJH10WklDgEAtgPLkq9AlqD/6aKFJLRgwQhs/dG8qVdQKX0ikVnbCakI4DDP1wiEDBMPc370SQeQ3RQ2Zi1HmsGuNcE4G9n3jEbSdagDyC7RZ+YcMImTnFXkQWDzrxZXTF45ZPBj8zty19enQZVUderXodyZML5j1hZBxESVNANUKYxf1VB1PE2XkTkNBzUyEIBFuALuDyRbNKooy9gg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Re29ps3AiOSg4y0WBx8YIBQJTME/7AeggREHZrD4b44=; b=clApeNA8EBuCA0WWhri2kWLZU1ddv8cJQZfT12M9TsnBqD02Em0B4MGLs/YiPfEvclT8l0CWvGArlfYUMG0lo7ZtLlBt3iY6WHakzuS7wEogq+Ps/MaEquhM2RzMUUIeP+61kQK5kENMXXpW37vuMCCLIl63DcpyqcHxZyF+MxHIY6wforDzMRIlZAZ+pKqPv3GCSumUGIQ7NfNoBOLACm1j7otCMYiTlt6WN4c2fhlj1Hvlw7jqihycDxc77MnxAmzjUk0bHit2V0HHFVYJZZZNdwzc0eKiXFcapdM0HXYfmvlB30MVx7eJ+ThwZGHVhS8JXu0kCV5kdALU6VwI2A== Received: from DM6PR02CA0098.namprd02.prod.outlook.com (2603:10b6:5:1f4::39) by DS0PR12MB7630.namprd12.prod.outlook.com (2603:10b6:8:11d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Wed, 11 Oct 2023 11:17:17 +0000 Received: from CY4PEPF0000EDD2.namprd03.prod.outlook.com (2603:10b6:5:1f4:cafe::c3) by DM6PR02CA0098.outlook.office365.com (2603:10b6:5:1f4::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.28 via Frontend Transport; Wed, 11 Oct 2023 11:17:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CY4PEPF0000EDD2.mail.protection.outlook.com (10.167.241.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Wed, 11 Oct 2023 11:17:17 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:06 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:05 -0700 Received: from localhost.localdomain (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 11 Oct 2023 04:16:59 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 3/8] soc/tegra: fuse: Refactor resource mapping Date: Wed, 11 Oct 2023 15:04:07 +0530 Message-ID: <20231011093412.7994-4-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011093412.7994-1-kkartik@nvidia.com> References: <20231011093412.7994-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD2:EE_|DS0PR12MB7630:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e27101b-97e9-4cb3-aece-08dbca4ba0c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9WtDv0FERGxkVe1bYwAi3UpEsh5iV2SHiXjoKXQYA39EUtAV+EDyAmdWSqn5nxwUI/+YOLAsniomDl9Rf1sA/+rrQ6zyogLtjDxw73tcoicZCrtIHdGJcA1hRDtglZr1lQ+h1ZlLe5VeRKo84XT5iUoYG1F5Yllcw7bffLVWzKqEeZlFjPWH0yD8kaj8e58Y+sVYnOiCwfPWvnMIKfkXCkC/sVQo4aqopPmNEkCW5V0UvJerzPMa78NoU3Edj98peULo2xLlUSqrNE9GDZlwaI/FUbOCJrBqUNXlqqVcY5nAYINaE6uwbKabaxLSJ5SdITCyvZjGPbUaV4zyHy3JGy6dXf+nvo2VeYDSvflURFrE0Gsth7ZDtM4tWuZV2z8/YlVfcq9hH8pSTZqO7l3P2QS4g+XDS12Z3fSAXweXlGxDSLa56poW2E4MB1g0dnF9e9Jh84ZWJBx1Bd60N24LFnhdtxMaIWIw1lSS5F0eWFzzNY00PBv9EiBS6f2St8dJT9pMGq/6xXdq2v2uYqwUrf6NGT4wobRUU0fyt9lEdUNc2986A14qEwwEI/51zLQ9y7t95eq0jZ1P1mEl9EY9f0/8E8bRHS54JS7e/B3ehIbaVSr0JKXvchd5gP5TYiVBAXE/cfPEIQHgJGFyb4QFjnb/2ZPrlAHvqXBI5gB0NpgdDHvMzveB92GIxePtQXonyH3umF9AgzzoujbiJ/l5rCvrD5lIRmzq0uBkpz+Slo7EW1ig8NjeU6wAiV6jWZ3QIxH1Wu9hB9wA2DvgehqAeQXsxiTXVRTqQt+s+K0zJSY8zxuTnXh6VPOFPPnF3qI0 X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(136003)(396003)(39860400002)(346002)(230922051799003)(64100799003)(82310400011)(451199024)(1800799009)(186009)(36840700001)(46966006)(40470700004)(8676002)(40460700003)(5660300002)(41300700001)(110136005)(316002)(70586007)(8936002)(70206006)(7416002)(86362001)(40480700001)(83380400001)(2906002)(336012)(426003)(26005)(7636003)(1076003)(356005)(36756003)(921005)(2616005)(36860700001)(82740400003)(47076005)(478600001)(6666004)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 11:17:17.0449 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e27101b-97e9-4cb3-aece-08dbca4ba0c7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7630 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:17:41 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779457655539408327 X-GMAIL-MSGID: 1779457655539408327 To prepare for adding ACPI support to the tegra-apbmisc driver, relocate the code responsible for mapping memory resources from the function ‘tegra_init_apbmisc’ to the function ‘tegra_init_apbmisc_resources.’ This adjustment will allow the code to be shared between ‘tegra_init_apbmisc’ and the upcoming ‘tegra_acpi_init_apbmisc’ function. Signed-off-by: Kartik --- drivers/soc/tegra/fuse/tegra-apbmisc.c | 37 +++++++++++++++----------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index da970f3dbf35..06c1b3a2c7ec 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -160,9 +160,28 @@ void __init tegra_init_revision(void) tegra_sku_info.platform = tegra_get_platform(); } -void __init tegra_init_apbmisc(void) +static void tegra_init_apbmisc_resources(struct resource *apbmisc, + struct resource *straps) { void __iomem *strapping_base; + + apbmisc_base = ioremap(apbmisc->start, resource_size(apbmisc)); + if (apbmisc_base) + chipid = readl_relaxed(apbmisc_base + 4); + else + pr_err("failed to map APBMISC registers\n"); + + strapping_base = ioremap(straps->start, resource_size(straps)); + if (strapping_base) { + strapping = readl_relaxed(strapping_base); + iounmap(strapping_base); + } else { + pr_err("failed to map strapping options registers\n"); + } +} + +void __init tegra_init_apbmisc(void) +{ struct resource apbmisc, straps; struct device_node *np; @@ -219,21 +238,7 @@ void __init tegra_init_apbmisc(void) } } - apbmisc_base = ioremap(apbmisc.start, resource_size(&apbmisc)); - if (!apbmisc_base) { - pr_err("failed to map APBMISC registers\n"); - } else { - chipid = readl_relaxed(apbmisc_base + 4); - } - - strapping_base = ioremap(straps.start, resource_size(&straps)); - if (!strapping_base) { - pr_err("failed to map strapping options registers\n"); - } else { - strapping = readl_relaxed(strapping_base); - iounmap(strapping_base); - } - + tegra_init_apbmisc_resources(&apbmisc, &straps); long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code"); put: From patchwork Wed Oct 11 09:34:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik Rajput X-Patchwork-Id: 151298 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp460810vqb; Wed, 11 Oct 2023 04:17:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGeV9Ya1lz62MUSgEw8ltrx8P3GssGq2RXSd4IGs2WvPtx+wCO3xVaQLcxq8uHAODZVuaT4 X-Received: by 2002:a17:90a:9c5:b0:273:e4a7:ce72 with SMTP id 63-20020a17090a09c500b00273e4a7ce72mr18475232pjo.3.1697023073768; Wed, 11 Oct 2023 04:17:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697023073; cv=pass; d=google.com; s=arc-20160816; b=z4SuNjAODJy/mY7i1JTG+cu4vuY9U3cjac3kkpGs8eNMslTLDgdVFbvrRMGIydnbT5 spb1VuIif4/NpcyFC/vmjg/liPMXUACqRJE3AmojtM0sfRkAKR61ulIJANowa7PytjoA b34TNfhjtg+Ywxg9GP0XJ3i0fZG3oskdCZMzQgrS1eQfPTRnt/H9YeYnbwPbzU4QQP8l 8yvEnAxabBYnGX1VMRxdt5L4DU/k6U2MzKk/wKY7F8WovtJNSgyi2wC9xov5Ckx/7dst vp2lgiUJSGspZg2AraVTe6tzZWUOLQXB49NtRYCDz3a+LPwyfrb0b1nzRilCpZfeI87W n2zg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=H+Fro14rgalH/06qabhLwOLhxQnp+Tg6JsjLLk27Cig=; fh=d8mWG3NQV2V/hyk7K09+X9SHeVkXjRhQql8E0ax2OHU=; b=hIG7z2IuUT4LZuMoJJKB7xVJrwWADLH2v7r9PaYnIa7Ej4QvNpEvoYpuBoQLK3gSSU XpqHEM4hqMGk+VlnI8W+GrA7gC4SKJEmAosCgYSh9sIvngTaNc1G4MFTHjhnYC5mXpdW wiJjclIJrVEQsjjp1vmKmizW/UrraigxtUn5kPYVed+//S6jeQ+JsqcWU/LuBccg4Ce8 fq8XUJbgiv+uWyRh5Vlphe2OVBw6DlzV93c/jaXmydWipMODZY7ltA24ePINdZNcu6GG x+P4Oto7uNqbD9AEfwDR6T7Xnq1wR+Tv4gWLb/KxQ3w4liOA6Wq4j30wAxNIscs02fWi waQA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=tXYCzHO6; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id q92-20020a17090a17e500b0027d032092d7si1486463pja.184.2023.10.11.04.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:17:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=tXYCzHO6; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C064F8226F7D; Wed, 11 Oct 2023 04:17:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234824AbjJKLRi (ORCPT + 18 others); Wed, 11 Oct 2023 07:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234796AbjJKLRd (ORCPT ); Wed, 11 Oct 2023 07:17:33 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6440DB; Wed, 11 Oct 2023 04:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A+40+o+V0WDK1IDU4kGKMG2KWtp442eF9gU/sLFzQEZ5YzKdRj8a6+fXC92ghg1OEW7kF5Hp3G6p0VUJ9jRZG7FY9AEAEkXDYDGzfosxmLiOwTrRIg9Eoq0dkxF4yDsgdOjwHigKmj4r9HK5lHEVsamJVfxk2gtqQI8hiGdOblYgcEx2idc4bc/AeRctUscSL6IDhPkDhNIj21Zu6A/nhOVlSHAy7tdOwgdmEbdferiS4Mniz3NpfTk56v59oqg/HShfCfagUxuXesnZ639BBWJ2b2Ki2Tw8yTCeT1MCQITlJUOvF8Mc2+dOrZ/JIZlld1ckS2m7bmIK0mzFbsxwbQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=H+Fro14rgalH/06qabhLwOLhxQnp+Tg6JsjLLk27Cig=; b=Q8fq4ELYY4OEHR0GbbFAUHObqj5i2y6ZT+J0ZdgoZxl+aD7pr6hWzL0UHUVxmZZr6al7VrPfLu1BSqFbqa/817DQ7d/ZrUZABRWzgUYJOpgnC2uQELkHz2j5cWACNzmb/6FsqhCuIxHJpuD6zmOmkGR2rH+WJMoNmfPuwWnPssfbISbxpOBtJFjFxhyqaoqLMEM/N1GxAYpOD/FSOu/w4ZPaQVd3ytbQsZRHTRWPBTcbA+GcbFBfsPtAUpljloEOz5VhsIE7lr+Igj+xCLWkSWh2k456ENyAQaeqD/RQbmVyMYvfHubKh2/5evNrROvWH/LcZeQaaw1cEP2y6j7MlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H+Fro14rgalH/06qabhLwOLhxQnp+Tg6JsjLLk27Cig=; b=tXYCzHO64jG/fBuk/a7MAH4gReE3nxIX26NOAevDgGs7m0YIXFnQwNcn5yktmE0bFkLv0IYyyoAY0yWpXwmCBWAngYEsy6F91GZd/DgDM+fHPw8olkuEvx2GLpBnuf3o/rpl5FxduFoOk5Z4Y9mfvIPKrJVrETO7s+LbcCrshagIDIJn05c1D6I73buAMlOuc8/7lFJUxd3wAd7flmhjobXZpx6DyybLmb9MT3mTjNuIlyHKukWU4TcIZh1zK4SpeEADxxPTLURlF6P+63E01RsJmOJv5QdGKBfFQ6x1HVyOSTSqh+Y6nQkpQ3hjENCV3e2WIH6xQUdeDSb6khcjkQ== Received: from DM6PR02CA0096.namprd02.prod.outlook.com (2603:10b6:5:1f4::37) by SA0PR12MB4493.namprd12.prod.outlook.com (2603:10b6:806:72::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Wed, 11 Oct 2023 11:17:25 +0000 Received: from CY4PEPF0000EDD2.namprd03.prod.outlook.com (2603:10b6:5:1f4:cafe::9b) by DM6PR02CA0096.outlook.office365.com (2603:10b6:5:1f4::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Wed, 11 Oct 2023 11:17:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CY4PEPF0000EDD2.mail.protection.outlook.com (10.167.241.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Wed, 11 Oct 2023 11:17:25 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:13 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:12 -0700 Received: from localhost.localdomain (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 11 Oct 2023 04:17:06 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 4/8] soc/tegra: fuse: Add tegra_acpi_init_apbmisc() Date: Wed, 11 Oct 2023 15:04:08 +0530 Message-ID: <20231011093412.7994-5-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011093412.7994-1-kkartik@nvidia.com> References: <20231011093412.7994-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EDD2:EE_|SA0PR12MB4493:EE_ X-MS-Office365-Filtering-Correlation-Id: fe57b8fe-d4a3-4d8a-ff49-08dbca4ba5a8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aA7PdbWy6LrcRoSoTw+RLMu9cPi28pDywdupWVPToK1b1zdBfoah+7bLTwCOmVzWzPCJP/CSDHZ1qr852Rzms+rvVEmRGWCScery5dJKUGv7FtMLRIAhRjgOH1UgLP/MIuOLA1HuFQqcV4hgsBIUGPRzEKvQfEwg0I6IRDNwtTGijhU8z8xCM8fwX/Sy/c/AOBoCnkcgEpXE6Tr7vlNI87+9tOwUJxFlCukTu9aQ82ea7X+rn2P6JSphLTYlgVWQqUoT8iGVGB47p8EWgAgqRiSfaQMEy9vlJy/lPzaZ/4fXHBBBtzIHupNE8V6hTI1d4elqxQkXOMw9U6jRx5kHpr9Nf6NrQ+x1ocV/SsMCW7hjxxEfrgdM2oxq/ycyEfhMlr/jjiJvyK0ImAbkjqq9B0Fzsgx0PP3Oq+s7nnv7Loo0eImUEFr9VrKZ2ooPj9VwaIKmWoGYWqNF9EeEJM1pHgVCco16cJpuWSbZNa3A9izU9hjXA9bAeOUXO20uDeU4mAQQvqaaPw/hvKC5P+GrVGB85Q/982Qyllbg3gi6HNgErYhJHeaoNCaXkkrytkAo33aHE84qaGrmhOcCflFq4Z4cxXbwyX7G/Kxyf+iX/rV4/GeBgVCOy/WT1RSmIbCPFeQD4LVPHXPdF37fo7zfn+M/oxMT1TPx71THwZxvMDeyOyVkJGhyTrAKzO6gdKptg8WBAmQuRdRz8HkLMtjXVDEd0IaOmiiFHXu6Kml8EnvMvYLRHnxWgKZfiH4puxzK2HP3RkTNXdFNUrqx6xlKdLD5fcDH69vgFxNyBhT4U+rfM/Dhi101CmUq5Wi/AYso X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(376002)(396003)(136003)(39860400002)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(82310400011)(40470700004)(46966006)(36840700001)(40460700003)(1076003)(2616005)(478600001)(26005)(47076005)(2906002)(426003)(336012)(7416002)(83380400001)(8676002)(70586007)(5660300002)(70206006)(110136005)(8936002)(316002)(41300700001)(82740400003)(356005)(7636003)(36860700001)(921005)(36756003)(40480700001)(86362001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 11:17:25.2324 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe57b8fe-d4a3-4d8a-ff49-08dbca4ba5a8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4493 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:17:46 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779457666559422448 X-GMAIL-MSGID: 1779457666559422448 In preparation to ACPI support in Tegra fuse driver add function tegra_acpi_init_apbmisc() to initialize tegra-apbmisc driver. Also, document the reason of calling tegra_init_apbmisc() at early init. Note that function tegra_acpi_init_apbmisc() is not placed in the __init section, because it will be called during probe. Signed-off-by: Kartik --- v2 -> v3: * Fix build warnings seen when CONFIG_ACPI is disabled by moving tegra_init_apbmisc table inside #ifdef CONFIG_ACPI block. v1 -> v2: * Update ACPI ID table 'tegra_init_apbmisc'. * Add comment to document the reason to call tegra_init_apbmisc at early init. * Fix an issue where acpi_dev_free_resource_list() and * acpi_dev_put() were not called if acpi_dev_get_memory_resources() returned 1. * Update logic to fetch memory resources in tegra_acpi_init_apbmisc(). * Fix build errors seen when CONFIG_ACPI is disabled. --- drivers/soc/tegra/fuse/fuse.h | 1 + drivers/soc/tegra/fuse/tegra-apbmisc.c | 72 ++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h index 90f23be73894..a41e9f85281a 100644 --- a/drivers/soc/tegra/fuse/fuse.h +++ b/drivers/soc/tegra/fuse/fuse.h @@ -69,6 +69,7 @@ struct tegra_fuse { void tegra_init_revision(void); void tegra_init_apbmisc(void); +void tegra_acpi_init_apbmisc(void); u32 __init tegra_fuse_read_spare(unsigned int spare); u32 __init tegra_fuse_read_early(unsigned int offset); diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index 06c1b3a2c7ec..e2ca93de6c1f 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -3,9 +3,11 @@ * Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved. */ +#include #include #include #include +#include #include #include @@ -180,6 +182,12 @@ static void tegra_init_apbmisc_resources(struct resource *apbmisc, } } +/** + * tegra_init_apbmisc - Initializes Tegra APBMISC and Strapping registers. + * + * This is called during early init as some of the old 32-bit ARM code needs + * information from the APBMISC registers very early during boot. + */ void __init tegra_init_apbmisc(void) { struct resource apbmisc, straps; @@ -244,3 +252,67 @@ void __init tegra_init_apbmisc(void) put: of_node_put(np); } + +#ifdef CONFIG_ACPI +static const struct acpi_device_id apbmisc_acpi_match[] = { + { "NVDA2010" }, + { /* sentinel */ } +}; + +void tegra_acpi_init_apbmisc(void) +{ + struct resource *resources[2] = { NULL }; + struct resource_entry *rentry, *tmp; + struct acpi_device *adev = NULL; + struct list_head resource_list; + int rcount = 0; + int ret; + + adev = acpi_dev_get_first_match_dev(apbmisc_acpi_match[0].id, NULL, -1); + if (!adev) + return; + + INIT_LIST_HEAD(&resource_list); + + ret = acpi_dev_get_memory_resources(adev, &resource_list); + if (ret < 0) { + pr_err("failed to get APBMISC memory resources"); + goto out_put_acpi_dev; + } + + /* + * Get required memory resources. + * + * resources[0]: apbmisc. + * resources[1]: straps. + */ + resource_list_for_each_entry_safe(rentry, tmp, &resource_list) { + if (rcount >= ARRAY_SIZE(resources)) + break; + + resources[rcount++] = rentry->res; + } + + if (!resources[0]) { + pr_err("failed to get APBMISC registers\n"); + goto out_free_resource_list; + } + + if (!resources[1]) { + pr_err("failed to get strapping options registers\n"); + goto out_free_resource_list; + } + + tegra_init_apbmisc_resources(resources[0], resources[1]); + +out_free_resource_list: + acpi_dev_free_resource_list(&resource_list); + +out_put_acpi_dev: + acpi_dev_put(adev); +} +#else +void tegra_acpi_init_apbmisc(void) +{ +} +#endif From patchwork Wed Oct 11 09:34:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik Rajput X-Patchwork-Id: 151301 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp460953vqb; Wed, 11 Oct 2023 04:18:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWKMGRKfUVzct/kZ4ZBVBiUC4Kt8LnfpOAuf/NgAGx3/+dUdmi7N6rH2xYoNOKvUurLvtR X-Received: by 2002:a05:6a20:9393:b0:16c:b95c:6d38 with SMTP id x19-20020a056a20939300b0016cb95c6d38mr13703528pzh.2.1697023092946; Wed, 11 Oct 2023 04:18:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697023092; cv=pass; d=google.com; s=arc-20160816; b=I2Ay97bGyMuin8zDfQ2TW7v3/+lm2MFTZnbt8DIQ5nIZIwJcWRERLMbAsynve8Xv6i Hn8npRUcbTAj48wirDdxxq4P+5yfWCog3nTW59ttK8CgkJtrTgue67btOwf151OXGiN3 96tpUD0c5ehoFW+/Fk/46uXr/08uSZbY01fWzdKxjav4oUDowRLQqIe9wdzor4AUJu92 kmGLu/Kp6i04ToyP0MzJuSK3ID7u4QIkqbcklyKSFq8QbUnZ8zfMx2TPRuHlPuUtKCwE o0aisymcKhjc7dcetLcpsmv8HAstUZQD5ZHVOTXLAuBdbwcW7AVjiSMxyZo5jgdrMAYu fASw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=BPUgh6twlRJm+WWMEgWW2mHamvqmlffPxhPVO0v6bYI=; fh=d8mWG3NQV2V/hyk7K09+X9SHeVkXjRhQql8E0ax2OHU=; b=uOQfwYSGrDWlQ4yLkq5AODJpVJFuRdXOOI2k916u0HRcP8+GQfuBckxw9hNXV7oJh9 pWVXmbKEx9d8oYhy8Ak1QLFadObyT56iPsZyNNl7weFCYWdNyBKerHoN+LTGdkO7knmZ zHtNl19ouB/RjG3RTgcfVUURIqI59eAiyDa2pAH6Flq5cD8jusXwveWntBCgyP3+BgZB bs1fJsZZ1WbEVuSZoD3FnJ+doryzV91xbWVfUqdDk1nRg7nf54PvsX8fTLKh4SnAeSDs JPpdPYXoRJ7ajMrn6gcPKeh+bUXQ4hWo8t2Xcote17y4jCH/q1hb4IsEatx1gwd+DuqG ikYA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=UCdjm2Zu; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id j14-20020a170903024e00b001bba894ac4asi15365878plh.274.2023.10.11.04.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:18:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=UCdjm2Zu; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 95E00820969F; Wed, 11 Oct 2023 04:18:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234771AbjJKLRn (ORCPT + 18 others); Wed, 11 Oct 2023 07:17:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234769AbjJKLRk (ORCPT ); Wed, 11 Oct 2023 07:17:40 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2084.outbound.protection.outlook.com [40.107.244.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F40FE1; Wed, 11 Oct 2023 04:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MhVc3a/LCwEUN9wuBdiY63wO/sBSPNpJ+jbckx6GsZDo8XwVZWtlusFJXeQo4tAHZXyp/K8pUaLC6Xawo9BYkIxh6PF9yIvXzraNg41VnYFDIG1iWByJVrSoIG9ajCR/8j/KrV961U5RABQSfZ7Hi+iwqtac+anUIPivsXK5MTzJcTzrW717H9LKOCQ7Pr6nY4nFAZGVWQbfl8D7E0lPo+8ZSZsdu3jFtB1SjCzc+Q6aFgsCHwnq8NKWPFmzhf9dL48Et5Zp3xd2j7HTCBtuLLmV+cOJYP9TCucBp+DFmtIlzagEoxnV+Kv6R95tIsw7CNRB0CqoOBhVM42eYHs38g== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BPUgh6twlRJm+WWMEgWW2mHamvqmlffPxhPVO0v6bYI=; b=HMc362uhMp3MvkNSyMLuJrv16/Ikovb8a2oXkyLmeAnuaPTzkLTk1j2bmEQOpNTjKUo9pgQpJ1IiEe/4PQPPudue127cCzb+RehmgzN5DXog63T7EdZh1yo/Z4tgf1tzjqzA0tGQc0gjQ+kO6/L75efWmQc/uYLUxa+Y1nBVIEHMbjA3AGsPB7B/c6GqGBfGLjImX3LPXs924Rz1pePUtguAxJyYzrOzJyBGXHduLDY8refHqoBY11Tbb0iA8X9Gvh0mF+jpKuAI6sZCBUsDbby26FtJxunNV4jRasTAQmlfR38m2EpiDH8pAL2R5QwbAFk4xNcTPMy4AqmhkzSIlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BPUgh6twlRJm+WWMEgWW2mHamvqmlffPxhPVO0v6bYI=; b=UCdjm2ZuK3laa9UWerLLXoxF29yBE3PH+shQSVmLafW36/bm/Kp/SoEFb0EYtx2FDPX9djQdJxQ1MWh+efYzOTItdhI6yte0ahILHYIAmu7ls15h+G5uSBQAOjncOLZdd1wFp2bE3TQCl8t79XbqNoorlzZtcbwAyfisU0zk9ir6CE9kGWxlpWQN63gceNgIlsT3c8vWokE2iu8fdUn6XP2WCoQpBFDCsddkUSSso/zZay1FkCkI/9hL8PrO1WYFBXksxWHg4arF/sPjgj5E14X5Y9Wi7z9XqH/eJk2EvIKM2tEUwcu768thlilHV30prRCadbb7O9fnSPTMUavkcg== Received: from DS7PR06CA0006.namprd06.prod.outlook.com (2603:10b6:8:2a::7) by MW6PR12MB8661.namprd12.prod.outlook.com (2603:10b6:303:23f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36; Wed, 11 Oct 2023 11:17:31 +0000 Received: from DS1PEPF00017096.namprd05.prod.outlook.com (2603:10b6:8:2a:cafe::29) by DS7PR06CA0006.outlook.office365.com (2603:10b6:8:2a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Wed, 11 Oct 2023 11:17:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS1PEPF00017096.mail.protection.outlook.com (10.167.18.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Wed, 11 Oct 2023 11:17:30 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:19 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:19 -0700 Received: from localhost.localdomain (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 11 Oct 2023 04:17:13 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 5/8] soc/tegra: fuse: Add function to add lookups Date: Wed, 11 Oct 2023 15:04:09 +0530 Message-ID: <20231011093412.7994-6-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011093412.7994-1-kkartik@nvidia.com> References: <20231011093412.7994-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017096:EE_|MW6PR12MB8661:EE_ X-MS-Office365-Filtering-Correlation-Id: b3394372-dbc8-4f89-0f64-08dbca4ba909 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9RTWc+UbHcA7C/Mq1UuqeqLkIfrkOxlyPEU6TuCZKD4K99zfrBrq/z4rhNfHQry7eXvclCS7GF9X02boSk6ka7cAbzINc3vYWuLpNR30pMa3OkI88pGNA8QAmtlW0TMiWEFTvo0Jfs89bU2l0ZT5138vpRJ9mvcFTJBQJgje171HvA0iHmS2FcZ4rFFpH+OkMo++Ra1yjRkFcsToqW0GN1NWwum2G+a0OF3niDG/U/eILEEFDtoMJ9c7UoUD412y6YYyFMVtLdcvJ1RjI1w4BWDVMbYIVsOY9KgCtx+NtguAQEvW9xmmydUhW52CR01GJcZ/qz/sibiRLWy3Phe/2NxXOCC4pMCjF5k3E4WCAhvqVHgUpkseu/ro+ieAUGTpddLAYhfauk9d91k/XXhajulWpdPOnXqTftTJY6nTq7ZuZ6otd3QLylCPnzFTztdNN5YmZcmFAliyZ0tQ4cT4LxEsj1uHfgykQRTXOyQ+r8BxqnEJkKNn5QTuRaIr4l7vd5P4m0MmIIXyYALdOfBiOkqiG7hLXxx+RSnsHf5mB94tkRXvxVzQUMQj4TimIS152biroYXDjMpXkmz0WfsjvXEmcmOobkaKNWQ4Eir5tzIzSvRKtoY2vec2madqgkSOpUFQ4WKuHkt8+fVuy88KvD1QK/PixkuTI8AaeHVu47TJ4AmHxdNvRNC4z8hgjoz2FmMKrCs1pQhlBS/+CcV9nOiyAjMpMIVEYf4a3UK8dLAqwkqiiklDkUP4AAq9EpC973EV0bvjOwDz8yUQ60p375DysVhWuvomO9QxKsmqJG4odtC9FAGS0jVy5Fi8hibGzHbBcy87r81URnwGZfwtDw== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(136003)(39860400002)(396003)(376002)(230922051799003)(451199024)(64100799003)(186009)(1800799009)(82310400011)(36840700001)(46966006)(40470700004)(83380400001)(26005)(426003)(1076003)(336012)(2616005)(40460700003)(86362001)(36860700001)(36756003)(40480700001)(921005)(82740400003)(7636003)(356005)(8936002)(478600001)(6666004)(2906002)(7416002)(47076005)(8676002)(5660300002)(316002)(110136005)(41300700001)(70586007)(70206006)(334744004)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 11:17:30.8795 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b3394372-dbc8-4f89-0f64-08dbca4ba909 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017096.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8661 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:18:09 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779457686772320617 X-GMAIL-MSGID: 1779457686772320617 Add helper function tegra_fuse_add_lookups() to register Tegra fuse nvmem lookups. So, this can be shared between tegra_fuse_init() and ACPI probe, which is to be introduced later. Use kmemdup_array to duplicate fuse->soc->lookups. Signed-off-by: Kartik --- v3 -> v4: * Use kmemdup_array to duplicate fuse->soc->lookups. * Return err at the end of tegra_fuse_probe to remove redundant code. v1 -> v2: * Use size_mul to calculate lookups array size. --- drivers/soc/tegra/fuse/fuse-tegra.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 98805885158e..ddf25a1bb19d 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -113,6 +113,21 @@ static void tegra_fuse_restore(void *base) fuse->clk = NULL; } +static int tegra_fuse_add_lookups(struct tegra_fuse *fuse) +{ + size_t size; + int ret; + + ret = kmemdup_array((void *)&fuse->lookups, &size, fuse->soc->lookups, + sizeof(*fuse->lookups), fuse->soc->num_lookups, GFP_KERNEL); + if (ret) + return ret; + + nvmem_add_cell_lookups(fuse->lookups, size); + + return 0; +} + static int tegra_fuse_probe(struct platform_device *pdev) { void __iomem *base = fuse->base; @@ -398,6 +413,7 @@ static int __init tegra_init_fuse(void) const struct of_device_id *match; struct device_node *np; struct resource regs; + int err; tegra_init_apbmisc(); @@ -495,15 +511,11 @@ static int __init tegra_init_fuse(void) pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n", tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id); - if (fuse->soc->lookups) { - size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups; + err = tegra_fuse_add_lookups(fuse); + if (err) + pr_err("failed to add FUSE lookups\n"); - fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL); - if (fuse->lookups) - nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); - } - - return 0; + return err; } early_initcall(tegra_init_fuse); From patchwork Wed Oct 11 09:34:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik Rajput X-Patchwork-Id: 151299 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp460840vqb; Wed, 11 Oct 2023 04:17:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3rW3uGPWAB/Kwm8174lML1g92MZnMmpSXijY+u+yhstnLa7b0QXk37aoF4ho5U2AmcyiQ X-Received: by 2002:a05:6a20:c18f:b0:16e:26fd:7c02 with SMTP id bg15-20020a056a20c18f00b0016e26fd7c02mr12152768pzb.2.1697023079178; Wed, 11 Oct 2023 04:17:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697023079; cv=pass; d=google.com; s=arc-20160816; b=Mw4lVJbXPqOKszdMhCAOgDUPrO0Spv/cooC0308SZeLjKrLg6mbGQbIztZ+OcoBtVg dc74nO/SgYl+YLZyYnBliR3UnwaA/Blz9Hk+WUaDMuBQlPItgUzdYcNYdNuKox3pVVM/ nfzV73B3qN3nNqYeaFyFTOJSz2vr8d0ZSGz+UGcOrkjmcfB2el9B6Kw4ioYunhe0DG5m bTPH7UyaKAY/3IHC0Fvh4AXr1yhAKdp76trOE93F5N95cPlietz7rrg1GVEEAizwoXSt 8JAqaRD7g5vvt7HWNbzkCIsBC1m3+3SS//bTJu2H5qcCYuB6tke2BsLirLOdT8MzY0kj kNvw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=RlaNkyQtsx9cx4kudwhzEKqtEz9OQ7zyAYec9tu4C0U=; fh=d8mWG3NQV2V/hyk7K09+X9SHeVkXjRhQql8E0ax2OHU=; b=KNGkFKp0nSyRDM2xjGzzEA/KexDg1QGKJV8ky1Eeqs5nzZY5bxu27I5Ml/1DjOaJ6s tn6F3otXP04UCDE2wD3hVvbcDh7Zx201opB2ZKLfrUT8dRRN9globHuJXy4DmJhDO+J7 gGrO8AqdnR2ZVjmHK/kw7YdEA61Zox6sY+FyLAd1cZZPSEcD+VQozRO7FGyDTB3TayKY egJaT54yRkEjdkfaPBn2iLrIkWuX5bYLg+pmcilGJ6qP0EHRGtGWNEmXuUpnW05FUSsQ XK301daOpjAfi1huf/YN4n8bFyyg11/LLkfVh3t6MupkMKSIjqcfcjbwJTCj2jWnVAHu 1g/A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=CoHlvqlH; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id j21-20020a170902c3d500b001b83767e879si13527630plj.266.2023.10.11.04.17.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:17:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=CoHlvqlH; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 098A781B93FA; Wed, 11 Oct 2023 04:17:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346195AbjJKLRx (ORCPT + 18 others); Wed, 11 Oct 2023 07:17:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234658AbjJKLRn (ORCPT ); Wed, 11 Oct 2023 07:17:43 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2041.outbound.protection.outlook.com [40.107.212.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BEBFD8; Wed, 11 Oct 2023 04:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FNUBbXf2wkeiyjWPo5FlfgddwRFwn1uqRYRM9I+rf/53QosfycIbQZd8eQQEWY1Vj86y6Q82CBOtZydA63JgRq+qjO2E1BxjSeWvKd4uMSS4S50pKgHAbE4Bm0usVfDrAJxfLeugZ3NKHDfe3pB1pWn6zWjdrbAK1NKTeIMKnLyr7ftcsaP9n45XepnBSa3lyYMOImVIImM2QOcMpfr25dTAwHbSf7Bl1hY3o0iTza5E3quuszXU/MvroG5nSeFjU/lXM2TENKnvH5cn+by77s2dIKOmx6zt5wuOl7vEjmJHdV48yLYjK5Ntucra4Qp+l6iw9DqCjAP8r/QMq5su5A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RlaNkyQtsx9cx4kudwhzEKqtEz9OQ7zyAYec9tu4C0U=; b=BX9d6CRzewdKgBQkmPBM09ZaYuArIuhdtQIrXvpCoin4igOr7hvBX6doq0oC9aPNkktj6k42bociPNQW7+OMNQU+hNgxIcLb13xu0c12KmckdCiKdvfebhFPi8/1gqSSMzuDfdbnRphXCbZBr2OmYL4soy3EdP+0ME8RReP8AoP9CT4r1Ngsmj7/VEzGWcCqueJchMNyvVyaBHYmECWB86gZU642yC9ZfSXVG6LlPwNcILDYcPJJczH030IIoLUF/S9Qo7J3LxtbwWKMyWr+IpYQR2dRwIN7rhM35DWj7FZLZ+gfrAnGE2kLd7iUDdxbgUPCGjygih7I4X9a7aOVRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RlaNkyQtsx9cx4kudwhzEKqtEz9OQ7zyAYec9tu4C0U=; b=CoHlvqlHphJVfVF69EQUOHnm2qfyIMZnaWWkGyqWErZ3gXbCA3BrhoTTL/FufMFiRFDDFEbZqIXif7FQoE6aN5WOhUc+jVPxumjGSJ+Tc2xqmMR98vHj3GuQtOZtEBJS0oyRXCWE8pD4P9yRA7t5e/WVFzFqG6eSQ1bpdOCZhzmqWkjZZ/JSK1SNtMx6+9cc4fNGSnMTqF6hyeh9yfevoR41fppK33PfSwvcG7QTDwhAlwmP7ovlqRgWWM88atvGnRF1g6T1ok0KeV5/OGw+64v3A/dPlGOgqFk0YiIKbr+FkiUpGLMf0QV9A5AnGrWPhLxD+nokDxWjSRQBrJ5Ujw== Received: from DM6PR12CA0017.namprd12.prod.outlook.com (2603:10b6:5:1c0::30) by DM4PR12MB5794.namprd12.prod.outlook.com (2603:10b6:8:61::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Wed, 11 Oct 2023 11:17:38 +0000 Received: from DS1PEPF00017098.namprd05.prod.outlook.com (2603:10b6:5:1c0:cafe::7b) by DM6PR12CA0017.outlook.office365.com (2603:10b6:5:1c0::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Wed, 11 Oct 2023 11:17:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS1PEPF00017098.mail.protection.outlook.com (10.167.18.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Wed, 11 Oct 2023 11:17:38 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:26 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:25 -0700 Received: from localhost.localdomain (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 11 Oct 2023 04:17:19 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 6/8] soc/tegra: fuse: Add function to print SKU info Date: Wed, 11 Oct 2023 15:04:10 +0530 Message-ID: <20231011093412.7994-7-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011093412.7994-1-kkartik@nvidia.com> References: <20231011093412.7994-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017098:EE_|DM4PR12MB5794:EE_ X-MS-Office365-Filtering-Correlation-Id: 2cd8ef6a-eef2-497f-8465-08dbca4bad6e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rzKgAgL5nF4Wm5OSvGzcHkLP+MByMDbwG/BuOzk9H1kZdBobd4ViyBwaDkKaMw7n021IYSeHxXfBfUf9gIo0Hc705aLiubdVempOPVC65i8QV+wrncfgGfvJdMrOJ794n5BghVcIvAk2xV9nnC8rEEw3qwe3D9p1dMqLCPsNRYcdkGh+1xEXKAg2hPcJb3M8ZiX/O/6u27X8Dr8fehwIUeFevPUZgtUU8FG7GpYEdKWRy3sXSfYJAmqjqdvf8rBdTdUDfJu72MomvdiNqxIMsSnEpK2W/+pFj5k01GeWjlr6/EEP5gXQZdMyxNs7/Uw47MxcJZWT8CFhDSjwmBTtDbHdMbHG333ZXxji2/zr+rvu3Wzoogm8XzouYVN/11p/B7qBbBNiTdQXGolZpmGCoY9HWRszbfW8BkPVuOX6EFVgbRSus29bkgMs2YD9Cw6oXk/bZj4aSBS98m+HYsc777SWbufQcWjGVOzu/PIlMf2/JN8LuIJONWXn4lHqu7sRp4CLyTGsjfinjOL4kDSCCDgMWtYoJFt0qKVhJPGlN+M6j3s2tH8L1UcuhNTv/ZYT/WCTW5k9ZAFzGEemi2LxmzF4FiajM6Fx83A6xf80hs8fdG6dmWEntT2E98xOpaqS+LYBHrZShq2k/QMU7Q0lFbbKM4TYSaLHb9ky1BfL8cUwNbOwOSNvkRcuWlEiYnWPLRN6pWOhDy55YFXfpf6E9xTrXZAtjy/qf21ZgN5moKgEqX7iFTK/TF/crnT27wZDrkOA5Mwoejx2rEho4RjvD1Mzlle/vN1FToUA2A5b7I8= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(136003)(396003)(376002)(39860400002)(230922051799003)(1800799009)(186009)(64100799003)(82310400011)(451199024)(36840700001)(46966006)(40470700004)(40460700003)(36860700001)(82740400003)(7636003)(6666004)(921005)(478600001)(356005)(426003)(47076005)(36756003)(336012)(26005)(83380400001)(2906002)(86362001)(1076003)(2616005)(40480700001)(5660300002)(41300700001)(70206006)(316002)(110136005)(8936002)(8676002)(70586007)(7416002)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 11:17:38.2710 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2cd8ef6a-eef2-497f-8465-08dbca4bad6e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017098.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5794 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:17:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779457672412424911 X-GMAIL-MSGID: 1779457672412424911 Add helper function tegra_fuse_print_sku_info() to print Tegra SKU information. So, it can be shared between tegra_fuse_init() and ACPI probe which is to be introduced later. Signed-off-by: Kartik --- v1 -> v2: * Renamed tegra_fuse_pr_sku_info() as tegra_fuse_print_sku_info(). --- drivers/soc/tegra/fuse/fuse-tegra.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index ddf25a1bb19d..2ac9e7a03d05 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -113,6 +113,16 @@ static void tegra_fuse_restore(void *base) fuse->clk = NULL; } +static void tegra_fuse_print_sku_info(struct tegra_sku_info *tegra_sku_info) +{ + pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n", + tegra_revision_name[tegra_sku_info->revision], + tegra_sku_info->sku_id, tegra_sku_info->cpu_process_id, + tegra_sku_info->soc_process_id); + pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n", + tegra_sku_info->cpu_speedo_id, tegra_sku_info->soc_speedo_id); +} + static int tegra_fuse_add_lookups(struct tegra_fuse *fuse) { size_t size; @@ -504,12 +514,7 @@ static int __init tegra_init_fuse(void) fuse->soc->init(fuse); - pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n", - tegra_revision_name[tegra_sku_info.revision], - tegra_sku_info.sku_id, tegra_sku_info.cpu_process_id, - tegra_sku_info.soc_process_id); - pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n", - tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id); + tegra_fuse_print_sku_info(&tegra_sku_info); err = tegra_fuse_add_lookups(fuse); if (err) From patchwork Wed Oct 11 09:34:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik Rajput X-Patchwork-Id: 151300 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp460923vqb; Wed, 11 Oct 2023 04:18:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElDj3XwIhClusd7AntotYkg+Qk/Jii6CwaXNYeQLOpr6z6vUqkrfSvRE5kB2EBTdWcRyrM X-Received: by 2002:a05:6358:c10a:b0:14a:cca4:55d7 with SMTP id fh10-20020a056358c10a00b0014acca455d7mr17093311rwb.3.1697023089405; Wed, 11 Oct 2023 04:18:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697023089; cv=pass; d=google.com; s=arc-20160816; b=szh305HkniaO7nMZYmP4GdgPiBlEDNJnd/BeBx9ph7nk5TJmmk4SIugF+jnMrzlSt7 K/nKKyTKjuLUzvOFg85KpMTgdyg8l59sdMsOAPRfGsVxfJaNLqscVlbNwqSRavM+n/Zj AUVwNnhfk+WUK0J2Ee2TL793bntfWMj5+JHwp1PaB1EixI/KmCyHZq9yS9DRLCiHYgzo vDBE6JjUwHzHtYvAIJ6lm9ALaY8Hc3H3Hj1rw7qHWfHFRrjgsP59Bv+aNl0tM9QlQM75 MLxa/tkrwvhdTeXzq+rM36naypNSZ5gEEDmkyE/nTLZl4SLJ12c+VH6OOU7l+Bvz+czW Kr4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dLed6JcZomXG6gLdEjsQNrb493DfTzaL6Ns1USO9rNA=; fh=d8mWG3NQV2V/hyk7K09+X9SHeVkXjRhQql8E0ax2OHU=; b=PAgFuApxFnl7lh6WxgxlxceYFwsuH9gk0mltGvw3xFqlYfmWabzLWMGjyjaPN6VuCx li9R+yOVJ/FD0sAboAUSvZzoeihU0cBbUe9UjfiGhmXMBNyusTKgazlVKCW35xX1hCED JgcrJgeKJWphTQfNCyslsH4AT9h9Wz3juerulsHCwaaKZ0TL8DfuwTtbygAZm5z95uiZ XwQLPr8liylh3ukLDRjgpylvQUL87G1ppTLzqZDZt/fzXuAMck432CLerNSIQkuE0IAa BNSIqUrg++yEGNhNUpQgK4K9wlmENA9OtK2KVaIjeo6YRcHXwTIbxkDd0sTb3EoPe0yT +/ig== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=M5iRz3+3; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i130-20020a639d88000000b00577516d9a0bsi2464414pgd.502.2023.10.11.04.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:18:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=M5iRz3+3; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 88E6481B94C9; Wed, 11 Oct 2023 04:18:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234842AbjJKLR7 (ORCPT + 18 others); Wed, 11 Oct 2023 07:17:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234848AbjJKLRv (ORCPT ); Wed, 11 Oct 2023 07:17:51 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2082.outbound.protection.outlook.com [40.107.100.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17471122; Wed, 11 Oct 2023 04:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fYjFXyUG5aDfeK0SMyL5o8zPbJIBFke91vfwz+YbOYt9iCBiNAHRlMpXQ6h+71g5Rt3IApM0TCIdw7bSh0OHdYSRvGRBMrUOWp+uAZsXRFKslhJV9YuOI24fFPnw813vwmZvA7hxEm+eJOkeeuHWYHvk5NPQ3CXNtTkiFz7F3/QM97ahgfhKg0cfP5LRruWcboOsBhS5YACW0mT1FifOTn9MfetSe9H+JCx7m7Oy1X8+PyrQNQMAu6Y+LnXfQCqRAknQ2WAs5L0xCHVP+qVsX5eXKFh4KkeGYPqeDLkOC+fNS78BeRta95BGjaGUodXtU12HcEl7z43EcE0IOsHbCg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dLed6JcZomXG6gLdEjsQNrb493DfTzaL6Ns1USO9rNA=; b=LR0mhy3Mb2/rJ8cpbR+S9UH/cQLlyCeIRQswL0xBnEZ4zrnHFWyBmvjGhwgtOQDWeS8eaLTTeQWLu/XxrD0Cwu7p5HRGB092xasOAxTA4uTeZRGHrTZTttbZ3b+jil7EGmFSkzeLbaFr8BdbXqzKHuD1FybQ9ehCxDEsUzeLpuLbmBAR7Ir+NRyguuCimyKYdb8jrprQN9MnsYXPKqEy7e4WJWHgwrd8Ia1wXPiPP8+MTLRIBBMv11JACohBVDWC2jdKookIHIts8HaOjYfO8K+6GEsFrNaYGQpsDEt5CqU5zUaNHCRxjLAUeCbYkiAENIxPa7IY1i81ibp62HqnUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dLed6JcZomXG6gLdEjsQNrb493DfTzaL6Ns1USO9rNA=; b=M5iRz3+3twHuzzPoHMjYEJrx6mhy727ZsDMqPnM+fdfcWPSxlZBGHID/tPPdYh5Sr2szm//099zqojzYYZUysYPEGNsYzOqtvRL3FbdcSKvS7XIGxCKMjzfded3dQyMEGt9j1r51rYJ7WOBrvgd43i+s0TaltzGrqyTpwksBNg/FJNJsuys2kyb29ECfLUJA8+Zb9zZJyO0jmoGqeIX9BrY9ZIQq8dfgGjizORygZvEydOqZiL9QgUpWYmXHRQYQfn+JOevVgmaVR3hvOtwcFp9y03DY79jdz5cdFyMmYrZATNBIkzi+ByDicDULM3vkkPLqoL7bm5tEttBDPMBErQ== Received: from CH3P221CA0007.NAMP221.PROD.OUTLOOK.COM (2603:10b6:610:1e7::9) by CY8PR12MB7196.namprd12.prod.outlook.com (2603:10b6:930:58::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Wed, 11 Oct 2023 11:17:44 +0000 Received: from CY4PEPF0000E9CE.namprd03.prod.outlook.com (2603:10b6:610:1e7:cafe::23) by CH3P221CA0007.outlook.office365.com (2603:10b6:610:1e7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.35 via Frontend Transport; Wed, 11 Oct 2023 11:17:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CY4PEPF0000E9CE.mail.protection.outlook.com (10.167.241.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Wed, 11 Oct 2023 11:17:43 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:33 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:32 -0700 Received: from localhost.localdomain (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 11 Oct 2023 04:17:26 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 7/8] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234 Date: Wed, 11 Oct 2023 15:04:11 +0530 Message-ID: <20231011093412.7994-8-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011093412.7994-1-kkartik@nvidia.com> References: <20231011093412.7994-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CE:EE_|CY8PR12MB7196:EE_ X-MS-Office365-Filtering-Correlation-Id: ff9195ea-e6e5-4f8f-5a22-08dbca4bb08a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +SlSDC78sPwuULbX+Vy+bZs01tXAnTztfuFk674aIQm83CAqST7FY4zx1H9yt1O4Vzh5MepWNi0sAa4TAUSXC04Xog61kqTcXM/RCojJc1xJ9IO3cwxmgQS0RlQ0pLsn5/VrPa1QoAv+fCSQOqDmRKKx2iFOY+1dVRySG8W+CV+TlPHOqZ1leh9R/giBGappdOY453NsVuw6zeZ9ZpYHNSRLqOi57z5AyoiepUD9SLdGl5mVIEgmgkBHcc5kFdfnIa2yxi0DyXVC6QzWKhwLA5Xx+jZsKEs4er8wE0TljHN0r4HI4r14i2N7XB4fJG3gmVUoqa+PAc5xKC3DynUNhwUFhlhMEjMiQ3YavhqmAaAD3BPUGbJ6rCcVFVwJZ696aE8+b7P92U3aOPM0yC6+gr1W+UszLVl6syxQaiRDzTWjBE0cGgIyOH3ODbu5jNBR4noD0/xKTQJZDsWRNJQ5bdsHrsmrm+SgFOwSdIcpBmihjU2LcuqJJyshPy5Wc/95UHdmUlhZVO/rcjR0iXcAb20/KN6Hgr1SMzCZVoZ3DSX2t54kRynnGPxx5zVc4fCaqTxCk0BS6vyL5A/24g4s68yiTp2Cr9l/F4MVjVG+hpfzuw2t+FT4nVuVaXQLQu8uVgOFlbf5Uha/p3DaRksauorLZTMi9NWr6IPOEs0RYnEnWOtim5E0H5hLBOFqaG7PGlci5OUT/kPkQPbRDQ1Mstpl3zr1RreyliFt9qOWHy+XGshZ6fH+7nwBQTzzdZvBMWZ//aAfE9ZOatsN05if7on51B+pVRy9ogLbooCH+qOjIX3YAOv6jdeAeX628MbI X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(136003)(376002)(346002)(396003)(230922051799003)(64100799003)(1800799009)(186009)(451199024)(82310400011)(40470700004)(46966006)(36840700001)(40460700003)(1076003)(478600001)(6666004)(2616005)(426003)(47076005)(26005)(2906002)(70586007)(7416002)(83380400001)(70206006)(5660300002)(316002)(110136005)(336012)(8936002)(41300700001)(8676002)(82740400003)(86362001)(921005)(356005)(36860700001)(7636003)(36756003)(40480700001)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 11:17:43.5022 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff9195ea-e6e5-4f8f-5a22-08dbca4bb08a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9CE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7196 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:18:08 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779457682842581792 X-GMAIL-MSGID: 1779457682842581792 Add ACPI support for Tegra194 & Tegra243 SoC's. This requires following modifications to the probe when ACPI boot is used: - Initialize soc data. - Add nvmem lookups. - Register soc device. - use devm_clk_get_optional() instead of devm_clk_get() to get fuse->clk, as fuse clocks are not required when using ACPI boot. Also, drop '__init' keyword for tegra_soc_device_register() as this is also used by tegra_fuse_probe() and use dev_err_probe() wherever applicable. Signed-off-by: Kartik --- v3 -> v4: * Use dev_fwnode() to dereference the fwnode. * Add MODULE_DEVICE_TABLE for tegra_fuse_acpi_match. * Moved tegra_fuse_acpi_match above tegra_fuse_driver i.e., close to the user of tegra_fuse_acpi_match. * Moved the improvements made to fuse clk/rst get error handling to separate patch. * Moved ACPI related initialization after fuse->base is initialized in tegra_fuse_probe(), as this triggers a warning in tegra_fuse_read_early() which is called from fuse->soc->init(). v2 -> v3: * Updated commit message to specify changes related to inclusion of dev_err_probe(). v1 -> v2: * Updated ACPI ID table 'tegra_fuse_acpi_match'. * Removed ',' after "{ /* sentinel */ }" in 'tegra_fuse_acpi_match'. * Using same probe for ACPI and device-tree boot. * Added code for required initialization when ACPI boot is used. * Make clocks optional for ACPI. * Use dev_err_probe() wherever applicable. * Check if clock has been initialized only when device-tree boot is used. --- drivers/soc/tegra/fuse/fuse-tegra.c | 50 +++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 2ac9e7a03d05..167a6fe6c43d 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -3,11 +3,13 @@ * Copyright (c) 2013-2023, NVIDIA CORPORATION. All rights reserved. */ +#include #include #include #include #include #include +#include #include #include #include @@ -155,6 +157,37 @@ static int tegra_fuse_probe(struct platform_device *pdev) return PTR_ERR(fuse->base); fuse->phys = res->start; + /* Initialize the soc data and lookups if using ACPI boot. */ + if (is_acpi_node(dev_fwnode(&pdev->dev)) && !fuse->soc) { + u8 chip; + + tegra_acpi_init_apbmisc(); + + chip = tegra_get_chip_id(); + switch (chip) { +#if defined(CONFIG_ARCH_TEGRA_194_SOC) + case TEGRA194: + fuse->soc = &tegra194_fuse_soc; + break; +#endif +#if defined(CONFIG_ARCH_TEGRA_234_SOC) + case TEGRA234: + fuse->soc = &tegra234_fuse_soc; + break; +#endif + default: + return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip); + } + + fuse->soc->init(fuse); + tegra_fuse_print_sku_info(&tegra_sku_info); + tegra_soc_device_register(); + + err = tegra_fuse_add_lookups(fuse); + if (err) + return dev_err_probe(&pdev->dev, err, "failed to add FUSE lookups\n"); + } + fuse->clk = devm_clk_get(&pdev->dev, "fuse"); if (IS_ERR(fuse->clk)) return dev_err_probe(&pdev->dev, PTR_ERR(fuse->clk), "failed to get FUSE clock\n"); @@ -278,10 +311,17 @@ static const struct dev_pm_ops tegra_fuse_pm = { SET_SYSTEM_SLEEP_PM_OPS(tegra_fuse_suspend, tegra_fuse_resume) }; +static const struct acpi_device_id tegra_fuse_acpi_match[] = { + { "NVDA200F" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(acpi, tegra_fuse_acpi_match); + static struct platform_driver tegra_fuse_driver = { .driver = { .name = "tegra-fuse", .of_match_table = tegra_fuse_match, + .acpi_match_table = ACPI_PTR(tegra_fuse_acpi_match), .pm = &tegra_fuse_pm, .suppress_bind_attrs = true, }, @@ -303,7 +343,13 @@ u32 __init tegra_fuse_read_early(unsigned int offset) int tegra_fuse_readl(unsigned long offset, u32 *value) { - if (!fuse->read || !fuse->clk) + /* + * Wait for fuse->clk to be initialized if device-tree boot is used. + */ + if (is_of_node(dev_fwnode(fuse->dev)) && !fuse->clk) + return -EPROBE_DEFER; + + if (!fuse->read) return -EPROBE_DEFER; if (IS_ERR(fuse->clk)) @@ -386,7 +432,7 @@ const struct attribute_group tegra194_soc_attr_group = { }; #endif -struct device * __init tegra_soc_device_register(void) +struct device *tegra_soc_device_register(void) { struct soc_device_attribute *attr; struct soc_device *dev; From patchwork Wed Oct 11 09:34:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik Rajput X-Patchwork-Id: 151302 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp461003vqb; Wed, 11 Oct 2023 04:18:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFswiyUnyUYGRaBQoVJ/4k1A3EqHF4sAIkeQxeG/j8KjrPKscj51kpNGd94U6ViRk/LC2Ya X-Received: by 2002:a05:6870:a448:b0:1dd:67a6:ed6e with SMTP id n8-20020a056870a44800b001dd67a6ed6emr22542246oal.1.1697023098614; Wed, 11 Oct 2023 04:18:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697023098; cv=pass; d=google.com; s=arc-20160816; b=GFfCi7qqZnOEQMdo1oCngLxiwnS3HoQCU0oAXzbdnu7sD8qWqM/M1fUHPM8o5Sv7iX L7U8reWlpRFrfY0xZ/8qiOYZxSGswRJhgaCy9NtkyqVFaokdfZJYxoCaTEevTmqQzrh7 0lJz2sBp9o/o4Kli0GFAA2syyqOG6TQJvkuCck97cIxhTXqR/6O4Fa3a9yWzzu2Ii71Q ZXe830wTqNLwOQS6cRYkHRbIx9mxV1W8WDHUjZjpWv8ukdDcrilTT26syMSFBykTHLFF sdbuSyQpPyKcZi8TrQ42zg5rH70ZzfA+Y8DCfZIag7evN1qXM1hUTQDVqd94ydIRvH4J qZRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=2WurtSdXatK1MVYtezFb+hCbY0OtHluU+OZ20OPVdfE=; fh=d8mWG3NQV2V/hyk7K09+X9SHeVkXjRhQql8E0ax2OHU=; b=JavlNS7TgUHXSIUCe4poMqWvTjvKkjf9TYHlk8pTQX4IlmUYQesL33jyQNer2SRxMq mr7KkcfR45aUFm0EjhcyTUIpAI7rHA6sNK072E6xk0cOk3UnbIs9W1eWobFlkkv6oEvL mNUW06cc815lAZtI3A4NfAt/Z1LE6J+K8S7vm4Ezjqz1BesQn/wPSYd8ureYdsYjSP06 m1GHaM8LJKcgBD3Kc0Goia9hMVqY5qr9p1JbrQSY7KVpUmHQzqlWQdW1dBsZMnGbvUge y9vKd3Zzw+2k5QnnHqXmWNzBMcCbJQw1aT7C0v7J8r7QMELkHG4A73Sys8vOqgmeYd6/ RPSg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=iePqMS0q; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bt8-20020a632908000000b0056a9544e894si12831172pgb.397.2023.10.11.04.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:18:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=iePqMS0q; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 63DD181B94D1; Wed, 11 Oct 2023 04:18:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346144AbjJKLSL (ORCPT + 18 others); Wed, 11 Oct 2023 07:18:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234833AbjJKLR6 (ORCPT ); Wed, 11 Oct 2023 07:17:58 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2074.outbound.protection.outlook.com [40.107.220.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63146196; Wed, 11 Oct 2023 04:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TXKvhKK/rp/EdyXx5VPQHBd+jvnTlBRRtEjcH0ziEkPr3YZQT4zVACa3Y/KGFwTUQugdYl+M1BqTP+HWFbHfEDrrb3dMsuftWGZafE06Sgz4boVA4w9BROMPNMx2XfkG/oyvo0Fc66WCMZphc2Q7bHb44TO5YWBB04vRHd5I5SNZNIoqMbug6VlNwXd5QkarzwSmPwHo2LfnL5tTsV0nUfrKgcX0MKiK66erIthIYN7dRmc4CfAvZuy0JV13z/Yk3Bol0aLyW78Wsyo9xXQlDF809O4hfB0W8/Oni6kzNC4Eee64QlZtNKuZwW7KlyCGDVZb5kVbTo77w+OlqjYsKg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2WurtSdXatK1MVYtezFb+hCbY0OtHluU+OZ20OPVdfE=; b=JSj1nVD1jrQ7kdLocWUQTyWeqtcC9wvV0TEnBwwX3nWO3oacnXj8ppXQT1763HQ1K0XRIfQgwPBteSAKOTKD9Qd13Ze2Tqaw08CYxMNSqLZhNbLOyO8rYquHbL4nJAz8qifSgknGGI7zlJX8fP9WR7yqkpuY2TjdXHguXhRKokBPoYXEXbSjoAISGG+GH/avtVz+tjlfU+lkODH4sZYyoAby9B/GkxZCddQnmLO9o6uBVPtx9wEqITcjkkhGLI76XcBtG3QxM2PrncTYQx97JR3n4RxNO1BYAb2bXzk5MeGG04ec8zbDMgQMBv8KD3eQv+/00PxduenSB05kPGx5Lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2WurtSdXatK1MVYtezFb+hCbY0OtHluU+OZ20OPVdfE=; b=iePqMS0q0lXwlTNIQduA1y4+DVfcfTQWlEXRX3jzDXLC33UDlh+EAWz52I6c0RNvpq8Yf8/so4Ub+MzNiGe/4mQFy3plfZVCGOfByNY8Qw30XEzhCBRBSqpJTPiDrMUR7/mJ0TtmYvVdeO6xRFb1M98YTwIS9q98pfpiUw6fIccvq8Q1Lyb1mcyHrgvBEWpJWm8GFq/J/XQG9u6AMdarc5PsEfEvmwgNincpCeI7/MY4FJnveN5TK+vyDjGoLiPdos5b/5RCn2ZWtwrQHB+vg0SH8w1nW43IrsDCzcLbvg/sUR+pNoEeHR8zeRs/3ZYgUQ3+pmkKkKdsbhFnJ0NvPQ== Received: from DS7PR06CA0006.namprd06.prod.outlook.com (2603:10b6:8:2a::7) by SN7PR12MB8003.namprd12.prod.outlook.com (2603:10b6:806:32a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.33; Wed, 11 Oct 2023 11:17:49 +0000 Received: from DS1PEPF00017096.namprd05.prod.outlook.com (2603:10b6:8:2a:cafe::67) by DS7PR06CA0006.outlook.office365.com (2603:10b6:8:2a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Wed, 11 Oct 2023 11:17:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS1PEPF00017096.mail.protection.outlook.com (10.167.18.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Wed, 11 Oct 2023 11:17:48 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:40 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 11 Oct 2023 04:17:39 -0700 Received: from localhost.localdomain (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 11 Oct 2023 04:17:33 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , Subject: [PATCH v4 8/8] soc/tegra: fuse: Add support for Tegra241 Date: Wed, 11 Oct 2023 15:04:12 +0530 Message-ID: <20231011093412.7994-9-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011093412.7994-1-kkartik@nvidia.com> References: <20231011093412.7994-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017096:EE_|SN7PR12MB8003:EE_ X-MS-Office365-Filtering-Correlation-Id: 9101d8a8-6faf-4406-16d4-08dbca4bb39b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6ibVR7mdqv3/A1+KPmHGe3j324tcfzuuACl8X/madPwHwR3qoQOPEOhSdLhUKjkQ0lMIwRLEl7taEzknOWeh0gyQpMK1555ojq6YBhvHwbI+AgnxWPJ4p/1BfC37Tcdj5WXeyEGWSEt/Vv3Qes2x7i9/Ql29d9WnoVx0iA8c93tdU5zAh6EgCwt+AYghIDMAikuzCF7004yK7iZUElE0BWZbmLrwaFkMOsgYLNaL65ThQXAhrT8xCvMIL+AC6ShMKE3ZHoxp/5fch8q4yEk4vpsoMO1bapomxh9uu6TEuHOzs+6+wlQhLh+zK9kPp/ccQ7sbwZXLyFRJlZzST10AV/xe98pEjiu/hLZWvqVD7zz/qvvLe1M9sICHPUygLtnjqdUYo36cpunYkYQNuTsipLOeiHxuO0IKhuX046B3k298fT4p7jpqasRNxX87JVKhwB5B7VGOWx75gqv5MOIzsLw0ZDrwKtl8+W5qKUMijX3JvzMFJP5HN4zG8DS1Xx5hg3YcBn4V3NLjfo0X0ktYD8MBZFvevianJXz7rFce+XSeMe/2XJoZi0W+i2LEZI2uT98VKVms6J2hcASHtRRgniHOHixpMEMOxRTDeT6QL2XLNCMAnNyrDJl6NXS1+7Op1mXYoq6i8MR4Gk8CfEIeRL+lg6kx3YDlic6XXayqryqim9gMES+h9Q69Jk0/rLP8ckFeRZ0WrxzPTnaXt7wqniE+/u9bmjG4rAsZlrs6qei61s2oSiLptsVmdFK9dfiSntpXrUvtxV6pcxlzp1+j3Y+UpInqbDKgAInmSG3rPgwoaxI30FDEM8JMZZF8W4ik X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(39860400002)(136003)(346002)(396003)(230922051799003)(64100799003)(82310400011)(451199024)(186009)(1800799009)(46966006)(36840700001)(40470700004)(82740400003)(40480700001)(40460700003)(2906002)(7416002)(41300700001)(316002)(8676002)(8936002)(5660300002)(921005)(356005)(36756003)(7636003)(70206006)(1076003)(336012)(2616005)(426003)(26005)(36860700001)(86362001)(47076005)(478600001)(110136005)(83380400001)(70586007)(6666004)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 11:17:48.6294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9101d8a8-6faf-4406-16d4-08dbca4bb39b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017096.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8003 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:18:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779457692570585864 X-GMAIL-MSGID: 1779457692570585864 Add support for Tegra241 which use ACPI boot. Signed-off-by: Kartik --- v1 -> v2: * Removed few entries from tegra241_fuse_soc which were initilized as NULL or 0. --- drivers/soc/tegra/Kconfig | 5 +++++ drivers/soc/tegra/fuse/fuse-tegra.c | 5 +++++ drivers/soc/tegra/fuse/fuse-tegra30.c | 20 ++++++++++++++++++++ drivers/soc/tegra/fuse/fuse.h | 4 ++++ drivers/soc/tegra/fuse/tegra-apbmisc.c | 1 + include/soc/tegra/fuse.h | 1 + 6 files changed, 36 insertions(+) diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig index f16beeabaa92..33512558af9f 100644 --- a/drivers/soc/tegra/Kconfig +++ b/drivers/soc/tegra/Kconfig @@ -133,6 +133,11 @@ config ARCH_TEGRA_234_SOC help Enable support for the NVIDIA Tegra234 SoC. +config ARCH_TEGRA_241_SOC + bool "NVIDIA Tegra241 SoC" + help + Enable support for the NVIDIA Tegra241 SoC. + endif endif diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 167a6fe6c43d..94bfccd719de 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -174,6 +174,11 @@ static int tegra_fuse_probe(struct platform_device *pdev) case TEGRA234: fuse->soc = &tegra234_fuse_soc; break; +#endif +#if defined(CONFIG_ARCH_TEGRA_241_SOC) + case TEGRA241: + fuse->soc = &tegra241_fuse_soc; + break; #endif default: return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip); diff --git a/drivers/soc/tegra/fuse/fuse-tegra30.c b/drivers/soc/tegra/fuse/fuse-tegra30.c index e94d46372a63..2070d36c510d 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra30.c +++ b/drivers/soc/tegra/fuse/fuse-tegra30.c @@ -678,3 +678,23 @@ const struct tegra_fuse_soc tegra234_fuse_soc = { .clk_suspend_on = false, }; #endif + +#if defined(CONFIG_ARCH_TEGRA_241_SOC) +static const struct tegra_fuse_info tegra241_fuse_info = { + .read = tegra30_fuse_read, + .size = 0x16008, + .spare = 0xcf0, +}; + +static const struct nvmem_keepout tegra241_fuse_keepouts[] = { + { .start = 0xc, .end = 0x1600c } +}; + +const struct tegra_fuse_soc tegra241_fuse_soc = { + .init = tegra30_fuse_init, + .info = &tegra241_fuse_info, + .keepouts = tegra241_fuse_keepouts, + .num_keepouts = ARRAY_SIZE(tegra241_fuse_keepouts), + .soc_attr_group = &tegra194_soc_attr_group, +}; +#endif diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h index a41e9f85281a..f3b705327c20 100644 --- a/drivers/soc/tegra/fuse/fuse.h +++ b/drivers/soc/tegra/fuse/fuse.h @@ -136,4 +136,8 @@ extern const struct tegra_fuse_soc tegra194_fuse_soc; extern const struct tegra_fuse_soc tegra234_fuse_soc; #endif +#ifdef CONFIG_ARCH_TEGRA_241_SOC +extern const struct tegra_fuse_soc tegra241_fuse_soc; +#endif + #endif diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index e2ca93de6c1f..c72bdb3e4e2c 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -64,6 +64,7 @@ bool tegra_is_silicon(void) switch (tegra_get_chip_id()) { case TEGRA194: case TEGRA234: + case TEGRA241: case TEGRA264: if (tegra_get_platform() == 0) return true; diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h index 3a513be50243..8f421b9f7585 100644 --- a/include/soc/tegra/fuse.h +++ b/include/soc/tegra/fuse.h @@ -17,6 +17,7 @@ #define TEGRA186 0x18 #define TEGRA194 0x19 #define TEGRA234 0x23 +#define TEGRA241 0x24 #define TEGRA264 0x26 #define TEGRA_FUSE_SKU_CALIB_0 0xf0