All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: Fabrice Gasnier <fabrice.gasnier@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Omap3630, rtserial, xeno_16550A: crash on insmod
Date: Wed, 18 Jan 2012 17:32:01 +0100	[thread overview]
Message-ID: <4F16F401.2090308@domain.hid> (raw)
In-Reply-To: <4F16F028.6020507@domain.hid>

On 01/18/2012 05:15 PM, Fabrice Gasnier wrote:
> Dear all,
> 
> On 15/01/2012 20:35, Wolfgang Grandegger wrote:
>>> -->
>>>> So can I just change the function in 16550A.c like this?:
>>>> rt_16550_reg_in(io_mode_t io_mode, unsigned long base, int off, int
>>>> regshift)
>>>> {
>>>>      switch (io_mode) {
>>>>     case MODE_PIO:
>>>>         return inb(base + off);
>>>>     default: /* MODE_MMIO */
>>>>          /* ADD REGSHIFT for MMIO Mode: */
>>>>          unsigned long paddr=((void*)base+off)<< regshift;
>>>>          return readb((void *)base + off);
>> You need to shift just the *offset* at the beginning of the function:
>>
>> 	off <<= regshift;
>>
>> You also need to adjust the region for request_region() or ioremap().
>>
> 
> 
> I've done similar modifications and try to run it on an omap3530 (PHYCARD-L) board.
> I'm able to receive data correctly. But tx data gives a strange behavior.
> Writting a little example that basically do rt_dev_write(fd, data_string, data_len) reports no error but no data is being output.
> 
> Another example that basically echo received chars:
> while (1){
> 	rt_dev_read(fd, rx_buf, 1);
> 	rt_dev_write(fd, rx_buf, 1);
> 	printf("%c", rx_buf[0]);
> }
> This one displays data when received but transmit is more random.
> When a first character has been received, it is only transmitted back when a second one is received.
> But second char is transmitted back immediately, without waiting for a third one ...
> 
> Further investigation indicates that when writing, tx interrupt is not asserted as expected (rt_16550_write):
> /* unmask tx interrupt */
> ctx->ier_status |= IER_TX;
> rt_16550_reg_out(rt_16550_io_mode_from_ctx(ctx),
> 		 ctx->base_addr, IER,
> 		 ctx->ier_status,
> 		 ctx->regshift);
> 
>>From my understanding this should trigger an irq for data to be put in rt_16550_tx_interrupt().
> It seems this is not always the case. Moreover, TX interrupt seem to be triggered by a new RX interrupt.

The TX interrupt will be enabled as long as there are chars to send,
IIRC. The isr the puts the chars into the FIFO and triggers the xfer.

> 
> Would you have an explanation for such a behavior?
> I'm not sure how to solve this.

Depending on the hardware/uart revision, you may need to take care of
other quirks, see:

http://lxr.linux.no/#linux+v3.2.1/arch/arm/mach-omap2/serial.c#L742

Wolfgang.


  reply	other threads:[~2012-01-18 16:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4F1080E8.6020408@domain.hid>
2012-01-13 19:15 ` [Xenomai-help] Omap3630, rtserial, xeno_16550A: crash on insmod Manfred
2012-01-15 19:35   ` Wolfgang Grandegger
2012-01-18 16:15     ` Fabrice Gasnier
2012-01-18 16:32       ` Wolfgang Grandegger [this message]
2012-01-19 17:09         ` Fabrice Gasnier
2012-01-20 12:03           ` Manfred
2012-01-20 14:41             ` Fabrice Gasnier
2012-01-20 15:58               ` Felipe Brandão Cavalcanti
2012-01-22 19:04               ` Manfred
2012-02-23 19:00                 ` Felipe Brandão Cavalcanti
2012-01-20 18:03           ` Wolfgang Grandegger
2012-01-20 18:46             ` Gilles Chanteperdrix
2012-01-20 19:04               ` Wolfgang Grandegger
2012-01-26 10:20                 ` Fabrice Gasnier
2012-01-19 19:43     ` Manfred
2012-01-12 17:53 Manfred
2012-01-12 18:44 ` Gilles Chanteperdrix
2012-01-12 19:36   ` Manfred
2012-01-12 19:53     ` Gilles Chanteperdrix
2012-01-12 18:52 ` Wolfgang Grandegger

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=4F16F401.2090308@domain.hid \
    --to=wg@domain.hid \
    --cc=fabrice.gasnier@domain.hid \
    --cc=xenomai@xenomai.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 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.