Skip to contentSkip to conversation

Early UART setup on 2.6 kernel for mpc85xx

DISCUSSION Morrison, Tom 2 participants 3 messages Aug 13, 2007 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 5 lines
Quoted 5 lines

In order to debug the kernel 2.6, I want setup serial port with=20 UART on mpc85xx as early as possible. I add the register access=20 code at the beginning of platform_init(). For example, I try=20 to write THR register(0xe0004500). However the system just=20 hanging there with this line.

<snip everything else>

If you are using a relatively new kernel like I am starting=20 up with - you don't need to add anything - you can use the "Early Debugging/Early Console" which defines PPC_EARLY_DEBUG You can find this in the kernel hacking options when you=20 go in and configure your linux kernel.

This causes the udbg serial driver to be initialized, and=20 99% of the early debug output is already put to the screen. This hands the serial port over to the console driver later on in the boot, and it works great (good job whoever wrote this piece - more than a helpful tool!).

FWIW, you really can't debug the earliest init code=20 because most of that is in assembly. Get a JTAG emulator (BDI or Lauterbach) and start stepping through.

Tom Morrison

#2 lore raw
Quoted 5 lines · Tom
Quoted 5 lines
Quoted 5 lines

In order to debug the kernel 2.6, I want setup serial port with UART on mpc85xx as early as possible. I add the register access code at the beginning of platform_init(). For example, I try to write THR register(0xe0004500). However the system just hanging there with this line.

Make sure there's a mapping in the TLB for that address.

Quoted 3 lines

FWIW, you really can't debug the earliest init code because most of that is in assembly. Get a JTAG emulator (BDI or Lauterbach) and start stepping through.

It's quite possible to debug assembly code without JTAG. :-)

-Scott

#3 lore raw

On the other side of early_debug...

In reply to a message not in the archive

It looks like I am getting up to the point where the=20 rootfs has been NFS mounted correctly. Whew, but the first thing the INIT program does it try to open the /dev/console device - and it goes oops:

Quoted 6 lines
Quoted 6 lines

kernel BUG at drivers/char/tty_io.c:781!

Oops: Exception in kernel mode, sig: 5 [#1]
Empirix MPC848 Cheetah Board
Modules linked in:
NIP: c01390d4 LR: c013abe4 CTR: 00000000
REGS: effc3d50 TRAP: 0700   Not tainted

(2.6.23-r3_tom-g46b28357-dirty)

Quoted 10 lines
Quoted 9 lines

MSR: 00021000 <ME> CR: 24242422 XER: 00000000
TASK =3D effc1a80[1] 'init' THREAD: effc2000
GPR00: 00000001 effc3e00 effc1a80 00000000 effc3de0 00000001 00000000

c02b60c8
GPR08: 00001aa3 00000000 c030b730 00000000 22242422 1001f2f8 fffffff0

007fff94
GPR16: 20000000 00000000 00000000 effc3e30 c17c2528 c17c2530 00000130

Quoted 15 lines
Quoted 13 lines

00000128
GPR24: c02c0000 00000001 00000001 00000000 00000000 00029000 c17c2400
00000001
NIP [c01390d4] tty_ldisc_put+0x44/0x70
LR [c013abe4] release_dev+0x4ec/0x6a0

Call Trace:
 [effc3e00] [c021d800] __mutex_unlock_slowpath+0x40/0xd4 (unreliable)
 [effc3e20] [c013abe4] release_dev+0x4ec/0x6a0
 [effc3ee0] [c013adac] tty_release+0x14/0x28
 [effc3ef0] [c0068844] __fput+0x178/0x19c
 [effc3f10] [c0066a5c] filp_close+0x54/0xac
 [effc3f30] [c0066b34] sys_close+0x80/0xc0
 [effc3f40] [c000c54c] ret_from_syscall+0x0/0x3c
Quoted 2 lines

Instruction dump:
7c000110 7c0000d0 0f000000 7fa000a6 7c000146 1d43004c 3d20c031

3929b730

Quoted 1 line
Quoted 1 line

7d4a4a14 816a0048 212b0000 7c095914 <0f000000> 396bffff 806a0044

916a0048

Now, it seems the root cause is that the tty's=20 console_init was NEVER being called.=20

I am wondering if there was a reason or rhyme for this?