OpenWrt Forum Archive

Topic: bootloader for MX29LV320D (D-Link DWL-2100AP rev A5)

The content of this topic has been archived on 13 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Flash chip:
        MX29LV320DBTI-70G
        http://datasheet.octopart.com/MX29LV320 … 325138.pdf

Bootloader:
        redboot
        http://downloads.openwrt.org/reference/redboot.tar.bz2

Problem:

        +FLASH: driver init failed: Driver does not support device                     
        FLASH: driver init failed: Driver does not support device                       
        Ethernet eth1: MAC address 14:d6:4d:53:d0:e7                                   
        Can't get BOOTP info for device!                                               
                                                                               
        RedBoot(tm) bootstrap and debug environment [ROM]                               
        Non-certified release, version v2_0 - built 09:14:46, Aug 25 2011               
                                                                               
        Copyright (C) 2000, 2001, 2002, Red Hat, Inc.                                   
                                                                               
        RAM: 0x80000400-0x80800000, 0x80000400-0x807f4000 available                     
        RedBoot> fis init -f                                                           
        FLASH: driver init failed: Driver does not support device                       
        Sorry, no FLASH memory is available                                             
        RedBoot>

Steps to reproduce:

        To prevent errors:
        find redboot/ -type f | xargs perl -i -pe 's/tail \+2/tail -n +2/g'

        ./build_platform (choose 'ap48')

        jtag> cable WIGGLER PPDEV /dev/parport0
        jtag> detect
        jtag> include atheros/ar2312/ar2312
        jtag> poke 0x58400000 0x000e3ce1
        jtag> detectflash 0x1fc00000
        jtag> flashmem 0x1fc00000 redboot/buildROM_ap48/install/bin/redboot.rom

Had a quick look for ya. Try changing packages\hal\mips\ap48\v2_0\misc\redboot_ROM.ecm

Replace cdl_option, CYGHWR_DEVS_FLASH_AMD_AM29LV160 with CYGHWR_DEVS_FLASH_AMD_AM29LV320D

This didn't help. The same error.

Maybe this has to do with UrJTAG ?

jtag> help flashmem
...
Supported Flash Memories:
AMD/Fujitsu Standard Command Set
     supported: AMD 29LV640D, 29LV641D, 29LV642D; 2x16 Bit
AMD/Fujitsu Standard Command Set
     supported: AMD 29LV800B, S92GLxxxN; MX29LV640B; 1x16 Bit
AMD/Fujitsu Standard Command Set
     supported: AMD 29LV160, AMD 29LV065D, AMD 29LV040B, S92GLxxxN; 1x8 Bit
Intel Standard Command Set
     supported: 28Fxxxx, 2 x 16 bit
Intel Standard Command Set
     supported: 28Fxxxx, 1 x 16 bit
Intel Standard Command Set
     supported: 28Fxxxx, 1 x 8 bit
AMD Standard Command Set
     supported: AMD 29LV040B, 29C040B, 1x8 Bit

Where do the values in flash layout come from ?

    {   // AM29LV320D
        device_id  : FLASHWORD(0xF9),
        block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
        block_count: 64,
        device_size: 0x400000 * CYGNUM_FLASH_INTERLEAVE,
        base_mask  : ~(0x400000 * CYGNUM_FLASH_INTERLEAVE - 1),
        bootblock  : true,
        bootblocks : { 0x000000 * CYGNUM_FLASH_INTERLEAVE,
                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
                       _LAST_BOOTBLOCK
                     },
        banked     : false
    },

My redboot source is custom so i do things very differently.

You could try this hackish way,

build as usual, cd into the build dir, take a look at ecos.ecc. see if you can find your flash part and if its enabled

should be something like

cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 {
    # Flavor: bool
    # No user value, uncomment the following line to provide one.
    # user_value 0
    # The inferred value should not be edited directly.
    inferred_value 1
    # value_source inferred
    # Default value: 0
};

