From patchwork Tue Apr 27 00:18:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 427784 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4161315jao; Mon, 26 Apr 2021 17:18:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6Qetqfy1xAFpFI1ccXZKYitKIBmxAoVpKjP8K/JojIdW/e0Zb0ZfBX/bvJPkgc5XeAIA8 X-Received: by 2002:a17:906:4098:: with SMTP id u24mr2815781ejj.228.1619482716762; Mon, 26 Apr 2021 17:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619482716; cv=none; d=google.com; s=arc-20160816; b=vR4MYfVVLeqK349MYtbaMC4FlNSotEoxbcZ7ppskCc0igYahDwq1+6gL6GiE5i8JxF YvzTIOzNv8i6xyxCciPgAAgS1B2HdvHOx6QrTW2YB1nkM8L+kHXpzEVypOBvDM3owIiu TB9IdbfmWwNu9SbC+QK+0sBAnL0Fdb0YXS90OVpbQ1EKtj2s23YxKytyyq9Twc+jB2BU SOYi6pZEd3NvyXEEaJGUfyYoxR8AvAk33WbVqa7rPQBgUizZAW1Db5/Lhz7oewYNF4NS gz3RTmsrPD7n6ZVQBgX69CDq1T2zb4BIZ5tSa/CBRIMnqeXOb0CRUvrIN3k9FdMh6yqQ 3R1A== 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 :dkim-signature; bh=ijc1U+UMGqLkSaCADs8rAj5/EZ+DPFy6/09GaffQN1o=; b=vjaH7/6ItM8G7BHTPUUQBFozxd2dF7IHxA+b4IiLgcrcVCJ/vcZqn8nWBKzY2/LMQr 9Vav7b3F+r/cJBV09BXHdTYwdcdK2T02GEHXMzyXUPkLduq4iL6Yc11aDgt078UyINzr x1KRU/I2dUBz2bRnPsa4sUS8kv7mptaAToW0+cn7XCQXZVih95WPjSNLTjucVJyTqEk2 oODtQn7Dc2eVrWQk9RPs7L5MkXBvQHogSIYl42tkj9P/Afk0LFtA9zG61FJOAA8xUT48 iilMoXAr3IjveBRQbvmXiB6m1Y05VGNQOxzpZRWHgFg/W/1CKRvxrfB4YzkCqR5hCBap H3ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tsAPPWmI; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si1063694edv.309.2021.04.26.17.18.36; Mon, 26 Apr 2021 17:18:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tsAPPWmI; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232161AbhD0ATR (ORCPT + 17 others); Mon, 26 Apr 2021 20:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234598AbhD0ATQ (ORCPT ); Mon, 26 Apr 2021 20:19:16 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFA0AC061760 for ; Mon, 26 Apr 2021 17:18:33 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id b23so8411800lfv.8 for ; Mon, 26 Apr 2021 17:18:33 -0700 (PDT) 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=ijc1U+UMGqLkSaCADs8rAj5/EZ+DPFy6/09GaffQN1o=; b=tsAPPWmIh2Z+c2VWBZfDmS2mvJxS4xPgUWE5z0UBkAIO5yIis4Pk2zgQiHwxH/gxoS 5PnWjb4K3/SFTLLo8cLuOyM6cDMuBEDRiHmppIxido3wuBErjItr3dECIG31YUX9Xdhr 7+42G+2c/XaDNYf7WtDqabnvAeLSh/mNNGUPyLpmhyP0NivSEAYAWpLwmm053LKbIL1A pAMjDhuIs4IEeAwLlFGl+mR60+WvCNLxwNF4OAHo5XVtkdtXC9mkjRpOP6bAvmpjY/Ie NlveQolNEf7fmaRRx9kxGpFsC1dvIEa/86tqDyoslMMUHshTwNGlG8D4PgJPc1RY2crD mr4g== 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=ijc1U+UMGqLkSaCADs8rAj5/EZ+DPFy6/09GaffQN1o=; b=TkTGitQS6H58Lo3nnW9Wp+ONxNoz8hqOzkeNCrar3KqcqqwSKpfm9HM8Kr6or037xz eY0HteyY/1vwIqdn8rJxWXelixLy7+pcjMC169ymHQb0uMELuatfLP839c2gN8yAOsgy PxKW25A18GjHhiGvW7G6L+B35LvuYlcxKaqBkzKIvFSC4q8s4gJt0OD31HWSPgzVBGqt zjXWZYLsfPVSn2qanJZ9vXkhMt7IHN53yM+X28osSDVw8Pi9EuCOkKRhjbtdJHPGoyTn ZeE0P1OI3/1lVSpv6EGNmuniV2xzduae6Jzwhmj9Ozc2opj3Xr4c74egvRrHQ8YkExDs UYWg== X-Gm-Message-State: AOAM533m1mEdOFDA5bFRdCZi75vSnqbeqKQj/CeALp2RAcEOhMmD5Wkw sh6vniN7bmCSXH0fTDhG8vx8qg== X-Received: by 2002:a19:ad41:: with SMTP id s1mr14570479lfd.306.1619482712483; Mon, 26 Apr 2021 17:18:32 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id d15sm1555100lfn.7.2021.04.26.17.18.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 17:18:32 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Cc: Jonathan Marek , Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 3/4] drm/msm: get rid of msm_iomap_size Date: Tue, 27 Apr 2021 03:18:27 +0300 Message-Id: <20210427001828.2375555-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210427001828.2375555-1-dmitry.baryshkov@linaro.org> References: <20210427001828.2375555-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Instead of looping throught the resources each time to get the DSI CTRL area size, get it at the ioremap time. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dsi/dsi_host.c | 5 +++-- drivers/gpu/drm/msm/msm_drv.c | 27 +++++++++------------------ drivers/gpu/drm/msm/msm_drv.h | 3 ++- 3 files changed, 14 insertions(+), 21 deletions(-) -- 2.30.2 Reviewed-by: Abhinav Kumar diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 1a63368c3912..b3ee5c0bce12 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -102,6 +102,7 @@ struct msm_dsi_host { int id; void __iomem *ctrl_base; + phys_addr_t ctrl_size; struct regulator_bulk_data supplies[DSI_DEV_REGULATOR_MAX]; struct clk *bus_clks[DSI_BUS_CLK_MAX]; @@ -1839,7 +1840,7 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) goto fail; } - msm_host->ctrl_base = msm_ioremap(pdev, "dsi_ctrl", "DSI CTRL"); + msm_host->ctrl_base = msm_ioremap_size(pdev, "dsi_ctrl", "DSI CTRL", &msm_host->ctrl_size); if (IS_ERR(msm_host->ctrl_base)) { pr_err("%s: unable to map Dsi ctrl base\n", __func__); ret = PTR_ERR(msm_host->ctrl_base); @@ -2494,7 +2495,7 @@ void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct mipi_dsi_ho pm_runtime_get_sync(&msm_host->pdev->dev); - msm_disp_snapshot_add_block(disp_state, msm_iomap_size(msm_host->pdev, "dsi_ctrl"), + msm_disp_snapshot_add_block(disp_state, msm_host->ctrl_size, msm_host->ctrl_base, "dsi%d_ctrl", msm_host->id); pm_runtime_put_sync(&msm_host->pdev->dev); diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 92fe844b517b..be578fc4e54f 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -124,7 +124,7 @@ struct clk *msm_clk_get(struct platform_device *pdev, const char *name) } static void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name, - const char *dbgname, bool quiet) + const char *dbgname, bool quiet, phys_addr_t *psize) { struct resource *res; unsigned long size; @@ -153,37 +153,28 @@ static void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name if (reglog) printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size); + if (psize) + *psize = size; + return ptr; } void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, const char *dbgname) { - return _msm_ioremap(pdev, name, dbgname, false); + return _msm_ioremap(pdev, name, dbgname, false, NULL); } void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name, const char *dbgname) { - return _msm_ioremap(pdev, name, dbgname, true); + return _msm_ioremap(pdev, name, dbgname, true, NULL); } -unsigned long msm_iomap_size(struct platform_device *pdev, const char *name) +void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name, + const char *dbgname, phys_addr_t *psize) { - struct resource *res; - - if (name) - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name); - else - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - - if (!res) { - dev_dbg(&pdev->dev, "failed to get memory resource: %s\n", - name); - return 0; - } - - return resource_size(res); + return _msm_ioremap(pdev, name, dbgname, false, psize); } void msm_writel(u32 data, void __iomem *addr) diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 15cb34451ded..c33fc1293789 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -450,9 +450,10 @@ struct clk *msm_clk_bulk_get_clock(struct clk_bulk_data *bulk, int count, const char *name); void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, const char *dbgname); +void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name, + const char *dbgname, phys_addr_t *size); void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name, const char *dbgname); -unsigned long msm_iomap_size(struct platform_device *pdev, const char *name); void msm_writel(u32 data, void __iomem *addr); u32 msm_readl(const void __iomem *addr); void msm_rmw(void __iomem *addr, u32 mask, u32 or);