From patchwork Fri Mar 27 16:16:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mason X-Patchwork-Id: 6109361 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 78D019F399 for ; Fri, 27 Mar 2015 16:19:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC0D12041E for ; Fri, 27 Mar 2015 16:19:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DCF6D20411 for ; Fri, 27 Mar 2015 16:19:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YbWwS-0007x2-Nl; Fri, 27 Mar 2015 16:17:04 +0000 Received: from smtp2-g21.free.fr ([2a01:e0c:1:1599::11]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YbWwM-0007qa-3L for linux-arm-kernel@lists.infradead.org; Fri, 27 Mar 2015 16:16:59 +0000 Received: from [172.27.0.114] (unknown [83.142.147.193]) (Authenticated sender: shill) by smtp2-g21.free.fr (Postfix) with ESMTPSA id 6CC8E4B02A2 for ; Fri, 27 Mar 2015 17:14:52 +0100 (CET) Message-ID: <55158261.9010108@free.fr> Date: Fri, 27 Mar 2015 17:16:33 +0100 From: Mason User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0 SeaMonkey/2.32.1 MIME-Version: 1.0 To: Linux ARM Subject: Reading twd_base at run-time X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150327_091658_329498_23A1885F X-CRM114-Status: GOOD ( 10.74 ) X-Spam-Score: -0.7 (/) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello everyone, In arch/arm/kernel/smp_twd.c, twd_local_timer_register() receives a struct twd_local_timer argument, which specifies 1) the physical address of twd_base 2) the twd interrupt number There's a helper to fill out the static struct: DEFINE_TWD_LOCAL_TIMER() But it seems to me (please correct me if I'm wrong) that the address of twd_base can be read at run-time, making it one less parameter to specify by hand at compile-time (with the risk that a HW engineer change the address in the next chip with no warning). Here's an incomplete patch to express my intent: As far as I can tell, all platforms use 29 for twd_ppi, but I can make sure if people agree this patch is indeed an improvement. Regards. diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index 6591e26..5177db8 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -369,14 +369,14 @@ out_free: return err; } -int __init twd_local_timer_register(struct twd_local_timer *tlt) +int __init twd_local_timer_register(void) { if (twd_base || twd_evt) return -EBUSY; - twd_ppi = tlt->res[1].start; + twd_ppi = 29; - twd_base = ioremap(tlt->res[0].start, resource_size(&tlt->res[0])); + twd_base = ioremap(scu_a9_get_base() + 0x600, 0x10); if (!twd_base) return -ENOMEM;