From patchwork Mon Feb 1 18:13:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 12059643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85E71C433DB for ; Mon, 1 Feb 2021 18:15:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3238364EA0 for ; Mon, 1 Feb 2021 18:15:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3238364EA0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fR9FTHE4qHmINsJjqsOtzZzwND1mbw4zMi0jDuQBbgg=; b=BZnlRMHWFvYNjBhLVaGBQgZ1j Tj6jAVtI4M5NQ3eX8Us3YrtiocPvcNW6FKSh8x+tNMmcbkSSfJha5lVVN/d0pfhqg8Hlndj2G81Av 5yqBJsv0RJcsgDzla2Xox2J5/44EPwdolvbfnOCBpshBqil+sVyESqWWFN1CGOi3zeIPI5rgRcZFG keHQM8EAhFOXfGao4fjIVQ4rukSp65SKuJrVFtCf2wv1jemelHV45lOYBAh654fa9vLv9vTJG16Ud lPKvnEf+/zTUZVkG8f5eT9B6xIgxmXycHXL6aAbfSiye+VpnfWOFuhQpBhUlKfqr98rD1+Ix+PHiJ zDdutw3Tg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6diQ-00038k-Me; Mon, 01 Feb 2021 18:14:22 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6di5-0002x4-UB for linux-arm-kernel@lists.infradead.org; Mon, 01 Feb 2021 18:14:05 +0000 Received: by mail-pj1-x1029.google.com with SMTP id s24so73036pjp.5 for ; Mon, 01 Feb 2021 10:14:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vkMHICiY0sjvBDYwRE3nRQtY0zoUuO0WMFpN8g7r2A8=; b=vlqpMcOccLHMKfyFmm0VBfziORVRLmt8yzV7ICOPBJoFkdzNIO89ZyGaqR6J8hhNNO 7ZlPjJYgqQ5Xvxzcqsep6TF2M15aBK7XgBiu3Zj5wTtj29UpvPf4Iw65f4NgrOSbiUAa +2z+x9Uj+mEvqFDjGraGjhnlPUpfpMLFtaMrbzhUENbXpYlloBTlZEEucKDwvBKCCDwm CbYprpqJVEe6Xu+tfGi9O0gln6Glwsi6U3N5VVWQGUzGLYagUh7fingrvtPAYzft+w9K yhki4VKGcLBRGm/WNKttqksUzJkJHhFE0FCiq2kqRiS9YRbR6vWQJGHQ0OvvLN+qHP38 8xdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vkMHICiY0sjvBDYwRE3nRQtY0zoUuO0WMFpN8g7r2A8=; b=iWj5pvtyfjDCfBHkk/Rq3Yq+/Hf0qbsLGcKdZlSGOvYJ98STyk6XJ1IQMFkK9AtmZf 290YhxxgwZ9coBv9BIBPZtuzWzSOTe2dXBadI1gPqdARTH5Y2rYaTL6MQokWy/EVHVP7 JLlDDkJahpbUA7J50dm9qHcYGCziOJ2L1TO4Rc9A50I4IPKF9oMzLdSZu4txQu4nYy1Q jNPbuN3HIdZ/VR3j4hfMISxTrJ0IVuOAeXmNd8/tkYDDO+WE7NCptIEI/vAeEDLMKuvb AvAQ138x4SVXPd6r1IZmaa1A70evFWI7z0mmh74awri4QHXoH4dxdbe4wSqLlWlFZXM5 a86A== X-Gm-Message-State: AOAM531YUuIiEB98I5V/0ytvJxOmS5k4xbyA2cQUdCIpGdTPIQoPZRA9 X3rz8neurvDuLJ6ADMmVder9iEk+XEGR0Q== X-Google-Smtp-Source: ABdhPJyztrTnQycZMCgCHBeSSeVduujWZcTuRldzwD/RBoN4blZFdcuzJgo7+pc9q0RlJZ9/uuBZ2Q== X-Received: by 2002:a17:902:6b45:b029:e0:7a3:a8c with SMTP id g5-20020a1709026b45b02900e007a30a8cmr19048550plt.1.1612203239599; Mon, 01 Feb 2021 10:13:59 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id e12sm75784pjj.23.2021.02.01.10.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 10:13:58 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 06/31] coresight: tpiu: Prepare for using coresight device access abstraction Date: Mon, 1 Feb 2021 11:13:26 -0700 Message-Id: <20210201181351.1475223-7-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210201181351.1475223-1-mathieu.poirier@linaro.org> References: <20210201181351.1475223-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210201_131402_092322_E9158515 X-CRM114-Status: GOOD ( 17.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Suzuki K Poulose Prepare the TPIU driver to make use of the CoreSight device access abstraction layer. The driver touches the device even before the coresight device is registered. Thus we could be accessing the devices without a csdev. As we are about to use the abstraction layer for accessing the device, pass in the access directly to avoid having to deal with the un-initialised csdev. Cc: Mike Leach Signed-off-by: Suzuki K Poulose Link: https://lore.kernel.org/r/20210110224850.1880240-5-suzuki.poulose@arm.com Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-tpiu.c | 30 +++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-tpiu.c b/drivers/hwtracing/coresight/coresight-tpiu.c index 6ca396799883..a12b6ee0a576 100644 --- a/drivers/hwtracing/coresight/coresight-tpiu.c +++ b/drivers/hwtracing/coresight/coresight-tpiu.c @@ -60,49 +60,45 @@ struct tpiu_drvdata { struct coresight_device *csdev; }; -static void tpiu_enable_hw(struct tpiu_drvdata *drvdata) +static void tpiu_enable_hw(struct csdev_access *csa) { - CS_UNLOCK(drvdata->base); + CS_UNLOCK(csa->base); /* TODO: fill this up */ - CS_LOCK(drvdata->base); + CS_LOCK(csa->base); } static int tpiu_enable(struct coresight_device *csdev, u32 mode, void *__unused) { - struct tpiu_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); - - tpiu_enable_hw(drvdata); + tpiu_enable_hw(&csdev->access); atomic_inc(csdev->refcnt); dev_dbg(&csdev->dev, "TPIU enabled\n"); return 0; } -static void tpiu_disable_hw(struct tpiu_drvdata *drvdata) +static void tpiu_disable_hw(struct csdev_access *csa) { - CS_UNLOCK(drvdata->base); + CS_UNLOCK(csa->base); /* Clear formatter and stop on flush */ - writel_relaxed(FFCR_STOP_FI, drvdata->base + TPIU_FFCR); + csdev_access_relaxed_write32(csa, FFCR_STOP_FI, TPIU_FFCR); /* Generate manual flush */ - writel_relaxed(FFCR_STOP_FI | FFCR_FON_MAN, drvdata->base + TPIU_FFCR); + csdev_access_relaxed_write32(csa, FFCR_STOP_FI | FFCR_FON_MAN, TPIU_FFCR); /* Wait for flush to complete */ - coresight_timeout(drvdata->base, TPIU_FFCR, FFCR_FON_MAN_BIT, 0); + coresight_timeout(csa->base, TPIU_FFCR, FFCR_FON_MAN_BIT, 0); /* Wait for formatter to stop */ - coresight_timeout(drvdata->base, TPIU_FFSR, FFSR_FT_STOPPED_BIT, 1); + coresight_timeout(csa->base, TPIU_FFSR, FFSR_FT_STOPPED_BIT, 1); - CS_LOCK(drvdata->base); + CS_LOCK(csa->base); } static int tpiu_disable(struct coresight_device *csdev) { - struct tpiu_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); - if (atomic_dec_return(csdev->refcnt)) return -EBUSY; - tpiu_disable_hw(drvdata); + tpiu_disable_hw(&csdev->access); dev_dbg(&csdev->dev, "TPIU disabled\n"); return 0; @@ -152,7 +148,7 @@ static int tpiu_probe(struct amba_device *adev, const struct amba_id *id) desc.access = CSDEV_ACCESS_IOMEM(base); /* Disable tpiu to support older devices */ - tpiu_disable_hw(drvdata); + tpiu_disable_hw(&desc.access); pdata = coresight_get_platform_data(dev); if (IS_ERR(pdata))