Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4637552ybv; Tue, 11 Feb 2020 00:15:47 -0800 (PST) X-Google-Smtp-Source: APXvYqw63+fp4A6JsZhwI38FXonIjkq1UurC94n1snOIyBcNypNuf1HrxV1oWaIBqG7CVBjiA0pW X-Received: by 2002:a9d:7d9a:: with SMTP id j26mr4084689otn.21.1581408947518; Tue, 11 Feb 2020 00:15:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581408947; cv=none; d=google.com; s=arc-20160816; b=X3UHz6hdkr4ngZzRTsLzFryJ/1b1TC//UIQqvOVlKb9s373Q/Fif5fBSAj7wOIbDqg QfkTJMwFX4epQxFbrHj0so+9AcJYVO3wDJthkbSFtbDOGpzJxzlsjSWZv9L/0vbGFWhQ CUPUUsQrHNtUShhgNoED3Z6hA78Rka8PJ0vM7dJUQOJ4E3TP3L0NQ+A7SSeQr8GmKYUu Ev3pOHTbBv2FnWQvIxRKKzAJFqiMaB80Y+hhxZ4oKWF5wixHkfKNcvyoPBalDQvCv/yf 3ZqrBZbiQE0MOKmol7Cr3csnMuS+r+oqCOAVEXf7ExOIWstVnYNYD4CTfbLoSz+k4k1y F/pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=KmW0O3LnLsxSEx5mSsn3yBdnjLfYpE0MC8ooH4ZjjKw=; b=RZAowC5+pte63NiVUd7ydGkQPa8gUsSLXeNO6ccZDks7PfnIGeOVkAT5RsGvxZ5IIJ KnFL6JGSZDWpuKawYksQzfTNouEHR/YuNTUYD7ikhVr9OSIalIixBbdlwihEY018fnQM alZOhzr4QapVqm3vr2jK6D6pGkehELX3upLevehG1U6hbpAldyA8i5e7cw+eeOVu2EXT mnN721TNkRx57bLTUs/Qsz/AJMM2S3fYCZVK2YfvclZH1t4Oc4OFN6N8yBvu7eiDOvdU qpLCefMY8a6HPcjNKWfXxxrYPoBhiJJSvrYdfM9Esu50XFPTO3kuTffLLi6Xdl9TJkpo Zarw== 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 7si1461243oij.29.2020.02.11.00.15.34; Tue, 11 Feb 2020 00:15:47 -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 S1727883AbgBKIPP (ORCPT + 99 others); Tue, 11 Feb 2020 03:15:15 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:38902 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727688AbgBKIPO (ORCPT ); Tue, 11 Feb 2020 03:15:14 -0500 Received: by mail-ot1-f65.google.com with SMTP id z9so9232613oth.5; Tue, 11 Feb 2020 00:15:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KmW0O3LnLsxSEx5mSsn3yBdnjLfYpE0MC8ooH4ZjjKw=; b=L8Et7rpBPKlE8yhxdqUNJNgm41Kz2j5U49UXgA4ooWFrH0e4reqfa4mIxQOl8Wyy/j NJhfC6TxM7aUO8gCQCoQNNdg9wrgYIa4IAfxFHdGm0DXcVWQfDK9d64IOeqjZCScVsBL HDsrvR2IxCA0kalACn4x9ISGvSFyGv+COG/fS8WJhm2J81bze5Be43asCGKnWw4bcj51 XiNez53G/ArftMEDlxXvX5uCmiybWAs9FhG742e2ztZTXUJpMb0YOCruhVpnEUJeT0RW CSS9Ob+kCr45BB82kWx7bXQBRpysHGJs1mXd2gLPE4+uLwGUQI0ncpFTCrjtszJERH6x rnNg== X-Gm-Message-State: APjAAAXEdEmktm41ecgO2QsXiimDFLFnt+crmfYridHhKDzRGfiJIOKK muyFlrED9q5X7/aB6y2liDmYszLSOz9F7JhYgDQ= X-Received: by 2002:a9d:7984:: with SMTP id h4mr4357532otm.297.1581408913600; Tue, 11 Feb 2020 00:15:13 -0800 (PST) MIME-Version: 1.0 References: <20200129161955.30562-1-erosca@de.adit-jv.com> <20200210205735.GB1347752@kroah.com> In-Reply-To: <20200210205735.GB1347752@kroah.com> From: Geert Uytterhoeven Date: Tue, 11 Feb 2020 09:15:02 +0100 Message-ID: Subject: Re: [PATCH] serial: sh-sci: Support custom speed setting To: Greg Kroah-Hartman Cc: Eugeniu Rosca , "open list:SERIAL DRIVERS" , Linux-Renesas , Wolfram Sang , Yoshihiro Shimoda , Ulrich Hecht , "George G . Davis" , Andrew Gabbasov , Jiada Wang , Yuichi Kusakabe , Yasushi Asano , Linux Kernel Mailing List , Jiri Slaby , Fukui Yohhei , Torii Kenichi , Magnus Damm , "Michael Kerrisk (man-pages)" , linux-man@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, CC man On Mon, Feb 10, 2020 at 9:57 PM Greg Kroah-Hartman wrote: > On Thu, Jan 30, 2020 at 01:32:50PM +0100, Geert Uytterhoeven wrote: > > On Wed, Jan 29, 2020 at 5:20 PM Eugeniu Rosca wrote: > > > 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 > > > > Thanks for your patch! > > > > While this seems to work fine[*], I have a few comments/questions: > > 1. This feature seems to be deprecated: > > > > sh-sci e6e68000.serial: setserial sets custom speed on > > ttySC1. This is deprecated. > > > > 2. As the wanted speed is specified as a divider, the resulting speed > > may be off, cfr. the example for 57600 below. > > Note that the SCIF device has multiple clock inputs, and can do > > 57600 perfectly if the right crystal has been fitted. > > > > 3. What to do with "[PATCH/RFC] serial: sh-sci: Update uartclk based > > on selected clock" (https://patchwork.kernel.org/patch/11103703/)? > > Combined with this, things become pretty complicated and > > unpredictable, as uartclk now always reflect the frequency of the > > last used base clock, which was the optimal one for the previously > > used speed.... > > > > I think it would be easier if we just had an API to specify a raw speed. > > Perhaps that already exists? > > Yes, see: > http://www.panix.com/~grante/arbitrary-baud.c Thanks a lot!! This must be one of the most guarded secrets of serial port programming ;-) Implemented since 2006, commit edc6afc5496875a6 ("[PATCH] tty: switch to ktermios and new framework"), not documented in today's man-pages. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds