From patchwork Thu Mar 30 13:17:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 9654139 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 F0A5960349 for ; Thu, 30 Mar 2017 13:16:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4BB326224 for ; Thu, 30 Mar 2017 13:16:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D957A284CF; Thu, 30 Mar 2017 13:16:24 +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=ham 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 6DAB826224 for ; Thu, 30 Mar 2017 13:16:24 +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=fM8JycnDclTMHLGOC0gjYpTjusgCGprRUnNlS3NgE3A=; b=NqsEfqKr7+MbRXTAiBKen3Ce4K ZyCJ/KawgrfW2Fk70U9mBHxVz3DqfAj3ya+yCg7/V6Vnn1rviPP4Y3dKPwrUD14v8HHO+A1BW6rzd 20i4uICpuuIocFojYNmzOfh7NJffcbAMqwb1jKaXFNEbJnbdg1uI0hJE7G3Y4L+vExM+YtxgNyWVm QNBvQC+IDU+Qu1HlXW2XUe5wuNd14MUl74AobneV3hrLPkkTddjKMrT4mnw0DjAF7QbnzMngGSGdp tThVkLBTyF9IU2Kk6Z74Y95+/J5WOWmPJmQjgTUMM2FtKajhEOYF5JgCxnI4c4utGpxBp2Rb1wbdP oMYft3GA==; 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 1ctZw6-00031l-Qe; Thu, 30 Mar 2017 13:16:22 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ctZub-0000Jz-S2 for linux-arm-kernel@lists.infradead.org; Thu, 30 Mar 2017 13:14:52 +0000 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ONM007VTQ4DSO40@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 30 Mar 2017 22:14:37 +0900 (KST) Received: from epsmges1p5.samsung.com (unknown [182.195.42.57]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20170330131436epcas1p1fb2e0ea7a76ef80d39fc0b9c60cba686~wqyrCGf-f2084920849epcas1p1N; Thu, 30 Mar 2017 13:14:36 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id E3.E2.03717.CB40DD85; Thu, 30 Mar 2017 22:14:36 +0900 (KST) Received: from epcpsbgm1new.samsung.com (u26.gpu120.samsung.co.kr [203.254.230.26]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20170330131436epcas1p4a4f8bf7b64b4a5ff9ee692adc4e7d001~wqyqzlb7A2150121501epcas1p4k; Thu, 30 Mar 2017 13:14:36 +0000 (GMT) X-AuditID: b6c32a39-f790c6d000000e85-84-58dd04bc5884 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 13.9B.05715.CB40DD85; Thu, 30 Mar 2017 22:14:36 +0900 (KST) Received: from pankaj.com ([107.108.83.125]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ONM009R0Q3AAC60@mmp2.samsung.com>; Thu, 30 Mar 2017 22:14:36 +0900 (KST) From: Pankaj Dubey To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr, flag} ops to exynos_s2r_data Date: Thu, 30 Mar 2017 18:47:02 +0530 Message-id: <1490879826-16754-9-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1490879826-16754-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNIsWRmVeSWpSXmKPExsWy7bCmnu4elrsRBmt+6lrcWneO1eLvpGPs Fs+Oalu8ebuGyaL/8Wtmi/PnN7BbbHp8jdVixvl9TBYvj/xgtFh75C67xaKtX9gduD1+/5rE 6HHrTr3Hzll32T02repk89i8pN5jSz+Q17dlFaPH501yARxRXDYpqTmZZalF+nYJXBlTN8xm LXgtU/Fz1nuWBsaNEl2MnBwSAiYSx9+vYoGwxSQu3FvP1sXIxSEksINR4til+WAJIYF2Jonn /0JgGv5OusYKUTSHUeLQ5VlQzjtGiUmtLWwgVWwCuhJP3s9lBrFFBLwlJp/5yw5SxCxwjVFi YfcKsISwQLLE5amvwFawCKhKHOo4wwhi8wp4SNw6eZYdYp2cxM1znWD1nAKeEicfTWODiC9i l3g4U7KLkQPIlpXYdIAZIuwi8az3B5QtLPHq+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SFGU6DDJjJLiSbnAyM2ryTe0MTcxNzYwMLc0tLESEmct3H2s3AhgfTEktTs 1NSC1CKYPiYOTqkGxnoxey62ySmLZ65vXNygbf7yp8YJt+B245vT927xt9gYfIz7drvilhjZ X9F6O9S3OU2Yo9Ly4N3XnBT9oxM2ybbrMt//OO+BQALDuuMLrn3xj71eot76J9vOf7Gff8Ta /Z83zJ13WzKwocQmIoazTNKSLYL9E9fSndcPSbB47l74p65u4na1mUosxRmJhlrMRcWJAELe LU6gAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170330131436epcas1p4a4f8bf7b64b4a5ff9ee692adc4e7d001 X-Msg-Generator: CA X-Sender-IP: 203.254.230.26 X-Local-Sender: =?UTF-8?B?7YyQ7Lm07KaIG1NTSVItVHVybiBLZXkgU29sdXRpb25zGw==?= =?UTF-8?B?7IK87ISx7KCE7J6QGy4vU2VuaW9yIENoaWVmIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?UEFOS0FKIEtVTUFSIERVQkVZG1NTSVItVHVybiBLZXkgU29s?= =?UTF-8?B?dXRpb25zG1NhbXN1bmcgRWxlY3Ryb25pY3MbLi9TZW5pb3IgQ2hpZWYgRW5n?= =?UTF-8?B?aW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG1NXQUhRG0MxMElEMDdJRDAxMDk5Nw==?= CMS-TYPE: 101P X-HopCount: 7 X-CMS-RootMailID: 20170330131436epcas1p4a4f8bf7b64b4a5ff9ee692adc4e7d001 X-RootMTR: 20170330131436epcas1p4a4f8bf7b64b4a5ff9ee692adc4e7d001 References: <1490879826-16754-1-git-send-email-pankaj.dubey@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170330_061450_300433_50D7505E X-CRM114-Status: GOOD ( 12.30 ) 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: arnd@arndb.de, javier@osg.samsung.com, Pankaj Dubey , krzk@kernel.org, m.reichl@fivetechno.de, a.hajda@samsung.com, kgene@kernel.org, cwchoi00@gmail.com, m.szyprowski@samsung.com 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 Various Exynos SoC needs different boot addresses and flags. Currently we are handling this difference by adding lots of soc_is_exynosMMM checks in the code, in an attempt to remove the dependency of such helper functions specific to each SoC, let's separate helper functions for these helper functions by moving them into SoC specific hooks in struct exynos_s2r_data. Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/pm.c | 60 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index fa24098..c3fa537 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -32,26 +32,56 @@ #include "common.h" struct exynos_s2r_data { + void __iomem* (*boot_vector_addr)(void); + void __iomem* (*boot_vector_flag)(void); void (*enter_aftr)(void); }; static const struct exynos_s2r_data *s2r_data; -static inline void __iomem *exynos_boot_vector_addr(void) +static void __iomem *exynos_boot_vector_addr(void) +{ + if (s2r_data && s2r_data->boot_vector_addr) + return s2r_data->boot_vector_addr(); + + return NULL; +} + +static inline void __iomem *exynos4210_rev11_boot_vector_addr(void) +{ + return pmu_base_addr + S5P_INFORM7; +} + +static inline void __iomem *exynos4210_rev10_boot_vector_addr(void) +{ + return sysram_base_addr + 0x24; +} + +static inline void __iomem *exynos_common_boot_vector_addr(void) { - if (samsung_rev() == EXYNOS4210_REV_1_1) - return pmu_base_addr + S5P_INFORM7; - else if (samsung_rev() == EXYNOS4210_REV_1_0) - return sysram_base_addr + 0x24; return pmu_base_addr + S5P_INFORM0; } -static inline void __iomem *exynos_boot_vector_flag(void) +static void __iomem *exynos_boot_vector_flag(void) +{ + if (s2r_data && s2r_data->boot_vector_flag) + return s2r_data->boot_vector_flag(); + + return NULL; +} + +static inline void __iomem *exynos4210_rev11_boot_vector_flag(void) +{ + return pmu_base_addr + S5P_INFORM6; +} + +static inline void __iomem *exynos4210_rev10_boot_vector_flag(void) +{ + return sysram_base_addr + 0x20; +} + +static inline void __iomem *exynos_common_boot_vector_flag(void) { - if (samsung_rev() == EXYNOS4210_REV_1_1) - return pmu_base_addr + S5P_INFORM6; - else if (samsung_rev() == EXYNOS4210_REV_1_0) - return sysram_base_addr + 0x20; return pmu_base_addr + S5P_INFORM1; } @@ -218,22 +248,32 @@ static void exynos5_enter_aftr(void) } static const struct exynos_s2r_data exynos_common_s2r_data = { + .boot_vector_addr = exynos_common_boot_vector_addr, + .boot_vector_flag = exynos_common_boot_vector_flag, .enter_aftr = exynos5_enter_aftr, }; static const struct exynos_s2r_data exynos3250_s2r_data = { + .boot_vector_addr = exynos_common_boot_vector_addr, + .boot_vector_flag = exynos_common_boot_vector_flag, .enter_aftr = exynos3_enter_aftr, }; static const struct exynos_s2r_data exynos4210_rev11_s2r_data = { + .boot_vector_addr = exynos4210_rev11_boot_vector_addr, + .boot_vector_flag = exynos4210_rev11_boot_vector_flag, .enter_aftr = exynos4_enter_aftr, }; static const struct exynos_s2r_data exynos4210_rev10_s2r_data = { + .boot_vector_addr = exynos4210_rev10_boot_vector_addr, + .boot_vector_flag = exynos4210_rev10_boot_vector_flag, .enter_aftr = exynos4_enter_aftr, }; static const struct exynos_s2r_data exynos4x12_s2r_data = { + .boot_vector_addr = exynos_common_boot_vector_addr, + .boot_vector_flag = exynos_common_boot_vector_flag, .enter_aftr = exynos4_enter_aftr, };