Re: [U-Boot] [U-BOOT] nand merge problem

zyliu@ingenic.cn wrote:
Hi, xiangfu
Maybe the drivers of mtd in linux-2.6.24.3 can be as reference.
Best Regards
thanks, now it's output : "nand_get_flash_type: second ID read did not match 43,20 against 84,84"
I will let you know the progress.
now the hwcontrol is -- static void jz_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) { struct nand_chip *this = (struct nand_chip *)(mtd->priv); unsigned int nandaddr = (unsigned int)this->IO_ADDR_W; if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_CLE) nandaddr = nandaddr | 0x00008000; else nandaddr = nandaddr & ~0x00008000; if (ctrl & NAND_ALE) this->IO_ADDR_W = (void __iomem *)((unsigned long)(this->IO_ADDR_W) | 0x00010000); else this->IO_ADDR_W = (void __iomem *)((unsigned long)(this->IO_ADDR_W) & ~0x00010000); if (ctrl & NAND_NCE) { this->IO_ADDR_W = this->IO_ADDR_R = (void __iomem *)NAND_DATA_PORT1; REG_EMC_NFCSR |= EMC_NFCSR_NFCE1; } else { REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE1; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE2; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE3; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE4; } }
this->IO_ADDR_W = (void __iomem *)nandaddr; if (cmd != NAND_CMD_NONE) writeb(cmd, this->IO_ADDR_W); }

On Sun, May 31, 2009 at 04:09:35PM +0800, xiangfu wrote:
static void jz_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) { struct nand_chip *this = (struct nand_chip *)(mtd->priv); unsigned int nandaddr = (unsigned int)this->IO_ADDR_W; if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_CLE) nandaddr = nandaddr | 0x00008000; else nandaddr = nandaddr & ~0x00008000; if (ctrl & NAND_ALE) this->IO_ADDR_W = (void __iomem *)((unsigned long)(this->IO_ADDR_W) | 0x00010000); else this->IO_ADDR_W = (void __iomem *)((unsigned long)(this->IO_ADDR_W) & ~0x00010000); if (ctrl & NAND_NCE) { this->IO_ADDR_W = this->IO_ADDR_R = (void __iomem *)NAND_DATA_PORT1; REG_EMC_NFCSR |= EMC_NFCSR_NFCE1; } else { REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE1; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE2; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE3; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE4; } }
this->IO_ADDR_W = (void __iomem *)nandaddr; if (cmd != NAND_CMD_NONE) writeb(cmd, this->IO_ADDR_W); }
Try something like this instead:
static void jz_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) { struct nand_chip *this = mtd->priv; unsigned long nandaddr = (unsigned long)this->IO_ADDR_W;
if (ctrl & NAND_CTRL_CHANGE) { /* Change this to use I/O accessors. */ if (ctrl & NAND_NCE) { REG_EMC_NFCSR |= EMC_NFCSR_NFCE1; } else { /* * Why set only one bit when NCE is high, but clear * four when low? Why clear separate bits in the same * register one at a time? */ REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE1; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE2; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE3; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE4; } }
if (cmd == NAND_CMD_NONE) return;
if (ctrl & NAND_CLE) nandaddr |= 0x00008000; else /* must be ALE */ nandaddr |= 0x00010000;
writeb(cmd, (uint8_t *)nandaddr); }
-Scott

Thanks Scott, it's work. :-)
Scott Wood wrote:
Try something like this instead:
static void jz_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) { struct nand_chip *this = mtd->priv; unsigned long nandaddr = (unsigned long)this->IO_ADDR_W;
if (ctrl & NAND_CTRL_CHANGE) { /* Change this to use I/O accessors. */ if (ctrl & NAND_NCE) { REG_EMC_NFCSR |= EMC_NFCSR_NFCE1; } else { /* * Why set only one bit when NCE is high, but clear * four when low? Why clear separate bits in the same * register one at a time? */
my mistake. I copy those code form the device's kernel source code.
REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE1; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE2; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE3; REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE4; }
}
if (cmd == NAND_CMD_NONE) return;
if (ctrl & NAND_CLE) nandaddr |= 0x00008000; else /* must be ALE */ nandaddr |= 0x00010000;
writeb(cmd, (uint8_t *)nandaddr); }
-Scott

Hi
the u-boot stop at console_init_r function.
here is part of board_init_r function code.
/** leave this here (after malloc(), environment and PCI are working) **/ /* Initialize devices */ devices_init ();
jumptable_init (); debug("DEBUG: jumptable over\n"); [1]
/* Initialize the console (after the relocation and devices init) */ console_init_r (); debug("DEBUG: console_init_r over\n");[2] /** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
I add two lines for debug.
the [1] is output form serial console. but [2] never show up. I also add some "puts" in the console_init_r function. it's not show in the serial console
give me some advice
thanks
Best Regards Xiangfu

Hi 1. I have try to port u-boot to jz4740 cpu device. now the lcd can show the LOGO. but the color is not correct.
2. gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */ when I comment this line. the device can boot to main_loop. when don't comment this line as normal. the system crash. give me some help about this problem
thanks.
attach is the jz_lcd.c file.

xiangfu wrote:
Hi
- I have try to port u-boot to jz4740 cpu device.
now the lcd can show the LOGO. but the color is not correct.
I fix this. now the LCD is correct.
- gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
when I comment this line. the device can boot to main_loop. when don't comment this line as normal. the system crash. give me some help about this problem
thanks.
Sorry for stupid question :-) the system not crash because the stdout=lcd. so the serial have nothing output.
participants (2)
-
Scott Wood
-
xiangfu