From patchwork Wed Sep 26 16:33:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory CLEMENT X-Patchwork-Id: 1510141 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 0A1A7DF238 for ; Wed, 26 Sep 2012 16:35:29 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TGuYK-0006YN-I5; Wed, 26 Sep 2012 16:33:36 +0000 Received: from mail.free-electrons.com ([88.190.12.23]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TGuY8-0006Y9-UM for linux-arm-kernel@lists.infradead.org; Wed, 26 Sep 2012 16:33:26 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 01228DE; Wed, 26 Sep 2012 18:33:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham version=3.3.1 Received: from [192.168.0.19] (tra42-5-83-152-246-54.fbx.proxad.net [83.152.246.54]) by mail.free-electrons.com (Postfix) with ESMTPA id 22A01C2; Wed, 26 Sep 2012 18:33:02 +0200 (CEST) Message-ID: <50632E46.1080603@free-electrons.com> Date: Wed, 26 Sep 2012 18:33:10 +0200 From: Gregory CLEMENT User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: Jason Cooper Subject: Re: [PATCH V5 1/6] arm: cache-l2x0: make outer_cache_fns a field of l2x0_of_data References: <1348675370-16359-1-git-send-email-gregory.clement@free-electrons.com> <1348675370-16359-2-git-send-email-gregory.clement@free-electrons.com> <20120926161403.GM5469@titan.lakedaemon.net> In-Reply-To: <20120926161403.GM5469@titan.lakedaemon.net> X-Enigmail-Version: 1.4.4 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.8 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Lior Amsalem , Andrew Lunn , Ike Pan , Will Deacon , Nadav Haklai , Ian Molton , David Marlin , Yehuda Yitschak , Jani Monoses , Russell King , Tawfik Bayouk , Dan Frazier , Barry Song <21cnbao@gmail.com>, Eran Ben-Avi , Li Li , Shadi Ammouri , Leif Lindholm , Sebastian Hesselbarth , Arnd Bergmann , Jon Masters , Rob Herring , Ben Dooks , linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , Chris Van Hoof , Nicolas Pitre , Maen Suleiman , Santosh Shilimkar , Olof Johansson X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On 09/26/2012 06:14 PM, Jason Cooper wrote: > On Wed, Sep 26, 2012 at 06:02:45PM +0200, Gregory CLEMENT wrote: >> Instead of having multiple functions belonging to outer_cache and >> filling this structure on the fly, use a outer_cache_fns field inside >> l2x0_of_data and just memcopy it into outer_cache depending of the >> type of the l2x0 cache. For non DT case, the former code was kept. >> >> Signed-off-by: Gregory CLEMENT >> Tested-and-reviewed-by: Yehuda Yitschak >> Tested-and-reviewed-by: Lior Amsalem >> >> Cc: Barry Song <21cnbao@gmail.com> >> Cc: Will Deacon >> Cc: Santosh Shilimkar >> Cc: Rob Herring >> Cc: Arnd Bergmann >> Cc: Olof Johansson >> Signed-off-by: Gregory CLEMENT >> --- >> arch/arm/mm/cache-l2x0.c | 55 +++++++++++++++++++++++++++++++++------------- >> 1 file changed, 40 insertions(+), 15 deletions(-) >> >> diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c >> index 2a8e380..8b9c0ae 100644 >> --- a/arch/arm/mm/cache-l2x0.c >> +++ b/arch/arm/mm/cache-l2x0.c >> @@ -39,8 +39,9 @@ struct l2x0_regs l2x0_saved_regs; >> struct l2x0_of_data { >> void (*setup)(const struct device_node *, u32 *, u32 *); >> void (*save)(void); >> - void (*resume)(void); >> + struct outer_cache_fns outer_cache; >> }; >> +static bool of_init = false; >> >> static inline void cache_wait_way(void __iomem *reg, unsigned long mask) >> { >> @@ -376,13 +377,15 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask) >> writel_relaxed(1, l2x0_base + L2X0_CTRL); >> } >> >> - outer_cache.inv_range = l2x0_inv_range; >> - outer_cache.clean_range = l2x0_clean_range; >> - outer_cache.flush_range = l2x0_flush_range; >> - outer_cache.sync = l2x0_cache_sync; >> - outer_cache.flush_all = l2x0_flush_all; >> - outer_cache.inv_all = l2x0_inv_all; >> - outer_cache.disable = l2x0_disable; >> + if (!of_init) { >> + outer_cache.inv_range = l2x0_inv_range; >> + outer_cache.clean_range = l2x0_clean_range; >> + outer_cache.flush_range = l2x0_flush_range; >> + outer_cache.sync = l2x0_cache_sync; >> + outer_cache.flush_all = l2x0_flush_all; >> + outer_cache.inv_all = l2x0_inv_all; >> + outer_cache.disable = l2x0_disable; >> + } >> >> printk(KERN_INFO "%s cache controller enabled\n", type); >> printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", >> @@ -533,15 +536,34 @@ static void pl310_resume(void) >> } >> >> static const struct l2x0_of_data pl310_data = { >> - pl310_of_setup, >> - pl310_save, >> - pl310_resume, >> + .setup = pl310_of_setup, >> + .save = pl310_save, >> + .outer_cache = { >> + .resume = pl310_resume, >> + .inv_range = l2x0_inv_range, >> + .clean_range = l2x0_clean_range, >> + .flush_range = l2x0_flush_range, >> + .sync = l2x0_cache_sync, >> + .flush_all = l2x0_flush_all, >> + .inv_all = l2x0_inv_all, >> + .disable = l2x0_disable, >> + .set_debug = pl310_set_debug, >> + }, >> }; >> >> static const struct l2x0_of_data l2x0_data = { >> - l2x0_of_setup, >> - NULL, >> - l2x0_resume, >> + .setup = l2x0_of_setup, >> + .save = NULL, >> + .outer_cache = { >> + .resume = l2x0_resume, >> + .inv_range = l2x0_inv_range, >> + .clean_range = l2x0_clean_range, >> + .flush_range = l2x0_flush_range, >> + .sync = l2x0_cache_sync, >> + .flush_all = l2x0_flush_all, >> + .inv_all = l2x0_inv_all, >> + .disable = l2x0_disable, >> + }, >> }; >> >> static const struct of_device_id l2x0_ids[] __initconst = { >> @@ -581,9 +603,12 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask) >> if (data->save) >> data->save(); >> >> + /* */ > > Was there a comment here? No it was due to a bad combination of keys with my editor. I have fixed in in the git repository now. And the updated patch is the following: Subject: [PATCH V5 1/6] arm: cache-l2x0: make outer_cache_fns a field of l2x0_of_data Instead of having multiple functions belonging to outer_cache and filling this structure on the fly, use a outer_cache_fns field inside l2x0_of_data and just memcopy it into outer_cache depending of the type of the l2x0 cache. For non DT case, the former code was kept. Signed-off-by: Gregory CLEMENT Tested-and-reviewed-by: Yehuda Yitschak Tested-and-reviewed-by: Lior Amsalem Cc: Barry Song <21cnbao@gmail.com> Cc: Will Deacon Cc: Santosh Shilimkar Cc: Rob Herring Cc: Arnd Bergmann Cc: Olof Johansson Signed-off-by: Gregory CLEMENT --- arch/arm/mm/cache-l2x0.c | 54 +++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index 2a8e380..1f7aad6 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c @@ -39,8 +39,9 @@ struct l2x0_regs l2x0_saved_regs; struct l2x0_of_data { void (*setup)(const struct device_node *, u32 *, u32 *); void (*save)(void); - void (*resume)(void); + struct outer_cache_fns outer_cache; }; +static bool of_init = false; static inline void cache_wait_way(void __iomem *reg, unsigned long mask) { @@ -376,13 +377,15 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask) writel_relaxed(1, l2x0_base + L2X0_CTRL); } - outer_cache.inv_range = l2x0_inv_range; - outer_cache.clean_range = l2x0_clean_range; - outer_cache.flush_range = l2x0_flush_range; - outer_cache.sync = l2x0_cache_sync; - outer_cache.flush_all = l2x0_flush_all; - outer_cache.inv_all = l2x0_inv_all; - outer_cache.disable = l2x0_disable; + if (!of_init) { + outer_cache.inv_range = l2x0_inv_range; + outer_cache.clean_range = l2x0_clean_range; + outer_cache.flush_range = l2x0_flush_range; + outer_cache.sync = l2x0_cache_sync; + outer_cache.flush_all = l2x0_flush_all; + outer_cache.inv_all = l2x0_inv_all; + outer_cache.disable = l2x0_disable; + } printk(KERN_INFO "%s cache controller enabled\n", type); printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", @@ -533,15 +536,34 @@ static void pl310_resume(void) } static const struct l2x0_of_data pl310_data = { - pl310_of_setup, - pl310_save, - pl310_resume, + .setup = pl310_of_setup, + .save = pl310_save, + .outer_cache = { + .resume = pl310_resume, + .inv_range = l2x0_inv_range, + .clean_range = l2x0_clean_range, + .flush_range = l2x0_flush_range, + .sync = l2x0_cache_sync, + .flush_all = l2x0_flush_all, + .inv_all = l2x0_inv_all, + .disable = l2x0_disable, + .set_debug = pl310_set_debug, + }, }; static const struct l2x0_of_data l2x0_data = { - l2x0_of_setup, - NULL, - l2x0_resume, + .setup = l2x0_of_setup, + .save = NULL, + .outer_cache = { + .resume = l2x0_resume, + .inv_range = l2x0_inv_range, + .clean_range = l2x0_clean_range, + .flush_range = l2x0_flush_range, + .sync = l2x0_cache_sync, + .flush_all = l2x0_flush_all, + .inv_all = l2x0_inv_all, + .disable = l2x0_disable, + }, }; static const struct of_device_id l2x0_ids[] __initconst = { @@ -581,9 +603,11 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask) if (data->save) data->save(); + of_init = true; l2x0_init(l2x0_base, aux_val, aux_mask); - outer_cache.resume = data->resume; + memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache)); + return 0; } #endif