Re: [U-Boot] about ## Unknown FLASH on Bank 0

Dear Peter Pan,
please keel the mailinmg list on Cc:
In message 48abf2c20910261812g75d17990jd1793f0560bc882c@mail.gmail.com you wrote:
I also think the 1.2.0 is an ancient version, so I migrate my u-boot from 1.2.0 to u-boot-2009-08 yestoday, the same "Unknown Flash Bank" problem happened. I changed a little in the common files, all of which I think should not lead to this "Unknown Flash Bank" problem. I use MPC8247, and all my changes are:
Which exact board are you using?
- in /common/env_common.c, I add my environment variables to array
default_environment.
Bad, very bad. You should never meddle with this file. You should add your custom settings to your board config file only.
- in /cpu/mpc8260/cpu_init.c, in function cpu_init_f, I common this line
"immr->im_clkrst.car_rsr = RSR_ALLBITS;", because I will need RSR register value later 3. in /cpu/mpc8260/serial_smc.c, we use BRG1 for SMC1 instead of BRG7
You are not supposed to meddle with these files. No changes to such common files are necessary to port U-Boot to custom hardware.
- in /include/mpc8260.h, we add a hardware dog kick function, and modified
functiion "reset_8260_watchdog" a little to kick the hardware dog. 5. in /common/main.c, we add support to the two jumper on our board, which is just two "if... else...".
Such changes should be done in board specific code, not in common files.
- in our board specific files, they all works fine before and I did not
change a thing. Make all the changes above, the u-boot works fine. then I modified the /common/cmd_mem.c, we make the mtest command to test memory only once(in CFG_ALT_MEMTEST mode). I change the "for(;;)" to for(;iterations == 1;)", then the "Unknown Flash Bank" happens. I printed out the 4 Flash IDs, the Manufacture Id changes from 0x01(normal) to 0x808(wrong!!), other IDs are all normal.
This makes zero sense to me.
I understand you have a custom board with local modifications. That means we don't know neither your hardware nor your code, which makes it impossible to help. From the symptoms you describe, there must be something fundamentally broken with your port, but without seeing your code we cannot even guess what this might be.
Best regards,
Wolfgang Denk

Dear Wolfgang Denk:
Our hardware should be fine. We run VxWorks on it before and it works fine. The hardware running VxWorks is already a mature product of our company. We recently want to run linux on it because of the high price of VxWorks.
I do a little experiments on the U-Boot-2009-08, any I successfully make the "Unknown Flash on Bank 0" appear without any code modification on common files. I only add my board specification files and my config file, change the Makefile to support my board files to compile, then the "unknown flash on bank 0" appears.
I use ELDK for cross compile, and the ELDK gcc version is : ppc_6xx-gcc(GCC) 4.2.2
Which part of the code may cause this kind of problem? Maybe I can send your that part of my codes.
2009/10/27 Wolfgang Denk wd@denx.de
Dear Peter Pan,
please keel the mailinmg list on Cc:
In message 48abf2c20910261812g75d17990jd1793f0560bc882c@mail.gmail.com you wrote:
I also think the 1.2.0 is an ancient version, so I migrate my u-boot from 1.2.0 to u-boot-2009-08 yestoday, the same "Unknown Flash Bank" problem happened. I changed a little in the common files, all of which I think should not
lead
to this "Unknown Flash Bank" problem. I use MPC8247, and all my changes are:
Which exact board are you using?
- in /common/env_common.c, I add my environment variables to array
default_environment.
Bad, very bad. You should never meddle with this file. You should add your custom settings to your board config file only.
- in /cpu/mpc8260/cpu_init.c, in function cpu_init_f, I common this line
"immr->im_clkrst.car_rsr = RSR_ALLBITS;", because I will need RSR
register
value later 3. in /cpu/mpc8260/serial_smc.c, we use BRG1 for SMC1 instead of BRG7
You are not supposed to meddle with these files. No changes to such common files are necessary to port U-Boot to custom hardware.
- in /include/mpc8260.h, we add a hardware dog kick function, and
modified
functiion "reset_8260_watchdog" a little to kick the hardware dog. 5. in /common/main.c, we add support to the two jumper on our board,
which
is just two "if... else...".
Such changes should be done in board specific code, not in common files.
- in our board specific files, they all works fine before and I did not
change a thing. Make all the changes above, the u-boot works fine. then I modified the /common/cmd_mem.c, we make the mtest command to test memory only once(in CFG_ALT_MEMTEST mode). I change the "for(;;)" to for(;iterations == 1;)", then the "Unknown
Flash
Bank" happens. I printed out the 4 Flash IDs, the Manufacture Id changes from
0x01(normal)
to 0x808(wrong!!), other IDs are all normal.
This makes zero sense to me.
I understand you have a custom board with local modifications. That means we don't know neither your hardware nor your code, which makes it impossible to help. From the symptoms you describe, there must be something fundamentally broken with your port, but without seeing your code we cannot even guess what this might be.
Best regards,
Wolfgang Denk
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de The high cost of living hasn't affected its popularity.

