[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAKKbWA7FkFosy4aUyYXvOW8tYxsoPPYj6Z-=2A9i5o6zkkRupw@mail.gmail.com>
Date: Thu, 15 Feb 2018 12:15:26 +0200
From: Avi Fishman <avifishman70@...il.com>
To: Joel Stanley <joel@....id.au>,
Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
linux-serial@...r.kernel.org,
devicetree <devicetree@...r.kernel.org>,
AP MS30 Linux Kernel community
<linux-kernel@...r.kernel.org>, Jeremy Kerr <jk@...abs.org>,
Tomer Maimon <tmaimon77@...il.com>
Subject: Re: [PATCH] serial: 8250: Add Nuvoton NPCM UART
> From: joel.stan@...il.com [mailto:joel.stan@...il.com] On Behalf Of Joel Stanley
> Sent: Thursday, February 15, 2018 4:00 AM
>
> On Wed, Feb 14, 2018 at 3:22 AM, Andy Shevchenko <andy.shevchenko@...il.com> wrote:
>> On Mon, Feb 12, 2018 at 6:48 AM, Joel Stanley <joel@....id.au> wrote:
>>> The Nuvoton UART is almost compatible with the 8250 driver when
>>> probed via the 8250_of driver, however it requires some extra
>>> configuration at startup.
>>
>>
>>> + [PORT_NPCM] = {
>>> + .name = "Nuvoton 16550",
>>> + .fifo_size = 16,
>>> + .tx_loadsz = 16,
>>> + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10 |
>>> + UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
>>> + .rxtrig_bytes = {1, 4, 8, 14},
>>> + .flags = UART_CAP_FIFO,
>>
>>> +
>>
>> Redundant.
>
> You are referring to the extra whitespace?
>
>>> + },
>>
>>> + /*
>>> + * Nuvoton calls the scratch register 'UART_TOR' (timeout
>>> + * register). Enable it, and set TIOC (timeout interrupt
>>> + * comparator) to be 0x20 for correct operation.
>>> + */
>>> + serial_port_out(port, UART_NPCM_TOR, UART_NPCM_TOIE |
>>> + 0x20);
>>
>>> +/* Nuvoton NPCM UARTs have a custom divisor calculation */
>>> + return DIV_ROUND_CLOSEST(port->uartclk, 16 * baud + 2) - 2;
>>
>> Is there any link to datasheet?
>
> I have a copy of the datasheet under NDA. The Nuvoton guys might be able to help you out. Avi?
In the spec the calculation is as follows:
BaudOut = Selected UART Clock Source / ( 16 * [Divisor + 2] )
To translate it to our code is:
baud = port->uartclk / (16 * (Divisor + 2) )
So it should calculate without the "+ 2" inside as follow:
+ return DIV_ROUND_CLOSEST(port->uartclk, 16 * baud) - 2;
In order to get the spec you can add somthing like that:
"For getting the NPCM7XX Data Sheet please contact bmc_marketing@...oton.com".
BTW Andy, Intel has our Data Sheet under NDA, you can ask Mihm James
<james.mihm@...el.com>.
>
>>
>>> +/* Nuvoton UART */
>>> +#define PORT_NPCM 118
>>
>> We have gaps there. #40 is perfect place for this one.
>
> Ok, I will move it up. Thanks for the review.
>
> Cheers,
>
> Joel
>
Powered by blists - more mailing lists