All of lore.kernel.org
 help / color / mirror / Atom feed
From: Long Cheng <long.cheng@mediatek.com>
To: Nicolas Boichat <drinkcat@chromium.org>
Cc: Vinod Koul <vkoul@kernel.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	"Ryder Lee" <ryder.lee@mediatek.com>,
	Sean Wang <sean.wang@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>, Sean Wang <sean.wang@mediatek.com>,
	<dmaengine@vger.kernel.org>, <devicetree@vger.kernel.org>,
	"linux-arm Mailing List" <linux-arm-kernel@lists.infradead.org>,
	"moderated list:ARM/Mediatek SoC support" 
	<linux-mediatek@lists.infradead.org>,
	lkml <linux-kernel@vger.kernel.org>,
	<linux-serial@vger.kernel.org>,
	srv_heupstream <srv_heupstream@mediatek.com>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	YT Shen <yt.shen@mediatek.com>,
	Zhenbao Liu <zhenbao.liu@mediatek.com>
Subject: Re: [PATCH 4/4] serial: 8250-mtk: modify uart DMA rx
Date: Fri, 17 May 2019 15:36:42 +0800	[thread overview]
Message-ID: <1558078602.14150.27.camel@mhfsdcap03> (raw)
In-Reply-To: <CANMq1KDTyu48joV6uMksGBMz9EmjFH9SEpGAm93YCZ40jxgBpQ@mail.gmail.com>

On Wed, 2019-05-15 at 21:48 +0800, Nicolas Boichat wrote:
> On Sat, Apr 27, 2019 at 11:36 AM Long Cheng <long.cheng@mediatek.com> wrote:
> >
> > Modify uart rx and complete for DMA.
> 
> I don't know much about the DMA framework, but can you please explain
> why you are making the changes in this CL? I see that you are dropping
> dma_sync_single_for_device calls, for example, why?
> 

the rx buffer is create by 'dma_alloc_coherent'. in the function, the
buffer is uncache. We don't need to sync between CPU and DMA. So I
remove it.

> >
> > Signed-off-by: Long Cheng <long.cheng@mediatek.com>
> > ---
> >  drivers/tty/serial/8250/8250_mtk.c |   53 ++++++++++++++++--------------------
> >  1 file changed, 23 insertions(+), 30 deletions(-)
> >
> > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> > index c1fdbc0..04081a6 100644
> > --- a/drivers/tty/serial/8250/8250_mtk.c
> > +++ b/drivers/tty/serial/8250/8250_mtk.c
> > @@ -30,7 +30,6 @@
> >  #define MTK_UART_DMA_EN_TX     0x2
> >  #define MTK_UART_DMA_EN_RX     0x5
> >
> > -#define MTK_UART_TX_SIZE       UART_XMIT_SIZE
> >  #define MTK_UART_RX_SIZE       0x8000
> >  #define MTK_UART_TX_TRIGGER    1
> >  #define MTK_UART_RX_TRIGGER    MTK_UART_RX_SIZE
> > @@ -64,28 +63,30 @@ static void mtk8250_dma_rx_complete(void *param)
> >         struct mtk8250_data *data = up->port.private_data;
> >         struct tty_port *tty_port = &up->port.state->port;
> >         struct dma_tx_state state;
> > +       int copied, cnt, tmp;
> >         unsigned char *ptr;
> > -       int copied;
> >
> > -       dma_sync_single_for_cpu(dma->rxchan->device->dev, dma->rx_addr,
> > -                               dma->rx_size, DMA_FROM_DEVICE);
> > +       if (data->rx_status == DMA_RX_SHUTDOWN)
> > +               return;
> >
> >         dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
> > +       cnt = dma->rx_size - state.residue;
> > +       tmp = cnt;
> 
> I ponder, maybe we should rename cnt to left? (like, how many bytes
> are left to transfer, in total) Or maybe "total"
> Then maybe rename tmp to cnt.
> 
like better.

