From patchwork Tue Jan 17 04:03:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lokesh Vutla X-Patchwork-Id: 9519867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 936E66020B for ; Tue, 17 Jan 2017 04:05:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8548A281A7 for ; Tue, 17 Jan 2017 04:05:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7889E28484; Tue, 17 Jan 2017 04:05:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 968FF281A7 for ; Tue, 17 Jan 2017 04:05:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751091AbdAQEFN (ORCPT ); Mon, 16 Jan 2017 23:05:13 -0500 Received: from lelnx194.ext.ti.com ([198.47.27.80]:56076 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751085AbdAQEFM (ORCPT ); Mon, 16 Jan 2017 23:05:12 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v0H458xB005846; Mon, 16 Jan 2017 22:05:08 -0600 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v0H458n8028699; Mon, 16 Jan 2017 22:05:08 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Mon, 16 Jan 2017 22:05:08 -0600 Received: from a0131933.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v0H4518I001509; Mon, 16 Jan 2017 22:05:05 -0600 From: Lokesh Vutla To: Tony Lindgren , Linux OMAP Mailing List CC: Device Tree Mailing List , Rob Herring , Tero Kristo , Sekhar Nori , Vignesh R , Nishanth Menon , Lokesh Vutla Subject: [PATCH 1/5] ARM: OMAP2+: omap_hwmod: Add support for earlycon Date: Tue, 17 Jan 2017 09:33:32 +0530 Message-ID: <20170117040336.21700-2-lokeshvutla@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170117040336.21700-1-lokeshvutla@ti.com> References: <20170117040336.21700-1-lokeshvutla@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hwmod core tries to reset and idles each IP that is registered with hwmod. In case of earlycon, that specific uart IP cannot be reset or keep it in idle state else earlycon hangs once hwmod resets that uart IP. So add support to not reset uart that is being used as earlycon only if CONFIG_SERIAL_EARLYCON is enabled. Signed-off-by: Lokesh Vutla --- arch/arm/mach-omap2/omap_hwmod.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index e8b988714a09..7b1ac69a2209 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -3249,6 +3249,39 @@ int __init omap_hwmod_setup_one(const char *oh_name) } /** + * omap_hwmod_setup_earlycon_flags - set up flags for early console + * + * Enable DEBUG_OMAPUART_FLAGS for uart hwmod that is being used as + * early concole so that hwmod core doesn't reset and keep it in idle + * that specific uart. + */ +#ifdef CONFIG_SERIAL_EARLYCON +static void __init omap_hwmod_setup_earlycon_flags(void) +{ + struct device_node *np; + struct omap_hwmod *oh; + const char *uart; + + np = of_find_node_by_path("/chosen"); + if (!np) + np = of_find_node_by_path("/chosen@0"); + + if (np) { + uart = of_get_property(np, "stdout-path", NULL); + if (uart) { + np = of_find_node_by_path(uart); + if (np) { + uart = of_get_property(np, "ti,hwmods", NULL); + oh = omap_hwmod_lookup(uart); + if (oh) + oh->flags |= DEBUG_OMAPUART_FLAGS; + } + } + } +} +#endif + +/** * omap_hwmod_setup_all - set up all registered IP blocks * * Initialize and set up all IP blocks registered with the hwmod code. @@ -3261,6 +3294,9 @@ static int __init omap_hwmod_setup_all(void) _ensure_mpu_hwmod_is_setup(NULL); omap_hwmod_for_each(_init, NULL); +#ifdef CONFIG_SERIAL_EARLYCON + omap_hwmod_setup_earlycon_flags(); +#endif omap_hwmod_for_each(_setup, NULL); return 0;