From patchwork Sat Dec 5 19:17:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 11953411 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=-16.7 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,MSGID_FROM_MTA_HEADER,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 935C6C433FE for ; Sat, 5 Dec 2020 19:19:45 +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 4FD2E23110 for ; Sat, 5 Dec 2020 19:19:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FD2E23110 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=prevas.dk 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=viN4wt3dd6jARkDUSg00fVk6J61yUhYGS72aZ8ftqPc=; b=KoV5dnlAoqUb04YaVn+RyBO9t +7LEwA3YRAYOsBefA9ocSuJV4fZ2XBLa5kZwjBGn+6uAB0rrR+orWb1BaDjAXGu3wuti1tnuir7dq 76+LvM9/4byeKySIpH36FAYRQVfZhO7iEpwLTR/JE6mr6W/5Ep+6QGOR2Gua9BMIMvC1XM4w7iQyc 1xancN204/iLxgBldJhfPTWNPbU3NgjeSO7k0trkwAVnrTZ0y86z6kPRURIr0HDTB/rH4jAAcdFYW 2i6ZFe6R0LkJBN/VuWPYwSrSF3ejCiUswORcaRSuMTAh3tG17Yke6+pV607URyEoHwDt7J/vTDdYW 8LC6NMUfA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kld4h-00044H-TN; Sat, 05 Dec 2020 19:18:31 +0000 Received: from mail-am6eur05on2132.outbound.protection.outlook.com ([40.107.22.132] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kld4a-00042O-SL for linux-arm-kernel@lists.infradead.org; Sat, 05 Dec 2020 19:18:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e1pBv1/Je+UeSjJD6JemeRUbBnfsVd/w0nQqTS2f97GIvT721jMKIWePja0SO5+0Cs8DnabMHTWmeMuuWDgFfQcliYJhG4UxfxCkt5bu9y8VGIYWexym5GXkMwy4GIuh0Ed5oc3VhT8sK+YN6qo/SzOhy0JRyvdy3uGMdPZibMXKI2XxAqzNRj0G7WBoQcGc9KRGRQBOqOUogKhCk2SORweUHTEfBsJQkc9+gxrjnLkU48LzB+S2uWb/84pR+Ig7V2u1y5gnRsmIJq/DWx/07lwAvS1Hzi46JVoTpWq7CET5xp4FY2auDEHp5Lv9KsyFHbAfC6OZj5cpke+8xck7oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nbeuYQ5z0yv0bqY63C91Xkj2WIbCJKoREPOQvXArM50=; b=YLhJwxjc6u9nkloj1WogjmNfPc/fPl/tRFsHsG88UW3hdUXz631bkdE/nuTTL0cJAaQXteA967D6kLO4ghW6F544S6DS800lsBNHD8Q+gx9A2SFDxhw8gXX8ndadi65ZqbxvhqzMZoKAGNBsZ58DzCAe/OHmOH/RD+rWHgFRozOmmo26T/cGokrVevk2Ta2+Hi6MxvfPscBWaybQ8Zg4qh2dkWIxVLbZsJxBjuV+2UzFdLeEyr7R1tJMpg39mIAEewioCcPQOdsTH7iPvI3L5xIMXYqzDmAGv3F+53mtr5OU3d4s5/KBewOyi/HAlhlRkvRkkSWAKvrrEDDR+aY8QQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nbeuYQ5z0yv0bqY63C91Xkj2WIbCJKoREPOQvXArM50=; b=j1M7cxF6A/OcmRRsmR0n/11lJUQQuNE4Jd095L0qdEMc9Cpakh+X4sel28ye/vjYXnNGA9zS0Sc6I0YXXtguU1nTjwoxoW5yEDIcvCh/Z6VWzbD2+0ZCaO40I5ib5qfjxnaDI6ZeFW2U4lBhYrXWgXPCtMqFNWY9fJraHIetvGI= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM4PR1001MB1363.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:200:99::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.19; Sat, 5 Dec 2020 19:18:22 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3632.021; Sat, 5 Dec 2020 19:18:22 +0000 From: Rasmus Villemoes To: Qiang Zhao , Li Yang Subject: [PATCH 06/20] soc: fsl: qe: add cpm_muram_free_addr() helper Date: Sat, 5 Dec 2020 20:17:29 +0100 Message-Id: <20201205191744.7847-7-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20201205191744.7847-1-rasmus.villemoes@prevas.dk> References: <20201205191744.7847-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM5PR0701CA0063.eurprd07.prod.outlook.com (2603:10a6:203:2::25) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM5PR0701CA0063.eurprd07.prod.outlook.com (2603:10a6:203:2::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.5 via Frontend Transport; Sat, 5 Dec 2020 19:18:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6012a865-70f2-4f38-635c-08d8995287d8 X-MS-TrafficTypeDiagnostic: AM4PR1001MB1363: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NNuj/RlT3jp7WI22eCyms92qPqR7Kb5imhdsBqPkO6OGXdMFzw3OcWRf4BqAZakEfKzd7SiC6TxAs+btcoICs+hRQbLKeyDFoNSfpArVm4jSZsodmT6IKsi3Tg3qVrUCUFTGv72uRMNNEHCJS54/FtGar+e0O48KA71tIFmuO3B+QwDqNrfo9d23ki2PhXGXIaow3UjnDuJZzJRhwrqOSaSB8M47Sb6/kPTOREM6DH2XkEkutlneRup29+6XGMO9FAJR//PVtFN6DJ6wj7cwAwJjK+SKv9xxAqUzrWNDkFuSxchAYA5i/VS/l98zm1u7dyeeR0aiW4zBtdC6D29zlw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(396003)(39840400004)(346002)(136003)(366004)(376002)(2616005)(2906002)(8676002)(8936002)(52116002)(36756003)(66476007)(66946007)(66556008)(4326008)(8976002)(5660300002)(1076003)(6486002)(44832011)(6512007)(186003)(26005)(110136005)(316002)(86362001)(478600001)(16526019)(54906003)(956004)(6506007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: bSclpNEkcYOXhHSIAqOtV3AArJXSfsvKPHUBlj4tgEe3rliFNXL3y7FHN6kqmxA/zg6XY9yc0NPOPF9a7PxC+EqX1ZP3Sqnc6VEYaSDhZb6LW8l1hjwv7oyeLO+kfOQ03XZvBDYdvLLdTQoH1w26DDmh9OLyFUCPyMGmEzcXAlTQxwYXGfOB0WuGOHIm2HbQspvhcW/6p2UwKZGmk/UpKfVmfmWGu1Ydb3BUvSmqo19Yaz8ab3OnuD90wiQlmUmuLObKos10y/lnTYJHv+bYnqbcZSg3ClM46vyCV+BEDCIfE62NYSwl0oAdNhtBUMvkqtu0WRIYD0uu1RQF9VvSDZGy5D5KV96Y6dq67xrkLT62yZ3Gj4RTD2Nx2kMHwBMi3VH9TXVNT/y5GTs4eJI3bga3uFjNMk0Z1+1LJQjc7TUT3PUsws9zlthWXyNouEC2UQ9dYQEyk36n6S8IGnsXaZATUTWwGr7wkuNRRmj5pAZqZwAhzJGbKtrDsLdIAlA7/Uv/Xm3F6nHbUSWmTcb2LdGG1tjaIK3LsmEhGjx7zCvtt2VQFaJcIf8ax0sZuBpPy/zfPDcqodZfjWIsHolDrbpjw1wR2SXwhAp/QxW+QJr5CGnPa77qawW9js394/H3MSzuDVTlte6SdAA/1QNX6A1eGrAeTTDP6ovM5MUjQyWjHIL2HAZ+MlmdTKFzyEssmcOZKzfdwjdSncky/uNYECU7w2a3mVi74RcD5zAczhgNnZF79CElwuqE78/7n2LSUPuXaS4iocN9q7RLYERpeP2g7+uU6RXvu+K3pa2gFW5oMc+uIOgt/beKhCd3cP1tg0Nz0tsycO2nIlEnXwzhj4IoTLTKKSmogMHy5iTyBzK40UXWOWQLZ3o5h8iiZoVAp3+kpWddAwhI1lDrswxqoMYUfX2fNnzVkT1Xswr2YCUQAOw1DhJ8iNiZt938RaJUA8fEwn5wlZMfI1FW3cdujekOfJFODDrIbpyHCp7LzmQ3xJCWngcxTYprEewq7Q/g X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 6012a865-70f2-4f38-635c-08d8995287d8 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2020 19:18:22.0437 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jFOW1GGhUi3LbVEg4FgTaP9gELyQMqvGeDBGGDilHQukeptGGT9Y/Ld7XgJ5H0iPq8puypekc6mgIU8SasK2dp0XHVp3yaPn9nl5FNItG4Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR1001MB1363 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201205_141825_024241_188437C4 X-CRM114-Status: GOOD ( 12.31 ) 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: Vladimir Oltean , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Rasmus Villemoes Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a helper that takes a virtual address rather than the muram offset. This will be used in a couple of places to avoid having to store both the offset and the virtual address, as well as removing NULL checks from the callers. Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe_common.c | 12 ++++++++++++ include/soc/fsl/qe/qe.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c index 303cc2f5eb4a..448ef7f5321a 100644 --- a/drivers/soc/fsl/qe/qe_common.c +++ b/drivers/soc/fsl/qe/qe_common.c @@ -238,3 +238,15 @@ dma_addr_t cpm_muram_dma(void __iomem *addr) return muram_pbase + (addr - muram_vbase); } EXPORT_SYMBOL(cpm_muram_dma); + +/* + * As cpm_muram_free, but takes the virtual address rather than the + * muram offset. + */ +void cpm_muram_free_addr(const void __iomem *addr) +{ + if (!addr) + return; + cpm_muram_free(cpm_muram_offset(addr)); +} +EXPORT_SYMBOL(cpm_muram_free_addr); diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h index 8ee3747433c0..66f1afc393d1 100644 --- a/include/soc/fsl/qe/qe.h +++ b/include/soc/fsl/qe/qe.h @@ -104,6 +104,7 @@ s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); void __iomem *cpm_muram_addr(unsigned long offset); unsigned long cpm_muram_offset(const void __iomem *addr); dma_addr_t cpm_muram_dma(void __iomem *addr); +void cpm_muram_free_addr(const void __iomem *addr); #else static inline s32 cpm_muram_alloc(unsigned long size, unsigned long align) @@ -135,6 +136,9 @@ static inline dma_addr_t cpm_muram_dma(void __iomem *addr) { return 0; } +static inline void cpm_muram_free_addr(const void __iomem *addr) +{ +} #endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */ /* QE PIO */ @@ -239,6 +243,7 @@ static inline int qe_alive_during_sleep(void) #define qe_muram_addr cpm_muram_addr #define qe_muram_offset cpm_muram_offset #define qe_muram_dma cpm_muram_dma +#define qe_muram_free_addr cpm_muram_free_addr #ifdef CONFIG_PPC32 #define qe_iowrite8(val, addr) out_8(addr, val)