> >
> > -       if (data->rx_status == DMA_RX_SHUTDOWN)
> > -               return;
> > +       if ((data->rx_pos + cnt) > dma->rx_size)
> > +               tmp = dma->rx_size - data->rx_pos;
> 
> Maybe replace this and the line above:
> tmp = max_t(int, cnt, dma->rx_size - data->rx_pos);
> 
Yes. It's better.

> >
> > -       if ((data->rx_pos + state.residue) <= dma->rx_size) {
> > -               ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > -               copied = tty_insert_flip_string(tty_port, ptr, state.residue);
> > -       } else {
> > -               ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > -               copied = tty_insert_flip_string(tty_port, ptr,
> > -                                               dma->rx_size - data->rx_pos);
> > +       ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > +       copied = tty_insert_flip_string(tty_port, ptr, tmp);
> > +       data->rx_pos += tmp;
> > +
> > +       if (cnt > tmp) {
> >                 ptr = (unsigned char *)(dma->rx_buf);
> > -               copied += tty_insert_flip_string(tty_port, ptr,
> > -                               data->rx_pos + state.residue - dma->rx_size);
> > +               tmp = cnt - tmp;
> > +               copied += tty_insert_flip_string(tty_port, ptr, tmp);
> > +               data->rx_pos = tmp;
> >         }
> > +
> >         up->port.icount.rx += copied;
> >
> >         tty_flip_buffer_push(tty_port);
> > @@ -96,9 +97,7 @@ static void mtk8250_dma_rx_complete(void *param)
> >  static void mtk8250_rx_dma(struct uart_8250_port *up)
> >  {
> >         struct uart_8250_dma *dma = up->dma;
> > -       struct mtk8250_data *data = up->port.private_data;
> >         struct dma_async_tx_descriptor  *desc;
> > -       struct dma_tx_state      state;
> >
> >         desc = dmaengine_prep_slave_single(dma->rxchan, dma->rx_addr,
> >                                            dma->rx_size, DMA_DEV_TO_MEM,
> > @@ -113,12 +112,6 @@ static void mtk8250_rx_dma(struct uart_8250_port *up)
> >
> >         dma->rx_cookie = dmaengine_submit(desc);
> >
> > -       dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
> > -       data->rx_pos = state.residue;
> > -
> > -       dma_sync_single_for_device(dma->rxchan->device->dev, dma->rx_addr,
> > -                                  dma->rx_size, DMA_FROM_DEVICE);
> > -
> >         dma_async_issue_pending(dma->rxchan);
> >  }
> >
> > @@ -131,13 +124,13 @@ static void mtk8250_dma_enable(struct uart_8250_port *up)
> >         if (data->rx_status != DMA_RX_START)
> >                 return;
> >
> > -       dma->rxconf.direction           = DMA_DEV_TO_MEM;
> > -       dma->rxconf.src_addr_width      = dma->rx_size / 1024;
> > -       dma->rxconf.src_addr            = dma->rx_addr;
> > +       dma->rxconf.direction                           = DMA_DEV_TO_MEM;
> > +       dma->rxconf.src_port_window_size        = dma->rx_size;
> > +       dma->rxconf.src_addr                            = dma->rx_addr;
> >
> > -       dma->txconf.direction           = DMA_MEM_TO_DEV;
> > -       dma->txconf.dst_addr_width      = MTK_UART_TX_SIZE / 1024;
> > -       dma->txconf.dst_addr            = dma->tx_addr;
> > +       dma->txconf.direction                           = DMA_MEM_TO_DEV;
> > +       dma->txconf.dst_port_window_size        = UART_XMIT_SIZE;
> > +       dma->txconf.dst_addr                            = dma->tx_addr;
> >
> >         serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
> >                 UART_FCR_CLEAR_XMIT);
> > @@ -217,7 +210,7 @@ static void mtk8250_shutdown(struct uart_port *port)
> >          * Mediatek UARTs use an extra highspeed register (UART_MTK_HIGHS)
> >          *
> >          * We need to recalcualte the quot register, as the claculation depends
> > -        * on the vaule in the highspeed register.
> > +        * on the value in the highspeed register.
> 
> Since you're doing some cosmetic changes here, you might as well fix
> recalcualte => recalculate and claculation => calculation on the line
> above.
> 

I see.

> But technically, this should belong in another patch...
> 
> >          *
> >          * Some baudrates are not supported by the chip, so we use the next
> >          * lower rate supported and update termios c_flag.
> > --
> > 1.7.9.5
> >



WARNING: multiple messages have this Message-ID (diff)
From: Long Cheng <long.cheng@mediatek.com>
To: Nicolas Boichat <drinkcat@chromium.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	devicetree@vger.kernel.org, Ryder Lee <ryder.lee@mediatek.com>,
	Zhenbao Liu <zhenbao.liu@mediatek.com>,
	linux-serial@vger.kernel.org,
	srv_heupstream <srv_heupstream@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Sean Wang <sean.wang@kernel.org>, YT Shen <yt.shen@mediatek.com>,
	dmaengine@vger.kernel.org, Vinod Koul <vkoul@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	Sean Wang <sean.wang@mediatek.com>, Jiri Slaby <jslaby@suse.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	Dan Williams <dan.j.williams@intel.com>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 4/4] serial: 8250-mtk: modify uart DMA rx