I have checked this problem again, and find out the reason why sometimes we get a false value of the ID0 we read from norflash.
When we read IDs from norflash, we first write the read id command:
AMD_SEND_CMD(baseaddr, ACMD_READMODE); AMD_SEND_CMD((baseaddr | LATCH_OFFSET1), ACMD_UNLOCK1); AMD_SEND_CMD((baseaddr | LATCH_OFFSET2), ACMD_UNLOCK2); AMD_SEND_CMD((baseaddr | LATCH_OFFSET1), ACMD_ID);
then we read the IDs from norflash: pAddr = (unsigned short *)(baseaddr & 0xFFFFFF00); //Manufacture Id code0 = *(pAddr); //cycle 4: Addr: X00 data = 0x01 pAddr = (unsigned short *)(baseaddr + DEVICE_CODE1_OFFSET_2X16); code1 = *pAddr; //cycle 4: Addr: X01, X - don't care. data = 0x227E pAddr = (unsigned short *)(baseaddr + DEVICE_CODE2_OFFSET_2X16); code2 = *pAddr; //cycle 5: Addr: X0E data = 0x2223 pAddr = (unsigned short *)(baseaddr + DEVICE_CODE3_OFFSET_2X16); code3 = *(pAddr); //cycle 6: Addr: X0F data = 0x2201 AMD_SEND_CMD(baseaddr, ACMD_READMODE);
We need to add a `__asm__ __volatile__ ("sync"); ` between the write and read operation to always get a correct result.
2009/10/28 Peter Pan pppeterpppan@gmail.com
Dear Wolfgang Denk:
Our hardware should be fine. We run VxWorks on it before and it works fine. The hardware running VxWorks is already a mature product of our company. We recently want to run linux on it because of the high price of VxWorks.
I do a little experiments on the U-Boot-2009-08, any I successfully make the "Unknown Flash on Bank 0" appear without any code modification on common files. I only add my board specification files and my config file, change the Makefile to support my board files to compile, then the "unknown flash on bank 0" appears.
I use ELDK for cross compile, and the ELDK gcc version is : ppc_6xx-gcc(GCC) 4.2.2
Which part of the code may cause this kind of problem? Maybe I can send your that part of my codes.
2009/10/27 Wolfgang Denk wd@denx.de
Dear Peter Pan,
please keel the mailinmg list on Cc:
In message 48abf2c20910261812g75d17990jd1793f0560bc882c@mail.gmail.com you wrote:
I also think the 1.2.0 is an ancient version, so I migrate my u-boot
from
1.2.0 to u-boot-2009-08 yestoday, the same "Unknown Flash Bank" problem happened. I changed a little in the common files, all of which I think should not
lead
to this "Unknown Flash Bank" problem. I use MPC8247, and all my changes are:
Which exact board are you using?
- in /common/env_common.c, I add my environment variables to array
default_environment.
Bad, very bad. You should never meddle with this file. You should add your custom settings to your board config file only.
- in /cpu/mpc8260/cpu_init.c, in function cpu_init_f, I common this
line
"immr->im_clkrst.car_rsr = RSR_ALLBITS;", because I will need RSR
register
value later 3. in /cpu/mpc8260/serial_smc.c, we use BRG1 for SMC1 instead of BRG7
You are not supposed to meddle with these files. No changes to such common files are necessary to port U-Boot to custom hardware.
- in /include/mpc8260.h, we add a hardware dog kick function, and
modified
functiion "reset_8260_watchdog" a little to kick the hardware dog. 5. in /common/main.c, we add support to the two jumper on our board,
which
is just two "if... else...".
Such changes should be done in board specific code, not in common files.
- in our board specific files, they all works fine before and I did not
change a thing. Make all the changes above, the u-boot works fine. then I modified the /common/cmd_mem.c, we make the mtest command to test memory only once(in CFG_ALT_MEMTEST mode). I change the "for(;;)" to for(;iterations == 1;)", then the "Unknown
Flash
Bank" happens. I printed out the 4 Flash IDs, the Manufacture Id changes from
0x01(normal)
to 0x808(wrong!!), other IDs are all normal.
This makes zero sense to me.
I understand you have a custom board with local modifications. That means we don't know neither your hardware nor your code, which makes it impossible to help. From the symptoms you describe, there must be something fundamentally broken with your port, but without seeing your code we cannot even guess what this might be.
Best regards,
Wolfgang Denk
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de The high cost of living hasn't affected its popularity.

