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: 9654119 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 E775060349 for ; Thu, 30 Mar 2017 13:14:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBEC0284CF for ; Thu, 30 Mar 2017 13:14:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0C952850D; Thu, 30 Mar 2017 13:14:40 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65BEF284CF for ; Thu, 30 Mar 2017 13:14:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933551AbdC3NOk (ORCPT ); Thu, 30 Mar 2017 09:14:40 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:51416 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933512AbdC3NOj (ORCPT ); Thu, 30 Mar 2017 09:14:39 -0400 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-samsung-soc@vger.kernel.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 Cc: krzk@kernel.org, arnd@arndb.de, m.szyprowski@samsung.com, kgene@kernel.org, m.reichl@fivetechno.de, a.hajda@samsung.com, cwchoi00@gmail.com, javier@osg.samsung.com, Pankaj Dubey 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+NgFnrN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 6HHrTr3Hzll32T02repk89i8pN5jSz+Q17dlFaPH501yARxRbjYZqYkpqUUKqXnJ+SmZeem2 SqEhbroWSgp5ibmptkoRur4hQUoKZYk5pUCekQEacHAOcA9W0rdLcMuYumE2a8FrmYqfs96z NDBulOhi5OSQEDCR+DvpGiuELSZx4d56ti5GLg4hgVmMEs8a/rBCOO8YJdZsW8UIUsUmoCvx 5P1cZhBbRMBbYvKZv+wgNrPAFUaJo1MzQWxhgWSJq5NegtWzCKhKHOo4A2bzCnhI3Dp5lh1i m5zEzXOdYHM4BTwlTj6axgZiCwHVLD95jHECI+8CRoZVjBKpBckFxUnpuYZ5qeV6xYm5xaV5 6XrJ+bmbGMFR8UxqB+PBXe6HGAU4GJV4eCvW3o4QYk0sK67MPcQowcGsJMK7kOluhBBvSmJl VWpRfnxRaU5q8SFGU6DDJjJLiSbnAyM2ryTe0MTcxNzYwMLc0tLESEmct3H2s3AhgfTEktTs 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> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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, };