Date: Fri, 17 May 2019 15:36:42 +0800	[thread overview]
Message-ID: <1558078602.14150.27.camel@mhfsdcap03> (raw)
In-Reply-To: <CANMq1KDTyu48joV6uMksGBMz9EmjFH9SEpGAm93YCZ40jxgBpQ@mail.gmail.com>

On Wed, 2019-05-15 at 21:48 +0800, Nicolas Boichat wrote:
> On Sat, Apr 27, 2019 at 11:36 AM Long Cheng <long.cheng@mediatek.com> wrote:
> >
> > Modify uart rx and complete for DMA.
> 
> I don't know much about the DMA framework, but can you please explain
> why you are making the changes in this CL? I see that you are dropping
> dma_sync_single_for_device calls, for example, why?
> 

the rx buffer is create by 'dma_alloc_coherent'. in the function, the
buffer is uncache. We don't need to sync between CPU and DMA. So I
remove it.

> >
> > Signed-off-by: Long Cheng <long.cheng@mediatek.com>
> > ---
> >  drivers/tty/serial/8250/8250_mtk.c |   53 ++++++++++++++++--------------------
> >  1 file changed, 23 insertions(+), 30 deletions(-)
> >
> > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> > index c1fdbc0..04081a6 100644
> > --- a/drivers/tty/serial/8250/8250_mtk.c
> > +++ b/drivers/tty/serial/8250/8250_mtk.c
> > @@ -30,7 +30,6 @@
> >  #define MTK_UART_DMA_EN_TX     0x2
> >  #define MTK_UART_DMA_EN_RX     0x5
> >
> > -#define MTK_UART_TX_SIZE       UART_XMIT_SIZE
> >  #define MTK_UART_RX_SIZE       0x8000
> >  #define MTK_UART_TX_TRIGGER    1
> >  #define MTK_UART_RX_TRIGGER    MTK_UART_RX_SIZE
> > @@ -64,28 +63,30 @@ static void mtk8250_dma_rx_complete(void *param)
> >         struct mtk8250_data *data = up->port.private_data;
> >         struct tty_port *tty_port = &up->port.state->port;
> >         struct dma_tx_state state;
> > +       int copied, cnt, tmp;
> >         unsigned char *ptr;
> > -       int copied;
> >
> > -       dma_sync_single_for_cpu(dma->rxchan->device->dev, dma->rx_addr,
> > -                               dma->rx_size, DMA_FROM_DEVICE);
> > +       if (data->rx_status == DMA_RX_SHUTDOWN)
> > +               return;
> >
> >         dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
> > +       cnt = dma->rx_size - state.residue;
> > +       tmp = cnt;
> 
> I ponder, maybe we should rename cnt to left? (like, how many bytes
> are left to transfer, in total) Or maybe "total"
> Then maybe rename tmp to cnt.
> 
like better.

