From patchwork Mon Mar 18 13:22:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Poddar, Sourav" X-Patchwork-Id: 2293421 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 537FE3FCF6 for ; Mon, 18 Mar 2013 15:06:26 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UHbam-0001We-H6; Mon, 18 Mar 2013 15:03:16 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UHa11-0003KS-OE for linux-arm-kernel@lists.infradead.org; Mon, 18 Mar 2013 13:22:16 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2IDM6C3003332; Mon, 18 Mar 2013 08:22:07 -0500 Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2IDM5ZI019454; Mon, 18 Mar 2013 18:52:05 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Mon, 18 Mar 2013 18:52:05 +0530 Received: from a0131647.apr.dhcp.ti.com (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2IDM5lV004443; Mon, 18 Mar 2013 18:52:05 +0530 From: Sourav Poddar To: , , , Subject: [PATCH/Resend 2/2] arm: mach-omap2: prevent UART console idle on suspend while using "no_console_suspend" Date: Mon, 18 Mar 2013 18:52:04 +0530 Message-ID: <1363612924-349-1-git-send-email-sourav.poddar@ti.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130318_092215_906996_D8962F78 X-CRM114-Status: GOOD ( 14.81 ) X-Spam-Score: -9.4 (---------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-9.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -2.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: b-cousson@ti.com, Rajendra nayak , linux-kernel@vger.kernel.org, Felipe Balbi , Santosh Shilimkar , linux-serial@vger.kernel.org, Sourav Poddar , linux-omap@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org With dt boot, uart wakeup after suspend is non functional on omap4/5 while using "no_console_suspend" in the bootargs. With "no_console_suspend" used, od->flags should be ORed with "OMAP_DEVICE_NO_IDLE_ON_SUSPEND", thereby not allowing the console to idle in the suspend path. For non-dt case, this was taken care by platform data. Tested on omap5430evm, omap4430sdp. Cc: Santosh Shilimkar Cc: Felipe Balbi Cc: Rajendra nayak Signed-off-by: Sourav Poddar --- arch/arm/mach-omap2/omap_device.c | 34 +++++++++++++++++++++++++++++++++- 1 files changed, 33 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index 381be7a..71f5a73 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c @@ -35,11 +35,17 @@ #include #include #include +#include #include "soc.h" #include "omap_device.h" #include "omap_hwmod.h" +#define MAX_UART_HWMOD_NAME_LEN 16 + +static u8 no_console_suspend; +static u8 console_uart_num; + /* Private functions */ static void _add_clkdev(struct omap_device *od, const char *clk_alias, @@ -108,6 +114,12 @@ static void _add_hwmod_clocks_clkdev(struct omap_device *od, _add_clkdev(od, oh->opt_clks[i].role, oh->opt_clks[i].clk); } +static char *cmdline_find_option(char *str) +{ + extern char *saved_command_line; + + return strstr(saved_command_line, str); +} /** * omap_device_build_from_dt - build an omap_device with multiple hwmods @@ -129,6 +141,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev) struct device_node *node = pdev->dev.of_node; const char *oh_name; int oh_cnt, i, ret = 0; + static u8 console_uart_id; oh_cnt = of_property_count_strings(node, "ti,hwmods"); if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) { @@ -170,7 +183,12 @@ static int omap_device_build_from_dt(struct platform_device *pdev) r->name = dev_name(&pdev->dev); } - if (of_get_property(node, "ti,no_idle_on_suspend", NULL)) + if (no_console_suspend && !strncmp(oh->name, "uart", 4)) { + if (console_uart_num == console_uart_id) + omap_device_disable_idle_on_suspend(pdev); + else + console_uart_id++; + } else if (of_get_property(node, "ti,no_idle_on_suspend", NULL)) omap_device_disable_idle_on_suspend(pdev); pdev->dev.pm_domain = &omap_device_pm_domain; @@ -838,7 +856,21 @@ static struct notifier_block platform_nb = { static int __init omap_device_init(void) { + int i; + char uart_name[MAX_UART_HWMOD_NAME_LEN]; + bus_register_notifier(&platform_bus_type, &platform_nb); + + if (cmdline_find_option("no_console_suspend")) { + no_console_suspend = true; + for (i = 0; i < OMAP_MAX_HSUART_PORTS; i++) { + snprintf(uart_name, MAX_UART_HWMOD_NAME_LEN, + "%s%d", OMAP_SERIAL_NAME, i); + if (cmdline_find_option(uart_name)) + console_uart_num = i; + } + } + return 0; } omap_core_initcall(omap_device_init);