Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2135122rdb; Thu, 7 Dec 2023 21:42:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IERTztXoy/JMK5tDm8GcRBLObvz84gvZ18cP8BVjdkh3ZzzoMp/NNY9m8Hgpb90+Ag0oPJF X-Received: by 2002:a17:903:503:b0:1cf:b964:5e5a with SMTP id jn3-20020a170903050300b001cfb9645e5amr3390559plb.17.1702014141434; Thu, 07 Dec 2023 21:42:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702014141; cv=none; d=google.com; s=arc-20160816; b=f4TTWW2HCw80M8NQ4PXyc7oqBvW2e2XEpKzQrrKKSmE3vlMLeMDRvtjfluRzwDdHxS J+J4+Hj73mYb6WuimXzZHT9bHg+DOgXrkoY6plbdNrroY1tz2p9WCGneUXH1jrLKncTO 82Y+XIdxbHT1Rqytm1lEKmyJaJCt50PsOy2ob++X+UPbk3V4sDjmT8E4yAgIT/ckT+OL m2HAeWzfgGd5o9c6ogCIdZ6s2A2+ryAld/aKqZ9O33G4UOv+DYqYSUeCWnHxenIi/Rt7 mRfKc+Gfa/9AdQpxArjIb9qjEiBtxS2Crqv2x+UnIbYyZbDkV7SxZv1IMfkCiCYcROXS /xtQ== ARC-Message-Signature: i=1; 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:cc:to:from; bh=8ge/ZBJ2qVEYpwlv9OzDUj304pflZgCh/bKD9mxBqmc=; fh=z4RmidW4C/H6Wukz35Ay3Y7gZc5eNYlbqbLWbc/zZ2Y=; b=WFGT+GZfKiPXQf8ZaWW8nHiyx6nn83I/cs6NPKRgn7niZn2RBxFLp5vYuD1M4281AM 4pfXC0WU9iwwQO0OJuZZhlCOdAoedT9Fc1qgXK5PcY+Z/hSH66zRdRLVxsa4U6kw/AEX J/+ZxZmcyQK0pIH5/swP71+O8YNKzBFx56owI4OjNgAN904W65cX3ezh2mSS5XbTFo/p ukKQHYbHyxATCYgcuismywMc0OHdvyvQ79OYiidmHOp0GbaYnoEzgD17I4a5DG1g39i0 XgNj3+QiDFuyLsqPlBeRmosLQnx/d2zCcFPUIm5SvcibCUM5moRecOeawAP/xNTWzg/i w+NQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id o15-20020a170902d4cf00b001d082f25836si997778plg.333.2023.12.07.21.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 21:42:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3321680789AC; Thu, 7 Dec 2023 21:40:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235706AbjLHFkM (ORCPT + 99 others); Fri, 8 Dec 2023 00:40:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233240AbjLHFkF (ORCPT ); Fri, 8 Dec 2023 00:40:05 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6D4891738; Thu, 7 Dec 2023 21:40:07 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E4D5A11FB; Thu, 7 Dec 2023 21:40:52 -0800 (PST) Received: from a077893.blr.arm.com (a077893.blr.arm.com [10.162.41.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 413633F5A1; Thu, 7 Dec 2023 21:40:01 -0800 (PST) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com Cc: Anshuman Khandual , Lorenzo Pieralisi , Sudeep Holla , Mike Leach , James Clark , Maxime Coquelin , Alexandre Torgue , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-stm32@st-md-mailman.stormreply.com, Leo Yan , Alexander Shishkin Subject: [PATCH V3 03/10] coresight: Add helpers registering/removing both AMBA and platform drivers Date: Fri, 8 Dec 2023 11:09:32 +0530 Message-Id: <20231208053939.42901-4-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231208053939.42901-1-anshuman.khandual@arm.com> References: <20231208053939.42901-1-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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]); Thu, 07 Dec 2023 21:40:27 -0800 (PST) This adds two different helpers i.e coresight_init_driver()/remove_driver() enabling coresight devices to register or remove AMBA and platform drivers. Cc: Suzuki K Poulose Cc: Mike Leach Cc: James Clark Cc: Leo Yan Cc: Alexander Shishkin Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: coresight@lists.linaro.org Signed-off-by: Anshuman Khandual --- Changes in V3: - New patch in the series drivers/hwtracing/coresight/coresight-core.c | 29 ++++++++++++++++++++ include/linux/coresight.h | 7 +++++ 2 files changed, 36 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c index 9fabe00a40d6..ede9b0723f95 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1833,6 +1833,35 @@ static void __exit coresight_exit(void) module_init(coresight_init); module_exit(coresight_exit); +int coresight_init_driver(const char *drv, struct amba_driver *amba_drv, + struct platform_driver *pdev_drv) +{ + int ret; + + ret = amba_driver_register(amba_drv); + if (ret) { + pr_err("%s: error registering AMBA driver\n", drv); + return ret; + } + + ret = platform_driver_register(pdev_drv); + if (!ret) + return 0; + + pr_err("%s: error registering platform driver\n", drv); + amba_driver_unregister(amba_drv); + return ret; +} +EXPORT_SYMBOL_GPL(coresight_init_driver); + +void coresight_remove_driver(struct amba_driver *amba_drv, + struct platform_driver *pdev_drv) +{ + amba_driver_unregister(amba_drv); + platform_driver_unregister(pdev_drv); +} +EXPORT_SYMBOL_GPL(coresight_remove_driver); + MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Pratik Patel "); MODULE_AUTHOR("Mathieu Poirier "); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index a269fffaf991..be7fe3793763 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -12,6 +12,8 @@ #include #include #include +#include +#include /* Peripheral id registers (0xFD0-0xFEC) */ #define CORESIGHT_PERIPHIDR4 0xfd0 @@ -597,6 +599,11 @@ void coresight_relaxed_write64(struct coresight_device *csdev, u64 val, u32 offset); void coresight_write64(struct coresight_device *csdev, u64 val, u32 offset); +int coresight_init_driver(const char *drv, struct amba_driver *amba_drv, + struct platform_driver *pdev_drv); + +void coresight_remove_driver(struct amba_driver *amba_drv, + struct platform_driver *pdev_drv); #else static inline struct coresight_device * coresight_register(struct coresight_desc *desc) { return NULL; } -- 2.25.1