From patchwork Mon Oct 15 23:49:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 1597591 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id B3D073FD86 for ; Mon, 15 Oct 2012 23:52:28 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TNuQB-0007nh-A0; Mon, 15 Oct 2012 23:50:07 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TNuQ7-0007nO-I6 for linux-arm-kernel@lists.infradead.org; Mon, 15 Oct 2012 23:50:04 +0000 Received: by mail-pa0-f49.google.com with SMTP id bi5so5573001pad.36 for ; Mon, 15 Oct 2012 16:50:00 -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=Wvzzo2ykhE2hDrN+xomQ1nr7exycIbg8JDNEEyVn8zA=; b=YNiLHzVKWT2R8XlZBuY7c9fLm6QWXCZ1IVT+L4DK76pyg/2d0PH6VSiZYJAWMD19Bu 8GxThWHcHLvXjTiJfu5WPx5lcrX7E26Aa7ijRAVsDU8OHmLErxZuCrlKgqASoRbqRqn4 D1HqP4KXgKUGuLsoKTlCq9PQ0HeCr7M4EQ+c3020i39wLWMxLjfjFhyuk5MdCLVn3/bo 8eUOOPW24cUTcSTndCsBg5lxOOFfnaH4G/wsu17P5ixul0uXdXLw0ibfvi3JPPoQgL1/ GApT+/MQJd8SrFRvjDTzbVgF5TiRvZhajRrdvIOawgiFVxUOdOfXQ9BBc8BNH9QklRuO IkVg== Received: by 10.68.137.228 with SMTP id ql4mr41845429pbb.125.1350345000589; Mon, 15 Oct 2012 16:50:00 -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 mn5sm9759689pbc.12.2012.10.15.16.49.59 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 16:49:59 -0700 (PDT) From: Kevin Hilman To: Tony Lindgren , linux-omap@vger.kernel.org Subject: [PATCH] ARM: OMAP2: UART: fix console UART mismatched runtime PM status Date: Mon, 15 Oct 2012 16:49:58 -0700 Message-Id: <1350344998-16328-1-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.7.9.2 X-Gm-Message-State: ALoCoQknNXzWo2MaB8i8CI87eg8HlIc1nAU8RYbau3CcXTdVEz/tA/BCR4H+onLMe2uC8DFDawIF X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Russell King , Paul Walmsley , Sourav Poddar , Felipe Balbi , linux-arm-kernel@lists.infradead.org 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: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Kevin Hilman The runtime PM framework assumes that the hardware state of devices when initialized is disabled. For all omap_devices, we idle/disable device by default. However, the console uart uses a "no idle" option during omap_device init in order to allow earlyprintk usage to work seamlessly during boot. Because the hardware is left partially enabled after init (whatever the bootloader settings were), the omap_device should later be fully initialized (including mux) and the runtime PM framework should be told that the device is active, and not disabled so that the hardware state is in sync with runtime PM state. To fix, after the device has been created/registered, call omap_device_enable() to finialize init and use pm_runtime_set_active() to tell the runtime PM core the device is enabled. Tested on 2420/n810, 3530/Overo, 3530/Beagle, 3730/OveroSTORM, 3730/Beagle-xM, 4460/PandaES. Reported-by: Paul Walmsley Suggested-by: Russell King Cc: Felipe Balbi Cc: Sourav Poddar Signed-off-by: Kevin Hilman Tested-by: Tony Lindgren Reviewed-by: Felipe Balbi --- Applies against v3.7-rc1. Fix targetted for v3.7. I'm still not entirely sure why this has worked up to now on OMAP3/4 but not on OMAP2. Even so, this fix is needed for all platforms to ensure matching hardware state and runtime PM state. arch/arm/mach-omap2/serial.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 0405c81..37b5dbe 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -327,6 +327,11 @@ void __init omap_serial_init_port(struct omap_board_data *bdata, if ((console_uart_id == bdata->id) && no_console_suspend) omap_device_disable_idle_on_suspend(pdev); + if (console_uart_id == bdata->id) { + omap_device_enable(pdev); + pm_runtime_set_active(&pdev->dev); + } + oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); oh->dev_attr = uart;