From patchwork Tue Nov 18 23:37:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 5333771 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9F9A8C11AC for ; Tue, 18 Nov 2014 23:41:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9FF4B20115 for ; Tue, 18 Nov 2014 23:41:28 +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 EAB82201FB for ; Tue, 18 Nov 2014 23:41:26 +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 1XqsMC-0001WX-0C; Tue, 18 Nov 2014 23:38:48 +0000 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XqsM8-0001V6-Ox for linux-arm-kernel@lists.infradead.org; Tue, 18 Nov 2014 23:38:46 +0000 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 0A0BE8066C; Wed, 19 Nov 2014 12:38:09 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail; t=1416353889; bh=9RoBeSbJK8u3shi9y+amAVk7PiPZfi0hqo9fU1t4CwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rHwwpOgR5kJ/GrW6MdEbO8lv7CNVx5IIhc9FVhC7AEIQBDADPnFPC/z+INrypd5mD fW19M+iTdkTV5260qELQGR18FbPrstH3WYacwuJR7RMAF1DoBAL7Beh6bOLbA8rhnO XXaN/uLsjnV4yaalCz48meb6epdfqm+DFrMyH3wU= Received: from alliedtelesyn.co.nz (Not Verified[10.32.16.32]) by mmarshal3.atlnz.lc with MailMarshal (v7, 1, 0, 4874) id ; Wed, 19 Nov 2014 12:38:10 +1300 Received: from MAIL/SpoolDir by alliedtelesyn.co.nz (Mercury 1.48); 19 Nov 14 12:38:38 +1300 Received: from SpoolDir by MAIL (Mercury 1.48); 19 Nov 14 12:38:37 +1300 Received: from chrisp-dl.ws.atlnz.lc (10.33.22.20) by alliedtelesyn.co.nz (Mercury 1.48) with ESMTP; 19 Nov 14 12:38:36 +1300 Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 51449C107D; Wed, 19 Nov 2014 12:38:06 +1300 (NZDT) From: Chris Packham To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCHv4] ARM: mvebu: use dt_fixup to provide fallback for enable-method Date: Wed, 19 Nov 2014 12:37:55 +1300 Message-Id: <1416353875-15602-1-git-send-email-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.2.0.rc0 In-Reply-To: <20141118082151.GX6414@lukather> References: <20141118082151.GX6414@lukather> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141118_153845_322053_90C40699 X-CRM114-Status: GOOD ( 17.85 ) X-Spam-Score: -0.1 (/) Cc: Andrew Lunn , Jason Cooper , Boris Brezillon , Chris Packham , Ezequiel Garcia , Gregory Clement , Maxime Ripard , Sebastian Hesselbarth 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 We need to maintain backwards compatibility with device trees that don't define an enable method. At the same time we want the device tree to be able to specify an enable-method and have it stick. Previously by having smp assigned in the DT_MACHINE definition this would be picked up by setup_arch() and override whatever arm_dt_init_cpu_maps() had configured. Now we move the initial assignment of default smp_ops to a dt_fixup and let arm_dt_init_cpu_maps() override that if the device tree defines an enable-method. Signed-off-by: Chris Packham --- Hi, For those loosing track v1: http://lists.infradead.org/pipermail/linux-arm-kernel/2014-November/300182.html v2: http://lists.infradead.org/pipermail/linux-arm-kernel/2014-November/300480.html v3: http://lists.infradead.org/pipermail/linux-arm-kernel/2014-November/302945.html (snip) >>> Instead of inserting something into the device tree I could just call >>> set_smp_ops here. That might be safer than trying to insert something >>> into the device tree. >> >> I don't think this is necessary. Injecting something in the DT is >> safe, u-boot does that at every boot :) >> > > Actually I thought a bit more about this option this morning. What I'm > trying to do is provide a fallback that defines smp_ops when there isn't > an enable-method in the device tree. I don't actually need do do > anything to the incoming device tree, I don't even need to look at it. I > can unconditionally call set_smp_ops() and if the device tree has an > enable-method it will override whatever has been configured. If the > device tree doesn't define an enable-method it will use the default that > I've configured here. That's actually very little code and can all be > contained in board-v7.c. I'm pretty happy with this incarnation. It doesn't touch core code. It provides a fallback for old device trees and it achieves my original goal of allowing the device tree to configure the smp_ops via the enable-method property. arch/arm/mach-mvebu/board-v7.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c index b2524d6..a4ece42 100644 --- a/arch/arm/mach-mvebu/board-v7.c +++ b/arch/arm/mach-mvebu/board-v7.c @@ -184,6 +184,11 @@ static void __init mvebu_dt_init(void) of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); } +static void __init armada_370_xp_dt_fixup(void) +{ + smp_set_ops(smp_ops(armada_xp_smp_ops)); +} + static const char * const armada_370_xp_dt_compat[] = { "marvell,armada-370-xp", NULL, @@ -192,11 +197,11 @@ static const char * const armada_370_xp_dt_compat[] = { DT_MACHINE_START(ARMADA_370_XP_DT, "Marvell Armada 370/XP (Device Tree)") .l2c_aux_val = 0, .l2c_aux_mask = ~0, - .smp = smp_ops(armada_xp_smp_ops), .init_machine = mvebu_dt_init, .init_irq = mvebu_init_irq, .restart = mvebu_restart, .dt_compat = armada_370_xp_dt_compat, + .dt_fixup = armada_370_xp_dt_fixup, MACHINE_END static const char * const armada_375_dt_compat[] = {