> >
> > -       if (data->rx_status == DMA_RX_SHUTDOWN)
> > -               return;
> > +       if ((data->rx_pos + cnt) > dma->rx_size)
> > +               tmp = dma->rx_size - data->rx_pos;
> 
> Maybe replace this and the line above:
> tmp = max_t(int, cnt, dma->rx_size - data->rx_pos);
> 
Yes. It's better.

> >
> > -       if ((data->rx_pos + state.residue) <= dma->rx_size) {
> > -               ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > -               copied = tty_insert_flip_string(tty_port, ptr, state.residue);
> > -       } else {
> > -               ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > -               copied = tty_insert_flip_string(tty_port, ptr,
> > -                                               dma->rx_size - data->rx_pos);
> > +       ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > +       copied = tty_insert_flip_string(tty_port, ptr, tmp);
> > +       data->rx_pos += tmp;
> > +
> > +       if (cnt > tmp) {
> >                 ptr = (unsigned char *)(dma->rx_buf);
> > -               copied += tty_insert_flip_string(tty_port, ptr,
> > -                               data->rx_pos + state.residue - dma->rx_size);
> > +               tmp = cnt - tmp;
> > +               copied += tty_insert_flip_string(tty_port, ptr, tmp);
> > +               data->rx_pos = tmp;
> >         }
> > +
> >         up->port.icount.rx += copied;
> >
> >         tty_flip_buffer_push(tty_port);
> > @@ -96,9 +97,7 @@ static void mtk8250_dma_rx_complete(void *param)
> >  static void mtk8250_rx_dma(struct uart_8250_port *up)
> >  {
> >         struct uart_8250_dma *dma = up->dma;
> > -       struct mtk8250_data *data = up->port.private_data;
> >         struct dma_async_tx_descriptor  *desc;
> > -       struct dma_tx_state      state;
> >
> >         desc = dmaengine_prep_slave_single(dma->rxchan, dma->rx_addr,
> >                                            dma->rx_size, DMA_DEV_TO_MEM,
> > @@ -113,12 +112,6 @@ static void mtk8250_rx_dma(struct uart_8250_port *up)
> >
> >         dma->rx_cookie = dmaengine_submit(desc);
> >
> > -       dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
> > -       data->rx_pos = state.residue;
> > -
> > -       dma_sync_single_for_device(dma->rxchan->device->dev, dma->rx_addr,
> > -                                  dma->rx_size, DMA_FROM_DEVICE);
> > -
> >         dma_async_issue_pending(dma->rxchan);
> >  }
> >
> > @@ -131,13 +124,13 @@ static void mtk8250_dma_enable(struct uart_8250_port *up)
> >         if (data->rx_status != DMA_RX_START)
> >                 return;
> >
> > -       dma->rxconf.direction           = DMA_DEV_TO_MEM;
> > -       dma->rxconf.src_addr_width      = dma->rx_size / 1024;
> > -       dma->rxconf.src_addr            = dma->rx_addr;
> > +       dma->rxconf.direction                           = DMA_DEV_TO_MEM;
> > +       dma->rxconf.src_port_window_size        = dma->rx_size;
> > +       dma->rxconf.src_addr                            = dma->rx_addr;
> >
> > -       dma->txconf.direction           = DMA_MEM_TO_DEV;
> > -       dma->txconf.dst_addr_width      = MTK_UART_TX_SIZE / 1024;
> > -       dma->txconf.dst_addr            = dma->tx_addr;
> > +       dma->txconf.direction                           = DMA_MEM_TO_DEV;
> > +       dma->txconf.dst_port_window_size        = UART_XMIT_SIZE;
> > +       dma->txconf.dst_addr                            = dma->tx_addr;
> >
> >         serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
> >                 UART_FCR_CLEAR_XMIT);
> > @@ -217,7 +210,7 @@ static void mtk8250_shutdown(struct uart_port *port)
> >          * Mediatek UARTs use an extra highspeed register (UART_MTK_HIGHS)
> >          *
> >          * We need to recalcualte the quot register, as the claculation depends
> > -        * on the vaule in the highspeed register.
> > +        * on the value in the highspeed register.
> 
> Since you're doing some cosmetic changes here, you might as well fix
> recalcualte => recalculate and claculation => calculation on the line
> above.
> 

I see.

> But technically, this should belong in another patch...
> 
> >          *
> >          * Some baudrates are not supported by the chip, so we use the next
> >          * lower rate supported and update termios c_flag.
> > --
> > 1.7.9.5
> >

WARNING: multiple messages have this Message-ID (diff)
From: Long Cheng <long.cheng@mediatek.com>
To: Nicolas Boichat <drinkcat@chromium.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	devicetree@vger.kernel.org, Ryder Lee <ryder.lee@mediatek.com>,
	Zhenbao Liu <zhenbao.liu@mediatek.com>,
	linux-serial@vger.kernel.org,
	srv_heupstream <srv_heupstream@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Sean Wang <sean.wang@kernel.org>, YT Shen <yt.shen@mediatek.com>,
	dmaengine@vger.kernel.org, Vinod Koul <vkoul@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	Sean Wang <sean.wang@mediatek.com>, Jiri Slaby <jslaby@suse.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	Dan Williams <dan.j.williams@intel.com>,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 4/4] serial: 8250-mtk: modify uart DMA rx
