Problems with mainline (4.2.0) kernel on custom iMX28 board

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

Problems with mainline (4.2.0) kernel on custom iMX28 board

Jump to solution
2,291 Views
paulbrown
Contributor I

Hi All,

Very new to all this, but please bare with me, also, I apologise if the group I have posted into is not correct, couldn't decide if it was an iMX problem or kernel!!!!

I have a custom board, based very loosely on the imx28evk. It is currently running the Freescale 3.2.0 kernel (from http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/)) which works fine (with the very latest u-boot). Basically, when I try to run the 4.2.0 (mainline) kernel I get the usual thing "Uncompressing Linux... done, booting the kernel." and then nothing. I have tried the recommendations from this site:

http://stackoverflow.com/questions/24302830/how-to-debug-using-printf-an-assembly-code-of-linux-kern...

I found that it gets to the point where it switches on the MMU and then hangs. I have confirmed this by using a JTAG debugger (I was hoping to have done a lot more with it, but I struggle to get on with OpenOCD and gdb), I read the registers after the hang and the PC is at 0xfffffffe, which I believe is a hard fault.

Problem is in arch/arm/kernel/head.S

ENTRY(__turn_mmu_on)

    mov    r0, r0

-------> ok until this point

    instr_sync

    mcr    p15, 0, r0, c1, c0, 0        @ write control reg

    mrc    p15, 0, r3, c0, c0, 0        @ read id reg

    instr_sync

--------> never gets to here, unless mcr instruction is removed

    mov    r3, r3

    mov    r3, r13

    ret    r3

__turn_mmu_on_end:

ENDPROC(__turn_mmu_on)

I have checked the register contents on both working and non-working kernels and both appear to be the same, although I'm not sure how to check c0 or c1! the mov instructions I use to printhex8 the normal registers don't work.

I'm not an ARM expert and find the assembler that it uses quite difficult to follow and haven't got time to learn the MMU inside and out.

Just wondered if anyone had any ideas on what to try next.

Many thanks

Paul

Labels (2)
0 Kudos
Reply
1 Solution
1,927 Views
fabio_estevam
NXP Employee
NXP Employee

FSL 3.2 kernel? I guess you meant FSL 2.6.35 kernel, right?

Mainline kernel uses device tree, so you need to make sure to build and load imx28-evk.dtb (or the equivalent to your board).

Take a look at arch/arm/boot/dts/imx28-evk.dts in the kernel source and make the necessary changes as per your hardware.

Then you need to build the dtb:

make imx28-evk.dtb

And build the kernel:

make

Then U-boot will load dtb and zImage to RAM and lauch the kernel (there are scripts that do this in include/configs/mx28evk.h in the U-boot source).

Regards,

Fabio Estevam

View solution in original post

0 Kudos
Reply
12 Replies
1,928 Views
paulbrown
Contributor I

That seems to have done the trick, although I still don't have output on the serial port, but that's probably just a device tree problem! I also found that you need to use the 'nand read' command, rather than 'nboot' in u-boot to load the kernel, otherwise it fails with 'bad zImage'.

Many thanks

0 Kudos
Reply
1,928 Views
fabio_estevam
NXP Employee
NXP Employee

Yes, in include/configs/mx28evk.h we have:

"nandboot="   /* Boot from NAND */ \

    "mtdparts default; " \

    "run nandargs; " \

    "nand read ${loadaddr} kernel 0x00400000; " \

    "if test ${boot_fdt} = yes; then " \

   "nand read ${fdt_addr} fdt 0x00080000; " \
   "bootz ${loadaddr} - ${fdt_addr}; " \

,where loadaddr is 0x42000000 and fdt_addr is 0x41000000.

Also, regarding the lack of serial console issue you reported, please check if you are passing console=ttyAMA0 and not ttyAM0 (which was used by the old FSL 2.6.35 kernel).

0 Kudos
Reply
1,928 Views
paulbrown
Contributor I

Hi Fabio,

I already have ttyAMA0, with the correct baud rate. What I have noticed though is that in the mx28.dtsi there isn't a configuration that suits my board for the duart.

From the file imx28.dtsi we have:

duart_pins_a: duart@0 {

                    reg = <0>;

                    fsl,pinmux-ids = <

                        MX28_PAD_PWM0__DUART_RX

                        MX28_PAD_PWM1__DUART_TX

                    >;

                    fsl,drive-strength = <MXS_DRIVE_4mA>;

                    fsl,voltage = <MXS_VOLTAGE_HIGH>;

                    fsl,pull-up = <MXS_PULL_DISABLE>;

                };

