Thread (12 messages) 12 messages, 6 authors, 2021-07-15

Re: [PATCH] serial: sh-sci: Support custom speed setting

From: <hidden>
Date: 2021-07-15 21:16:20
Also in: linux-renesas-soc, lkml

Mon, Mar 30, 2020 at 07:43:09AM +0000, ashiduka@fujitsu.com kirjoitti:
Dear Greg, Geert,
quoted
Right.
Adding "#include <sys/ioctl.h>" to Greg's sample code causes a
compilation error.
<snip>
quoted
Is it normal to declare ioctl() without "#include <sys/ioctl.h>" ?
I would be happy if you could give me some comments.
quoted
http://www.panix.com/~grante/arbitrary-baud.c
We think this sample code is no good.
Should I work on glibc changes instead of kernel fixes?
Side note: I hope introducing spd_cust hack hadn't made upstream.

To the point. Use BOTHER as in code excerpt. Yes, there is a problematic parts
with the headers regarding to this feature. But you may look how others solve
it.

https://github.com/npat-efault/picocom/blob/master/termios2.txt
quoted
Subject: RE: [PATCH] serial: sh-sci: Support custom speed setting

Dear Greg, Geert,
quoted
I guess you mean the forward declaration of ioctrl()?
No, they should include <sys/ioctl.h> instead.
Right.
Adding "#include <sys/ioctl.h>" to Greg's sample code causes a
compilation error.
quoted
quoted
I saw the code above, I thought I wouldn't write such code
normally.
quoted
Why not?
Is it normal to declare ioctl() without "#include <sys/ioctl.h>" ?

Thanks & Best Regards,
Yuusuke Ashiduka [off-list ref]
Embedded System Development Dept. Embedded System Development Div.
FUJITSU COMPUTER TECHNOLOGIES Ltd.
quoted
-----Original Message-----
From: Geert Uytterhoeven <geert@linux-m68k.org>
Sent: Thursday, March 12, 2020 6:03 PM
To: Torii, Kenichi/鳥居 健一 <redacted>
Cc: gregkh@linuxfoundation.org; erosca@de.adit-jv.com;
linux-serial@vger.kernel.org;
linux-renesas-soc@vger.kernel.org;
quoted
wsa+renesas@sang-engineering.com;
yoshihiro.shimoda.uh@renesas.com; uli+renesas@fpond.eu;
george_davis@mentor.com; andrew_gabbasov@mentor.com;
jiada_wang@mentor.com; yuichi.kusakabe@denso-ten.com;
yasano@jp.adit-jv.com; linux-kernel@vger.kernel.org;
jslaby@suse.com; yohhei.fukui@denso-ten.com; Ashizuka, Yuusuke/
芦塚 雄介 [off-list ref]; magnus.damm@gmail.com
Subject: Re: [PATCH] serial: sh-sci: Support custom speed setting

Hi Torii-san,

On Thu, Mar 12, 2020 at 6:10 AM torii.ken1@fujitsu.com
[off-list ref] wrote:
quoted
On Tue, 11 Feb 2020 05:57:35 +0900,
Greg Kroah-Hartman wrote:
quoted
On Thu, Jan 30, 2020 at 01:32:50PM +0100, Geert Uytterhoeven
wrote:
quoted
quoted
quoted
On Wed, Jan 29, 2020 at 5:20 PM Eugeniu Rosca
[off-list ref] wrote:
quoted
quoted
quoted
quoted
From: Torii Kenichi <redacted>

This patch is necessary to use BT module and XM module
with
quoted
DENSO TEN
quoted
quoted
quoted
quoted
development board.

This patch supports ASYNC_SPD_CUST flag by
ioctl(TIOCSSERIAL),
quoted
enables
quoted
quoted
quoted
quoted
custom speed setting with setserial(1).

The custom speed is calculated from uartclk and
custom_divisor.
quoted
quoted
quoted
quoted
If custom_divisor is zero, custom speed setting is invalid.

Signed-off-by: Torii Kenichi <redacted>
[erosca: rebase against v5.5]
Signed-off-by: Eugeniu Rosca <redacted>
Thanks for your patch!

While this seems to work fine[*], I have a few
comments/questions:
quoted
quoted
quoted
  1. This feature seems to be deprecated:

         sh-sci e6e68000.serial: setserial sets custom speed
on
quoted
quoted
quoted
ttySC1. This is deprecated.

  2. As the wanted speed is specified as a divider, the
resulting
quoted
speed
quoted
quoted
quoted
     may be off, cfr. the example for 57600 below.
     Note that the SCIF device has multiple clock inputs,
and
quoted
can do
quoted
quoted
quoted
     57600 perfectly if the right crystal has been fitted.

 3. What to do with "[PATCH/RFC] serial: sh-sci: Update
uartclk
quoted
based
quoted
quoted
quoted
     on selected clock"
(https://patchwork.kernel.org/patch/11103703/)?
quoted
quoted
quoted
     Combined with this, things become pretty complicated
and
quoted
quoted
quoted
quoted
     unpredictable, as uartclk now always reflect the
frequency
quoted
of the
quoted
quoted
quoted
     last used base clock, which was the optimal one for the
previously
quoted
quoted
quoted
     used speed....

I think it would be easier if we just had an API to specify
a raw speed.
quoted
quoted
quoted
Perhaps that already exists?
Yes, see:
      http://www.panix.com/~grante/arbitrary-baud.c
I saw the code above, I thought I wouldn't write such code
normally.
quoted
quoted
quoted
#include <linux/termios.h>

int ioctl(int d, int request, ...);
Do application programmers have to accept this bad code?
I guess you mean the forward declaration of ioctrl()?
No, they should include <sys/ioctl.h> instead.

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
quoted
hacker. But
when I'm talking to journalists I just say "programmer" or
something
quoted
like that.
                                -- Linus Torvalds
-- 
With Best Regards,
Andy Shevchenko

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help