# AMD AM29LV320 flash memory support
# When this option is enabled, the AMD flash driver will be
# able to recognize and handle the AMD29LV320
# part in the family.
#
cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV320D {
    # Flavor: bool
    # user_value 0
    # value_source default
    # Default value: 0

replace it with

cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 {
    # Flavor: bool
    # No user value, uncomment the following line to provide one.
    # user_value 0
    # value_source default
    # Default value: 0
};

# AMD AM29LV320 flash memory support
# When this option is enabled, the AMD flash driver will be
# able to recognize and handle the AMD29LV320
# part in the family.
#
cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV320D {
    # Flavor: bool
    user_value 1
    # value_source user
    # Default value: 0

# cd ..
# ECOS_REPOSITORY=`pwd`/ecos-2.0/packages export ECOS_REPOSITORY
# PATH=`pwd`/gnutools/mipsisa32-elf/bin:$PATH export PATH
# PATH=`pwd`/ecos-2.0/tools/bin:$PATH export PATH
# cd [BUILD_DIR]

delete everything except ecos.ecc

# ecosconfig tree
# make
# cd install/bin
# mipsisa32-elf-objcopy -O binary redboot.elf redboot.rom

I cant guarantee it will work though.

(Last edited by routednbooted on 27 Aug 2011, 07:46)

routednbooted, please share your redboot source or a patch. It's interesting to have a look.

Everything was done exactly as said in post #6.
It became clear from disassembling rom image that there is absolutely no difference between what is done in post #2 and post #6.

Following is the diff of the disassembled rom image between pristine source and routednbooted's advice:

@@ -43418,31 +43418,39 @@

9fc29898 <supported_devices>:
9fc29898:    00000000     nop
-9fc2989c:    c4000000     lwc1    $f0,0(zero)
+9fc2989c:    f6000000     sdc1    $f0,0(s0)
9fc298a0:    00010000     sll    zero,at,0x0
-9fc298a4:    00000020     add    zero,zero,zero
-9fc298a8:    ffe00000     sdc3    $0,0(ra)
-9fc298ac:    00200000     0x200000
+9fc298a4:    00000040     ssnop
+9fc298a8:    ffc00000     sdc3    $0,0(s8)
+9fc298ac:    00400000     0x400000
9fc298b0:    00000001     movf    zero,zero,$fcc0
-9fc298b4:    001f0000     sll    zero,ra,0x0
-9fc298b8:    00008000     sll    s0,zero,0x0
+9fc298b4:    003f0000     0x3f0000
+9fc298b8:    00002000     sll    a0,zero,0x0
9fc298bc:    00002000     sll    a0,zero,0x0
9fc298c0:    00002000     sll    a0,zero,0x0
-9fc298c4:    00004000     sll    t0,zero,0x0
-9fc298c8:    ffffffff     sdc3    $31,-1(ra)
+9fc298c4:    00002000     sll    a0,zero,0x0
+9fc298c8:    00002000     sll    a0,zero,0x0
+9fc298cc:    00002000     sll    a0,zero,0x0
+9fc298d0:    00002000     sll    a0,zero,0x0
+9fc298d4:    00002000     sll    a0,zero,0x0
+9fc298d8:    ffffffff     sdc3    $31,-1(ra)
    ...
-9fc299dc:    49000000     bc2f    9fc299e0 <supported_devices+0x148>
+9fc299dc:    f9000000     sdc2    $0,0(t0)
9fc299e0:    00010000     sll    zero,at,0x0
-9fc299e4:    00000020     add    zero,zero,zero
-9fc299e8:    ffe00000     sdc3    $0,0(ra)
-9fc299ec:    00200000     0x200000
+9fc299e4:    00000040     ssnop
+9fc299e8:    ffc00000     sdc3    $0,0(s8)
+9fc299ec:    00400000     0x400000
9fc299f0:    00000001     movf    zero,zero,$fcc0
9fc299f4:    00000000     nop
-9fc299f8:    00004000     sll    t0,zero,0x0
+9fc299f8:    00002000     sll    a0,zero,0x0
9fc299fc:    00002000     sll    a0,zero,0x0
9fc29a00:    00002000     sll    a0,zero,0x0
-9fc29a04:    00008000     sll    s0,zero,0x0
-9fc29a08:    ffffffff     sdc3    $31,-1(ra)
+9fc29a04:    00002000     sll    a0,zero,0x0
+9fc29a08:    00002000     sll    a0,zero,0x0
+9fc29a0c:    00002000     sll    a0,zero,0x0
+9fc29a10:    00002000     sll    a0,zero,0x0
+9fc29a14:    00002000     sll    a0,zero,0x0
+9fc29a18:    ffffffff     sdc3    $31,-1(ra)
    ...

9fc29b18 <hexchars>:

SOLVED

The problem was with device id detection. Hardcoding solved the problem.

diff -ur redboot/ecos-2.0/packages/devs/flash/amd/am29xxxxx/v2_0/include/flash_am29xxxxx.inl redboot-new//ecos-2.0/packages/devs/flash/amd/am29xxxxx/v2_0/include/flash_am29xxxxx.inl
--- redboot/ecos-2.0/packages/devs/flash/amd/am29xxxxx/v2_0/include/flash_am29xxxxx.inl    2011-09-02 09:27:55.000000000 +0800
+++ redboot-new//ecos-2.0/packages/devs/flash/amd/am29xxxxx/v2_0/include/flash_am29xxxxx.inl    2011-09-02 09:31:12.000000000 +0800
@@ -155,8 +155,28 @@
 } flash_dev_info_t;
 
 static const flash_dev_info_t* flash_dev_info;
+#define _LAST_BOOTBLOCK (-1)
 static const flash_dev_info_t supported_devices[] = {
-#include <cyg/io/flash_am29xxxxx_parts.inl>
+    {   // AM29LV320D
+        device_id  : FLASHWORD(0xF9),
+        block_size : 0x10000 * CYGNUM_FLASH_INTERLEAVE,
+        block_count: 64,
+        device_size: 0x400000 * CYGNUM_FLASH_INTERLEAVE,
+        base_mask  : ~(0x400000 * CYGNUM_FLASH_INTERLEAVE - 1),
+        bootblock  : true,
+        bootblocks : { 0x000000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       0x002000 * CYGNUM_FLASH_INTERLEAVE,
+                       _LAST_BOOTBLOCK
+                     },
+        banked     : false
+    },
 };
 #define NUM_DEVICES (sizeof(supported_devices)/sizeof(flash_dev_info_t))
 
@@ -240,7 +260,7 @@
 flash_hwr_init(void)
 {
     flash_data_t id[4];
-    int i;
+//    int i;
 
     CYGHWR_FLASH_AM29XXXXX_PLF_INIT();
 
@@ -248,6 +268,7 @@
 
     // Look through table for device data
     flash_dev_info = supported_devices;
+/*
     for (i = 0; i < NUM_DEVICES; i++) {
         if (!flash_dev_info->long_device_id && flash_dev_info->device_id == id[1])
             break;
@@ -261,7 +282,7 @@
     // Did we find the device? If not, return error.
     if (NUM_DEVICES == i)
         return FLASH_ERR_DRV_WRONG_PART;
-
+*/
     // Hard wired for now
     flash_info.block_size = flash_dev_info->block_size;
     flash_info.blocks = flash_dev_info->block_count * CYGNUM_FLASH_SERIES;
routednbooted wrote:

My redboot source is custom so i do things very differently.

You could try this hackish way,

build as usual, cd into the build dir, take a look at ecos.ecc. see if you can find your flash part and if its enabled

should be something like

cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 {
    # Flavor: bool
    # No user value, uncomment the following line to provide one.
    # user_value 0
    # The inferred value should not be edited directly.
    inferred_value 1
    # value_source inferred
    # Default value: 0
};

# AMD AM29LV320 flash memory support
# When this option is enabled, the AMD flash driver will be
# able to recognize and handle the LV320
# part in the family.
#
cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV320D {
    # Flavor: bool
    # user_value 0
    # value_source default
    # Default value: 0

replace it with

cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV160 {
    # Flavor: bool
    # No user value, uncomment the following line to provide one.
    # user_value 0
    # value_source default
    # Default value: 0
};

# AMD AM29LV320 flash memory support
# When this option is enabled, the AMD flash driver will be
# able to recognize and handle the AMD29LV320
# part in the family.
#
cdl_option CYGHWR_DEVS_FLASH_AMD_AM29LV320D {
    # Flavor: bool
    user_value 1
    # value_source user
    # Default value: 0

# cd ..
# ECOS_REPOSITORY=`pwd`/ecos-2.0/packages export ECOS_REPOSITORY
# PATH=`pwd`/gnutools/mipsisa32-elf/bin:$PATH export PATH
# PATH=`pwd`/ecos-2.0/tools/bin:$PATH export PATH
# cd [BUILD_DIR]

delete everything except ecos.ecc

# ecosconfig tree
# make
# cd install/bin
# mipsisa32-elf-objcopy -O binary redboot.elf redboot.rom

I cant guarantee it will work though.

The problem was with device id detection. Hardcoding solved the problem.

(Last edited by btysd45g on 16 Sep 2011, 17:00)

The discussion might have continued from here.