duart_pins_b: duart@1 {

                    reg = <1>;

                    fsl,pinmux-ids = <

                        MX28_PAD_AUART0_CTS__DUART_RX

                        MX28_PAD_AUART0_RTS__DUART_TX

                    >;

                    fsl,drive-strength = <MXS_DRIVE_4mA>;

                    fsl,voltage = <MXS_VOLTAGE_HIGH>;

                    fsl,pull-up = <MXS_PULL_DISABLE>;

                };

But my board uses:

MX28_PAD_I2C0_SCL__DUART_RX

MX28_PAD_I2C0_SDA__DUART_TX

How do I override the defaults, without modifying imx28.dtsi?

Many thanks

Paul

0 Kudos
Reply
1,928 Views
fabio_estevam
NXP Employee
NXP Employee

Just add "duart_pins_c: duart@2" entry to imx28.dtsi and then reference it from your dts file.

Regards,

Fabio Estevam

0 Kudos
Reply
1,928 Views
paulbrown
Contributor I

What I did (but haven't checked whether it works yet, but it compiles ok) is add the following to my dts file:

in the section "pinctrl@80018000m", I added:

duart_pins_kiwi: duart-evk@0 {

                    reg = <0>;

                    fsl,pinmux-ids = <

                        MX28_PAD_I2C0_SCL__DUART_RX

                        MX28_PAD_I2C0_SDA__DUART_TX

                    >;

                    fsl,drive-strength = <MXS_DRIVE_4mA>;

                    fsl,voltage = <MXS_VOLTAGE_HIGH>;

                    fsl,pull-up = <MXS_PULL_DISABLE>;

                };

and

duart: serial@80074000 {

                pinctrl-names = "default";

                pinctrl-0 = <&duart_pins_kiwi>;

                status = "okay";

            };

This way, if in future the imx28.dtsi file changes, my changes won't get overwritten.

Cheers

Paul

0 Kudos
Reply
1,928 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Paul,

This approach should work as well.

If you want you can even submit your dts + duart_pins_c entry to imx28.dtsi so that they can be reviewed and applied in the mainline kernel.

Then you don't need to worry about future changes on imx28.dtsi file and can get your hardware supported by default.

Regards,

Fabio Estevam

0 Kudos
Reply
1,928 Views
paulbrown
Contributor I

Hadn't thought of that!

Many thanks for all your help.

Best regards,

Paul

0 Kudos
Reply
1,928 Views
OtavioSalvador
Senior Contributor II

If you want, Paul, we can assist in upstreaming the custom board for the Linux mainline.

0 Kudos
Reply
1,928 Views
fabio_estevam
NXP Employee
NXP Employee

FSL 3.2 kernel? I guess you meant FSL 2.6.35 kernel, right?

Mainline kernel uses device tree, so you need to make sure to build and load imx28-evk.dtb (or the equivalent to your board).

Take a look at arch/arm/boot/dts/imx28-evk.dts in the kernel source and make the necessary changes as per your hardware.

Then you need to build the dtb:

make imx28-evk.dtb

And build the kernel:

make

Then U-boot will load dtb and zImage to RAM and lauch the kernel (there are scripts that do this in include/configs/mx28evk.h in the U-boot source).

Regards,

Fabio Estevam

0 Kudos
Reply
1,928 Views
paulbrown
Contributor I

Thanks for your quick response.

u-boot is very latest:

result of 'git show':

commit 1a9c229bf754c89f42b085451ad506693f326427

Merge: d0f3021 f697c2a

Author: Tom Rini <trini@konsulko.com>

Date:   Thu Sep 24 12:28:10 2015 -0400

    Merge branch 'master' of git://www.denx.de/git/u-boot-imx

I get confused by Freescale's numbering system, all I know is that I downloaded the working kernel from the address in the first post and when I run

'make kernelversion' I get 3.2.0 returned!?!?!?!

I have already created a dts file, from which i have generated a dtb file. This is loaded by u-boot from a partition of nand flash and placed into ram at address 0x47000000 (128MB ram installed). The kernel gets loaded to 0x46000000, the reason for the high addresses, is that I thought the kernel decompression might be running into the dtb location. The load seems to go fine and the address of the dtb file is passed to the kernel correctly.

One thing I did just catch in your email is that you said zImage, I thought you needed uImage or is that where I am going wrong?

Many thanks

Paul

0 Kudos
Reply
1,928 Views
paulbrown
Contributor I

I have just read up on the difference between uImage and zImage and I use the bootm command, so uImage is good. I will give the zImage a try though (with the bootz command) and see if it makes any difference.

0 Kudos
Reply
1,928 Views
igorpadykov
NXP Employee
NXP Employee

Hi Paul

every kernel version should correspond to uboot version, I would suggest

to try other uboot versions for example

ftp://ftp.denx.de/pub/u-boot/u-boot-2015.07.tar.bz2

or from FSL

uboot-imx.git - Freescale i.MX u-boot Tree

it may be useful to post this on uboot mailing list

U-Boot Info Page

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply