All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [U-BOOT] nand merge problem
@ 2009-05-26  7:46 xiangfu_gmail
  2009-05-26  9:12 ` xiangfu_gmail
  0 siblings, 1 reply; 11+ messages in thread
From: xiangfu_gmail @ 2009-05-26  7:46 UTC (permalink / raw)
  To: u-boot

Hi
I have try to merge Ingenic U-boot (1.1.6) with upstream.
but I have some problem
1. there is no
--
NAND_CTL_SETNCE:
NAND_CTL_CLRNCE:
NAND_CTL_SETCLE:
NAND_CTL_CLRCLE:
NAND_CTL_SETALE:
NAND_CTL_CLRALE:
instead of :
--
NAND_NCE:
NAND_CLE:
NAND_ALE:
NAND_CTRL_CLE:
NAND_CTRL_ALE:
NAND_CTRL_CHANGE:

I use the NAND_CTL_SETNCE... in the jz_hwcontrol function.
i use "nand->hwcontrol = jz_hwcontrol" in the u-boot 1.1.6
but in the U-boot V2009-06 the nand_chip structure does not have
"hwcontrol" function.

what am I gonna do?

thanks for help.

--

Best Regards
Xiangfu Liu

jabber : xiangfu.z at gmail.com
skype  : xiangfu.z

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [U-BOOT] nand merge problem
  2009-05-26  7:46 [U-Boot] [U-BOOT] nand merge problem xiangfu_gmail
@ 2009-05-26  9:12 ` xiangfu_gmail
  2009-05-26 21:17   ` Scott Wood
  0 siblings, 1 reply; 11+ messages in thread
From: xiangfu_gmail @ 2009-05-26  9:12 UTC (permalink / raw)
  To: u-boot

xiangfu_gmail wrote:
> Hi
> I have try to merge Ingenic U-boot (1.1.6) with upstream.
> but I have some problem
Hi I rewrite the jz_hwcontrol to :
--
static void jz_hwcontrol(......)
{	......
	if (ctrl & NAND_CTRL_CHANGE) {
		if (ctrl & NAND_NCE)
			REG_EMC_NFCSR |= EMC_NFCSR_NFCE1;
		else
			REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE1;

		if (ctrl & NAND_CLE)
		......
	}
}
and
" nand->cmd_ctrl =  jz_hwcontrol; " in board_nand_init

but it's still not work:
the error message:
--
NAND:  nand_get_flash_type: second ID read did not match ff,ff against
00,00
No NAND device found!!!

0 MiB
--

what can cause this problem?

thanks

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [U-BOOT] nand merge problem
  2009-05-26  9:12 ` xiangfu_gmail
@ 2009-05-26 21:17   ` Scott Wood
  2009-05-27  0:41     ` xiangfu_gmail
  0 siblings, 1 reply; 11+ messages in thread
From: Scott Wood @ 2009-05-26 21:17 UTC (permalink / raw)
  To: u-boot

On Tue, May 26, 2009 at 05:12:01PM +0800, xiangfu_gmail wrote:
> xiangfu_gmail wrote:
> > Hi
> > I have try to merge Ingenic U-boot (1.1.6) with upstream.
> > but I have some problem
> Hi I rewrite the jz_hwcontrol to :
> --
> static void jz_hwcontrol(......)
> {	......
> 	if (ctrl & NAND_CTRL_CHANGE) {
> 		if (ctrl & NAND_NCE)
> 			REG_EMC_NFCSR |= EMC_NFCSR_NFCE1;
> 		else
> 			REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE1;
> 
> 		if (ctrl & NAND_CLE)
> 		......
> 	}
> }
> and
> " nand->cmd_ctrl =  jz_hwcontrol; " in board_nand_init
> 
> but it's still not work:
> the error message:
> --
> NAND:  nand_get_flash_type: second ID read did not match ff,ff against
> 00,00
> No NAND device found!!!
> 
> 0 MiB
> --
> 
> what can cause this problem?