Date: Fri, 17 May 2019 15:36:42 +0800	[thread overview]
Message-ID: <1558078602.14150.27.camel@mhfsdcap03> (raw)
In-Reply-To: <CANMq1KDTyu48joV6uMksGBMz9EmjFH9SEpGAm93YCZ40jxgBpQ@mail.gmail.com>

On Wed, 2019-05-15 at 21:48 +0800, Nicolas Boichat wrote:
> On Sat, Apr 27, 2019 at 11:36 AM Long Cheng <long.cheng@mediatek.com> wrote:
> >
> > Modify uart rx and complete for DMA.
> 
> I don't know much about the DMA framework, but can you please explain
> why you are making the changes in this CL? I see that you are dropping
> dma_sync_single_for_device calls, for example, why?
> 

the rx buffer is create by 'dma_alloc_coherent'. in the function, the
buffer is uncache. We don't need to sync between CPU and DMA. So I
remove it.

> >
> > Signed-off-by: Long Cheng <long.cheng@mediatek.com>
> > ---
> >  drivers/tty/serial/8250/8250_mtk.c |   53 ++++++++++++++++--------------------
> >  1 file changed, 23 insertions(+), 30 deletions(-)
> >
> > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> > index c1fdbc0..04081a6 100644
> > --- a/drivers/tty/serial/8250/8250_mtk.c
> > +++ b/drivers/tty/serial/8250/8250_mtk.c
> > @@ -30,7 +30,6 @@
> >  #define MTK_UART_DMA_EN_TX     0x2
> >  #define MTK_UART_DMA_EN_RX     0x5
> >
> > -#define MTK_UART_TX_SIZE       UART_XMIT_SIZE
> >  #define MTK_UART_RX_SIZE       0x8000
> >  #define MTK_UART_TX_TRIGGER    1
> >  #define MTK_UART_RX_TRIGGER    MTK_UART_RX_SIZE
> > @@ -64,28 +63,30 @@ static void mtk8250_dma_rx_complete(void *param)
> >         struct mtk8250_data *data = up->port.private_data;
> >         struct tty_port *tty_port = &up->port.state->port;
> >         struct dma_tx_state state;
> > +       int copied, cnt, tmp;
> >         unsigned char *ptr;
> > -       int copied;
> >
> > -       dma_sync_single_for_cpu(dma->rxchan->device->dev, dma->rx_addr,
> > -                               dma->rx_size, DMA_FROM_DEVICE);
> > +       if (data->rx_status == DMA_RX_SHUTDOWN)
> > +               return;
> >
> >         dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
> > +       cnt = dma->rx_size - state.residue;
> > +       tmp = cnt;
> 
> I ponder, maybe we should rename cnt to left? (like, how many bytes
> are left to transfer, in total) Or maybe "total"
> Then maybe rename tmp to cnt.
> 
like better.

