From patchwork Fri Oct 19 22:24:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 1620151 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 2DB573FC1A for ; Fri, 19 Oct 2012 22:26:42 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TPKze-0003cS-Vh; Fri, 19 Oct 2012 22:24:39 +0000 Received: from mail-da0-f49.google.com ([209.85.210.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TPKzc-0003cC-5t for linux-arm-kernel@lists.infradead.org; Fri, 19 Oct 2012 22:24:36 +0000 Received: by mail-da0-f49.google.com with SMTP id q27so421788daj.36 for ; Fri, 19 Oct 2012 15:24:33 -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=UJ4HPn2RKOE4wJN91GgR0qqlXnac+8YSa+d5W7AM7TQ=; b=UTemsWfb1qm5VKTrh/VVBJIqKOUNnJiCqL3ynvojlsARCYBzW0Ysf6huB+KF+trm+h PdkMz7IdRzjdmaKYG0zckiimNLndTQKbvP5VIwgpVMSytXz6JoWxgTXKZLYBlBk9uD5o jdubOTlvqnh+N2Gk5gEwrN+vtQnHyq7DSQqtTOuWDJY9W9w/DTAsDKv5rkY6iV4BRGi4 kGfSKYG0ldhsiXsYQ0ZJekkg4f5XNnNzHA8Q/59OZw6c0wxcJkKHx0RDvDjIaDkleonB cbhMVJmc10DjCO5mQ5a5ydArY+s/XMUjBHW4avVAZ+nVJocKm3aqUnD5O325Qoc8HFzC FidA== Received: by 10.68.235.106 with SMTP id ul10mr10169380pbc.83.1350685473188; Fri, 19 Oct 2012 15:24:33 -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 kc4sm1829424pbc.23.2012.10.19.15.24.31 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Oct 2012 15:24:32 -0700 (PDT) From: Kevin Hilman To: Tony Lindgren , linux-omap@vger.kernel.org Subject: [PATCH v2] ARM: OMAP2: UART: fix console UART mismatched runtime PM status Date: Fri, 19 Oct 2012 15:24:30 -0700 Message-Id: <1350685470-3634-1-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.7.9.2 X-Gm-Message-State: ALoCoQmpIV84u60mMgT1EwOrXj0u7zKX9EqGEH6BLI6KFTq0JBf0091IX8nYGQoF8GMiE/buqEUx 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.210.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Russell King , 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. Suggested-by: Russell King Cc: Felipe Balbi Cc: Sourav Poddar Signed-off-by: Kevin Hilman --- Applies to v3.7-rc1. v2: call omap_device_enable() only after oh->mux has been initialized otherwise, IO ring wakeups not properly enabled. 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..a507cd6 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -329,6 +329,11 @@ void __init omap_serial_init_port(struct omap_board_data *bdata, oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); + if (console_uart_id == bdata->id) { + omap_device_enable(pdev); + pm_runtime_set_active(&pdev->dev); + } + oh->dev_attr = uart; if (((cpu_is_omap34xx() || cpu_is_omap44xx()) && bdata->pads)