[#5256] Compact Flash not working in U-Boot 2009R1

Document created by Aaronwu Employee on Sep 25, 2013
Version 1Show Document
  • View in full screen mode

[#5256] Compact Flash not working in U-Boot 2009R1

Submitted By: Jason Holden

Open Date

2009-06-15 10:34:01     Close Date

2010-02-22 10:34:26

Priority:

Medium     Assignee:

Mike Frysinger

Michael Hennerich

Category:

N/A     Fixed In Release:

N/A

Found In Release:

2009R1     Status:

Closed

Board:

EZ-Kit Lite     Processor:

BF537

Silicon Revision:

0.3     Resolution:

Assigned (Not Start)

Is the bug repeatable?:

yes     

Summary: Compact Flash not working in U-Boot 2009R1

Details:

 

I've recently been trying to update u-boot on a 0.3 silicon BF537-EZKit board w/ 128MB of RAM to work w/ compact flash.  I'm using version 0.8 of the CF/Nand/IDE board. 

 

In the old version of u-boot, the compact flash card is detected.  In the latest 2009R1, the bus is not detected.  The tests below where run back to back, only changing the version of u-boot.  I've attached the two patches I used to compile.

 

I launched both captures using the "go 0x1000000" u-boot command.

 

Any idea what could be going wrong here?  I realize there have been almost 1000 commits since my last known-good version, so a lot has changed.  Does anyone else have compact flash working w/ the latest u-boot?

 

 

Output of trunk@964 (Compact Flash Works!)

## Starting application at 0x01000000 ...                                      

                                                                               

                                                                               

U-Boot 1.1.6-ge2139076-svn (ADI-2007R2-pre) (Jun 15 2009 - 09:37:31)           

                                                                               

CPU:   ADSP bf537-0.2 (Detected Rev: 0.3)                                      

Board: ADI BF537 stamp board                                                   

       Support: http://blackfin.uclinux.org/                                   

Clock: VCO: 500 MHz, Core: 500 MHz, System: 100 MHz                            

SDRAM: 128 MB                                                                  

FLASH:  4 MB                                                                   

In:    serial                                                                  

Out:   serial                                                                  

Err:   serial                                                                  

Using CF True IDE Mode                                                         

Bus 0: OK                                                                      

  Device 0: Model: HMS360604D5CF00  Firm: DP4EC42D Ser#: ND4P034BZY96GL        

            Type: Hard Disk                                                    

            Capacity: 3906.0 MB = 3.8 GB (7999488 x 512)                       

Net:   Blackfin EMAC                                                           

I2C:   ready                                                                   

Hit any key to stop autoboot:  0                                               

bfin>

 

 

Output of 2009R1@1914 (Compact Flash Broken!)

## Starting application at 0x01000000 ...                                      

                                                                               

                                                                               

U-Boot 2008.10 (ADI-2009R1-rc2) (Jun 15 2009 - 09:51:45)                       

                                                                               

CPU:   ADSP bf537-0.2 (Detected Rev: 0.3) (bypass boot)                        

Board: ADI BF537 stamp board                                                   

       Support: http://blackfin.uclinux.org/                                   

Clock: VCO: 500 MHz, Core: 500 MHz, System: 100 MHz                            

RAM:   128 MB                                                                  

Flash:  4 MB                                                                   

In:    serial                                                                  

Out:   serial                                                                  

Err:   serial                                                                  

Using CF True IDE Mode                                                         

Bus 0: not available                                                           

Net:   Warning: Generating 'random' MAC address                                

Blackfin EMAC                                                                  

MAC:   FE:B7:A0:FA:D7:C7                                                       

Hit any key to stop autoboot:  0                                               

bfin>

 

Follow-ups

 

--- Mike Frysinger                                           2009-06-15 10:42:51

it's known to be broken with anything newer than 1.1.6.  there is a task already

to fix this, but with no one asking for it, it was a low priority.  no research

has been done on it yet.

 

dupe of [#4542].

 

--- Jason Holden                                             2009-06-15 11:51:45

Fix is attached in fix_compact_flash_in_2009R1.diff

 

It was basically just reapplying the fix that had been present in 1.1.6 but was

never brought forward to 2008.10.

 

The patch probably needs to be reworked before it is acceptable to mainline.

 

For future reference, I found this be printing out the contents of any

ide_outb() in common/cmd_ide.c and I noticed there were differences between the

working and non-working versions.

 

Not Working:

Using CF True IDE Mode                                                        

 

Bus 0: ide_outb (dev= 0, port= 0x2c, val= 0xe0) : @ 0x2031c02c                

 

not available

 

Working:

Using CF True IDE Mode                                                        

 

Bus 0: ide_outb (dev= 0, port= 0x26, val= 0xe0) : @ 0x2031c026                

 

OK                                                                            

 

  Device 0: ide_outb (dev= 0, port= 0x26, val= 0xe0) : @ 0x2031c026           

 

ide_outb (dev= 0, port= 0x2026, val= 0xec) : @ 0x2031e026                     

 

Model: HMS360604D5CF00  Firm: DP4EC42D Ser#: ND4P034BZY96GL                   

 

            Type: Hard Disk                                                   

 

            Capacity: 3906.0 MB = 3.8 GB (7999488 x 512)                      

 

ide_outb (dev= 0, port= 0x26, val= 0xe0) : @ 0x2031c026                       

 

ide_outb (dev= 0, port= 0x2026, val= 0xe5) : @ 0x2031e026                     

 

ide_outb (dev= 0, port= 0x22, val= 0x01) : @ 0x2031c022                       

 

ide_outb (dev= 0, port= 0x2022, val= 0x00) : @ 0x2031e022                     

 

ide_outb (dev= 0, port= 0x24, val= 0x00) : @ 0x2031c024                       

 

ide_outb (dev= 0, port= 0x2024, val= 0x00) : @ 0x2031e024                     

 

ide_outb (dev= 0, port= 0x26, val= 0xe0) : @ 0x2031c026                       

 

ide_outb (dev= 0, port= 0x2026, val= 0x20) : @ 0x2031e026

 

--- Jason Holden                                             2009-06-15 12:03:06

I keep getting file-not-found when I try and access the fixes on the

"files" tab below.  Please post a follow-up if you are also having

trouble accessing them.  Maybe this is a GForge issue because this bug is

closed???

 

-Jason

 

--- Mike Frysinger                                           2009-06-16 06:28:11

you need to be patient -- the files are pushed to a public mirror and thus not

immediately available

 

--- Mike Frysinger                                           2009-06-16 06:51:49

ok, the change you're looking at is this bad boy:

http://blackfin.uclinux.org/git/?p=readonly-mirrors/u-boot.git;a=commit;h=5f518fe7967d81bf2017846914f534cf16ba8d20

 

now the question is how to do this right.  let's hope Michael knows the answer

;).

 

--- Mike Frysinger                                           2009-06-16 10:42:44

i have restored the hack to the branch at least so it'll work in the next

release

 

--- Michael Hennerich                                        2009-06-16 15:38:22

I posted some explanations here:

 

http://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&_forum_action=MessageReply&message_id=75849

 

I would prefer if we remove the hack.

People interfacing with CF should use the interface posted here:

 

http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:ide-blackfin&s[]=ide&s[]=mode#example_interfacing_a_cf_card_in_true_ide_mode

 

The restored hack will break this.

 

Or they should interface with the Card in Common Memory mode.

The restored hack will break this, too.

 

The restored hack was only there to make the CF-IDE-NAND multifunction card

happy in TRUE-IDE-MODE.

 

Please remove.

Jason please try Common Memory mode in u-boot.

 

-Michael

 

--- Mike Frysinger                                           2009-06-16 16:51:09

the hack is only added for CONFIG_BFIN_TRUE_IDE, so i dont think it'll break

other configurations ?

 

there is no wiki docs for how to program this card in u-boot, and the

BF537-STAMP has a lot of nested logic:

#if defined(CONFIG_BFIN_CF_IDE) || \

    defined(CONFIG_BFIN_HDD_IDE) || \

    defined(CONFIG_BFIN_TRUE_IDE)

# define CONFIG_BFIN_IDE    1

# define CONFIG_CMD_IDE

#endif

 

#if defined(CONFIG_BFIN_IDE)

....

#if defined(CONFIG_BFIN_TRUE_IDE)

....

#elif defined(CONFIG_BFIN_CF_IDE)

....

#elif defined(CONFIG_BFIN_HDD_IDE)

....

 

if only one thing is supported, can we punt the rest ?

 

--- Michael Hennerich                                        2009-06-17 17:05:37

Mike,

 

I guess you are right. -Wasn't aware that we have that much IDE options.

-Will take a look tomorrow. Maybe we should rename some and proper document -

at least with some comment blocks.

 

-Michael

 

--- Michael Hennerich                                        2009-06-18 04:32:00

Hi Jason,

 

I tested the CF Common Memory Support in u-boot.

In your u-boot config file enable CONFIG_BFIN_CF_IDE

 

 

/*

* CF-CARD IDE-HDD Support

*/

/* #define CONFIG_BFIN_TRUE_IDE */    /* Add CF flash card support */

#define CONFIG_BFIN_CF_IDE    /* Add CF flash card support */

/* #define CONFIG_BFIN_HDD_IDE */    /* Add IDE Disk Drive (HDD) support */

 

I also have a CF+ Type II Hitatchi Microdrive -

It works pretty well in common memory mode.

 

 

U-Boot 2009.06-svn1936 (ADI-2009R2-pre) (Jun 18 2009 - 10:07:23)

 

CPU:   ADSP bf537-0.2 (Detected Rev: 0.3) (bypass boot)

Board: ADI BF537 stamp board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 500 MHz, Core: 500 MHz, System: 125 MHz

RAM:   64 MB

Flash:  4 MB

In:    serial

Out:   serial

Err:   serial

Warning: Generating 'random' MAC address

Using CF Common Memory Mode

Bus 0: OK

  Device 0: Model: HMS360604D5CF00  Firm: DP4OC40D Ser#: DNP450B4ZG8ULG

            Type: Removable Hard Disk

            Capacity: 3906.0 MB = 3.8 GB (7999488 x 512)

Net:   Blackfin EMAC

MAC:   aa:8f:68:32:2f:12

Hit any key to stop autoboot:  0

bfin> fatls ide0 0

512000000   foo

 

1 file(s), 0 dir(s)

 

bfin>

 

This is a typical CF Flash Card

 

U-Boot 2009.06-svn1936 (ADI-2009R2-pre) (Jun 18 2009 - 10:07:23)

 

CPU:   ADSP bf537-0.2 (Detected Rev: 0.3) (bypass boot)

Board: ADI BF537 stamp board

       Support: http://blackfin.uclinux.org/

Clock: VCO: 500 MHz, Core: 500 MHz, System: 125 MHz

RAM:   64 MB

Flash:  4 MB

In:    serial

Out:   serial

Err:   serial

Warning: Generating 'random' MAC address

Using CF Common Memory Mode

Bus 0: OK

  Device 0: Model: SanDisk SDCFH-2048 Firm: HDX 4.04 Ser#: 003611L1406M4839

            Type: Removable Hard Disk

            Capacity: 1953.9 MB = 1.9 GB (4001760 x 512)

Net:   Blackfin EMAC

MAC:   aa:8f:68:32:2f:12

Hit any key to stop autoboot:  0

bfin> fatls ide0 0

            flex700/

     1244   icd.jed

     2890   foo_n

     2890   bdm

            all-07a/

 

3 file(s), 2 dir(s)

 

bfin>

 

 

I would try to avoid TRUE-IDE mode with the CF-IDE-NAND card on the CF Socket.

This way you can use the platform pata driver without modifications.

 

Best regards,

Michael

 

--- Mike Frysinger                                           2009-06-18 07:49:50

if one of the modes requires the hack to ata.h, can we remove that from the

bf537-stamp.h completely ?  i only applied the ata.h hack to the branch -- i

want to drop it from trunk and any future release.

 

--- Michael Hennerich                                        2009-06-18 08:04:02

CONFIG_BFIN_TRUE_IDE requires the hack, and this one should be removed.

 

Jason,

 

Can you confirm that CONFIG_BFIN_CF_IDE works for you?

 

-Michael

 

--- Jason Holden                                             2009-06-18 17:58:51

CONFIG_BFIN_CF_IDE works on my SanDisk:

Using CF Common Memory Mode                                                   

 

Bus 0: OK 

  Device 0: Model: SanDisk SDCFH-1024 Firm: HDX 4.04 

            Type: Removable Hard Disk                                         

 

            Capacity: 977.4 MB = 0.9 GB (2001888 x 512)  

 

CONFIG_BFIN_CF_IDE using my favorite flavor of Hitachi drive doesn't work.  We

have about 20 of these, and they all behave the same, so its not just one bad

drive:

Using CF Common Memory Mode                                                   

 

Bus 0: not available                                                          

 

 

I also dug up a different version hitachi drive (Same model number, same size

disk, different part number if I recall correctly, and it looks to be the exact

same one as what you have ) that did work w/ CONFIG_BFIN_CF_IDE:

Using CF Common Memory Mode                                                   

 

Bus 0: OK                                                                     

 

  Device 0: Model: HMS360604D5CF00  Firm: DP4OC40D      

            Type: Removable Hard Disk                                         

 

            Capacity: 3906.0 MB = 3.8 GB (7999488 x 512)                      

 

 

W/ my patch applied and in true-ide mode I can get my favorite model hitachi

driver to work (Note the different firmware version and Type):

 

Using CF True IDE Mode                                                        

 

Bus 0: OK                                                                     

 

  Device 0: Model: HMS360604D5CF00  Firm: DP4EC42D     

            Type: Hard Disk                                                   

 

            Capacity: 3906.0 MB = 3.8 GB (7999488 x 512)     

 

Here the difference between Hard Disk and Removable Hard Disk stands out quite

starkly.  It would be interesting to find another CF card that presents itself

as "Type: Hard Disk" and see if it works in common memory mode.  That

way we would narrow it down to one particular buggy version of Hitachi firmware,

or a whole class of CF devices.

 

 

This was against (2009R1@1914, d2876d30)

 

-Jason

 

--- Michael Hennerich                                        2010-02-22 10:33:37

I guess this tracker item can be closed?

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

cf_works_r964.diff    text/x-patch    1092    Jason Holden

fix_compact_flash_in_2009R1.diff    text/x-patch    1641    Jason Holden

cf_broke_r1914.diff    text/x-patch    1461    Jason Holden

Outcomes