[U-Boot] Unwritable registers on MPC8308

Guy Morand Morand at telecontrol.ch
Thu Dec 16 14:03:09 CET 2010


Hello,

I'm working on a board based on MPC8308 and trying to configure the RTC. The problem is that when I try to write into these registers, their value is always 0x0 !!! I've tried a lot of things such as debugging step by step with gdb/JTAG/Peedi, writing to these registers with the Peedi, desabling address translation, using writel/out_le32/..., they are always 0x0 ! However, writing in RAM works perfectly !

Here is a sample of code about what I'd like to do :
---------------------------------------
#define RTC_BASE  CONFIG_SYS_IMMR + 0x300
#define RTC_CNR   RTC_BASE
#define RTC_LDR   RTC_BASE + 0x4
#define RTC_PSR   RTC_BASE + 0x8
#define RTC_TR    RTC_BASE + 0xC
#define RTC_EVR   RTC_BASE + 0x10
#define RTC_ALR   RTC_BASE + 0x14

void initRTC()
{

  u32* volatile psr = RTC_PSR;
  u32* volatile ldr = RTC_LDR;
  u32* volatile cnr = RTC_CNR;
  u32* volatile loadaddr = 0x800000;

  u32 psr_value = 0x0;
  u32 ldr_value = 0xABCD1234;
  u32 cnr_value = (0x1 << 7);// | (1 << 24);
  u32 loadValue = 0xBEEFABCD;

  *psr = psr_value;                     // Divide clock by 1
  *ldr = ldr_value;              // Initial time
  *cnr = cnr_value;// | (1 << 24);// Clock enable use, CSB clock
  *loadaddr = loadValue;

  printf("PSR pointer is 0x%08X, put 0x%08X and actually is 0x%08X\n", psr, psr_value, *psr);
  printf("LDR pointer is 0x%08X, put 0x%08X and actually is 0x%08X\n", ldr, ldr_value, *ldr);
  printf("CNR pointer is 0x%08X, put 0x%08X and actually is 0x%08X\n", cnr, cnr_value, *cnr);
  printf("loadaddr pointer is 0x%08X, put 0x%08X and actually is 0x%08X\n", loadaddr, loadValue, *loadaddr);
}
---------------------------------------
And the output :
---------------------------------------
PSR pointer is 0xE0000308, put 0x00000000 and actually is 0x00000000
LDR pointer is 0xE0000304, put 0xABCD1234 and actually is 0x00000000
CNR pointer is 0xE0000300, put 0x00000080 and actually is 0x00000000
loadaddr pointer is 0x00800000, put 0xBEEFABCD and actually is 0xBEEFABCD
---------------------------------------

I have the same problem with ANY register ! I also noticed a register that should be initialized to 0xFFFFFFFF is actually 0x0 at reset ! More it goes, more I think I'm reading the wrong datasheet or the wrong number has been printed on the chip :-p ! Or a bug ... what I doubt ... !

I've been stuck here all the week, without finding any clue, please give me something to dig into !

Thanks for your precious advices !

Guy Morand


More information about the U-Boot mailing list