All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Shijie <b32955@freescale.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: gregkh@linuxfoundation.org, shawn.guo@linaro.org,
	linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org
Subject: Re: [PATCH 2/3] serial: mxs: enable the DMA only when the rts/cts is enabled
Date: Mon, 15 Jul 2013 18:53:13 +0800	[thread overview]
Message-ID: <51E3D499.3060902@freescale.com> (raw)
In-Reply-To: <20130715090755.GN12139@pengutronix.de>

于 2013年07月15日 17:07, Uwe Kleine-König 写道:
> Hello,
>
> On Mon, Jul 15, 2013 at 04:41:25PM +0800, Huang Shijie wrote:
>> 于 2013年07月15日 16:27, Uwe Kleine-König 写道:
>>> do you want to say that the driver fails to only enable DMA when RTS/CTS
>>> are available; or that today the driver can handle DMA just fine even
>>> without RTS/CTS? I interpret your commit log as the latter, your patch
>>> implements the former however.
>> in the mxs-auart, if the RTS/CTS is not invalid, the DMA should be
>> not enabled.
>>
>> But current code lost the limit, a uart without the RTS/CTS may also
>> enables the DMA in which case the uart
>> may does not run or run in a abnormal way.
> So this sounds like a fix that should go into stable and so preferably
> should be the first patch in your series.
This patch depends on the first patch. :)
> Something like:
>
> 	serial: mxs-auart: DMA unreliable without RTS/CTS
>
> 	According to [add some document name here] DMA doesn't work
> 	reliable without hardware handshaking. So make DMA dependant on
> 	a newly introdused property "fsl,uart-has-rtscts".
>
> 	Cc: stable@kernel.org # [first affected version]
>
> The flag is only used to decide if dma should be enabled. So I think an
> in-code comment would be nice, too. Is it still correct to set
ok.
> AUART_CTRL2_RTSEN and AUART_CTRL2_RTS and read AUART_STAT_CTS when
> fsl,uart-has-rtscts is not provided?
i think it's correct. (if i have a imx28-evk board, i can test it.)

If you enable the RTS/CTS from the application, the 
tty_port_cts_enabled() will be true.
we will set the AUART_CTRL2_RTSEN in the end when the 
"fsl,uart-has-rtscts" is enabled.


> (BTW, mxs_auart_set_mctrl has:
>
> 	u32 ctrl = readl(u->membase + AUART_CTRL2);
>
> 	ctrl&= ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS);
>          if (mctrl&  TIOCM_RTS) {
>                  if (tty_port_cts_enabled(&u->state->port))
>                          ctrl |= AUART_CTRL2_RTSEN;
>                  else
>                          ctrl |= AUART_CTRL2_RTS;
>          }
>
> 	s->ctrl = mctrl;
>
> A comment for the diligent reader about the difference between RTSEN and
> RTS would be nice. Also I wonder if shadowing mctrl is sensible and used
Please see the spec about the RTSEN and RTS.

RTSEN enable the flow control by the hardware;
RTS enable the flow control by the software.

thanks
Huang Shijie
> correctly here.)
>
> Best regards
> Uwe
>



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

WARNING: multiple messages have this Message-ID (diff)
From: b32955@freescale.com (Huang Shijie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] serial: mxs: enable the DMA only when the rts/cts is enabled
Date: Mon, 15 Jul 2013 18:53:13 +0800	[thread overview]
Message-ID: <51E3D499.3060902@freescale.com> (raw)
In-Reply-To: <20130715090755.GN12139@pengutronix.de>

