From patchwork Mon Oct 22 22:58:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 1628201 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 3F6DD400E8 for ; Mon, 22 Oct 2012 22:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756066Ab2JVW6n (ORCPT ); Mon, 22 Oct 2012 18:58:43 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:50297 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754355Ab2JVW6n (ORCPT ); Mon, 22 Oct 2012 18:58:43 -0400 Received: by mail-pa0-f46.google.com with SMTP id hz1so2282704pad.19 for ; Mon, 22 Oct 2012 15:58:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=XyxDvGCVSpj8L0sScS5sITFm0xFaynL0ZLn4OS+luJc=; b=SGr7W8Vjmb/n0RmXuvJ+gNSWuQAHukw7Ih5fzu5T48Vj1wtTP3egD0U5Xv2X5D5188 LWUU9HatH94IToCiU50KWohp2pZE0gpb7zR9JKLYnNaSQOcVTVmB6yPzz/jF5LWOaEEv qdNlNuI24koUqRvXwmdYoWJX8U+fpYfJvxhvDrXod0jxVBOetuaN7CtIBY4+UxO8aHNL dXGLAz1Uz+uZQhcP1TVUimKVd+bJY7yfsuHdibxuJ3kfzWMcE2W9v5Gi4teP56TKpBvH B0RSrmYKOUeE/TE27ZOgphWFmNjXHViL0ozSNaQ9e/gmJLO8ZDwBbCzbtche9uXZquPz knaw== Received: by 10.68.216.131 with SMTP id oq3mr33618364pbc.147.1350946722292; Mon, 22 Oct 2012 15:58:42 -0700 (PDT) Received: from localhost (c-24-19-7-36.hsd1.wa.comcast.net. [24.19.7.36]) by mx.google.com with ESMTPS id rz10sm6595903pbc.32.2012.10.22.15.58.41 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Oct 2012 15:58:41 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org, Paul Walmsley Cc: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: OMAP3: Beagle: fix OPP customization and initcall ordering Date: Mon, 22 Oct 2012 15:58:39 -0700 Message-Id: <1350946719-9583-1-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.8.0 X-Gm-Message-State: ALoCoQmnyq5kNWT0CCuQ2OG0Lx42adfpmorO/T6ahzd61Eikw7gu2pdi70tyeNZuwi9M7Cuq/Iax Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Kevin Hilman After commit 24d7b40a60cf19008334bcbcbd98da374d4d9c64 (ARM: OMAP2+: PM: MPU DVFS: use generic CPU device for MPU-SS), OPPs are registered using an existing CPU device, not the omap_device for MPU-SS. First, fix the board file to use get_cpu_device() as required by the above commit, otherwise custom OPPs will be added to the wrong device. Second, the board files OPP init is called from the its init_machine method, and the generic CPU devices are not yet created when init_machine is run. Therefore OPP initialization will fail. To fix, use a device_initcall() for the board file's OPP customization, and make the device_initcall board-specific by using a machine_is check. Reported-by: Paul Walmsley Signed-off-by: Kevin Hilman --- v2: add machine_is* check to the device_initcall. arch/arm/mach-omap2/board-omap3beagle.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 388c431..60729bf 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -444,12 +445,16 @@ static struct omap_board_mux board_mux[] __initdata = { }; #endif -static void __init beagle_opp_init(void) +static int __init beagle_opp_init(void) { int r = 0; - /* Initialize the omap3 opp table */ - if (omap3_opp_init()) { + if (!machine_is_omap3_beagle()) + return 0; + + /* Initialize the omap3 opp table if not already created. */ + r = omap3_opp_init(); + if (IS_ERR_VALUE(r) && (r != -EEXIST)) { pr_err("%s: opp default init failed\n", __func__); return; } @@ -458,13 +463,13 @@ static void __init beagle_opp_init(void) if (cpu_is_omap3630()) { struct device *mpu_dev, *iva_dev; - mpu_dev = omap_device_get_by_hwmod_name("mpu"); + mpu_dev = get_cpu_device(0); iva_dev = omap_device_get_by_hwmod_name("iva"); if (IS_ERR(mpu_dev) || IS_ERR(iva_dev)) { pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", __func__, mpu_dev, iva_dev); - return; + return -ENODEV; } /* Enable MPU 1GHz and lower opps */ r = opp_enable(mpu_dev, 800000000); @@ -484,8 +489,9 @@ static void __init beagle_opp_init(void) opp_disable(iva_dev, 660000000); } } - return; + return 0; } +device_initcall(beagle_opp_init); static void __init omap3_beagle_init(void) { @@ -522,8 +528,6 @@ static void __init omap3_beagle_init(void) /* Ensure SDRC pins are mux'd for self-refresh */ omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); - - beagle_opp_init(); } MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")