From patchwork Tue Mar 28 11:19:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 9648877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5F0DD601E9 for ; Tue, 28 Mar 2017 11:21:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EECF265B9 for ; Tue, 28 Mar 2017 11:21:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 334DF27F81; Tue, 28 Mar 2017 11:21:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B468D265B9 for ; Tue, 28 Mar 2017 11:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=kynmwNih25OTWRS8Szt7g8h+cu/YcL+V2+TJPwOl7m8=; b=HQFk8mauVTpsQ3VjPWUaSCdBN0 6cGCof3lVkV4Qa+Cibj2p6y4/mOYngigDiKJcYfVK0iw0KKFJRX+0HiykDT7jH2VEsSVaDb+tYT7T Jo90t1vuSEhNEppVT8xjWbqeFvgkthGb2eAArA9SdI5y52+jV/zayr6EktVzmNIu5/pb3k77avPNd 5lMfLO/5Bb+St+Bxn6PgzqTTeIvIc9vyyvY+fag+HRdCJN2bX6EJxM2ImLNmoPhGqgrGihz6q9q97 j+cFv+8YZLU8N96wxCHaDPMQcUB3SoTR4qbijhqOTsRP1gV92PSmI3xuTpfjzXNHK+aY180+UIH7D iNl1nBhQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cspBg-0006S1-Hg; Tue, 28 Mar 2017 11:21:20 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cspAV-0003yh-P2 for linux-arm-kernel@lists.infradead.org; Tue, 28 Mar 2017 11:20:12 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id 2F7882081D; Tue, 28 Mar 2017 13:19:47 +0200 (CEST) Received: from localhost (unknown [88.191.26.124]) by mail.free-electrons.com (Postfix) with ESMTPSA id 064D920801; Tue, 28 Mar 2017 13:19:47 +0200 (CEST) From: Alexandre Belloni To: Nicolas Ferre Subject: [PATCH v2 03/11] ARM: at91: pm: Move global variables into at91_pm_data Date: Tue, 28 Mar 2017 13:19:30 +0200 Message-Id: <20170328111938.21297-4-alexandre.belloni@free-electrons.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170328111938.21297-1-alexandre.belloni@free-electrons.com> References: <20170328111938.21297-1-alexandre.belloni@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170328_042008_188786_C6C8FACD X-CRM114-Status: GOOD ( 15.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , Alexandre Belloni , Wenyou.Yang@microchip.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of having separate global variables to hold IP addresses, move them to struct at91_pm_data. Signed-off-by: Alexandre Belloni Acked-by: Wenyou Yang --- arch/arm/mach-at91/pm.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 41789aa4df86..c780dda3b604 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c @@ -26,8 +26,6 @@ #include "generic.h" #include "pm.h" -static void __iomem *pmc; - /* * FIXME: this is needed to communicate between the pinctrl driver and * the PM implementation in the machine. Possibly part of the PM @@ -40,17 +38,17 @@ extern void at91_pinctrl_gpio_resume(void); #endif static struct { + void __iomem *pmc; + void __iomem *ramc[2]; unsigned long uhp_udp_mask; int memctrl; } at91_pm_data; -static void __iomem *at91_ramc_base[2]; #define at91_ramc_read(id, field) \ - __raw_readl(at91_ramc_base[id] + field) + __raw_readl(at91_pm_data.ramc[id] + field) #define at91_ramc_write(id, field, value) \ - __raw_writel(value, at91_ramc_base[id] + field) - + __raw_writel(value, at91_pm_data.ramc[id] + field) static int at91_pm_valid_state(suspend_state_t state) { @@ -86,7 +84,7 @@ static int at91_pm_verify_clocks(void) unsigned long scsr; int i; - scsr = readl(pmc + AT91_PMC_SCSR); + scsr = readl(at91_pm_data.pmc + AT91_PMC_SCSR); /* USB must not be using PLLB */ if ((scsr & at91_pm_data.uhp_udp_mask) != 0) { @@ -100,7 +98,7 @@ static int at91_pm_verify_clocks(void) if ((scsr & (AT91_PMC_PCK0 << i)) == 0) continue; - css = readl(pmc + AT91_PMC_PCKR(i)) & AT91_PMC_CSS; + css = readl(at91_pm_data.pmc + AT91_PMC_PCKR(i)) & AT91_PMC_CSS; if (css != AT91_PMC_CSS_SLOW) { pr_err("AT91: PM - Suspend-to-RAM with PCK%d src %d\n", i, css); return 0; @@ -143,8 +141,8 @@ static void at91_pm_suspend(suspend_state_t state) flush_cache_all(); outer_disable(); - at91_suspend_sram_fn(pmc, at91_ramc_base[0], - at91_ramc_base[1], pm_data); + at91_suspend_sram_fn(at91_pm_data.pmc, at91_pm_data.ramc[0], + at91_pm_data.ramc[1], pm_data); outer_resume(); } @@ -247,7 +245,7 @@ static void at91rm9200_standby(void) " mcr p15, 0, %0, c7, c0, 4\n\t" " str %5, [%1, %2]" : - : "r" (0), "r" (at91_ramc_base[0]), "r" (AT91_MC_SDRAMC_LPR), + : "r" (0), "r" (at91_pm_data.ramc[0]), "r" (AT91_MC_SDRAMC_LPR), "r" (1), "r" (AT91_MC_SDRAMC_SRR), "r" (lpr)); } @@ -262,7 +260,7 @@ static void at91_ddr_standby(void) u32 lpr0, lpr1 = 0; u32 saved_lpr0, saved_lpr1 = 0; - if (at91_ramc_base[1]) { + if (at91_pm_data.ramc[1]) { saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR); lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB; lpr1 |= AT91_DDRSDRC_LPCB_SELF_REFRESH; @@ -274,13 +272,13 @@ static void at91_ddr_standby(void) /* self-refresh mode now */ at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0); - if (at91_ramc_base[1]) + if (at91_pm_data.ramc[1]) at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1); cpu_do_idle(); at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0); - if (at91_ramc_base[1]) + if (at91_pm_data.ramc[1]) at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); } @@ -308,7 +306,7 @@ static void at91sam9_sdram_standby(void) u32 lpr0, lpr1 = 0; u32 saved_lpr0, saved_lpr1 = 0; - if (at91_ramc_base[1]) { + if (at91_pm_data.ramc[1]) { saved_lpr1 = at91_ramc_read(1, AT91_SDRAMC_LPR); lpr1 = saved_lpr1 & ~AT91_SDRAMC_LPCB; lpr1 |= AT91_SDRAMC_LPCB_SELF_REFRESH; @@ -320,13 +318,13 @@ static void at91sam9_sdram_standby(void) /* self-refresh mode now */ at91_ramc_write(0, AT91_SDRAMC_LPR, lpr0); - if (at91_ramc_base[1]) + if (at91_pm_data.ramc[1]) at91_ramc_write(1, AT91_SDRAMC_LPR, lpr1); cpu_do_idle(); at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr0); - if (at91_ramc_base[1]) + if (at91_pm_data.ramc[1]) at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1); } @@ -346,8 +344,8 @@ static __init void at91_dt_ramc(void) const void *standby = NULL; for_each_matching_node_and_match(np, ramc_ids, &of_id) { - at91_ramc_base[idx] = of_iomap(np, 0); - if (!at91_ramc_base[idx]) + at91_pm_data.ramc[idx] = of_iomap(np, 0); + if (!at91_pm_data.ramc[idx]) panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx); if (!standby) @@ -373,12 +371,12 @@ static void at91rm9200_idle(void) * Disable the processor clock. The processor will be automatically * re-enabled by an interrupt or by a reset. */ - writel(AT91_PMC_PCK, pmc + AT91_PMC_SCDR); + writel(AT91_PMC_PCK, at91_pm_data.pmc + AT91_PMC_SCDR); } static void at91sam9_idle(void) { - writel(AT91_PMC_PCK, pmc + AT91_PMC_SCDR); + writel(AT91_PMC_PCK, at91_pm_data.pmc + AT91_PMC_SCDR); cpu_do_idle(); } @@ -447,8 +445,8 @@ static void __init at91_pm_init(void (*pm_idle)(void)) platform_device_register(&at91_cpuidle_device); pmc_np = of_find_matching_node(NULL, atmel_pmc_ids); - pmc = of_iomap(pmc_np, 0); - if (!pmc) { + at91_pm_data.pmc = of_iomap(pmc_np, 0); + if (!at91_pm_data.pmc) { pr_err("AT91: PM not supported, PMC not found\n"); return; }