Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753049Ab3FJL4f (ORCPT ); Mon, 10 Jun 2013 07:56:35 -0400 Received: from eu1sys200aog104.obsmtp.com ([207.126.144.117]:46858 "EHLO eu1sys200aog104.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751552Ab3FJL4d (ORCPT ); Mon, 10 Jun 2013 07:56:33 -0400 Message-ID: <51B5BE53.2000105@st.com> Date: Mon, 10 Jun 2013 12:53:55 +0100 From: Srinivas KANDAGATLA Reply-To: srinivas.kandagatla@st.com Organization: STMicroelectronics User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: Russell King - ARM Linux Cc: linux-arm-kernel@lists.infradead.org, Andrew Morton , Arnd Bergmann , "David S. Miller" , devicetree-discuss@lists.ozlabs.org, Grant Likely , Greg Kroah-Hartman , John Stultz , Linus Walleij , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Mark Brown , Mauro Carvalho Chehab , Olof Johansson , Rob Herring , Rob Landley , Samuel Ortiz , Stephen Gallimore , Stuart Menefy , Thomas Gleixner , Tony Prisk Subject: Re: [PATCH v2 01/11] serial:st-asc: Add ST ASC driver. References: <1370855828-5318-1-git-send-email-srinivas.kandagatla@st.com> <1370856060-6403-1-git-send-email-srinivas.kandagatla@st.com> <20130610093511.GT18614@n2100.arm.linux.org.uk> In-Reply-To: <20130610093511.GT18614@n2100.arm.linux.org.uk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3519 Lines: 110 Thankyou for your comment and suggestion, I will fix the POSIX compliant issue. On 10/06/13 10:35, Russell King - ARM Linux wrote: > On Mon, Jun 10, 2013 at 10:21:00AM +0100, Srinivas KANDAGATLA wrote: >> This patch adds support to ASC (asynchronous serial controller) >> driver, which is basically a standard serial driver. This IP is common >> across all the ST parts for settop box platforms. >> >> ASC is embedded in ST COMMS IP block. It supports Rx & Tx functionality. >> It support all industry standard baud rates. > > Your driver is not POSIX compliant. > >> + for (; count != 0; count--) { >> + c = asc_in(port, ASC_RXBUF); >> + flag = TTY_NORMAL; >> + port->icount.rx++; >> + >> + if (unlikely(c & ASC_RXBUF_FE)) { >> + if (c == ASC_RXBUF_FE) { >> + port->icount.brk++; >> + if (uart_handle_break(port)) >> + continue; >> + flag = TTY_BREAK; >> + } else { >> + port->icount.frame++; >> + flag = TTY_FRAME; >> + } >> + } else if (ascport->check_parity && >> + unlikely(c & ASC_RXBUF_PE)) { >> + port->icount.parity++; >> + flag = TTY_PARITY; >> + } >> + >> + if (uart_handle_sysrq_char(port, c)) >> + continue; >> + tty_insert_flip_char(tport, c & 0xff, flag); >> + } >> + if (overrun) { >> + port->icount.overrun++; >> + tty_insert_flip_char(tport, 0, TTY_OVERRUN); >> + } > > No support for ignoring error conditions. No support for ignoring all > input... and: > >> +static void asc_set_termios(struct uart_port *port, struct ktermios *termios, >> + struct ktermios *old) >> +{ >> + struct asc_port *ascport = to_asc_port(port); >> + unsigned int baud; >> + u32 ctrl_val; >> + tcflag_t cflag; >> + unsigned long flags; >> + >> + port->uartclk = clk_get_rate(ascport->clk); >> + >> + baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); >> + cflag = termios->c_cflag; >> + >> + spin_lock_irqsave(&port->lock, flags); >> + >> + /* read control register */ >> + ctrl_val = asc_in(port, ASC_CTL); >> + >> + /* stop serial port and reset value */ >> + asc_out(port, ASC_CTL, (ctrl_val & ~ASC_CTL_RUN)); >> + ctrl_val = ASC_CTL_RXENABLE | ASC_CTL_FIFOENABLE; >> + >> + /* reset fifo rx & tx */ >> + asc_out(port, ASC_TXRESET, 1); >> + asc_out(port, ASC_RXRESET, 1); >> + >> + /* set character length */ >> + if ((cflag & CSIZE) == CS7) { >> + ctrl_val |= ASC_CTL_MODE_7BIT_PAR; >> + } else { >> + ctrl_val |= (cflag & PARENB) ? ASC_CTL_MODE_8BIT_PAR : >> + ASC_CTL_MODE_8BIT; >> + } >> + >> + ascport->check_parity = (cflag & PARENB) ? 1 : 0; >> + >> + /* set stop bit */ >> + ctrl_val |= (cflag & CSTOPB) ? ASC_CTL_STOP_2BIT : ASC_CTL_STOP_1BIT; >> + >> + /* odd parity */ >> + if (cflag & PARODD) >> + ctrl_val |= ASC_CTL_PARITYODD; >> + >> + /* hardware flow control */ >> + if ((cflag & CRTSCTS) && ascport->hw_flow_control) >> + ctrl_val |= ASC_CTL_CTSENABLE; > > This doesn't reflect those facts back into the termios structure to > indicate that they aren't supported. > > Consider using uart_port's ignore and read status masks to implement > the break, framing, parity and overrun checking in your interrupt > handler using the same methodology as drivers like 8250, amba-pl011 > etc. That will help you get these code sequences correct. > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/