Kernel low level debug broken on iMX6

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Kernel low level debug broken on iMX6

2,472 Views
emilmyhrman
Contributor IV

Hi everyone

we've just spent almost a week on this so I thought I'd let you know so you don't have to .

 

When enabling DEBUG_LL in kernel the virtual address used for UART is calculated wrong on iMX6, resulting in an prefetch abort during boot.

 

Don't know what is the correct way to send patches for freescale kernel so I've attached a patch for this.

 

 

regards,

Emil

Original Attachment has been moved to: imx6_io_address.patch.zip

Labels (2)
6 Replies

1,177 Views
israelpz
Senior Contributor I

Hi Emil,

I'm trying to test your patch but seem the definition MX6_IO_ADDRESS is not present in my kernel.

Could you tell me which kernel version are you using?

Thanks & Regards,

-Israel.

0 Kudos

1,177 Views
emilmyhrman
Contributor IV

Hi Israel,

the kernel version is based on your android release for JB/4.2.2 (I think it is jb4.2.2_1.0.0-ga).

regards,

Emil

0 Kudos

1,177 Views
YixingKong
Senior Contributor IV

Emil, please click Correct Answer/Helpful Answer, if your question had been answered.

Thanks,

Yixing

0 Kudos

1,177 Views
israelpz
Senior Contributor I

Hi Emil,

Sorry for the too late response. Checking the patch against freescale kernel 3.0.35 Which should be similar in this case to kernel 2.6.x i found the following:

1)When the uart drivers prints the IO address is not different when i enable the CONFIG_LL_DEBUG or when i disable it. It always the same.

CONFIG_LL_DEBUG =y

imx-uart.1: ttymxc1 at MMIO 0x21e8000 (irq = 59) is a IMX                      

imx-uart.2: ttymxc2 at MMIO 0x21ec000 (irq = 60) is a IMX                      

imx-uart.3: ttymxc3 at MMIO 0x21f0000 (irq = 61) is a IMX

#CONFIG_LL_DEBUG

imx-uart.1: ttymxc1 at MMIO 0x21e8000 (irq = 59) is a IMX                      

imx-uart.2: ttymxc2 at MMIO 0x21ec000 (irq = 60) is a IMX                      

imx-uart.3: ttymxc3 at MMIO 0x21f0000 (irq = 61) is a IMX 


2) With your patches when i disable LL_DEBUG compiles and the IO address printed is the same as before(with no patch apply).

PATCH && #CONFIG_LL_DEBUG

Serial: IMX driver                                                             

imx-uart.1: ttymxc1 at MMIO 0x21e8000 (irq = 59) is a IMX                      

imx-uart.2: ttymxc2 at MMIO 0x21ec000 (irq = 60) is a IMX                      

imx-uart.3: ttymxc3 at MMIO 0x21f0000 (irq = 61) is a IMX


3) With your patch and LL_DEBUG enable i got a compile error in a macro expansion.

arch/arm/kernel/debug.S: Assembler messages:

arch/arm/kernel/debug.S:157: Error: missing ')'

arch/arm/kernel/debug.S:157: Error: missing ')'

arch/arm/kernel/debug.S:157: Error: garbage following instruction -- `ldr r2,=((void __force __iomem*)((((0x02100000+0x80000)+0x70000))+0xF2000000))'

arch/arm/kernel/debug.S:173: Error: missing ')'

arch/arm/kernel/debug.S:173: Error: missing ')'

arch/arm/kernel/debug.S:173: Error: garbage following instruction -- `ldr r2,=((void __force __iomem*)((((0x02100000+0x80000)+0x70000))+0xF2000000))'

make[1]: *** [arch/arm/kernel/debug.o] Error 1

Regards,

-Israel.

0 Kudos

1,176 Views
emilmyhrman
Contributor IV

I just tried this and also get a compile error. Our original fix was done by editing debug.S directly, but before I sent the patch I thought it would be better to change in hardware.h instead, I probably didn't have CONFIG_LL_DEBUG enabled when testing if it compiled... sorry about that. :smileysad:

To have it compile, change in plat-mxc/include/mach/mx6.h the following

change:

#define MX6_IO_ADDRESS(x) (void __force __iomem *)((x) + PERIPBASE_VIRT)

to

#define MX6_IO_ADDRESS:smileyx: IOMEM((x) + PERIPBASE_VIRT)

and it should work.

Also, to clarify the problem:

in debug.S, without the fix, UART_VADDR will use IMX_IO_P2V to calculate the virtual address, but for i.mx6, MX6_IO_ADDRESS should be used.

#define UART_VADDRIMX_IO_ADDRESS(UART_PADDR)

the ttymxc1,2,3 will use the correct virtual address, it is only in debug.S that the problem is.

0 Kudos

1,177 Views
israelpz
Senior Contributor I

Hi Emil,

I already review your patch.

I going  to apply it to our repository and send it for review to R&D in order to get integrated or rejected.

Regards,

-Israel.

0 Kudos