All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manfred <manfred@domain.hid>
To: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Omap3630, rtserial, xeno_16550A: crash on insmod
Date: Fri, 13 Jan 2012 20:15:49 +0100	[thread overview]
Message-ID: <4F1082E5.8000501@domain.hid> (raw)
In-Reply-To: <4F1080E8.6020408@domain.hid>

(In reply to Wolfgangs Respond)

Thank you for the explanations.
So I managed to recompile the kernel module with a lot of "printk"

commands. And I could track the problem to the following:
it fails in:[1]
int __init rt_16550_init(void)

When calling these lines:
rt_16550_reg_out(mode, base, IER, 0);
DEBUGPRINT("after reg_out IER \n");
rt_16550_reg_in(mode, base, IIR);
DEBUGPRINT("after reg_in IIR \n");

So it seems to fail the first time when it tries to call:
rt_16550_reg_in(mode, base, IIR);
where
mode=1
rt_16550_reg_in is defined in:
16550A_io.h:161:
static RT_16550_IO_INLINE u8
rt_16550_reg_in(io_mode_t io_mode, unsigned long base, int off)
{
	switch (io_mode) {
	case MODE_PIO:
		return inb(base + off);
	default: /* MODE_MMIO */
		return readb((void *)base + off);
	}
}

--> where is MODE_PIO defined?: is it 1 or 0?
(could not find it in any .c or .h file)

So anyway, it either fails in inb(base+off)
or (more probably:) in read(void*)base+off

-->
Is this consistent with your assumption that we need a regshift?
If yes, which function calls need to be fixed?
-->
I tried to look in 8250.c [2]:
regshift seems to be mostly used when using map_8250_in_reg and
map_8250_out_reg:
offset = map_8250_in_reg(p, offset) << p->regshift;
offset = map_8250_in_reg(p, offset) << p->regshift;
but also elsewhere:
2498 static unsigned int serial8250_port_size(struct uart_8250_port *pt)
2499 {
2500         if (pt->port.iotype == UPIO_AU)
2501                 return 0x1000;
2502 #ifdef CONFIG_ARCH_OMAP
2503         if (is_omap_port(pt))
2504                 return 0x16 << pt->port.regshift;
2505 #endif
2506         return 8 << pt->port.regshift;
2507 }
or:
2600 static void serial8250_release_rsa_resource(struct uart_8250_port *up)
2601 {
2602         unsigned long offset = UART_RSA_BASE << up->port.regshift;
2603         unsigned int size = 8 << up->port.regshift;
2604
2605         switch (up->port.iotype) {
2606         case UPIO_HUB6:
2607         case UPIO_PORT:
2608                 release_region(up->port.iobase + offset, size);
2609                 break;
2610         }
2611 }

-->
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);
	}
}

Thanks for the help.
Please note, this is really my first try on kernel modules and drivers,
So sorry, in case I got it all wrong.

--Manfred


[1]:
http://git.xenomai.org/?p=xenomai-2.6.git;a=blob;f=
ksrc/drivers/serial/16550A.c;h=8c8c86438874f03e4df17e6a2a1c02b9788f57b0;
hb=8f6feff876029244dabc1257cdf13209fbd64fb5
[2]:
http://www.sakoman.com/cgi-bin/gitweb.cgi?p=linux-omap-2.6.git;
a=blob_plain;f=drivers/tty/serial/8250.c;
hb=a6679de82eaa9128566dd5eea291afeb615764ea

 > On 1/13/12 8:37 AM, Wolfgang Grandegger wrote:
 >
 > The regshift is not yet supported. Therefore you need to adapt the
 > 16550A driver, preferably by using a module parameter.
 >
 >> The details of the addresses in omap3630/dm37x can be found here:
 >> http://www.ti.com/litv/pdf/sprugn4n
 >> Chapter 19: UART
 >> page 2950: UART Register Addresses.
 >
 > I looked to the Linux source code:
 >
 > http://lxr.linux.no/#linux+v3.2.1/arch/arm/mach-omap2/serial.c
 >
 > Therein I found the regshift=2. Adding some printk's would tell you
 > quickly what you need to get the serial uart running.
 >
 > Wolfgang.





       reply	other threads:[~2012-01-13 19:15 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 ` Manfred [this message]
2012-01-15 19:35   ` [Xenomai-help] Omap3630, rtserial, xeno_16550A: crash on insmod Wolfgang Grandegger
2012-01-18 16:15     ` Fabrice Gasnier
2012-01-18 16:32       ` Wolfgang Grandegger
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=4F1082E5.8000501@domain.hid \
    --to=manfred@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.