address did not match any chip selects
我的板卡是freescale的。目前遇到的问题是:uboot在nandflash的驱动中报错。错误为:fsl_elbc_nand: address did not match any chip selects
我发现错误代码在uboot的drivers/mtd/nand/fsl_elbc_nand.c中。代码为board_nand_init函数,函数如下:
int board_nand_init(struct nand_chip *nand)
{
struct fsl_elbc_mtd *priv;
uint32_t br = 0, or = 0;
if (!elbc_ctrl) {
printf("fsl_elbc_ctrl_init\n");
fsl_elbc_ctrl_init();
if (!elbc_ctrl)
return -1;
}
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
priv->ctrl = elbc_ctrl;
priv->vbase = nand->IO_ADDR_R;
/* Find which chip select it is connected to. It'd be nice
* if we could pass more than one datum to the NAND driver...
*/
for (priv->bank = 0; priv->bank < MAX_BANKS; priv->bank++) {
phys_addr_t base_addr = virt_to_phys(nand->IO_ADDR_R);
br = in_be32(&elbc_ctrl->regs->bank[priv->bank].br);
or = in_be32(&elbc_ctrl->regs->bank[priv->bank].or);
uint32_t tmpFcm = (br & BR_V) && (br & BR_MSEL); 毕业论文
uint32_t tmpAddr = br & or & BR_BA;
printf("in the for base_addr = %d br = %u or = %u tmpFcm = %u tmpAddr = %u\n",BR_PHYS_ADDR(base_addr),
br,or,tmpFcm,tmpAddr);
if ((br & BR_V) && (br & BR_MSEL) == BR_MS_FCM &&
(br & or & BR_BA) == BR_PHYS_ADDR(base_addr))
break;
}
if (priv->bank >= MAX_BANKS) {
printf("fsl_elbc_nand: address did not match any "
"chip selects\n");
printf("priv->bank=%d MAXBANKS = %d\n",priv->bank,int(MAX_BANKS));
return -ENODEV;
}
。。。。。。。。。。。。。。。
未贴完。打印出来的结果是:
in the for priv->bank = 0
in the for base_addr = ffa00000 br = ef001001 or = ff000ff7 tmpFcm = 0 tmpAddr = ef000000
in the for priv->bank = 1
in the for base_addr = ffa00000 br = 0 or = 0 tmpFcm = 0 tmpAddr = 0
in the for priv->bank = 2
in the for base_addr = ffa00000 br = 0 or = 0 tmpFcm = 0 tmpAddr = 0
in the for priv->bank = 3
in the for base_addr = ffa00000 br = c0001001 or = fc000c34 tmpFcm = 0 tmpAddr = c0000000
in the for priv->bank = 4
in the for base_addr = ffa00000 br = d0001001 or = fc000c30 tmpFcm = 0 tmpAddr = d0000000
in the for priv->bank = 5
in the for base_addr = ffa00000 br = 0 or = 0 tmpFcm = 0 tmpAddr = 0
in the for priv->bank = 6
in the for base_addr = ffa00000 br = 0 or = 0 tmpFcm = 0 tmpAddr = 0
in the for priv->bank = 7
in the for base_addr = ffa00000 br = 0 or = 0 tmpFcm = 0 tmpAddr = 0
fsl_elbc_nand: address did not match any chip selects
priv->bank=8 MAXBANKS = 8
代码中我加了一些打印数据,
个人感觉是地址上有问题。但是我是个完全没做过的大菜鸟。不知道从何下手。求各位能指点一二。我知道这样的问题基本在论坛上得不到解决。但还是希望大家各抒己见,说说也好。给点思路。在线等
寄存器设置不正确。