It would be helpful if you were to post the entire hwcontrol, so we can
see what's hiding behind those "......"s.

Posting the original legacy NAND defines for this board would be helpful
as well.

-Scott

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [U-BOOT] nand merge problem
  2009-05-26 21:17   ` Scott Wood
@ 2009-05-27  0:41     ` xiangfu_gmail
  2009-05-27 14:34       ` Scott Wood
  0 siblings, 1 reply; 11+ messages in thread
From: xiangfu_gmail @ 2009-05-27  0:41 UTC (permalink / raw)
  To: u-boot

Hi Scott

thanks for the reply
Scott Wood wrote:
> On Tue, May 26, 2009 at 05:12:01PM +0800, xiangfu_gmail wrote:
>> xiangfu_gmail wrote:
>>> Hi
>>> I have try to merge Ingenic U-boot (1.1.6) with upstream.
>>> but I have some problem
>> Hi I rewrite the jz_hwcontrol to :
>> --
>> static void jz_hwcontrol(......)
>> {	......
>> }
>> and
>> " nand->cmd_ctrl =  jz_hwcontrol; " in board_nand_init
>>
>> but it's still not work:
>> the error message:
>> --
>> NAND:  nand_get_flash_type: second ID read did not match ff,ff against
>> 00,00
>> No NAND device found!!!
>>
>> 0 MiB
>> --
>>
>> what can cause this problem?
> 
> It would be helpful if you were to post the entire hwcontrol, so we can
> see what's hiding behind those "......"s.
here is the entire hwontrol
static void jz_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{
	struct nand_chip *this = (struct nand_chip *)(mtd->priv);

	if (ctrl & NAND_CTRL_CHANGE) {
		if (ctrl & NAND_NCE)
			REG_EMC_NFCSR |= EMC_NFCSR_NFCE1;
		else
			REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE1;

		if (ctrl & NAND_CLE)
			this->IO_ADDR_W = (void __iomem *)
		((unsigned long)(this->IO_ADDR_W) | 0x00008000);
		else			
			this->IO_ADDR_W = (void __iomem *)
		((unsigned long)(this->IO_ADDR_W) & ~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);

	}
}

> 
> Posting the original legacy NAND defines for this board would be helpful
> as well.
I don't know which code should I post. so I post the git URL:
http://github.com/xiangfu/pi-u-boot/tree/xiangfu


> 
> -Scott

thanks
-- 

Best Regards
Xiangfu Liu

jabber : xiangfu.z at gmail.com
skype  : xiangfu.z

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [U-BOOT] nand merge problem
  2009-05-27  0:41     ` xiangfu_gmail
@ 2009-05-27 14:34       ` Scott Wood
       [not found]         ` <00ab01c9e19b$b2488f50$3e03a8c0@st.jz.com>
  0 siblings, 1 reply; 11+ messages in thread
From: Scott Wood @ 2009-05-27 14:34 UTC (permalink / raw)
  To: u-boot

xiangfu_gmail wrote:
> static void jz_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
> {
> 	struct nand_chip *this = (struct nand_chip *)(mtd->priv);
> 
> 	if (ctrl & NAND_CTRL_CHANGE) {
> 		if (ctrl & NAND_NCE)
> 			REG_EMC_NFCSR |= EMC_NFCSR_NFCE1;
> 		else
> 			REG_EMC_NFCSR &= ~EMC_NFCSR_NFCE1;
> 
> 		if (ctrl & NAND_CLE)
> 			this->IO_ADDR_W = (void __iomem *)
> 		((unsigned long)(this->IO_ADDR_W) | 0x00008000);
> 		else			
> 			this->IO_ADDR_W = (void __iomem *)
> 		((unsigned long)(this->IO_ADDR_W) & ~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);
> 
> 	}
> }

Nowhere in this function do you issue the command...  See 
cpu/ppc4xx/ndfc.c for a simple hwcontrol function.

