Memory problem with Uboot

Francois
Hi everybody,
I'm using the micro2440 with a custom board, which have a micrel KSZ8842
MAC/PHY chip instead of the original DM9000. The memory mapping is the same
(I use memory bank 4), and everything works fine if I boot the linux kernel
from supervivi. I programmed uboot on the nand flash, and if I boot the
linux kernel from uboot, the chip is not recognized.
I don't know if I am clear enough, but what I mean is that the behaviour of
the kernel is different if I boot from one bootloader or the other.
Does anybody have an idea about what is the cause of that problem?

Regards,

François

wildpossum
I'll take a guess and say the u-boot source was generated with the DM9000
as the ethernet component (maybe there is some register setting
inconsistancy.   Unfortunately, If this is the case then you will need to
download the u-boot source, modify it where required, compile, and install.

Otherwise, I don't recall any other issue with such a problem.
Cheers.

Francois
Thanks for your answer. I've already downloaded the uboot source and spent
a long time to compare the registers when I boot from vivi and from uboot.
I tried with the GPIO regs, clock (CLKCON...), memory (BWSCON, BANKCON4),
and even if I found a few differences, changing these values didn't solve
my problem. I anybody have an idea about the registers that might be
involved, that would help me a lot!
Cheers.

François

open-nandra
Hi,

now sure about that but kernel make self net initialization and not sure if
there should be some u-boot dependency. Would be good to ask on u-boot
forums on mailing lists to get proper answer ;)

marek

Francois
Hi,
You're right marek, kernel make self net init, but my problem was a little
bit different : I removed the dm9000 driver and successfully ported the
KSZ8842 driver, so I've a kernel with full working network. The problem is
that when I run my "zImage" kernel with supervivi, everything works fine,
but when I load the "uImage" conversion of the same kernel, the chip is not
detected.
But I finally found the trick : The problem is in the uboot mmu init : I
found on the net the vivi code for s3c2440, and I noticed several
differences. So I changed the mmu init in "lowlevel_foo.S", and everything
works now!
I don't know if I can call it a "bug" in uboot, but in my opinion, people
would expect kernel to work the same way, no matter what bootloader is
used.

François

open-nandra
Hi Francois,

nice ;). Which u-boot version you use? From friendlyarm or latest?

marek

Francois
Hi Marek,

I'm using the stable version ("mini2440-dev-stable") found here :
http://repo.or.cz/w/u-boot-openmoko/mini2440.git .

cheers.

François

open-nandra
I'm using same but have dm9000 and have no such a troubles. Are you sure
problem is in u-boot? Could you please post your changes.

thanks,

marek

Francois
I noticed too that the problem doesn't happen with the DM9000 (I also have
a micro2440 SDK), but the difference is that the KSZ8842 uses 16 bits
addressing (LADDR[0..15] are connected to the chip).
I'm 100% sure that this issue is related to uboot, I tried it several
times, and my little changes to the mmu init code made everything work
so...
Here are the changes I applied, I hope this will be helpful for people who
have a micro2440 and want to use memory bank 4 with other chips than a
DM9000...

In the file "lowlevel_foo.S" (under board/mini2440/ directory) :

         /*(no changes before "cpu_init_crit")*/
cpu_init_crit:
         /*
   * flush v4 I/D caches
   */
  mov  r0, #0
  mcr  p15, 0, r0, c7, c7, 0  /* flush v3/v4 cache */
  mcr     p15, 0, r0, c7, c10, 4  /* drain write buffer on v4 */ 
  mcr  p15, 0, r0, c8, c7, 0  /* flush v4 TLB */

  /* Load page table pointer */  
  mov    r4, #0  
  mcr    p15, 0, r4, c2, c0, 0    /* load page table pointer */ 
  /* Write domain id (cp15_r3) */  
  mvn    r0, #0               /* Domains 0, 1 = client */  
  mcr    p15, 0, r0, c3, c0, 0    /* load domain access register */

  /*
   * disable MMU stuff and caches
   */
  mrc  p15, 0, r0, c1, c0, 0
  bic  r0, r0, #0x3000    @ clear bits 13, 9:8 (--V- --RS)
  bic  r0, r0, #0x0300    @ clear bits 7, 2:0 (B--- -CAM)
  bic  r0, r0, #0x0087
  orr  r0, r0, #0x00000002  @ set bit 2 (A) Align
  orr  r0, r0, #0x00001000  @ set bit 12 (I) I-Cache
  orr  r0, r0, #0x1000
  mcr  p15, 0, r0, c1, c0, 0

  /*
   * before relocating, we have to setup RAM timing
   * because memory timing is board-dependend, you will
   * find a lowlevel_init.S in your board directory.
   */
  mov  ip, lr
  bl  lowlevel_init
  mov  lr, ip
  mov  pc, lr

cheers,

François

Suresh Chauhan
Hi,

I also wants to use same configuration means, micro2440 with KSZ8842.

Please guide me for KSZ8842 porting in uboot & linux kernel.

Thanks in advance.