Dear Peter Pan,
In message 48abf2c20911251756k1ca3fe19p26db4a65b68bc366@mail.gmail.com you wrote:
I have checked this problem again, and find out the reason why sometimes we get a false value of the ID0 we read from norflash.
When we read IDs from norflash, we first write the read id command:
AMD_SEND_CMD(baseaddr, ACMD_READMODE); AMD_SEND_CMD((baseaddr | LATCH_OFFSET1), ACMD_UNLOCK1); AMD_SEND_CMD((baseaddr | LATCH_OFFSET2), ACMD_UNLOCK2); AMD_SEND_CMD((baseaddr | LATCH_OFFSET1), ACMD_ID);
then we read the IDs from norflash: pAddr = (unsigned short *)(baseaddr & 0xFFFFFF00); //Manufacture Id code0 = *(pAddr); //cycle 4: Addr: X00 data = 0x01 pAddr = (unsigned short *)(baseaddr + DEVICE_CODE1_OFFSET_2X16); code1 = *pAddr; //cycle 4: Addr: X01, X - don't care. data = 0x227E pAddr = (unsigned short *)(baseaddr + DEVICE_CODE2_OFFSET_2X16); code2 = *pAddr; //cycle 5: Addr: X0E data = 0x2223 pAddr = (unsigned short *)(baseaddr + DEVICE_CODE3_OFFSET_2X16); code3 = *(pAddr); //cycle 6: Addr: X0F data = 0x2201 AMD_SEND_CMD(baseaddr, ACMD_READMODE);
Umm.. could you please point out which specific part of code (i. e . file name and line numbers, or snippet of the real code from the source file) you are talking about here?
I have problems following you, as for example I can find no such thing as AMD_SEND_CMD or ACMD_READMODE or LATCH_OFFSET anywhere in the whole source tree ?
Best regards,
Wolfgang Denk

The part of code I given out is in my get_flash_size() function in my flash.c. This part of code is used to read out the Manufacture ID and Device ID of my nor flash. This maybe have no contribution to the source tree, but maybe others that having the same problem can get a clue for such problems.
2009/11/26 Wolfgang Denk wd@denx.de
Dear Peter Pan,
In message 48abf2c20911251756k1ca3fe19p26db4a65b68bc366@mail.gmail.com you wrote:
I have checked this problem again, and find out the reason why sometimes we get a false value of the ID0 we read from norflash.
When we read IDs from norflash, we first write the read id command:
AMD_SEND_CMD(baseaddr, ACMD_READMODE); AMD_SEND_CMD((baseaddr | LATCH_OFFSET1), ACMD_UNLOCK1); AMD_SEND_CMD((baseaddr | LATCH_OFFSET2), ACMD_UNLOCK2); AMD_SEND_CMD((baseaddr | LATCH_OFFSET1), ACMD_ID);
then we read the IDs from norflash: pAddr = (unsigned short *)(baseaddr & 0xFFFFFF00); //Manufacture Id code0 = *(pAddr); //cycle 4: Addr: X00 data = 0x01 pAddr = (unsigned short *)(baseaddr + DEVICE_CODE1_OFFSET_2X16); code1 = *pAddr; //cycle 4: Addr: X01, X - don't care. data = 0x227E pAddr = (unsigned short *)(baseaddr + DEVICE_CODE2_OFFSET_2X16); code2 = *pAddr; //cycle 5: Addr: X0E data = 0x2223 pAddr = (unsigned short *)(baseaddr + DEVICE_CODE3_OFFSET_2X16); code3 = *(pAddr); //cycle 6: Addr: X0F data = 0x2201 AMD_SEND_CMD(baseaddr, ACMD_READMODE);
Umm.. could you please point out which specific part of code (i. e . file name and line numbers, or snippet of the real code from the source file) you are talking about here?
I have problems following you, as for example I can find no such thing as AMD_SEND_CMD or ACMD_READMODE or LATCH_OFFSET anywhere in the whole source tree ?
Best regards,
Wolfgang Denk
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de You could end up being oddly sad and full of a strange, diffuse com- passion which would lead you to believe that it might be a good idea to wipe out the whole human race and start again with amoebas. - Terry Pratchett, _Guards! Guards!_

Dear Peter Pan,
In message 48abf2c20911252320h15babe52xe059e72d9ec6d580@mail.gmail.com you wrote:
The part of code I given out is in my get_flash_size() function in my flash.c.
i Ah. You're re-inventing the wheel one more time, it seems? Have fun...
This part of code is used to read out the Manufacture ID and Device ID of my nor flash. This maybe have no contribution to the source tree, but maybe others that having the same problem can get a clue for such problems.
One likely reason for your problem is using plain pointer acesses while in fact you should be using proper accessor functions instead.
Best regards,
Wolfgang Denk
participants (2)
-
Peter Pan
-
Wolfgang Denk