> >
> > -       if (data->rx_status == DMA_RX_SHUTDOWN)
> > -               return;
> > +       if ((data->rx_pos + cnt) > dma->rx_size)
> > +               tmp = dma->rx_size - data->rx_pos;
> 
> Maybe replace this and the line above:
> tmp = max_t(int, cnt, dma->rx_size - data->rx_pos);
> 
Yes. It's better.

> >
> > -       if ((data->rx_pos + state.residue) <= dma->rx_size) {
> > -               ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > -               copied = tty_insert_flip_string(tty_port, ptr, state.residue);
> > -       } else {
> > -               ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > -               copied = tty_insert_flip_string(tty_port, ptr,
> > -                                               dma->rx_size - data->rx_pos);
> > +       ptr = (unsigned char *)(data->rx_pos + dma->rx_buf);
> > +       copied = tty_insert_flip_string(tty_port, ptr, tmp);
> > +       data->rx_pos += tmp;
> > +
> > +       if (cnt > tmp) {
> >                 ptr = (unsigned char *)(dma->rx_buf);
> > -               copied += tty_insert_flip_string(tty_port, ptr,
> > -                               data->rx_pos + state.residue - dma->rx_size);
> > +               tmp = cnt - tmp;
> > +               copied += tty_insert_flip_string(tty_port, ptr, tmp);
> > +               data->rx_pos = tmp;
> >         }
> > +
> >         up->port.icount.rx += copied;
> >
> >         tty_flip_buffer_push(tty_port);
> > @@ -96,9 +97,7 @@ static void mtk8250_dma_rx_complete(void *param)
> >  static void mtk8250_rx_dma(struct uart_8250_port *up)
> >  {
> >         struct uart_8250_dma *dma = up->dma;
> > -       struct mtk8250_data *data = up->port.private_data;
> >         struct dma_async_tx_descriptor  *desc;
> > -       struct dma_tx_state      state;
> >
> >         desc = dmaengine_prep_slave_single(dma->rxchan, dma->rx_addr,
> >                                            dma->rx_size, DMA_DEV_TO_MEM,
> > @@ -113,12 +112,6 @@ static void mtk8250_rx_dma(struct uart_8250_port *up)
> >
> >         dma->rx_cookie = dmaengine_submit(desc);
> >
> > -       dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
> > -       data->rx_pos = state.residue;
> > -
> > -       dma_sync_single_for_device(dma->rxchan->device->dev, dma->rx_addr,
> > -                                  dma->rx_size, DMA_FROM_DEVICE);
> > -
> >         dma_async_issue_pending(dma->rxchan);
> >  }
> >
> > @@ -131,13 +124,13 @@ static void mtk8250_dma_enable(struct uart_8250_port *up)
> >         if (data->rx_status != DMA_RX_START)
> >                 return;
> >
> > -       dma->rxconf.direction           = DMA_DEV_TO_MEM;
> > -       dma->rxconf.src_addr_width      = dma->rx_size / 1024;
> > -       dma->rxconf.src_addr            = dma->rx_addr;
> > +       dma->rxconf.direction                           = DMA_DEV_TO_MEM;
> > +       dma->rxconf.src_port_window_size        = dma->rx_size;
> > +       dma->rxconf.src_addr                            = dma->rx_addr;
> >
> > -       dma->txconf.direction           = DMA_MEM_TO_DEV;
> > -       dma->txconf.dst_addr_width      = MTK_UART_TX_SIZE / 1024;
> > -       dma->txconf.dst_addr            = dma->tx_addr;
> > +       dma->txconf.direction                           = DMA_MEM_TO_DEV;
> > +       dma->txconf.dst_port_window_size        = UART_XMIT_SIZE;
> > +       dma->txconf.dst_addr                            = dma->tx_addr;
> >
> >         serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
> >                 UART_FCR_CLEAR_XMIT);
> > @@ -217,7 +210,7 @@ static void mtk8250_shutdown(struct uart_port *port)
> >          * Mediatek UARTs use an extra highspeed register (UART_MTK_HIGHS)
> >          *
> >          * We need to recalcualte the quot register, as the claculation depends
> > -        * on the vaule in the highspeed register.
> > +        * on the value in the highspeed register.
> 
> Since you're doing some cosmetic changes here, you might as well fix
> recalcualte => recalculate and claculation => calculation on the line
> above.
> 

I see.

> But technically, this should belong in another patch...
> 
> >          *
> >          * Some baudrates are not supported by the chip, so we use the next
> >          * lower rate supported and update termios c_flag.
> > --
> > 1.7.9.5
> >



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-05-17  7:42 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-27  3:36 [PATCH v12 0/4] add uart DMA function Long Cheng
2019-04-27  3:36 ` Long Cheng
2019-04-27  3:36 ` Long Cheng
2019-04-27  3:36 ` [1/4] dmaengine: mediatek: Add MediaTek UART APDMA support Long Cheng
2019-04-27  3:36   ` [PATCH 1/4] " Long Cheng
2019-04-27  3:36   ` Long Cheng
2019-04-27  3:36   ` Long Cheng
2019-05-21 14:00   ` Vinod Koul
2019-05-21 14:00     ` Vinod Koul
2019-04-27  3:36 ` [2/4] arm: dts: mt2712: add uart APDMA to device tree Long Cheng
2019-04-27  3:36   ` [PATCH 2/4] " Long Cheng
2019-04-27  3:36   ` Long Cheng
2019-04-27  3:36   ` Long Cheng
2020-05-21 15:35   ` Matthias Brugger
2020-05-21 15:35     ` Matthias Brugger
2020-05-21 15:35     ` Matthias Brugger
2019-04-27  3:36 ` [3/4] dt-bindings: dma: uart: rename binding Long Cheng
2019-04-27  3:36   ` [PATCH 3/4] " Long Cheng
2019-04-27  3:36   ` Long Cheng
2019-04-27  3:36   ` Long Cheng
2019-05-21 14:01   ` Vinod Koul
2019-05-21 14:01     ` Vinod Koul
2019-04-27  3:36 ` [4/4] serial: 8250-mtk: modify uart DMA rx Long Cheng
2019-04-27  3:36   ` [PATCH 4/4] " Long Cheng
2019-04-27  3:36   ` Long Cheng
2019-04-27  3:36   ` Long Cheng
2019-05-15 13:48   ` Nicolas Boichat
2019-05-15 13:48     ` Nicolas Boichat
2019-05-15 13:48     ` Nicolas Boichat
2019-05-17  7:36     ` Long Cheng [this message]
2019-05-17  7:36       ` Long Cheng
2019-05-17  7:36       ` Long Cheng
2019-05-22  5:24       ` Long Cheng
2019-05-22  5:24         ` Long Cheng
2019-05-22  5:24         ` Long Cheng
2019-05-21 13:57   ` Vinod Koul
2019-05-21 13:57     ` Vinod Koul
2019-04-29 12:48 [3/4] dt-bindings: dma: uart: rename binding Rob Herring
2019-04-29 12:48 ` [PATCH 3/4] " Rob Herring
2019-04-29 12:48 ` Rob Herring
2019-04-29 12:48 ` Rob Herring

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=1558078602.14150.27.camel@mhfsdcap03 \
    --to=long.cheng@mediatek.com \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=drinkcat@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=rdunlap@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@kernel.org \
    --cc=sean.wang@mediatek.com \
    --cc=srv_heupstream@mediatek.com \
    --cc=vkoul@kernel.org \
    --cc=yingjoe.chen@mediatek.com \
    --cc=yt.shen@mediatek.com \
    --cc=zhenbao.liu@mediatek.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.