From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754465AbcJ0ReO (ORCPT ); Thu, 27 Oct 2016 13:34:14 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:25997 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752288AbcJ0ReN (ORCPT ); Thu, 27 Oct 2016 13:34:13 -0400 Message-ID: <58123A79.3080905@imgtec.com> Date: Thu, 27 Oct 2016 18:33:45 +0100 From: Ed Blake User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: Andy Shevchenko CC: , , , , , , , , Subject: Re: [PATCH 2/2] serial: 8250_dw: Add support for IrDA SIR mode References: <1477586286-15748-1-git-send-email-ed.blake@imgtec.com> <1477587370.5295.37.camel@linux.intel.com> In-Reply-To: <1477587370.5295.37.camel@linux.intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.167.87] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/27/16 17:56, Andy Shevchenko wrote: > On Thu, 2016-10-27 at 17:38 +0100, Ed Blake wrote: >> Add a set_ldisc function to enable/disable IrDA SIR mode according to >> the new line discipline. > Thanks for the patch. > > Consider that not all implementations based on 8250_dw support IRDA > feature. I suppose you need to read capability register bits 6 and 7, > set flag and then based on the value accept or reject IRDA mode. Thanks for the review, I'll add this for the second version. Ed. > > P.S. Use -n when prepare patches to link them if you consider them > dependent. > >> Signed-off-by: Ed Blake >> --- >> drivers/tty/serial/8250/8250_dw.c | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >> diff --git a/drivers/tty/serial/8250/8250_dw.c >> b/drivers/tty/serial/8250/8250_dw.c >> index 459d726..7dd5369 100644 >> --- a/drivers/tty/serial/8250/8250_dw.c >> +++ b/drivers/tty/serial/8250/8250_dw.c >> @@ -53,6 +53,8 @@ >> /* Helper for fifo size calculation */ >> #define DW_UART_CPR_FIFO_SIZE(a) (((a >> 16) & 0xff) * 16) >> >> +/* DesignWare specific register fields */ >> +#define DW_UART_MCR_SIRE BIT(6) >> >> struct dw8250_data { >> u8 usr_reg; >> @@ -254,6 +256,20 @@ static void dw8250_set_termios(struct uart_port >> *p, struct ktermios *termios, >> serial8250_do_set_termios(p, termios, old); >> } >> >> +static void dw8250_set_ldisc(struct uart_port *p, struct ktermios >> *termios) >> +{ >> + unsigned int mcr = p->serial_in(p, UART_MCR); >> + >> + if (termios->c_line == N_IRDA) >> + mcr |= DW_UART_MCR_SIRE; >> + else >> + mcr &= ~DW_UART_MCR_SIRE; >> + >> + p->serial_out(p, UART_MCR, mcr); >> + >> + serial8250_do_set_ldisc(p, termios); >> +} >> + >> /* >> * dw8250_fallback_dma_filter will prevent the UART from getting just >> any free >> * channel on platforms that have DMA engines, but don't have any >> channels >> @@ -392,6 +408,7 @@ static int dw8250_probe(struct platform_device >> *pdev) >> p->iotype = UPIO_MEM; >> p->serial_in = dw8250_serial_in; >> p->serial_out = dw8250_serial_out; >> + p->set_ldisc = dw8250_set_ldisc; >> >> p->membase = devm_ioremap(dev, regs->start, >> resource_size(regs)); >> if (!p->membase) From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ed Blake Subject: Re: [PATCH 2/2] serial: 8250_dw: Add support for IrDA SIR mode Date: Thu, 27 Oct 2016 18:33:45 +0100 Message-ID: <58123A79.3080905@imgtec.com> References: <1477586286-15748-1-git-send-email-ed.blake@imgtec.com> <1477587370.5295.37.camel@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1477587370.5295.37.camel@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org To: Andy Shevchenko Cc: gregkh@linuxfoundation.org, jslaby@suse.com, wangkefeng.wang@huawei.com, heikki.krogerus@linux.intel.com, noamc@ezchip.com, annie.wang@amd.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, james.hartley@imgtec.com List-Id: linux-serial@vger.kernel.org On 10/27/16 17:56, Andy Shevchenko wrote: > On Thu, 2016-10-27 at 17:38 +0100, Ed Blake wrote: >> Add a set_ldisc function to enable/disable IrDA SIR mode according to >> the new line discipline. > Thanks for the patch. > > Consider that not all implementations based on 8250_dw support IRDA > feature. I suppose you need to read capability register bits 6 and 7, > set flag and then based on the value accept or reject IRDA mode. Thanks for the review, I'll add this for the second version. Ed. > > P.S. Use -n when prepare patches to link them if you consider them > dependent. > >> Signed-off-by: Ed Blake >> --- >> drivers/tty/serial/8250/8250_dw.c | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >> diff --git a/drivers/tty/serial/8250/8250_dw.c >> b/drivers/tty/serial/8250/8250_dw.c >> index 459d726..7dd5369 100644 >> --- a/drivers/tty/serial/8250/8250_dw.c >> +++ b/drivers/tty/serial/8250/8250_dw.c >> @@ -53,6 +53,8 @@ >> /* Helper for fifo size calculation */ >> #define DW_UART_CPR_FIFO_SIZE(a) (((a >> 16) & 0xff) * 16) >> >> +/* DesignWare specific register fields */ >> +#define DW_UART_MCR_SIRE BIT(6) >> >> struct dw8250_data { >> u8 usr_reg; >> @@ -254,6 +256,20 @@ static void dw8250_set_termios(struct uart_port >> *p, struct ktermios *termios, >> serial8250_do_set_termios(p, termios, old); >> } >> >> +static void dw8250_set_ldisc(struct uart_port *p, struct ktermios >> *termios) >> +{ >> + unsigned int mcr = p->serial_in(p, UART_MCR); >> + >> + if (termios->c_line == N_IRDA) >> + mcr |= DW_UART_MCR_SIRE; >> + else >> + mcr &= ~DW_UART_MCR_SIRE; >> + >> + p->serial_out(p, UART_MCR, mcr); >> + >> + serial8250_do_set_ldisc(p, termios); >> +} >> + >> /* >> * dw8250_fallback_dma_filter will prevent the UART from getting just >> any free >> * channel on platforms that have DMA engines, but don't have any >> channels >> @@ -392,6 +408,7 @@ static int dw8250_probe(struct platform_device >> *pdev) >> p->iotype = UPIO_MEM; >> p->serial_in = dw8250_serial_in; >> p->serial_out = dw8250_serial_out; >> + p->set_ldisc = dw8250_set_ldisc; >> >> p->membase = devm_ioremap(dev, regs->start, >> resource_size(regs)); >> if (!p->membase)