From: Peter Hung <hpeter@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linus.walleij@linaro.org, gnurou@gmail.com,
gregkh@linuxfoundation.org, paul.gortmaker@windriver.com,
lee.jones@linaro.org, jslaby@suse.com,
gnomes@lxorguk.ukuu.org.uk, peter_hong@fintek.com.tw
Cc: heikki.krogerus@linux.intel.com, peter@hurleysoftware.com,
soeren.grunewald@desy.de, udknight@gmail.com,
adam.lee@canonical.com, arnd@arndb.de, manabian@gmail.com,
scottwood@freescale.com, yamada.masahiro@socionext.com,
paul.burton@imgtec.com, mans@mansr.com, matthias.bgg@gmail.com,
ralf@linux-mips.org, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org,
tom_tsai@fintek.com.tw,
Peter Hung <hpeter+linux_kernel@gmail.com>
Subject: Re: [PATCH V3 3/4] 8250: 8250_f81504: Add Fintek F81504/508/512 PCIE-to-UART/GPIO UART support
Date: Wed, 17 Feb 2016 17:30:15 +0800 [thread overview]
Message-ID: <56C43DA7.9080400@gmail.com> (raw)
In-Reply-To: <1455613899.31169.149.camel@linux.intel.com>
Hi Andy,
Andy Shevchenko 於 2016/2/16 下午 05:11 寫道:
> On Tue, 2016-02-16 at 14:55 +0800, Peter Hung wrote:
>> +static u32 baudrate_table[] = { 1500000, 1152000, 921600 };
>> +static u8 clock_table[] = { F81504_CLKSEL_24_MHZ,
>> F81504_CLKSEL_18DOT46_MHZ,
>> + F81504_CLKSEL_14DOT77_MHZ };
>
> I suggest to replace DOT by _.
ok
>> +/* We should do proper H/W transceiver setting before change to
>> RS485 mode */
>> +static int f81504_rs485_config(struct uart_port *port,
>> + struct serial_rs485 *rs485)
>> +{
>> + u8 setting;
>> + u8 *index = (u8 *) port->private_data;
>
> private_data is a type of void *, therefore no need to have an explicit
> casting.
ok
>> +static int f81504_check_baudrate(u32 baud, size_t *idx)
>> +{
>> + size_t index;
>> + u32 quot, rem;
>> +
>> + for (index = 0; index < ARRAY_SIZE(baudrate_table); ++index)
>
> Post-increment is also okay.
>
>> {
>> + /* Clock source must largeer than desire baudrate */
>> + if (baud > baudrate_table[index])
>> + continue;
>> +
>> + quot = DIV_ROUND_CLOSEST(baudrate_table[index],
>> baud);
>
> So, how quot is used and is it possible to set, for example, baud rate
> as 1000000 or 576000?
The IC don't support B1000000 due to no 16MHz clock source.
The quot & rem is only use for compare, and it's must be not 0
when the code run to calculate DIV_ROUND_CLOSEST. So quot
is a redundancy here.
This function will find the suitable clock source for future use.
We'll pass suitable baud rate * 16 to port->uartclk for
serial8250_do_set_termios() to do advance divider operations.
I'll rewrite this section with remove quot and direct check
the "baudrate_table[index] % baud" divisible.
>> + u8 tmp, *offset = (u8 *) port->private_data;
>
> Same for provate_data as above.
ok
>> + /*
>> + * direct use 1.8432MHz when baudrate
>> smaller then or
>> + * equal 115200bps
>
> Check your style of comments in a _whole_ your series.
ok
>> + /*
>> + * If it can't found suitable clock source
>> but had old
>> + * accpetable baudrate, we'll use it
>
> Typo: acceptable.
> Baudrate -> baud rate.
ok
>> + port.port.private_data = data; /* save current idx */
>
> Not sure you need to allocate memory for that at all, or maybe use a
> struct with one member (for now).
>
We just pass the index of PCI configuration space currently. So
I just set a allocated u8 memory to private data. We'll maintain
current method.
>> +static SIMPLE_DEV_PM_OPS(f81504_serial_pm_ops,
>> f81504_serial_suspend,
>> + f81504_serial_resume);
>> +
>> +static struct platform_driver f81504_serial_driver = {
>> + .driver = {
>> + .name = F81504_SERIAL_NAME,
>> + .owner = THIS_MODULE,
>
> You perhaps don't need this. Check the rest of the modules.
ok
>> +config SERIAL_8250_F81504
>> + tristate "Fintek F81504/508/512 16550 PCIE device support"
>> if EXPERT
>> + depends on SERIAL_8250 && MFD_FINTEK_F81504_CORE
>> + default SERIAL_8250
>> + select RATIONAL
>
> It seems RATIONAL API is not used here.
>
This driver hadn't use RATIONAL API. I'll remove it.
Thanks for your advice.
--
With Best Regards,
Peter Hung
next prev parent reply other threads:[~2016-02-17 9:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 6:55 [PATCH V3 0/4] Transform Fintek PCIE driver from 8250 to MFD Peter Hung
2016-02-16 6:55 ` [PATCH V3 1/4] mfd: f81504-core: Add Fintek F81504/508/512 PCIE-to-UART/GPIO core support Peter Hung
2016-02-16 6:55 ` [PATCH V3 2/4] gpio: gpio-f81504: Add Fintek F81504/508/512 PCIE-to-UART/GPIO GPIOLIB support Peter Hung
2016-02-16 15:22 ` Linus Walleij
2016-02-17 10:13 ` Peter Hung
2016-02-16 6:55 ` [PATCH V3 3/4] 8250: 8250_f81504: Add Fintek F81504/508/512 PCIE-to-UART/GPIO UART support Peter Hung
2016-02-16 9:11 ` Andy Shevchenko
2016-02-17 9:30 ` Peter Hung [this message]
2016-02-16 6:55 ` [PATCH V3 4/4] serial: 8250_pci: Remove Fintek F81504/508/512 UART driver Peter Hung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56C43DA7.9080400@gmail.com \
--to=hpeter@gmail.com \
--cc=adam.lee@canonical.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gnurou@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=hpeter+linux_kernel@gmail.com \
--cc=jslaby@suse.com \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=manabian@gmail.com \
--cc=mans@mansr.com \
--cc=matthias.bgg@gmail.com \
--cc=paul.burton@imgtec.com \
--cc=paul.gortmaker@windriver.com \
--cc=peter@hurleysoftware.com \
--cc=peter_hong@fintek.com.tw \
--cc=ralf@linux-mips.org \
--cc=scottwood@freescale.com \
--cc=soeren.grunewald@desy.de \
--cc=tom_tsai@fintek.com.tw \
--cc=udknight@gmail.com \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome