From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEBD7C35240 for ; Wed, 29 Jan 2020 16:20:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 876D12070E for ; Wed, 29 Jan 2020 16:20:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727112AbgA2QUt (ORCPT ); Wed, 29 Jan 2020 11:20:49 -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