Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp719412ybl; Wed, 29 Jan 2020 08:31:12 -0800 (PST) X-Google-Smtp-Source: APXvYqxAOyXKnPGDohEGbKAX9q7x2D5WjvP3DmLu43UozYuFHLdTkq34VqdUsk2wadplAB71DCAs X-Received: by 2002:a54:4896:: with SMTP id r22mr7060515oic.30.1580315472283; Wed, 29 Jan 2020 08:31:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580315472; cv=none; d=google.com; s=arc-20160816; b=trVgTPBZ4rsJfGJN/HkolgHGrwtt51KWNiC0MbQHkUyP350G/3OMuCeQrNkWCz03nL q0tQYvdW/c6qb44FHhTEgT+5aWwKmAJ7YHpsIMM394yXDqFV72kWU5txIqgS5q4GPMDz nZtAguHsLuH8JRlCXps4iRZv2q4uU8N/lFkmIyWHb7clfof0DoKxaBieIFSh13/aKxMD t19pNJiE8lztOmJBrZAY5eN9H+/uGQcxzHSPYKtUBU/Tg43YW4RKYglpkcUzJRXTIys0 xERosAdlxvYu3VCaXuNh1BJVKw8d3Ee6yAbPKGM00yNQB0o0KxN6OFh7yiY2C5lzKAqX 0sxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=o0u5Sf21w9sFHx0zXMCORsgdfJdrBcq2bbrusVVo5MM=; b=ztbOrLQB7ZMFTs6kRslCBt1N0KI6pGDm93CQbM+I6xZSum6MLFytuVyPcN6dsdF0N3 hS7ygasoDXk3sZtDh2SXPZWDB+9U/6JEVFTRhZ27eaShQQKeozNc8kE0s0a7K0NHgAkb mz74UhdJ4vIAAh+4U3L1jzZ8j39KK30RByMb0DYUFjtdVDqxDQIckQawHTMm81IWsQNG WkXd2/oe1K5XlNgpVLmJGK6sYFXvkx8J0o/ylui9TKtnrsQ6k0diSwg0g/Kb0kzDs1vZ eOqG39JSJBF4Xu/I6N0o6JBDvwWpgEWqVsaJdXC0UfUxa6ZlD+d5XvTkOnVoID1mHx0N M3FA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si1420237otq.250.2020.01.29.08.30.59; Wed, 29 Jan 2020 08:31:12 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727099AbgA2QUs (ORCPT + 99 others); Wed, 29 Jan 2020 11:20:48 -0500 Received: from smtp1.de.adit-jv.com ([93.241.18.167]:52933 "EHLO smtp1.de.adit-jv.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726645AbgA2QUs (ORCPT ); Wed, 29 Jan 2020 11:20:48 -0500 Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id 074393C0579; Wed, 29 Jan 2020 17:20:46 +0100 (CET) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Azz6qmwHLR9N; Wed, 29 Jan 2020 17:20:40 +0100 (CET) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id 12EE53C009E; Wed, 29 Jan 2020 17:20:40 +0100 (CET) Received: from lxhi-065.adit-jv.com (10.72.93.66) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.468.0; Wed, 29 Jan 2020 17:20:39 +0100 From: Eugeniu Rosca To: Geert Uytterhoeven , , CC: Wolfram Sang , Yoshihiro Shimoda , Ulrich Hecht , "George G . Davis" , Andrew Gabbasov , Jiada Wang , Yuichi Kusakabe , Yasushi Asano , , Greg Kroah-Hartman , Jiri Slaby , Fukui Yohhei , Torii Kenichi , Eugeniu Rosca Subject: [PATCH] serial: sh-sci: Support custom speed setting Date: Wed, 29 Jan 2020 17:19:55 +0100 Message-ID: <20200129161955.30562-1-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.72.93.66] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Torii Kenichi This patch is necessary to use BT module and XM module with DENSO TEN development board. This patch supports ASYNC_SPD_CUST flag by ioctl(TIOCSSERIAL), enables custom speed setting with setserial(1). The custom speed is calculated from uartclk and custom_divisor. If custom_divisor is zero, custom speed setting is invalid. Signed-off-by: Torii Kenichi [erosca: rebase against v5.5] Signed-off-by: Eugeniu Rosca --- drivers/tty/serial/sh-sci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 87ca6294de0e..dd468909b2c4 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -2405,6 +2405,10 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, if (!baud) goto done; + if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST && + port->custom_divisor) + baud = port->uartclk / port->custom_divisor; + /* * There can be multiple sources for the sampling clock. Find the one * that gives us the smallest deviation from the desired baud rate. -- 2.25.0