Helped to debug a previously unknown nand chip.

Signed-off-by: Luc Verhaegen <l...@skynet.be>
---
 fs/fat/fat.c                         |    6 +++++-
 nand_sunxi/nand_drv/nand_for_uboot.c |   14 ++++++++------
 nand_sunxi/src/scan/nand_scan.c      |    8 ++++----
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 5a75513..bfc8f92 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -81,8 +81,10 @@ int fat_register_device (block_dev_desc_t * dev_desc, int 
part_no)
 
        disk_partition_t info;
 
-       if (!dev_desc->block_read)
+       if (!dev_desc->block_read) {
+               printf("** block device lacks block_read **\n");
                return -1;
+       }
 
        cur_dev = dev_desc;
        /* check if we have a MBR (on floppies we have only a PBR) */
@@ -94,6 +96,8 @@ int fat_register_device (block_dev_desc_t * dev_desc, int 
part_no)
        if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 ||
            buffer[DOS_PART_MAGIC_OFFSET + 1] != 0xaa) {
                /* no signature found */
+               printf("** no FAT signature found on part %d of device %d**\n",
+                      part_no, dev_desc->dev);
                return -1;
        }
 #if (defined(CONFIG_CMD_IDE) || \
diff --git a/nand_sunxi/nand_drv/nand_for_uboot.c 
b/nand_sunxi/nand_drv/nand_for_uboot.c
index 72be703..b12663a 100644
--- a/nand_sunxi/nand_drv/nand_for_uboot.c
+++ b/nand_sunxi/nand_drv/nand_for_uboot.c
@@ -224,20 +224,20 @@ int NAND_PhyInit(void)
        ret = PHY_Init();
        if (ret)
        {
-               OSAL_printf("NB1 : nand phy init fail\n");
+               printf("NB1 : nand phy init fail\n");
                return ret;
        }
 
        ret = SCN_AnalyzeNandSystem();
        if (ret)
        {
-               OSAL_printf("NB1 : nand scan fail\n");
+               printf("NB1 : nand scan fail\n");
                return ret;
        }
        //modify ValidBlkRatio
     //NAND_SetValidBlkRatio(nand_good_blk_ratio);
 
-       OSAL_printf("NB1 : nand phy init ok\n");
+       printf("NB1 : nand phy init ok\n");
        return(PHY_ChangeMode(1));
 }
 
@@ -326,7 +326,7 @@ int NAND_Init(void)
        result = NAND_PhyInit();
        if (result < 0)
        {
-               OSAL_printf("NB1 : phy init fail\n");
+               printf("NB1 : phy init fail\n");
                return -1;
        }
 
@@ -334,20 +334,21 @@ int NAND_Init(void)
     result = FMT_Init();
     if(result < 0)
     {
-       OSAL_printf("NB1 : format init fail\n");
+           printf("NB1 : format init fail\n");
                return -5;
     }
 
     result = FMT_FormatNand();
     if(result < 0)
     {
-       OSAL_printf("NB1 : format fail\n");
+       printf("NB1 : format fail\n");
         return -6;
     }
 
     result = FMT_Exit();
     if(result < 0)
     {
+       printf("FMT_Exit failed\n");
         return -7;
     }
 
@@ -355,6 +356,7 @@ int NAND_Init(void)
     result = LML_Init();
     if(result < 0)
     {
+        printf("LML_Init failed\n");
          return -8;
     }
 #ifdef BOOT_CACHE_OPEN
diff --git a/nand_sunxi/src/scan/nand_scan.c b/nand_sunxi/src/scan/nand_scan.c
index df23953..b4903e2 100644
--- a/nand_sunxi/src/scan/nand_scan.c
+++ b/nand_sunxi/src/scan/nand_scan.c
@@ -292,7 +292,7 @@ __s32  SCN_AnalyzeNandSystem(void)
     result |= PHY_SynchBank(BOOT_CHIP_SELECT_NUM, SYNC_CHIP_MODE);
     if(result)
     {
-        SCAN_ERR("[SCAN_ERR] Reset boot nand flash chip failed!\n");
+        printf("[SCAN_ERR] Reset boot nand flash chip failed!\n");
         return -1;
     }
 
@@ -300,7 +300,7 @@ __s32  SCN_AnalyzeNandSystem(void)
     result = PHY_ReadNandId(BOOT_CHIP_SELECT_NUM, tmpChipID);
     if(result)
     {
-        SCAN_ERR("[SCAN_ERR] Read chip ID from boot chip failed!\n");
+        printf("[SCAN_ERR] Read chip ID from boot chip failed!\n");
         return -1;
     }
     SCAN_DBG("[SCAN_DBG] Nand flash chip id is:0x%x 0x%x 0x%x 0x%x 0x%x 
0x%x\n",
@@ -310,7 +310,7 @@ __s32  SCN_AnalyzeNandSystem(void)
     result = _SearchNandArchi(tmpChipID, &tmpNandPhyInfo);
     if(result)
     {
-        SCAN_ERR("[SCAN_ERR] search nand physical architecture parameter 
failed!\n");
+        printf("[SCAN_ERR] search nand physical architecture parameter 
failed!\n");
         return -1;
     }
 
@@ -445,7 +445,7 @@ __s32  SCN_AnalyzeNandSystem(void)
 
                if( NandStorageInfo.RbConnectMode == 0xff)
             {
-                   SCAN_ERR("%s : check nand rb connect fail, ChipCnt =  %x, 
ChipConnectInfo = %x \n",__FUNCTION__, NandStorageInfo.ChipCnt, 
NandStorageInfo.ChipConnectInfo);
+                   printf("%s : check nand rb connect fail, ChipCnt =  %x, 
ChipConnectInfo = %x \n",__FUNCTION__, NandStorageInfo.ChipCnt, 
NandStorageInfo.ChipConnectInfo);
                    return -1;
                }
 
-- 
1.7.7

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to