? 2013?07?15? 17:07, Uwe Kleine-K?nig ??:
> Hello,
>
> On Mon, Jul 15, 2013 at 04:41:25PM +0800, Huang Shijie wrote:
>> ? 2013?07?15? 16:27, Uwe Kleine-K?nig ??:
>>> do you want to say that the driver fails to only enable DMA when RTS/CTS
>>> are available; or that today the driver can handle DMA just fine even
>>> without RTS/CTS? I interpret your commit log as the latter, your patch
>>> implements the former however.
>> in the mxs-auart, if the RTS/CTS is not invalid, the DMA should be
>> not enabled.
>>
>> But current code lost the limit, a uart without the RTS/CTS may also
>> enables the DMA in which case the uart
>> may does not run or run in a abnormal way.
> So this sounds like a fix that should go into stable and so preferably
> should be the first patch in your series.
This patch depends on the first patch. :)
> Something like:
>
> 	serial: mxs-auart: DMA unreliable without RTS/CTS
>
> 	According to [add some document name here] DMA doesn't work
> 	reliable without hardware handshaking. So make DMA dependant on
> 	a newly introdused property "fsl,uart-has-rtscts".
>
> 	Cc: stable at kernel.org # [first affected version]
>
> The flag is only used to decide if dma should be enabled. So I think an
> in-code comment would be nice, too. Is it still correct to set
ok.
> AUART_CTRL2_RTSEN and AUART_CTRL2_RTS and read AUART_STAT_CTS when
> fsl,uart-has-rtscts is not provided?
i think it's correct. (if i have a imx28-evk board, i can test it.)

If you enable the RTS/CTS from the application, the 
tty_port_cts_enabled() will be true.
we will set the AUART_CTRL2_RTSEN in the end when the 
"fsl,uart-has-rtscts" is enabled.


> (BTW, mxs_auart_set_mctrl has:
>
> 	u32 ctrl = readl(u->membase + AUART_CTRL2);
>
> 	ctrl&= ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS);
>          if (mctrl&  TIOCM_RTS) {
>                  if (tty_port_cts_enabled(&u->state->port))
>                          ctrl |= AUART_CTRL2_RTSEN;
>                  else
>                          ctrl |= AUART_CTRL2_RTS;
>          }
>
> 	s->ctrl = mctrl;
>
> A comment for the diligent reader about the difference between RTSEN and
> RTS would be nice. Also I wonder if shadowing mctrl is sensible and used
Please see the spec about the RTSEN and RTS.

RTSEN enable the flow control by the hardware;
RTS enable the flow control by the software.

thanks
Huang Shijie
> correctly here.)
>
> Best regards
> Uwe
>

  reply	other threads:[~2013-07-15 10:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15  3:08 [PATCH 1/3] serial: mxs: remove the unused macro Huang Shijie
2013-07-15  3:08 ` Huang Shijie
2013-07-15  3:08 ` [PATCH 2/3] serial: mxs: enable the DMA only when the rts/cts is enabled Huang Shijie
2013-07-15  3:08   ` Huang Shijie
2013-07-15  8:27   ` Uwe Kleine-König
2013-07-15  8:27     ` Uwe Kleine-König
2013-07-15  8:41     ` Huang Shijie
2013-07-15  8:41       ` Huang Shijie
2013-07-15  9:07       ` Uwe Kleine-König
2013-07-15  9:07         ` Uwe Kleine-König
2013-07-15 10:53         ` Huang Shijie [this message]
2013-07-15 10:53           ` Huang Shijie
2013-07-16  7:33           ` Uwe Kleine-König
2013-07-16  7:33             ` Uwe Kleine-König
2013-07-16  8:11             ` Huang Shijie
2013-07-16  8:11               ` Huang Shijie
2013-07-15  3:08 ` [PATCH 3/3] ARM: dts: imx28-evk: add the rts/cts property for auart0 Huang Shijie
2013-07-15  3:08   ` Huang Shijie
2013-07-15  8:20 ` [PATCH 1/3] serial: mxs: remove the unused macro Uwe Kleine-König
2013-07-15  8:20   ` Uwe Kleine-König
2013-07-15  8:30   ` Huang Shijie
2013-07-15  8:30     ` Huang Shijie

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=51E3D499.3060902@freescale.com \
    --to=b32955@freescale.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=shawn.guo@linaro.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.