* [U-Boot] kb9202/at91rm9200: compiler quirk?
@ 2009-05-04 18:13 Matthias Kaehlcke
2009-05-04 21:26 ` Jean-Christophe PLAGNIOL-VILLARD
0 siblings, 1 reply; 3+ messages in thread
From: Matthias Kaehlcke @ 2009-05-04 18:13 UTC (permalink / raw)
To: u-boot
hi,
i'm trying to do a forward port of the out of tree patches for the
kwikbyte kb9202b. my board is booting and detects the nand flash, but
only in certain circumstances.
the hwcontrol function looks like this:
#define KB9202_NAND_NCE ((unsigned int)1 << 28) /* EN* on D28 */
static void kb9202_nand_hwcontrol(struct mtd_info *mtd, int cmd,
unsigned int ctrl)
{
...
if (ctrl & NAND_NCE)
AT91C_BASE_PIOB->PIO_CODR = KB9202_NAND_NCE;
else
AT91C_BASE_PIOB->PIO_SODR = KB9202_NAND_NCE;
...
}
the problem is that for some reason the enable signal isn't generated
when using the pre-processor constant KB9202_NAND_NCE. on the other
hand it is generated when using ((unsigned int)1 << 28), instead of
the define. it took me some hours to figure this out ...
the generated assembler code differs slightly:
[without define]
Dump of assembler code for function kb9202_nand_hwcontrol:
0x21f1998c <kb9202_nand_hwcontrol+0>: tst r2, #128 ; 0x80
0x21f19990 <kb9202_nand_hwcontrol+4>: ldr r0, [r0, #152]
0x21f19994 <kb9202_nand_hwcontrol+8>: beq 0x21f199d0 <kb9202_nand_hwcontrol+68>
0x21f19998 <kb9202_nand_hwcontrol+12>: ldr r3, [r0, #4]
0x21f1999c <kb9202_nand_hwcontrol+16>: tst r2, #2 ; 0x2
0x21f199a0 <kb9202_nand_hwcontrol+20>: bic r3, r3, #6291456; 0x600000
0x21f199a4 <kb9202_nand_hwcontrol+24>: orrne r3, r3, #2097152; 0x200000
0x21f199a8 <kb9202_nand_hwcontrol+28>: tst r2, #4 ; 0x4
0x21f199ac <kb9202_nand_hwcontrol+32>: orrne r3, r3, #4194304; 0x400000
0x21f199b0 <kb9202_nand_hwcontrol+36>: tst r2, #1 ; 0x1
0x21f199b4 <kb9202_nand_hwcontrol+40>: str r3, [r0, #4]
0x21f199b8 <kb9202_nand_hwcontrol+44>: movne r2, #268435456 ; 0x10000000
0x21f199bc <kb9202_nand_hwcontrol+48>: mvnne r3, #1792 ; 0x700
0x21f199c0 <kb9202_nand_hwcontrol+52>: moveq r2, #268435456 ; 0x10000000
0x21f199c4 <kb9202_nand_hwcontrol+56>: mvneq r3, #1792 ; 0x700
0x21f199c8 <kb9202_nand_hwcontrol+60>: strne r2, [r3, #-203]
0x21f199cc <kb9202_nand_hwcontrol+64>: streq r2, [r3, #-207]
0x21f199d0 <kb9202_nand_hwcontrol+68>: cmn r1, #1 ; 0x1
0x21f199d4 <kb9202_nand_hwcontrol+72>: ldrne r2, [r0, #4]
0x21f199d8 <kb9202_nand_hwcontrol+76>: andne r3, r1, #255 ; 0xff
0x21f199dc <kb9202_nand_hwcontrol+80>: strneb r3, [r2]
0x21f199e0 <kb9202_nand_hwcontrol+84>: mov pc, lr
[differences with define]
0x21f199b8 <kb9202_nand_hwcontrol+44>: movne r2, #268435456 ; 0x10000000
0x21f199bc <kb9202_nand_hwcontrol+48>: mvnne r3, #2304 ; 0x900
0x21f199c0 <kb9202_nand_hwcontrol+52>: moveq r2, #268435456 ; 0x10000000
0x21f199c4 <kb9202_nand_hwcontrol+56>: mvneq r3, #2304 ; 0x900
any idea what could be the problem? some kind of compiler optimization
i guess, though i expected the two expressions to be 100% equivalent.
--
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona
An ounce of practice is worth more than tons of preaching
(Mahatma Gandhi)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] kb9202/at91rm9200: compiler quirk?
2009-05-04 18:13 [U-Boot] kb9202/at91rm9200: compiler quirk? Matthias Kaehlcke
@ 2009-05-04 21:26 ` Jean-Christophe PLAGNIOL-VILLARD
2009-05-04 21:54 ` Matthias Kaehlcke
0 siblings, 1 reply; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-05-04 21:26 UTC (permalink / raw)
To: u-boot
On 20:13 Mon 04 May , Matthias Kaehlcke wrote:
> hi,
>
> i'm trying to do a forward port of the out of tree patches for the
> kwikbyte kb9202b. my board is booting and detects the nand flash, but
> only in certain circumstances.
I've never test the nand on rm9200 as the rm9200ek does not have it
but I'll try this
>
> the hwcontrol function looks like this:
>
> #define KB9202_NAND_NCE ((unsigned int)1 << 28) /* EN* on D28 */
unsigned int is not needed
>
> static void kb9202_nand_hwcontrol(struct mtd_info *mtd, int cmd,
> unsigned int ctrl)
> {
> ...
>
> if (ctrl & NAND_NCE)
> AT91C_BASE_PIOB->PIO_CODR = KB9202_NAND_NCE;
try writel(KB9202_NAND_NCE, AT91C_BASE_PIOB->PIO_CODR);
> else
> AT91C_BASE_PIOB->PIO_SODR = KB9202_NAND_NCE;
and writel(KB9202_NAND_NCE, AT91C_BASE_PIOB->PIO_SODR);
>
> ...
> }
>
> the problem is that for some reason the enable signal isn't generated
> when using the pre-processor constant KB9202_NAND_NCE. on the other
> hand it is generated when using ((unsigned int)1 << 28), instead of
> the define. it took me some hours to figure this out ...
Best Regards,
J.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] kb9202/at91rm9200: compiler quirk?
2009-05-04 21:26 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-05-04 21:54 ` Matthias Kaehlcke
0 siblings, 0 replies; 3+ messages in thread
From: Matthias Kaehlcke @ 2009-05-04 21:54 UTC (permalink / raw)
To: u-boot
hi jean-christophe,
El Mon, May 04, 2009 at 11:26:12PM +0200 Jean-Christophe PLAGNIOL-VILLARD ha dit:
> On 20:13 Mon 04 May , Matthias Kaehlcke wrote:
>
> > i'm trying to do a forward port of the out of tree patches for the
> > kwikbyte kb9202b. my board is booting and detects the nand flash, but
> > only in certain circumstances.
> I've never test the nand on rm9200 as the rm9200ek does not have it
> but I'll try this
> >
> > the hwcontrol function looks like this:
> >
> > #define KB9202_NAND_NCE ((unsigned int)1 << 28) /* EN* on D28 */
> unsigned int is not needed
> >
> > static void kb9202_nand_hwcontrol(struct mtd_info *mtd, int cmd,
> > unsigned int ctrl)
> > {
> > ...
> >
> > if (ctrl & NAND_NCE)
> > AT91C_BASE_PIOB->PIO_CODR = KB9202_NAND_NCE;
> try writel(KB9202_NAND_NCE, AT91C_BASE_PIOB->PIO_CODR);
> > else
> > AT91C_BASE_PIOB->PIO_SODR = KB9202_NAND_NCE;
> and writel(KB9202_NAND_NCE, AT91C_BASE_PIOB->PIO_SODR);
thanks for your response
i just tried it with writel(), but it doesn't work either, not even
without the define :(
any other idea?
--
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona
Yo soy como soy y t? eres como eres, construyamos un mundo donde yo
pueda ser sin dejar de ser yo, donde t? puedas ser sin dejar de ser
t?, y donde ni yo ni t? obliguemos al otro a ser como yo o como t?
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-05-04 21:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-04 18:13 [U-Boot] kb9202/at91rm9200: compiler quirk? Matthias Kaehlcke
2009-05-04 21:26 ` Jean-Christophe PLAGNIOL-VILLARD
2009-05-04 21:54 ` Matthias Kaehlcke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox