Adjust UART clock dynamically to requested baud rate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,
Hi Greg,


Recently I did an update to Fintek's 8250 driver, allowing it to support baud rates up to 921600. The chip supports 4 clock rates. I changed it's interal base clock to 14.746 MHz. (See https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git/commit/?h=tty-next&id=fab8a02b73eb2a42c589f943c377143f04b2bb73)

I want to support rates like B500000 too. Would be easy to set the clock to full 24MHz, but then there's no proper 16x-divisor for B460800 (divisor 3 would give 499200 instead of 460800 - not close enough). The table below ist from a Fintek datasheet (http://pdf1.alldatasheet.com/datasheet-pdf/view/459084/FINTEK/F81866A.html). It gives a quick overview which baud rates are possible with different clock speeds.

I thought about writing a custom set_termios that decides which clock matches best for the requested baud rate and changes it dynamically.

1) is there anything like that already in kernel source code?
2) good idea in general to do this in set_termios?
3) do i need to convert fintek.c to a standalone driver? I have no idea how to proper override set_termios otherwise...
4) make that dynamic-baud-thing more generic so other ttys can use it too?

Happy to hear your thoughts!

Thanks in advance,
Lukas


--------------------------------------------------------------------------------

                   BAUD RATES BY CLOCK / DIVISOR

Base clock:        23.961661341853 MHz
                                                        16x divisor
Pre-Divider     13      1.625      1.300          1
Clock        1.843     14.746     18.431     23.961

                50        399        499        649        2308
                75        599        749        974        1538
               110        879      1,098      1,428        1049
               135      1,078      1,347      1,752         855
               150      1,198      1,498      1,947         769
               299      2,394      2,992      3,890         385
               600      4,800      6,000      7,800         192
             1,200      9,600     12,000     15,600          96
             1,800     14,400     18,000     23,400          64
             1,986     15,890     19,862     25,821          58
             2,400     19,200     23,999     31,200          48
             3,600     28,800     35,999     46,800          32
             4,800     38,400     47,999     62,400          24
             7,200     57,600     71,998     93,600          16
             9,600     76,800     95,997    124,800          12
            19,200    153,600    191,995    249,601           6
            38,400    307,201    383,990    499,201           3
            57,600    460,801    575,985    748,802           2
           115,200    921,602  1,151,969  1,497,604           1
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux