From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4F1082E5.8000501@domain.hid> Date: Fri, 13 Jan 2012 20:15:49 +0100 From: Manfred MIME-Version: 1.0 References: <4F1080E8.6020408@domain.hid> In-Reply-To: <4F1080E8.6020408@domain.hid> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Xenomai-help] Omap3630, rtserial, xeno_16550A: crash on insmod List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xenomai@xenomai.org (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.