-Scott

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [U-BOOT] nand merge problem
       [not found]         ` <00ab01c9e19b$b2488f50$3e03a8c0@st.jz.com>
@ 2009-05-31  8:09           ` xiangfu
  2009-06-01 16:54             ` Scott Wood
  0 siblings, 1 reply; 11+ messages in thread
From: xiangfu @ 2009-05-31  8:09 UTC (permalink / raw)
  To: u-boot

zyliu at 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);
}



-- 
Best Regards
Xiangfu Liu

jabber : xiangfu.z at gmail.com
skype  : xiangfu.z

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [U-BOOT] nand merge problem
  2009-05-31  8:09           ` xiangfu
@ 2009-06-01 16:54             ` Scott Wood
  2009-06-02  2:42               ` xiangfu
                                 ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Scott Wood @ 2009-06-01 16:54 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [U-BOOT] nand merge problem
  2009-06-01 16:54             ` Scott Wood
@ 2009-06-02  2:42               ` xiangfu
  2009-06-06 14:46               ` [U-Boot] console_init_r problem with ingenic jz4740 cpu xiangfu
  2009-06-10  9:14               ` [U-Boot] lcd logo color not correct xiangfu
  2 siblings, 0 replies; 11+ messages in thread
From: xiangfu @ 2009-06-02  2:42 UTC (permalink / raw)
  To: u-boot

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


-- 
Best Regards
Xiangfu Liu

jabber : xiangfu.z at gmail.com
skype  : xiangfu.z

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot]  console_init_r problem with ingenic jz4740 cpu
  2009-06-01 16:54             ` Scott Wood
  2009-06-02  2:42               ` xiangfu
@ 2009-06-06 14:46               ` xiangfu
  2009-06-10  9:14               ` [U-Boot] lcd logo color not correct xiangfu
  2 siblings, 0 replies; 11+ messages in thread
From: xiangfu @ 2009-06-06 14:46 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot]   lcd logo color not correct
  2009-06-01 16:54             ` Scott Wood
  2009-06-02  2:42               ` xiangfu
  2009-06-06 14:46               ` [U-Boot] console_init_r problem with ingenic jz4740 cpu xiangfu
@ 2009-06-10  9:14               ` xiangfu
  2009-06-10 14:26                 ` xiangfu
  2 siblings, 1 reply; 11+ messages in thread
From: xiangfu @ 2009-06-10  9:14 UTC (permalink / raw)
  To: u-boot

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.

-- 
Best Regards
Xiangfu Liu

jabber : xiangfu.z at gmail.com
skype  : xiangfu.z
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jz_lcd.c
Type: text/x-csrc
Size: 18368 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090610/8464b93f/attachment.c 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] lcd logo color not correct
  2009-06-10  9:14               ` [U-Boot] lcd logo color not correct xiangfu
@ 2009-06-10 14:26                 ` xiangfu
  0 siblings, 0 replies; 11+ messages in thread
From: xiangfu @ 2009-06-10 14:26 UTC (permalink / raw)
  To: u-boot

xiangfu wrote:
> 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.
> 
I fix this. now the LCD is 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.
Sorry for stupid question :-)
the system not crash
because the stdout=lcd. so the serial have nothing output.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-06-10 14:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-26  7:46 [U-Boot] [U-BOOT] nand merge problem xiangfu_gmail
2009-05-26  9:12 ` xiangfu_gmail
2009-05-26 21:17   ` Scott Wood
2009-05-27  0:41     ` xiangfu_gmail
2009-05-27 14:34       ` Scott Wood
     [not found]         ` <00ab01c9e19b$b2488f50$3e03a8c0@st.jz.com>
2009-05-31  8:09           ` xiangfu
2009-06-01 16:54             ` Scott Wood
2009-06-02  2:42               ` xiangfu
2009-06-06 14:46               ` [U-Boot] console_init_r problem with ingenic jz4740 cpu xiangfu
2009-06-10  9:14               ` [U-Boot] lcd logo color not correct xiangfu
2009-06-10 14:26                 ` xiangfu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.