From patchwork Fri May 8 12:35:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 226186 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable 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 AEB2DC47257 for ; Fri, 8 May 2020 12:58:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FCC624978 for ; Fri, 8 May 2020 12:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942712; bh=T+auyRm387bDHY5h1X+vQAB1Wd987DZ/XpEgUIlqWAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NvoYJjBWqDbDnDkhuKnP6yLTAjrqZJbWuAoOQaxN3wX70QfiyPUjNhg1uObILKYov 9oamsu0DwiEmK2ndNJbss0CI+bxxh4O5vKv9wHvQ1n41UxDPrbzhg2Zg3QPM+as9BN BksdLtf+BBfdvp0jOID+8HUQNH42UkGro/pxL5Z4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729306AbgEHM60 (ORCPT ); Fri, 8 May 2020 08:58:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:36802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728391AbgEHMy3 (ORCPT ); Fri, 8 May 2020 08:54:29 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D6DB224958; Fri, 8 May 2020 12:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588942468; bh=T+auyRm387bDHY5h1X+vQAB1Wd987DZ/XpEgUIlqWAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oX29nqRJTXQIJROhaj9OcrdI8FMSZfdhaJd0z0XEzbK5ByywKNw+j3vRcHU7E+aai MjO819aV6tOHFol+hNln/7c+zExO8I/oN5Y5TEfggjva8Ys2XV4MeecRFdjBXxHJyL 6UMOSC+V8hkTYeYdOq2uGO8hliDVt+8X6+Hn/vx8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AceLan Kao , Tuowen Zhao , Mika Westerberg , Andy Shevchenko , Luis Chamberlain , Lee Jones , Sasha Levin Subject: [PATCH 5.4 34/50] lib: devres: add a helper function for ioremap_uc Date: Fri, 8 May 2020 14:35:40 +0200 Message-Id: <20200508123048.118049262@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200508123043.085296641@linuxfoundation.org> References: <20200508123043.085296641@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tuowen Zhao [ Upstream commit e537654b7039aacfe8ae629d49655c0e5692ad44 ] Implement a resource managed strongly uncachable ioremap function. Cc: # v4.19+ Tested-by: AceLan Kao Signed-off-by: Tuowen Zhao Acked-by: Mika Westerberg Acked-by: Andy Shevchenko Acked-by: Luis Chamberlain Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- include/linux/io.h | 2 ++ lib/devres.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/linux/io.h b/include/linux/io.h index accac822336aa..a59834bc0a114 100644 --- a/include/linux/io.h +++ b/include/linux/io.h @@ -64,6 +64,8 @@ static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr) void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, resource_size_t size); +void __iomem *devm_ioremap_uc(struct device *dev, resource_size_t offset, + resource_size_t size); void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, resource_size_t size); void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset, diff --git a/lib/devres.c b/lib/devres.c index 6a0e9bd6524ae..17624d35e82d4 100644 --- a/lib/devres.c +++ b/lib/devres.c @@ -9,6 +9,7 @@ enum devm_ioremap_type { DEVM_IOREMAP = 0, DEVM_IOREMAP_NC, + DEVM_IOREMAP_UC, DEVM_IOREMAP_WC, }; @@ -39,6 +40,9 @@ static void __iomem *__devm_ioremap(struct device *dev, resource_size_t offset, case DEVM_IOREMAP_NC: addr = ioremap_nocache(offset, size); break; + case DEVM_IOREMAP_UC: + addr = ioremap_uc(offset, size); + break; case DEVM_IOREMAP_WC: addr = ioremap_wc(offset, size); break; @@ -68,6 +72,21 @@ void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, } EXPORT_SYMBOL(devm_ioremap); +/** + * devm_ioremap_uc - Managed ioremap_uc() + * @dev: Generic device to remap IO address for + * @offset: Resource address to map + * @size: Size of map + * + * Managed ioremap_uc(). Map is automatically unmapped on driver detach. + */ +void __iomem *devm_ioremap_uc(struct device *dev, resource_size_t offset, + resource_size_t size) +{ + return __devm_ioremap(dev, offset, size, DEVM_IOREMAP_UC); +} +EXPORT_SYMBOL_GPL(devm_ioremap_uc); + /** * devm_ioremap_nocache - Managed ioremap_nocache() * @dev: Generic device to remap IO address for