From: Alan Cox <alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
To: Feng Tang <feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: David Brownell
<dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>,
linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
spi-devel-list
<spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Subject: Re: [RFC][PATCH] serial: spi: add spi-uart driver for Maxim 3110
Date: Tue, 29 Dec 2009 15:02:13 +0000 [thread overview]
Message-ID: <20091229150213.3c50b7b3@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <20091229222006.1ddb28a4@feng-desktop>
> As a RFC, the driver doesn't have a valid UART port type yet, but borrow
> PORT_PXA. I would apply one if there is no main objection for it.
Please just add a new uart type for it.
> +config MAX3110_DESIGNWARE
> + boolean "Enable Max3110 to work with Designware controller"
> + default y
> + depends on SERIAL_MAX3110
> +
> +config MAX3110_IRQ
> + boolean "Enable IRQ for Max3110"
> + default n
> + depends on SERIAL_MAX3110
> +
These should be runtime
> +int max3110_write_then_read(struct uart_max3110 *max,
> + const u8 *txbuf, u8 *rxbuf, unsigned len, int always_fast)
> +{
> + struct spi_device *spi = max->spi;
> + struct spi_message message;
> + struct spi_transfer x;
> + int ret;
> +
> + if (!txbuf || !rxbuf)
> + return -EINVAL;
How can the above occur - it seems no user triggered event can cause it
and almost all the paths then lose the error before userspace gets it
(and silently).
> + if (len > MAX_READ_LEN) {
> + pr_err(PR_FMT "read len %d is too large\n", len);
> + return 0;
> + }
Ditto
> + while (len) {
> + usable = tty_buffer_request_room(tty, len);
> + if (usable) {
> + tty_insert_flip_string(tty, str, usable);
> + str += usable;
> + port->icount.rx += usable;
> + tty_flip_buffer_push(tty);
You really only want to push once. tty_insert_flip_string also knows
about multiple blocks so all of this can be a single
tty_insert_flip_string(tty, str, len);
tty_flip_buffer_push(tty);
>
> +static void
> +serial_m3110_set_termios(struct uart_port *port, struct ktermios *termios,
> + struct ktermios *old)
> +{
> + struct uart_max3110 *max =
> + container_of(port, struct uart_max3110, port);
> + unsigned char cval;
> + unsigned int baud, parity = 0;
> + int clk_div = -1;
> + u16 new_conf = max->cur_conf;
> +
> + switch (termios->c_cflag & CSIZE) {
> + case CS7:
> + cval = UART_LCR_WLEN7;
> + new_conf |= WC_7BIT_WORD;
> + break;
> + default:
> + case CS8:
> + cval = UART_LCR_WLEN8;
> + new_conf |= WC_8BIT_WORD;
If you can only do CS8 when asked for other values you need to update the
termios struct to report that
termios->c_cflag &= ~CSIZE;
termios->c_flag |= CS8;
> + if (!(termios->c_cflag & PARODD))
> + parity |= UART_LCR_EPAR;
> + max->parity = parity;
> +
> + uart_update_timeout(port, termios->c_cflag, baud);
> +
> + new_conf |= WC_TAG;
> + if (new_conf != max->cur_conf) {
> + max3110_out(max, new_conf);
> + max->cur_conf = new_conf;
> + max->baud = baud;
> + }
And as you don't support it
termios->c_cflag &= ~CMSPAR;
I'll take a more serious look over it in the new year when I'm back at
work.
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
next prev parent reply other threads:[~2009-12-29 15:02 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20091229222006.1ddb28a4@feng-desktop>
2009-12-29 14:59 ` [spi-devel-general] [RFC][PATCH] serial: spi: add spi-uart driver for Maxim 3110 Baruch Siach
2009-12-29 16:05 ` Tang, Feng
2009-12-29 18:43 ` Erwin Authried
2009-12-30 1:54 ` Feng Tang
2010-02-25 4:47 ` David Brownell
2010-02-25 7:49 ` Feng Tang
2009-12-29 15:02 ` Alan Cox [this message]
2010-02-08 8:59 ` [RFC][PATCH v2] " Feng Tang
[not found] ` <20100208165946.0e4dde83@feng-i7>
2010-02-09 0:20 ` Andrew Morton
2010-02-09 0:26 ` Grant Likely
2010-02-09 1:36 ` Feng Tang
2010-02-17 22:58 ` Greg KH
2010-02-24 5:11 ` [RFC][PATCH v3] " Feng Tang
2010-02-24 10:44 ` Alan Cox
2010-02-24 14:25 ` Grant Likely
2010-02-24 23:18 ` Andrew Morton
2010-02-25 6:39 ` Feng Tang
2010-02-25 4:43 ` David Brownell
2010-02-25 7:44 ` Feng Tang
2010-02-25 8:11 ` David Brownell
2010-02-26 3:47 ` [PATCH v4] " Feng Tang
[not found] ` <20100226114729.679bb933@feng-i7>
2010-02-26 9:59 ` Masakazu Mokuno
2010-02-26 19:41 ` David Brownell
2010-03-01 2:30 ` Feng Tang
2010-03-02 3:38 ` Feng Tang
2010-02-09 9:25 ` [RFC][PATCH v2] " Alan Cox
2010-03-03 2:57 ` [PATCH v5] " Feng Tang
2010-03-03 3:59 ` Grant Likely
2010-03-03 4:51 ` David Brownell
2010-03-03 5:52 ` Feng Tang
2010-03-03 6:16 ` David Brownell
2010-03-03 6:37 ` Feng Tang
2010-03-03 7:25 ` David Brownell
2010-03-03 7:42 ` Feng Tang
2009-12-29 14:20 [RFC][PATCH] " Feng Tang
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=20091229150213.3c50b7b3@lxorguk.ukuu.org.uk \
--to=alan-qbu/x9rampvanceybjwyrvxrex20p6io@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=gregkh-l3A5Bk7waGM@public.gmane.org \
--cc=linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).