From patchwork Tue Feb 19 07:31:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 158684 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3360271jaa; Mon, 18 Feb 2019 23:31:55 -0800 (PST) X-Google-Smtp-Source: AHgI3IadEhbHD6S+upGDgqvO/yekDWybifMTPC4mgESItQmeaJTtkRtsGtphRUvdmT+tisZIlLzc X-Received: by 2002:a65:5844:: with SMTP id s4mr22341409pgr.77.1550561514901; Mon, 18 Feb 2019 23:31:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550561514; cv=none; d=google.com; s=arc-20160816; b=MvjQYKNtuoADR3lfsUTZpMz93RPg4uCVWeUIRY0+9Dp3p6IRw1zyxXg5kgCCfYVxUt 47T20ejdBT+haH9bgVmidxjHcxrlGYub6x0l9xlgHvhNhBRQovY/dCsT8EqrDxQERU3c SCP52RlC+MSUctLlyxGkBlW83uqPS0Irf/STmRvMYajGxw+auM0jzEtG9Tgmf7sd/65r K1ERUtnDCQQlRd920sCnDvkqHy3oFNQFL/r6iiNZZ+RB2+JDMaPJ7xu3EqoLJzbfs6Xu a4AUnwi/GjCutFlDq4DA0waayTjqQmnv9DbaJNyE4a5SQfUW5sfgBPylrNLfqVr6+p6q P01g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=aeVLkZNBgesC+IRltdDGw/TLRa8vIRSPBiqLESkQCWY=; b=L7lKnjKkfWfi8rcmx4fjrvAR9OoYiqYOTr0fDPxlKEyUQ4RTjD7tZHhB6Pat6oRDIY 9oDdB7iZjmhe+XDQe5pPdzYBBeiy5AB8Hn/pNSWUcKphc5m7pa5G9OAlG4F3oZiW+2LV KwK+jog8B3NW5DrsYWEAxUV4Oa8TTrBYe09oZgpedSlmcQXgBYB5xB+uDxFWyA7W9Cf7 eco21qvEc0gNE6R8wzsjsJJ3SeGFkxIOmnOGd69Xzx4x9fOccgFRxuRUF35RWG60vvS2 jpU2aMgCM4Eys2iy/C5Rp8wk4BQCc4Sk2sqBNFcrXMTxxJL8SUIorhRVwaXrYxa5FcVq mPDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M2oVAUua; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o188si7405705pfb.66.2019.02.18.23.31.54; Mon, 18 Feb 2019 23:31:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@linaro.org header.s=google header.b=M2oVAUua; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726978AbfBSHbw (ORCPT + 32 others); Tue, 19 Feb 2019 02:31:52 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36465 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726845AbfBSHbv (ORCPT ); Tue, 19 Feb 2019 02:31:51 -0500 Received: by mail-pl1-f194.google.com with SMTP id k2so651785plt.3 for ; Mon, 18 Feb 2019 23:31:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=aeVLkZNBgesC+IRltdDGw/TLRa8vIRSPBiqLESkQCWY=; b=M2oVAUuaJNwf8FsOJV0QHgUTqac/OCdGhCpwf54UMDwBMVmR/UN+UlIyZrhmttlGS3 uj4UTyEp/4YXow7f7s9A1fEaqigEQ5RFDfC6YWuuEVanTsRVnZBOT6VO1zgKUDblvNMM 0mGm1ekTYL7FzLepaE27CyVmbbVHrUWGRXGk5bHC7XPkobGrbDSwLJXL1NhrcKnvAo63 N/B6o6adlI8MrEvYE3GRcktwcF2fiiF6sCh4FHVvkXUfKLfCUMBIxo34Yep2Eg8ypbaH gJZSgDAn8rfCp9UOpAs7wTVhaSQo4iDSB8JfyzMDt9JvVY0PfIPIIVfDrRHkcwDpyDDA y8Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=aeVLkZNBgesC+IRltdDGw/TLRa8vIRSPBiqLESkQCWY=; b=oN8o4AAsCtp7OFiEIAoh+jnezjtsyy8U04BvlxrbnyBL+tczWM07l49BmFFU+eio3K Y/4Vt2wXcKEyDTbCgCeCJPnQv41GeGJn5X/xV2Mn9mHxYMpzVmA/nvGE08LwZjcxcte+ v+8vTlZETvWvZdCVTX7lv+5pVse8omWftzE+ns3y0SRJYtJnJsFwFs/46AH17gahDLty BpaleGLZFs4yclfERD3kPNrJ7iF1H31DrmWj63X1soUcYYyZOsx5gOtgtBLB5rUvLa19 AsHzIvbcQRSom/dw+fqtbHxCW/FCOSBVHCa6zVxgHo1Ww66PDdLYK/ocANnbRBxHBc7s 7+wg== X-Gm-Message-State: AHQUAuaZ7ruERAmY0LmK16DQliZXKrnfJ271OFzk605xoleIJGQF9yJq LKRcItEeU+BVuEksOwth7Kx0DiYmGp2Rlg== X-Received: by 2002:a17:902:4124:: with SMTP id e33mr29536066pld.236.1550561511154; Mon, 18 Feb 2019 23:31:51 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id n27sm31556569pfb.8.2019.02.18.23.31.47 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Feb 2019 23:31:50 -0800 (PST) From: Baolin Wang To: gregkh@linuxfoundation.org, jslaby@suse.com, robh+dt@kernel.org, mark.rutland@arm.com, orsonzhai@gmail.com, zhang.lyra@gmail.com Cc: baolin.wang@linaro.org, broonie@kernel.org, lanqing.liu@unisoc.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 1/5] serial: sprd: Modify the baud rate calculation formula Date: Tue, 19 Feb 2019 15:31:11 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lanqing Liu When the source clock is not divisible by the expected baud rate and the remainder is not less than half of the expected baud rate, the old formular will round up the frequency division coefficient. This will make the actual baud rate less than the expected value and can not meet the external transmission requirements. Thus this patch modifies the baud rate calculation formula to support the serial controller output the maximum baud rate. Signed-off-by: Lanqing Liu Signed-off-by: Baolin Wang --- drivers/tty/serial/sprd_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c index 4287ca3..1891a45 100644 --- a/drivers/tty/serial/sprd_serial.c +++ b/drivers/tty/serial/sprd_serial.c @@ -371,7 +371,7 @@ static void sprd_set_termios(struct uart_port *port, /* ask the core to calculate the divisor for us */ baud = uart_get_baud_rate(port, termios, old, 0, SPRD_BAUD_IO_LIMIT); - quot = (unsigned int)((port->uartclk + baud / 2) / baud); + quot = port->uartclk / baud; /* set data length */ switch (termios->c_cflag & CSIZE) { From patchwork Tue Feb 19 07:31:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 158685 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3360335jaa; Mon, 18 Feb 2019 23:32:00 -0800 (PST) X-Google-Smtp-Source: AHgI3IYjDzADNpdY986zvMTnG4L6QlmTLFPImDJVAk+3JrkY2o35xTCd8NJbIJwynqJTZjRgvWT9 X-Received: by 2002:a63:305:: with SMTP id 5mr16535736pgd.57.1550561520603; Mon, 18 Feb 2019 23:32:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550561520; cv=none; d=google.com; s=arc-20160816; b=YczEu/X1t/HNhd3WkL8b7Hjl2qW9bk9q/UZiLdndlmDmOrQhaeJ0fyrv9smzDy+CUe 8UbjgzZwqEc2dq9N+2Ls3V7eCk24daqkmmOdauPaoUajYd2Yt+WNY3JRGLi37WyMHqPq +IlXQdMiaWFculP2umrScXEFTrzLqM8gnmZA0IgYrAplcmpGScddHvocY/OIZqPUjfa2 YNEA63HjVT2VrepOz9AOekbFkkfLspc7GmTh8VXTFWM8j4bC4eVFqG30xuzA6gsTnX4P zScO7aNxg05QbPVzSKiNUpEJBLOX9kOax8aYmU1GIC7h8pINqTjMnnAgxb1nXTCaxhF4 cTMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=yyLHgf/fg0UKT/vKQ5XRuE7/YcLw7WJlhicYn1jLCNw=; b=MKwQ38qs8fiFy+tAY6KTRWMVIUCmVt9C0HgsItePWu7XD6rHl1++1NjotCU1U5vdlD EHbk4yzfWC6yNS6apyjqNpOuIawyPJHCeF2HaVK8r76qPATgmhKfw6lfgnCKN6M0FHNA bB51cOZzyHenvx9dl9BuhKLoI1fjDy8vwyVRpb1y1aHwf9+TxQxRiUZrKbF5rreUnBrb jQxUN6Uy/f4wnz5rN+28MwTsQV+PMSpMnpycSJ+0Xa/j0yXNID6B+wJcLld8HGGIO53T /B0VdLCB1IlitxVVrwm+yhIsyRgY1I0K+nAgoJeQHIbqAV1jws1mqsYE+ZY+pY+sz+KU RSaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="R/T95oDK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 25si12857911pgz.309.2019.02.18.23.32.00; Mon, 18 Feb 2019 23:32:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@linaro.org header.s=google header.b="R/T95oDK"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727027AbfBSHb6 (ORCPT + 32 others); Tue, 19 Feb 2019 02:31:58 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37231 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbfBSHb4 (ORCPT ); Tue, 19 Feb 2019 02:31:56 -0500 Received: by mail-pl1-f195.google.com with SMTP id q3so2627330pll.4 for ; Mon, 18 Feb 2019 23:31:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=yyLHgf/fg0UKT/vKQ5XRuE7/YcLw7WJlhicYn1jLCNw=; b=R/T95oDKjrZuBgj/s9/l0Ok04YZ1LfuEY+5bc/RCjr/FhhohsJVD7Wdi8/TCiKOjzp dLB9L19bqz43sU+M1WUOHrDm6CYgFLgQOMWW8te5c/1X+dlsnzdunOlbWsejqGotKoEj nbbnueQzHAGvhBLG5YCIOH6CU0R2O+lp+KjBXfMZR5pv+sTk6P1eSqe9A7oo1Bvhj0YW 9rfgWGnnRym0pdOig+pwXpgfb8mdc7RBQzbSHwavE4vMIXT0oWf8PBdZk6OycdLG4h2P +Das0nfAupMhubdzLC9rB4b9QQx8BWA5QL5Xh33UOL99UdFxJyjiJ1RWzi/GVdec9kob Sx9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=yyLHgf/fg0UKT/vKQ5XRuE7/YcLw7WJlhicYn1jLCNw=; b=mMGxqU4XMaSus0snkVOOkfxRGDUEKA7ZNzB6CUuF5MqaE5GIQvt3lUTk4nATXyCppz B/Cz8lKjEZChsRKuqa5Ski+/xiBXXP5P+P8VJRWbHNpxo8oB7a7Md8dbGCUnz07XD39G cxR0d1UA76u85/VtYy44Z2VURzuln1nOHf3DNF/ywCIgENNKnrK2L0DzYWCBHn/acPHY RZ3Vb+FgMabE6Q/c1sEE1xU8AWu5ijzOxYrvGixHsl9efgQNx0r2QSVa5EGih/4o1RpZ xLTO6aeMVtERVdpF/DB1C0CnnbVZNCUSJvhT7bmqVEWz5Piauj0AzydvPte5KEVYRF0o 3Mrg== X-Gm-Message-State: AHQUAuajBm7tDIvIaquQ2Oc59Wn0P57SNSksjmdTUYygHl3bWjrqsdhk Ersgham1y60zpiWVXnNABeFYBw== X-Received: by 2002:a17:902:7c98:: with SMTP id y24mr11632179pll.191.1550561515473; Mon, 18 Feb 2019 23:31:55 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id n27sm31556569pfb.8.2019.02.18.23.31.51 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Feb 2019 23:31:54 -0800 (PST) From: Baolin Wang To: gregkh@linuxfoundation.org, jslaby@suse.com, robh+dt@kernel.org, mark.rutland@arm.com, orsonzhai@gmail.com, zhang.lyra@gmail.com Cc: baolin.wang@linaro.org, broonie@kernel.org, lanqing.liu@unisoc.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 2/5] dt-bindings: serial: sprd: Add clocks and clocks-names properties Date: Tue, 19 Feb 2019 15:31:12 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lanqing Liu This patch adds clocks and clocks-names properties, which are used to do power management for our UART driver. Signed-off-by: Lanqing Liu Signed-off-by: Baolin Wang --- .../devicetree/bindings/serial/sprd-uart.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) -- 1.7.9.5 diff --git a/Documentation/devicetree/bindings/serial/sprd-uart.txt b/Documentation/devicetree/bindings/serial/sprd-uart.txt index cab40f0..6eb5863 100644 --- a/Documentation/devicetree/bindings/serial/sprd-uart.txt +++ b/Documentation/devicetree/bindings/serial/sprd-uart.txt @@ -7,7 +7,13 @@ Required properties: - reg: offset and length of the register set for the device - interrupts: exactly one interrupt specifier -- clocks: phandles to input clocks. +- clock-names: Should contain following entries: + "enable" for UART module enable clock, + "uart" for UART clock, + "source" for UART source (parent) clock. +- clocks: Should contain a clock specifier for each entry in clock-names. + UART clock and source clock are optional properties, but enable clock + is required. Example: uart0: serial@0 { @@ -15,5 +21,6 @@ Example: "sprd,sc9836-uart"; reg = <0x0 0x100>; interrupts = ; - clocks = <&ext_26m>; + clock-names = "enable", "uart", "source"; + clocks = <&clk_ap_apb_gates 9>, <&clk_uart0>, <&ext_26m>; }; From patchwork Tue Feb 19 07:31:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 158686 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3360367jaa; Mon, 18 Feb 2019 23:32:04 -0800 (PST) X-Google-Smtp-Source: AHgI3IYfx8sLuPgzMHFHp7oqsvh2kRVUPYjHRiBFwtGHLv9RxhxmfF6oRnMf1/eLe1Dde8e5ospf X-Received: by 2002:a63:f30d:: with SMTP id l13mr22768571pgh.399.1550561524359; Mon, 18 Feb 2019 23:32:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550561524; cv=none; d=google.com; s=arc-20160816; b=xgNPLc5ZAXhTHh/++iL+JMF80Uy1gahIPZIpq1NKPv/K4Pm8YssJYuG9OhC/tk31X6 L5pG2cTa1DSLTWnwQoeMKuZ0D7bydpfCBTpWm8PgIq6mmMA2NCcnYDilMsL1PKotwHet +VTJRoDEjBZa0K2qQrFTMxrSjTDc5Ur7pGf7AtfuEaMBwWnK2FswZjKeXNMDmrgKicJD rVIM2X8DYbGm9A2uUwiWVfgEaum9FPitOb1MrBsR3yFnn43lYRkoFE47gm1c0C6TJg7c flWEkD1/lZwv9B+ifyBit/wKjr+p/D7ea6Yyh8D+RkSPAcz7w5eLYq8dIOw2g75CLHDJ RNYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=OH4/R/+Sw0xSAT1PY7Jcu+TD5xcCuEZT5i9WHOVRd/E=; b=KDDd3EA20PH4RfGwNH9WtEuEZHto3a6WJquLGFVWKsTaym4T/o68oXRDgM1h6Lqm/D CoLW1kNjbAI6PXZ/imXYH9YnpumPrb7ksvFNKqrJGPyqfpLpJD1+owhgZbwJMaDIqTJH bUUwFnhAJlKtZl3OuB1C3ooh2vHaNgbrLvN4zq/U7+2CnxLZPJoWqnsL5OMMFf6ZyXlA gY8z25WbWWWqJit7gu+UrGoZqlpDOu/xsYlim2N/qHXDsfrrfFt7U/1BMMCeTbCwVXji i/pPXneHx7DitiobFlEzRfa6dUgOOOi4Qu79B2WKKenFyXDl26/XTkq98axPgLSzX2up bSwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mBVRP98Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 25si12857911pgz.309.2019.02.18.23.32.04; Mon, 18 Feb 2019 23:32:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@linaro.org header.s=google header.b=mBVRP98Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727216AbfBSHcC (ORCPT + 32 others); Tue, 19 Feb 2019 02:32:02 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:41015 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725768AbfBSHcB (ORCPT ); Tue, 19 Feb 2019 02:32:01 -0500 Received: by mail-pf1-f193.google.com with SMTP id d25so1470323pfn.8 for ; Mon, 18 Feb 2019 23:32:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=OH4/R/+Sw0xSAT1PY7Jcu+TD5xcCuEZT5i9WHOVRd/E=; b=mBVRP98YrgXxSycI+IEpurKiIyLWSygxELFbpBiYNuhcEegSpkm8ZYEkBKgHbHaOXl 8p22pkX0L8RdjuZay61ImSfuY+W2gLqUR64kM6GcN2YHly9w/hZKA9FoCBEWLbCJt7be T+OHTKD+0tD4AnNTzMIBJrOlpm84cd5HoSEMj/SjPMM1WOmDgQ1w4mOY5KyUChN+sXG4 /Z+aryL/8ty5KWOYxQ/JesGZZ79S62Wtz4qqY/yOu+oraDQBJ3LsEotuWCoeQsalXPXo FxH7b6KPXrhlby6qbdISBaSfi/an3m2z18Lpi38RWDjGwunSaoRKZX46867Bst+BrpHy jnlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=OH4/R/+Sw0xSAT1PY7Jcu+TD5xcCuEZT5i9WHOVRd/E=; b=Y7cn8AbCm9q7o5HS5HpXEal38N+2HsuUYnQioiPjD/sz1CanP1D0Wv3RjG7t1Xjn// sYlSz11uvfeKiKSkFsSMFsJn92SSYYWhWqMXK/Nk/5KZZ6RHvqKqlEQLoN0cFH6xucAW 9+sZZKxI/sUft221K6En1UkCMNejPPIZQVFLrstHiaCT2MHwwpvZfZVpB5IrfKAl8qfZ GgCo9HWemK9OivkviSySqbRsSXecvYr5TTdz0rrWr0f6yWgo4EOKosPYAK8kS7TmMOp+ ngCRfhleEkcFQmtZ3Ujv+R0zFkF1DnBWMEvh/4TEmNj+DXbzHZmouFSAlhQvPqjI83jC OCtg== X-Gm-Message-State: AHQUAubMAZNQbSSx6mFl3rX6lEl4WTXPrUP3YSzJV6vHrzuGNfpIz9TW 7yBOgYJH8Pn/aEhGPZTl5S1VFg== X-Received: by 2002:a63:ae0e:: with SMTP id q14mr26926027pgf.151.1550561519923; Mon, 18 Feb 2019 23:31:59 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id n27sm31556569pfb.8.2019.02.18.23.31.55 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Feb 2019 23:31:59 -0800 (PST) From: Baolin Wang To: gregkh@linuxfoundation.org, jslaby@suse.com, robh+dt@kernel.org, mark.rutland@arm.com, orsonzhai@gmail.com, zhang.lyra@gmail.com Cc: baolin.wang@linaro.org, broonie@kernel.org, lanqing.liu@unisoc.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 3/5] serial: sprd: Add power management for the Spreadtrum serial controller Date: Tue, 19 Feb 2019 15:31:13 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lanqing Liu This patch adds power management for the Spreadtrum serial controller. Signed-off-by: Lanqing Liu Signed-off-by: Baolin Wang --- drivers/tty/serial/sprd_serial.c | 61 +++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 4 deletions(-) -- 1.7.9.5 diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c index 1891a45..8f45b66 100644 --- a/drivers/tty/serial/sprd_serial.c +++ b/drivers/tty/serial/sprd_serial.c @@ -100,10 +100,12 @@ #define SPRD_IMSR_TX_FIFO_EMPTY BIT(1) #define SPRD_IMSR_BREAK_DETECT BIT(7) #define SPRD_IMSR_TIMEOUT BIT(13) +#define SPRD_DEFAULT_SOURCE_CLK 26000000 struct sprd_uart_port { struct uart_port port; char name[16]; + struct clk *clk; }; static struct sprd_uart_port *sprd_port[UART_NR_MAX]; @@ -491,6 +493,22 @@ static int sprd_verify_port(struct uart_port *port, struct serial_struct *ser) return 0; } +static void sprd_pm(struct uart_port *port, unsigned int state, + unsigned int oldstate) +{ + struct sprd_uart_port *sup = + container_of(port, struct sprd_uart_port, port); + + switch (state) { + case UART_PM_STATE_ON: + clk_prepare_enable(sup->clk); + break; + case UART_PM_STATE_OFF: + clk_disable_unprepare(sup->clk); + break; + } +} + static const struct uart_ops serial_sprd_ops = { .tx_empty = sprd_tx_empty, .get_mctrl = sprd_get_mctrl, @@ -507,6 +525,7 @@ static int sprd_verify_port(struct uart_port *port, struct serial_struct *ser) .request_port = sprd_request_port, .config_port = sprd_config_port, .verify_port = sprd_verify_port, + .pm = sprd_pm, }; #ifdef CONFIG_SERIAL_SPRD_CONSOLE @@ -671,11 +690,45 @@ static int sprd_remove(struct platform_device *dev) return 0; } +static int sprd_clk_init(struct uart_port *uport) +{ + struct clk *clk_uart, *clk_parent; + struct sprd_uart_port *u = sprd_port[uport->line]; + + clk_uart = devm_clk_get(uport->dev, "uart"); + if (IS_ERR(clk_uart)) { + dev_warn(uport->dev, "uart%d can't get uart clock\n", + uport->line); + clk_uart = NULL; + } + + clk_parent = devm_clk_get(uport->dev, "source"); + if (IS_ERR(clk_parent)) { + dev_warn(uport->dev, "uart%d can't get source clock\n", + uport->line); + clk_parent = NULL; + } + + if (!clk_uart || clk_set_parent(clk_uart, clk_parent)) + uport->uartclk = SPRD_DEFAULT_SOURCE_CLK; + else + uport->uartclk = clk_get_rate(clk_uart); + + u->clk = devm_clk_get(uport->dev, "enable"); + if (IS_ERR(u->clk)) { + if (PTR_ERR(u->clk) != -EPROBE_DEFER) + dev_err(uport->dev, "uart%d can't get enable clock\n", + uport->line); + return PTR_ERR(u->clk); + } + + return 0; +} + static int sprd_probe(struct platform_device *pdev) { struct resource *res; struct uart_port *up; - struct clk *clk; int irq; int index; int ret; @@ -704,9 +757,9 @@ static int sprd_probe(struct platform_device *pdev) up->ops = &serial_sprd_ops; up->flags = UPF_BOOT_AUTOCONF; - clk = devm_clk_get(&pdev->dev, NULL); - if (!IS_ERR_OR_NULL(clk)) - up->uartclk = clk_get_rate(clk); + ret = sprd_clk_init(up); + if (ret) + return ret; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); up->membase = devm_ioremap_resource(&pdev->dev, res); From patchwork Tue Feb 19 07:31:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 158687 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3360426jaa; Mon, 18 Feb 2019 23:32:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IZp7Rhmihfjd/8N2f12AZPLEth01sSYJm4QB36X9f+tTsaYrGcFk4pdCln88Pc6Ea8Au9qL X-Received: by 2002:a17:902:bb89:: with SMTP id m9mr29227336pls.320.1550561529038; Mon, 18 Feb 2019 23:32:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550561529; cv=none; d=google.com; s=arc-20160816; b=CW8JjJZYqCe6Gwmq8hLb2IpaPfyCWoFmBwGBs9+TcOVg/6TMVVxR5tZAitBZDlsj/T nJnFgy072L5d1alacBUk0j7ksensK+tqUWL9hW1ULWk2cOWSvji8cbB+RwDJGZ3fJTEW lJks4yxrs/OXpd5oezUWDvFafbT0U9Tj3CHePHvoeUQUYsNvzydqDF759FESWjfoaei0 FNLg3RnXQuv04kvoBIZXGEL4fFPbc8exojBEKM04UJGN8BZWwze+DB2A30HrO40Hpudt xXJZ7qepx/Si/NM3PNVZzCdi+hvYiC/76zv6lOxljopjb8OZ7J8Np5uBs+gtsSIMjb55 qGvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=KgTwt+mvKpgOELot+xmj2f5gFMFsgIKRQfOaJRZIYrA=; b=0sHcxui+4S8olT0uN3gYnO+lGUpjzqQNYjMBEO06CKoEOD+5W0GL6JvMtSbbcKIvl9 mHIwbZolGUyArdfDhljLtqj7j14SSURkvQMfDrSII/i6b6GJXH9NQfDREbQ64bTBvejR XVE5QOy/TCoYirQpRKNWURNUOEXr0Ca41nKwRNXlz/dHku+UHGuNQLYQUa3KOV1e2wwx fSVR9jD6xA31OITyZf8ukycHHIkuveElnsIDywzAvpkFDRaZDpp4E7tV7d6hm3OEgXD1 vvNhf6ufsirqyF62F3bqMqpsBa3stQkTt00y8WpObZYzcqgQ1brKPnZ4vvJ4Bi56HzZn EkZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DVr2VlEc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g18si8639055pfg.99.2019.02.18.23.32.08; Mon, 18 Feb 2019 23:32:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@linaro.org header.s=google header.b=DVr2VlEc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727269AbfBSHcH (ORCPT + 32 others); Tue, 19 Feb 2019 02:32:07 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:34124 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725768AbfBSHcE (ORCPT ); Tue, 19 Feb 2019 02:32:04 -0500 Received: by mail-pl1-f195.google.com with SMTP id d15so2858044plr.1 for ; Mon, 18 Feb 2019 23:32:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=KgTwt+mvKpgOELot+xmj2f5gFMFsgIKRQfOaJRZIYrA=; b=DVr2VlEcqP9TalSPwKET4j+4t+LjROY6ji28p3LRmQWMGQol/DOnIyax8XEx/onC6p Huh06/j19ri9l7fvjszirst/FehKh9KtJvyJg07adQOCl1s8L1DKEK5HlJXtFaORDuBo dYDi5kDTLnkvGgpbgkWe7A100TZTVgS9CT3k6Yv2bmyQDL7NWQepdHQJIiP+DewWY6Kg /J/X8/uzBwegFxN9QPWGNYqV7UJ0NhTPkeBmEHh5rLBw59tqTQYFC6gAOSP3lFA3Evxg zvm5b/w/+y29T8aQv1exlTy/T666CiVuBUoiQZOEytclfFKc4HxQazYop8bRaQDwPmez cKVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=KgTwt+mvKpgOELot+xmj2f5gFMFsgIKRQfOaJRZIYrA=; b=JrftA6rZDnEC26lOD4nVUqvGUt59pi3MhRZqdZ1Y0vNzsTYjzkKlNCHGxnl0llhEl9 5RlbQThcKxB85g3BkdmjmP+cL424VTcqf9tCuBoIYKA8Qa1TjZTgt2MkLrEtMtj2G3fx n8xGQpsMwRGbMRuIUsJ5jaR82nD/jtLpQmzl+AKKbCRzhB7JRrqKHzCIiXz5suS4qQZq 03n63l0vjlqNU0z+J+H8jBzRLh0UP6AEpxNESwvEr8CrGr819Jz/R0oFqsq9mLbs1ksq iy75CIbE0pVw9YrUxOOn4tJZW5k3MySjcl0xAN9tCAxTTUFKzS1Agr7MTXJUNHS2aPq+ NSUA== X-Gm-Message-State: AHQUAubOuvn3TNy/eEYrnu5LYTKJ+3TcLG120SwgPEK0uH2BBqIGZEmH jTnukMkdbcTF/SlvNrT3bjn2UA== X-Received: by 2002:a17:902:8304:: with SMTP id bd4mr28506732plb.329.1550561524227; Mon, 18 Feb 2019 23:32:04 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id n27sm31556569pfb.8.2019.02.18.23.32.00 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Feb 2019 23:32:03 -0800 (PST) From: Baolin Wang To: gregkh@linuxfoundation.org, jslaby@suse.com, robh+dt@kernel.org, mark.rutland@arm.com, orsonzhai@gmail.com, zhang.lyra@gmail.com Cc: baolin.wang@linaro.org, broonie@kernel.org, lanqing.liu@unisoc.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 4/5] dt-bindings: serial: sprd: Add dma properties to support DMA mode Date: Tue, 19 Feb 2019 15:31:14 +0800 Message-Id: <8f0a032f9bcce28bb0d147f9646950f64fc22a74.1550560916.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lanqing Liu This patch adds dmas and dma-names properties for the UART DMA mode. Signed-off-by: Lanqing Liu Signed-off-by: Baolin Wang --- .../devicetree/bindings/serial/sprd-uart.txt | 6 ++++++ 1 file changed, 6 insertions(+) -- 1.7.9.5 diff --git a/Documentation/devicetree/bindings/serial/sprd-uart.txt b/Documentation/devicetree/bindings/serial/sprd-uart.txt index 6eb5863..9ac28f6 100644 --- a/Documentation/devicetree/bindings/serial/sprd-uart.txt +++ b/Documentation/devicetree/bindings/serial/sprd-uart.txt @@ -15,12 +15,18 @@ Required properties: UART clock and source clock are optional properties, but enable clock is required. +Optional properties: +- dma-names: Should contain "tx" for transmit and "rx" for receive channels. +- dmas: A list of dma specifiers, one for each entry in dma-names. + Example: uart0: serial@0 { compatible = "sprd,sc9860-uart", "sprd,sc9836-uart"; reg = <0x0 0x100>; interrupts = ; + dma-names = "rx", "tx"; + dmas = <&ap_dma 19 19>, <&ap_dma 20 20>; clock-names = "enable", "uart", "source"; clocks = <&clk_ap_apb_gates 9>, <&clk_uart0>, <&ext_26m>; };