From patchwork Tue Jun 4 08:55:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erwan Le Ray X-Patchwork-Id: 165722 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp5559358ili; Tue, 4 Jun 2019 01:56:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3BD5+ycbzWnClvRSPgPYWbsKLKOb61zodyzjH5LTS2TxbNjCGVDNBOz4YqjiOh1YJjrQy X-Received: by 2002:a17:90a:ac14:: with SMTP id o20mr7769806pjq.114.1559638560530; Tue, 04 Jun 2019 01:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559638560; cv=none; d=google.com; s=arc-20160816; b=S3v4gygEy615Mndz1EccfV0VXi9SwfY8ZaUIrCjkaHQSx/1M9x4HA8Ng3o5U5auul8 Lh0KtbX9W8P1zskmgNwlaywlwSiOo1cO11kHp8WpY5jLzF8E7DLs1/RgsPzMVChNJAxO BEVC21Hqeayhu+a3cw/yqT3eZDMgIqCJ5nP4HKWoHzieMSYtEWEZMsjb5QjD6dwv8U1f dSrFlWLcgLSv20fvJ3ARDYJzaHddnbhNmyDhGpAqWHQEm3z2azapjNZldEcXbrH6XiyJ GVY9Fic2g2u6IR9dfhs09EJvvL6QibQNJbsosd99rlIRekswa3FvZ3H6m8yyTr/K2Ofi x1Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=9gSGjqYoy+Fbf2xPESzbOyGUbO7HOvEvjLu/ZOx6/bE=; b=VW/+Lr3U2i9EwHtonnBuw0PKMy6bdcO7acJScpWBKA54WU7B7AKcCW5x7FRtQ7HJjn 59QzpTl0AOfz2y1ZowlrKolHoxdy3LHUR+ES13FAnzJ3QGmiuLNv56ddr2GBjNbrre62 PzCvnEngaI965bMchL19tzo5usE2VoVilDNIP7YMu5YrlVPCSmfuTVY0oWAK4aQDgU/W luFsPGFkedU75uv46K2yoDGlZaQPUNJhuEO2YsKiuFry2P2jKKH5XsD+pD5V4G6mquC/ 808lFmdkK7XSxsyGNTfMThQiZ2kQXMshmDLBNY4RicwmEb8qfD5s7rNzom6tYi7zpyig rUnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=RjX2tYwV; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13si21839032pge.212.2019.06.04.01.56.00; Tue, 04 Jun 2019 01:56:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=RjX2tYwV; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726965AbfFDIz7 (ORCPT + 1 other); Tue, 4 Jun 2019 04:55:59 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:52804 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726883AbfFDIz6 (ORCPT ); Tue, 4 Jun 2019 04:55:58 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x548tKLM021280; Tue, 4 Jun 2019 10:55:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=9gSGjqYoy+Fbf2xPESzbOyGUbO7HOvEvjLu/ZOx6/bE=; b=RjX2tYwV8kgxxGc0rW2nlLgfguePoiuo03mr3r/QBAvY1398mhHF0ZhRzQNWn5bE9d6S JjdZvKhT2l5TNZTaGOH56n5+f7o6/DGH+XW+I5PgIZU/bfXv06tg5G0a4iFt99j+6Yhd proABBwOSJSFvveL0vtq2K6k0rQUgGupK9KlDj3M5L9pAmQbkY6e0PU9ml4ch3w0CswS h2LORq1cYDJ7Kk/FZ2xOn1ZwlLO99bkCKJq97UTyX9q/TOM+bGgYf/7VFJ9h937XIr4t G+4vVg/ez6o3VFTNzLD128GoKisdyMDyfdA3osNOhFm/mbwFxgOYDpdpO2IJBtdF6P5P EA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2sundryngp-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 04 Jun 2019 10:55:32 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id ADF15159; Tue, 4 Jun 2019 08:55:25 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 83E0E2503; Tue, 4 Jun 2019 08:55:25 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.93) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 4 Jun 2019 10:55:25 +0200 Received: from localhost (10.201.23.31) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 4 Jun 2019 10:55:25 +0200 From: Erwan Le Ray To: Greg Kroah-Hartman , Jiri Slaby , Maxime Coquelin , "Alexandre Torgue" , Rob Herring , "Mark Rutland" CC: , , , , , Erwan Le Ray , "Fabrice Gasnier" , Bich Hemon Subject: [PATCH 01/10] dt-bindings: serial: stm32: add wakeup option Date: Tue, 4 Jun 2019 10:55:10 +0200 Message-ID: <1559638519-6128-2-git-send-email-erwan.leray@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1559638519-6128-1-git-send-email-erwan.leray@st.com> References: <1559638519-6128-1-git-send-email-erwan.leray@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.31] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-04_07:, , signatures=0 Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Add a note for enabling wakeup capabilities of usart Signed-off-by: Bich Hemon Signed-off-by: Erwan Le Ray -- 1.9.1 diff --git a/Documentation/devicetree/bindings/serial/st,stm32-usart.txt b/Documentation/devicetree/bindings/serial/st,stm32-usart.txt index 9d3efed..5ec80c1 100644 --- a/Documentation/devicetree/bindings/serial/st,stm32-usart.txt +++ b/Documentation/devicetree/bindings/serial/st,stm32-usart.txt @@ -19,6 +19,11 @@ Optional properties: linux,rs485-enabled-at-boot-time: see rs485.txt. - dmas: phandle(s) to DMA controller node(s). Refer to stm32-dma.txt - dma-names: "rx" and/or "tx" +- wakeup-source: bool flag to indicate this device has wakeup capabilities +- interrupt-names, if optional wake-up interrupt is used, should be: + - "event": the name for the interrupt line of the USART instance + - "wakeup" the name for the optional wake-up interrupt + Examples: usart4: serial@40004c00 { From patchwork Tue Jun 4 08:55:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erwan Le Ray X-Patchwork-Id: 165725 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp5559792ili; Tue, 4 Jun 2019 01:56:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuy2BdoIbx3nxBsQFAKw0i1YC4IUm667X2CFR/VWp4Rllo6J4HSUSXHShFX8rjpcu15YPe X-Received: by 2002:a62:5587:: with SMTP id j129mr36655603pfb.45.1559638587364; Tue, 04 Jun 2019 01:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559638587; cv=none; d=google.com; s=arc-20160816; b=oUe8qkGAVnsYTsjAAZgBqvWaYBOoHTIFCeHVtP1tbJ/SuA8SCpH4ws64IhXEecNdVK PIRtBVVUsSwum0BAf59d+9cBK3UGXug122MCB7Vi8Nk3NBGjUy6T5unU7PjWvQVOiWME BI1k7LO8wUwE7SZR3Klv27Pn4OMCOYrXl0H2mYQxCtKZAoLeL0qtm6GCiQNKnlgM6prH HsGPTX4PKydcSlzT2Z03L74eRVieNlzepQr+b9yYIlkOn1BCmislmex5JJiUJBqyttMv 2Fhw11Mju8+MUlU0cDSWzbhbi67I8GGwCT/MK+YuXdngEFOEYdLHjHNr99IWom1ROZGb VEHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=2t7Oh2wFwFzhKSRexvanrt3z18l9MjaRhX9ZcdCIqoQ=; b=PE2B10T9KxSqQEVvajCDUBCWRXUFP088JB/JwuRnEZXkuUkNRvQEEniUkHhJ1dczMj tYsjXbWgBq1679+mildfsEGXwBzoUnAlAP2neb4cP6+n1B+yzSfcT+xD3RBM665WveUj BGM1WphwIKca5BE7ncq1huSq3mcGgq0UMrrks/Pie/5AmQQkFk7dXPzp0RhkNbnsDtem TSKclkgw8kdtD/x0TnXwXycRVX5coVMydEHS5+V2/oTglDV+1L6xa73zAXYDpMzIlrLw 3Zf2DHhxDOPdKlPQ5uppTsGEUwWWt9jAz3m8/N4A/fUwSNvQIJH0KGjpndCHghqnZI8J vFtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=zcB+NMK4; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o4si20565318pgg.49.2019.06.04.01.56.27; Tue, 04 Jun 2019 01:56:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=zcB+NMK4; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727013AbfFDI40 (ORCPT + 1 other); Tue, 4 Jun 2019 04:56:26 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:52982 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726988AbfFDI40 (ORCPT ); Tue, 4 Jun 2019 04:56:26 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x548tKw0021226; Tue, 4 Jun 2019 10:55:56 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=2t7Oh2wFwFzhKSRexvanrt3z18l9MjaRhX9ZcdCIqoQ=; b=zcB+NMK4ZEKRouNwjVExKEnwxrgxeu2Fil4w6ZZvxebJzxMN5BKsKqqErUlE6i7b3zTa yVTjw4DDtR54Sr+8YnvD3WVjGymrHCuIFR2vsKjBwLjkXJaHwaPnlB+7saNTKdVtA+gq 8PtnXy/xQCwVidJTjNXokBNS5/0BGwceMsdl6GRGtiMSE53dfneX7txHvdry4vvOePsd zVO4S8jU2FkvhrA35rE80HH7oMGW9kBfBz5JE5Q9wb1YlIMMPxD/ATEEhY9YWrOPoNH2 ZV4YHgC7HmgikiFjuPMI/x5odw52oMN8LP1dfOcBLJJ6QMGj7FBHsLcj98p9Gym2xnxi Ww== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2sundrynjk-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 04 Jun 2019 10:55:56 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8D9E016A; Tue, 4 Jun 2019 08:55:38 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 730242508; Tue, 4 Jun 2019 08:55:38 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.93) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 4 Jun 2019 10:55:38 +0200 Received: from localhost (10.201.23.31) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 4 Jun 2019 10:55:36 +0200 From: Erwan Le Ray To: Greg Kroah-Hartman , Jiri Slaby , Maxime Coquelin , "Alexandre Torgue" , Rob Herring , "Mark Rutland" CC: , , , , , Erwan Le Ray , "Fabrice Gasnier" Subject: [PATCH 05/10] serial: stm32: Use __maybe_unused instead of #if CONFIG_PM_SLEEP Date: Tue, 4 Jun 2019 10:55:14 +0200 Message-ID: <1559638519-6128-6-git-send-email-erwan.leray@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1559638519-6128-1-git-send-email-erwan.leray@st.com> References: <1559638519-6128-1-git-send-email-erwan.leray@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.31] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-04_07:, , signatures=0 Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Use __maybe_unused for power management related functionsinstead of #if CONFIG_PM_SLEEP to simply the code. fixes: 270e5a74fe4c ("serial: stm32: add wakeup mechanism") Signed-off-by: Erwan Le Ray -- 1.9.1 diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index 05d2ef6..aa3da1c 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -1200,8 +1200,8 @@ static int stm32_console_setup(struct console *co, char *options) .cons = STM32_SERIAL_CONSOLE, }; -#ifdef CONFIG_PM_SLEEP -static void stm32_serial_enable_wakeup(struct uart_port *port, bool enable) +static void __maybe_unused stm32_serial_enable_wakeup(struct uart_port *port, + bool enable) { struct stm32_port *stm32_port = to_stm32_port(port); struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; @@ -1225,7 +1225,7 @@ static void stm32_serial_enable_wakeup(struct uart_port *port, bool enable) } } -static int stm32_serial_suspend(struct device *dev) +static int __maybe_unused stm32_serial_suspend(struct device *dev) { struct uart_port *port = dev_get_drvdata(dev); @@ -1241,7 +1241,7 @@ static int stm32_serial_suspend(struct device *dev) return 0; } -static int stm32_serial_resume(struct device *dev) +static int __maybe_unused stm32_serial_resume(struct device *dev) { struct uart_port *port = dev_get_drvdata(dev); @@ -1252,7 +1252,6 @@ static int stm32_serial_resume(struct device *dev) return uart_resume_port(&stm32_usart_driver, port); } -#endif /* CONFIG_PM_SLEEP */ static int __maybe_unused stm32_serial_runtime_suspend(struct device *dev) { From patchwork Tue Jun 4 08:55:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erwan Le Ray X-Patchwork-Id: 165728 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp5576760ili; Tue, 4 Jun 2019 02:12:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyExRGZphPMUGaLwxBrnD9vM3h4ON2i7dm07fUucax82WuSgOdefBiZlnZv1kxyFpshrVL2 X-Received: by 2002:a62:51c2:: with SMTP id f185mr36114356pfb.16.1559639562446; Tue, 04 Jun 2019 02:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559639562; cv=none; d=google.com; s=arc-20160816; b=Mw6vkfzkpDXrqZn74n0C1vVTom+3qOrE1s7sd7uQSZlD2QDCi9oEjC+ZuR0Oo16Nws QYwRfgbj33ARvmp7gS7NOUeWUXjhGXy4xKIZWnskrKmkMurOhEOMrCpkwYzdPkIsKYuZ GDs6N1mE9/cWhn0iBNMo+TuFI8IrPSJSaH8ntiLYe4gxIpQJtbSGaFiHul3NKjwHpe85 dQZfY9mw1utpCe2dHRImumyFffYmuucjJXgMr4ubOX4E1JCwiwKtV/4FAp3jpvoKquAl kK1Mhjnuv4sWmmwGKGtpuCA/BV4m5icEjPJ89elkiqs6GogqS+/+qaj35tcnwNsvkr6t kFDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=PlxzoaxTpT7xfTSaFEe7rJyo9NUlAGqUd0kCqJ49OI4=; b=e3Wq31k4llIpSZQX9fZ/cm3URUbILBT4y/2kG8W3L4qUDCV2Uirx/7gjqQSa2lZsq3 eVg3n9yRqFdIWhnGoaojL++/pEBdwbBsIPzMd9q0IO/xu1vTPJYSME/iTT3cSjnTTpYW VMuxOnfpICP6LBCmEPJprOn1Dl2SLSmpSAwkfTWmT0maolttIVDjBUkT45LBs6VUKoxF PXlYcl0wLXuvhlsWHFwijPpcrUSjXeJQCx+rZLwnhm0+MyO83Ed5mALV92u0P2AD+BXL jyqrGK/p5mcdrMo7kM1twtE47E0l/T/QxCV9dIgTymkkDRWf1BEjJjeXy2YowxMTXH9A SIHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=XtvRF2Je; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l27si19707507pgm.172.2019.06.04.02.12.42; Tue, 04 Jun 2019 02:12:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=XtvRF2Je; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727140AbfFDJMl (ORCPT + 1 other); Tue, 4 Jun 2019 05:12:41 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:12896 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726877AbfFDJMl (ORCPT ); Tue, 4 Jun 2019 05:12:41 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5498qNp019707; Tue, 4 Jun 2019 11:12:21 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=PlxzoaxTpT7xfTSaFEe7rJyo9NUlAGqUd0kCqJ49OI4=; b=XtvRF2JeKJZfffjpzMNle1ULSUh/rkODDI4QXRECKKUHrDNwTzdSSsQFalGKpEzaX7c3 zbdFycHJK0pK41AqKzt8HzxEPeS/R+NpLHPnwFNRl+7fEQVvJqCiJsIrVkqlJfVWsnw1 s5bpON+O+iCT3GTVpXsG7jkXTbOmwlAUSL/01gpJykwL6Wtd4/6Csdo3M31y9DgD7eKy AH6xJxvjR27XMZDahEE5uOf/NctnBrvnWp3k38bh1ahoRPF5DZImMR1hba6fMdZRVj75 ESMRxem/Yf4Nl6StAyVjtmij9zLMHceFLYD4i6RGUtKC/rJVtwgTyKLX4G4QEwZ26t7R NQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2sunmefkt6-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 04 Jun 2019 11:12:20 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9F70A17E; Tue, 4 Jun 2019 08:55:41 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 5B858250C; Tue, 4 Jun 2019 08:55:41 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.93) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 4 Jun 2019 10:55:41 +0200 Received: from localhost (10.201.23.31) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 4 Jun 2019 10:55:39 +0200 From: Erwan Le Ray To: Greg Kroah-Hartman , Jiri Slaby , Maxime Coquelin , "Alexandre Torgue" , Rob Herring , "Mark Rutland" CC: , , , , , Erwan Le Ray , "Fabrice Gasnier" , Bich Hemon Subject: [PATCH 06/10] serial: stm32: add support for no_console_suspend Date: Tue, 4 Jun 2019 10:55:15 +0200 Message-ID: <1559638519-6128-7-git-send-email-erwan.leray@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1559638519-6128-1-git-send-email-erwan.leray@st.com> References: <1559638519-6128-1-git-send-email-erwan.leray@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.31] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-04_07:, , signatures=0 Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org In order to display console messages in low power mode, console pins must be kept active after suspend call. Signed-off-by: Bich Hemon Signed-off-by: Erwan Le Ray -- 1.9.1 diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index aa3da1c..573eae1 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include #include @@ -802,6 +804,7 @@ static int stm32_init_port(struct stm32_port *stm32port, { struct uart_port *port = &stm32port->port; struct resource *res; + struct pinctrl *uart_pinctrl; int ret; port->iotype = UPIO_MEM; @@ -816,6 +819,24 @@ static int stm32_init_port(struct stm32_port *stm32port, stm32port->wakeirq = platform_get_irq(pdev, 1); stm32port->fifoen = stm32port->info->cfg.has_fifo; + uart_pinctrl = devm_pinctrl_get(&pdev->dev); + if (IS_ERR(uart_pinctrl)) { + ret = PTR_ERR(uart_pinctrl); + if (ret != -ENODEV) { + dev_err(&pdev->dev, "Can't get pinctrl, error %d\n", + ret); + return ret; + } + stm32port->console_pins = ERR_PTR(-ENODEV); + } else { + stm32port->console_pins = pinctrl_lookup_state + (uart_pinctrl, "no_console_suspend"); + } + + if (IS_ERR(stm32port->console_pins) && PTR_ERR(stm32port->console_pins) + != -ENODEV) + return PTR_ERR(stm32port->console_pins); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); port->membase = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(port->membase)) @@ -1228,6 +1249,7 @@ static void __maybe_unused stm32_serial_enable_wakeup(struct uart_port *port, static int __maybe_unused stm32_serial_suspend(struct device *dev) { struct uart_port *port = dev_get_drvdata(dev); + struct stm32_port *stm32_port = to_stm32_port(port); uart_suspend_port(&stm32_usart_driver, port); @@ -1236,7 +1258,19 @@ static int __maybe_unused stm32_serial_suspend(struct device *dev) else stm32_serial_enable_wakeup(port, false); - pinctrl_pm_select_sleep_state(dev); + if (uart_console(port) && !console_suspend_enabled) { + if (IS_ERR(stm32_port->console_pins)) { + dev_err(dev, "no_console_suspend pinctrl not found\n"); + return PTR_ERR(stm32_port->console_pins); + } + + pinctrl_select_state(dev->pins->p, stm32_port->console_pins); + } else { + if (device_may_wakeup(dev)) + pinctrl_pm_select_idle_state(dev); + else + pinctrl_pm_select_sleep_state(dev); + } return 0; } diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h index 6f294e2..6957d50 100644 --- a/drivers/tty/serial/stm32-usart.h +++ b/drivers/tty/serial/stm32-usart.h @@ -261,6 +261,7 @@ struct stm32_port { bool hw_flow_control; bool fifoen; int wakeirq; + struct pinctrl_state *console_pins; }; static struct stm32_port stm32_ports[STM32_MAX_PORTS]; From patchwork Tue Jun 4 08:55:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erwan Le Ray X-Patchwork-Id: 165727 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp5576446ili; Tue, 4 Jun 2019 02:12:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQmnHgptOpMcQ+PyNMdTMbvcCumzNGj9LGwFZ1yNyepEyH78jF9tCLgxh9t7V40n/n/iCd X-Received: by 2002:a17:90a:a10f:: with SMTP id s15mr36306166pjp.30.1559639543366; Tue, 04 Jun 2019 02:12:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559639543; cv=none; d=google.com; s=arc-20160816; b=fgegOqrZf89w7A4GdglRUPcAKibQqRIAeHnW1iHISYGdbrpR3N2rhccVDp9lT8kK3D qTD+CwvqsRAwre+9v8qrnfamQG/EJqrT7bw9bwn/eaep5ZbuJ/lBhzfCtuP4R0KSwNyt jndWsZbDBK3m4uqlKMFvJQdmJ/YUaJkJpZqqjs9U71naGBGT9dl6RF2XdXdIzPc+4tMZ guX0cWjzzbnPaaNmDgGoDnA99lWm7r5mKnKfF4rMv02SFFNAG2nTy+RlY5KtDwd23nQz s0XNaWSNpXn5GIDp7xCfIQXdri+2EDpTHfNQnW5gDiItJBG8Ya20NMrMrkVqu65/VOUc B/zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=7dQ+9lqtmTtedvp/b3rgO/AqPLUdhqousiUICsfwmlU=; b=BOBDKvc6/9zpoCyHuQ4fAwfmcAT6M0AIxJdMmDR7DFDC9oIx3Hna4zt/G9tIQ3/uNc VkcIJ0LyZFIk4mI8uUdZHc2EkfmRSBB9Amqhgzpj3NqzeIEKSmdpxtvMTxQIH+bo0m7P IszBL8QEm3F5k1iQZIE6pn15hoMs5YtoHJGV7ujnt9DYD6xnPnRvrUoPWCiJ57BG1Ufz drYFZldk7KZA4YV+f7gNWxRFbvDz4xMTZP1jf+fM8/8uk9ZAWzecv/dRQL9kNFzpkMft dytss0h+zbNvXh53ZsRjRic1mAzGrDkvn8d3+Mlgn3yTD66Y/xUvEw4+0yZcnYOSNC5N J+4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=SpEMvvWc; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e11si7837957pjw.39.2019.06.04.02.12.23; Tue, 04 Jun 2019 02:12:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=SpEMvvWc; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726937AbfFDJMW (ORCPT + 1 other); Tue, 4 Jun 2019 05:12:22 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:1798 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726877AbfFDJMW (ORCPT ); Tue, 4 Jun 2019 05:12:22 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5498m8l019440; Tue, 4 Jun 2019 11:12:09 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=7dQ+9lqtmTtedvp/b3rgO/AqPLUdhqousiUICsfwmlU=; b=SpEMvvWcUnePXF+45Bix5UMA9ew3+AtsyZG9D1f4bqvRi04RA4ma6HaJp2oFc8jVi4Vu qnxjdWdnoK31qOFC1K9oPPJtmOcKtADkTIyX+h0LfN9zvTt865gX4nphqIXmO+nFJWYB ACVwhSUN3WTbi0o0UD6RvU0J+LLKYJYu2askkTg7JI9MYLIUhrFqhFzN8d6sgFSMWHrC Q6ABZAkkFhbeHzbEmWsuCfxWAfYnp8XOIO+M3MYGyEOqFbGzYepdQJdxi+GUiDRq9WwJ oSR02A3G4y0h8R6sVbUp/RkZiIckvq0V3VBTZ1UmRBt99+EOURN5JG3vDNfC0cBxyGK+ tQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2sunmefknd-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 04 Jun 2019 11:12:09 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7BB731A0; Tue, 4 Jun 2019 08:55:43 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas24.st.com [10.75.90.94]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 09829250B; Tue, 4 Jun 2019 08:55:42 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.93) by Safex1hubcas24.st.com (10.75.90.94) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 4 Jun 2019 10:55:42 +0200 Received: from localhost (10.201.23.31) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 4 Jun 2019 10:55:41 +0200 From: Erwan Le Ray To: Greg Kroah-Hartman , Jiri Slaby , Maxime Coquelin , "Alexandre Torgue" , Rob Herring , "Mark Rutland" CC: , , , , , Erwan Le Ray , "Fabrice Gasnier" , Bich Hemon Subject: [PATCH 07/10] ARM: dts: stm32: update uart4 pin configurations for low power Date: Tue, 4 Jun 2019 10:55:16 +0200 Message-ID: <1559638519-6128-8-git-send-email-erwan.leray@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1559638519-6128-1-git-send-email-erwan.leray@st.com> References: <1559638519-6128-1-git-send-email-erwan.leray@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.31] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-04_07:, , signatures=0 Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Currently, pinctrl states defines only one "sleep" configuration for pins, no matter the possible uart low power modes (Rx pin always kept active). Sleep pin configuration is refined for low power modes: - "sleep" (no wakeup & console suspend enabled): put pins in analog state to optimize power - "idle" (wakeup capability): keep Rx pin in alternate function - "default" state remains untouched, to be used while the UART is active or in case the no_console_suspend mode is enabled Signed-off-by: Bich Hemon Signed-off-by: Erwan Le Ray -- 1.9.1 diff --git a/arch/arm/boot/dts/stm32mp157-pinctrl.dtsi b/arch/arm/boot/dts/stm32mp157-pinctrl.dtsi index 85c417d..2e1ab1b 100644 --- a/arch/arm/boot/dts/stm32mp157-pinctrl.dtsi +++ b/arch/arm/boot/dts/stm32mp157-pinctrl.dtsi @@ -599,6 +599,23 @@ bias-disable; }; }; + + uart4_idle_pins_a: uart4-idle-0 { + pins1 { + pinmux = ; /* UART4_TX */ + }; + pins2 { + pinmux = ; /* UART4_RX */ + bias-disable; + }; + }; + + uart4_sleep_pins_a: uart4-sleep-0 { + pins { + pinmux = , /* UART4_TX */ + ; /* UART4_RX */ + }; + }; }; pinctrl_z: pin-controller-z@54004000 {