Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1702459ybl; Thu, 30 Jan 2020 04:35:47 -0800 (PST) X-Google-Smtp-Source: APXvYqyoHb/e0yzhdzCW9Wq6Uhxm+acRH0hWf45RL8gyLvfd3yxjCk85629NiGhm5O9Bi7rTifR3 X-Received: by 2002:a05:6808:30d:: with SMTP id i13mr2602126oie.144.1580387746965; Thu, 30 Jan 2020 04:35:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580387746; cv=none; d=google.com; s=arc-20160816; b=GuhMQQC6uRU/b4AM1YAuneERmU0yN/ABDKpAmDTiieSu8emX84IDUiFyNVSNSxbY0F eY9bGPo9BLwX2pFzstdrGRLseVZXHcLic8kkYpDhUxmWwo/Did3APBszvX6SxmU9jmH1 p/eP8Tu/chpAyvhh7Oi1KVaKa22CcAGq5uPWV+SKfu9At1vc6A0q3cDQIVuixtADb3Wn j/CArRFHNxW1LfQgOZ1HsRbIfFfSaLBAsk1nl1M6dyNOKnAZitXje2f4bDq8gZotgPWc YPrxTEUXn/Zh/fidpYq1bMVBT4Wl5IiKCcdFy3KnDDBfQFxP1fbFQlMZtvImo1KNQJn5 XNdg== 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=SF4A8MXH4i+NehAjiTIe/wipSti1DDnySBzIoKhtngY=; b=SulfxqM2mkiwgu33pw7mt7BtSWVvUIT6NXO8dBvTlbquQ4hNMLb4ejOACxlzIIRg8O t9IwXKTp11xLlORBpgBihBNUDj1Hzx3zgLZEdH5EX4J0/dxFSztRt8rTiTReKkzTkTm3 siBcvlj+KXjq2x1Gdx4jXDM+89BGi0z3wTnWuRxy5wrjyMvc3fD0ZVHFdBpHOtxHDlvG toIh0iXQEJNFtwAQlGe/GacQIWg9IREeLAIlKEJzgfGxJM1k8DgiBiJuBabp57yneC1s 2UtgqNZ5GuwlA+VfyOZMMoDw+mJ8g/K5dX0epCNX9kcpFJOJ6qgVdAHOQtiHCHn5K+7J Fahw== 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 w11si2828415oic.62.2020.01.30.04.35.34; Thu, 30 Jan 2020 04:35:46 -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 S1727185AbgA3MdC (ORCPT + 99 others); Thu, 30 Jan 2020 07:33:02 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:35510 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726873AbgA3MdC (ORCPT ); Thu, 30 Jan 2020 07:33:02 -0500 Received: by mail-ot1-f66.google.com with SMTP id r16so2967386otd.2; Thu, 30 Jan 2020 04:33:01 -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=SF4A8MXH4i+NehAjiTIe/wipSti1DDnySBzIoKhtngY=; b=eSq6OFsX4FUlr2UyT62wcGR/P57xE6a1RWZKmFOUveUDcc2MF6HDoUuqNOKoI/hX/Q 5mG9gOuUPYXSq10Qquk70XLbbshE489kwzMlFyZ/fEMlG1cIKE/CzjcSdydLnhPi93pY oUiTEq0UNwlUVxyKVDVRblmdhGAbQT9xy25izoBxIHzbm7hJYMOJqM4Ost6sGI3KcV1G gqRgmUqoqjbDSgGI83nRBNWfLmi5uX1BpcJiQ2PgVmRuTAvi1Z/KTVwzYLhEphYxUJOT cLxQusUClWa9kQ1e5q+NZnJLeiH2oO8cubqo3dFJKVzHmCwvo5wPP6cUAVeldR5XuTgr Rfrg== X-Gm-Message-State: APjAAAVpvdwBCH8pCGTItPOSbZJJAPxLOQZpQw64tf297s9Ibff0pkIj TIpPhBLdXTu5Th82Y6AOkaWnFsLRXCSkwzbjVkc= X-Received: by 2002:a9d:7984:: with SMTP id h4mr3438190otm.297.1580387581450; Thu, 30 Jan 2020 04:33:01 -0800 (PST) MIME-Version: 1.0 References: <20200129161955.30562-1-erosca@de.adit-jv.com> In-Reply-To: <20200129161955.30562-1-erosca@de.adit-jv.com> From: Geert Uytterhoeven Date: Thu, 30 Jan 2020 13:32:50 +0100 Message-ID: Subject: Re: [PATCH] serial: sh-sci: Support custom speed setting To: Eugeniu Rosca Cc: "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 , Greg Kroah-Hartman , Jiri Slaby , Fukui Yohhei , Torii Kenichi , Magnus Damm 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 Eugeniu, 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? BTW, what's the speed you need for your BT/XM modules? [*] stty speed 38400 < /dev/ttySC1 followed by setserial /dev/ttySC1 spd_cust divisor 1128 gives 57624 bps on Koelsch. 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