Advertisement
Guest User

Original and Rejects

a guest
Dec 22nd, 2012
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.18 KB | None | 0 0
  1. Original:
  2. ---------
  3. /* read chip mfr and id
  4.  * return 0 if they match board config
  5.  * return 1 if not
  6.  */
  7. int nand_chip()
  8. {
  9.     int mfr, id;
  10.  
  11.     NAND_ENABLE_CE();
  12.  
  13.     if (NanD_Command(NAND_CMD_RESET)) {
  14.         printf("Err: RESET\n");
  15.         NAND_DISABLE_CE();
  16.         return 1;
  17.     }
  18.  
  19.     if (NanD_Command(NAND_CMD_READID)) {
  20.         printf("Err: READID\n");
  21.         NAND_DISABLE_CE();
  22.         return 1;
  23.     }
  24.  
  25.     NanD_Address(ADDR_COLUMN, 0);
  26.  
  27.     mfr = READ_NAND(NAND_ADDR);
  28.     id = READ_NAND(NAND_ADDR);
  29.  
  30.     NAND_DISABLE_CE();
  31.  
  32.     switch (mfr) {
  33.         /* Hynix NAND Part */
  34.         case HYNIX4GiB_MFR:
  35.             is_ddr_166M = 0;
  36.             if (is_cpu_family() == CPU_OMAP36XX)
  37.                 return (id != HYNIX4GiB_ID);
  38.             break;
  39.         /* Micron NAND Part */
  40.         case MT29F1G_MFR:
  41.             is_ddr_166M = 1;
  42.             if ((is_cpu_family() == CPU_OMAP34XX) ||
  43.                     (is_cpu_family() == CPU_AM35XX) ||
  44.                     (is_cpu_family() == CPU_OMAP36XX)) {
  45. #ifdef CONFIG_AM3517CRANE
  46.                 return (mfr != MT29F1G_MFR &&
  47.                 !(id == MT29F1G_ID || id == MT29F2G_ID));
  48. #endif
  49.                 return (!((id == MT29F1G_ID) ||
  50.                         (id == MT29F2G_ID) ||
  51.                         (id ==MT29F4G_ID)));
  52.             }
  53.             break;
  54. #ifdef CONFIG_FLASHBOARD
  55.         case SAMSUNG_MFR: /* Samsung NAND on FLASH Board */
  56.             is_ddr_166M = 1;  /* set ddr to 166MHz */
  57.             if (is_cpu_family() == CPU_OMAP36XX)
  58.                 return (id != K9F4G08U0B_ID);
  59.             break;
  60. #else
  61.         case K9F1G08R0A_MFR:
  62. #endif
  63.         default:
  64.             is_ddr_166M = 1;
  65.             break;
  66.     }
  67.  
  68.     return (id != K9F1G08R0A_ID);
  69. }
  70.  
  71.  
  72. Rejects
  73. ---------------
  74. --- drivers/k9f1g08r0a.c
  75. +++ drivers/k9f1g08r0a.c
  76. @@ -185,23 +208,23 @@
  77.  {
  78.     int mfr, id;
  79.  
  80. -   NAND_ENABLE_CE();
  81. +   NAND_ENABLE_CE();
  82.  
  83. -   if (NanD_Command(NAND_CMD_RESET)) {
  84. -       printf("Err: RESET\n");
  85. -       NAND_DISABLE_CE();  
  86. +   if (NanD_Command(NAND_CMD_RESET)) {
  87. +       printf("Err: RESET\n");
  88. +       NAND_DISABLE_CE();  
  89.         return 1;
  90.     }
  91.  
  92. -   if (NanD_Command(NAND_CMD_READID)) {
  93. -       printf("Err: READID\n");
  94. -       NAND_DISABLE_CE();
  95. +   if (NanD_Command(NAND_CMD_READID)) {
  96. +       printf("Err: READID\n");
  97. +       NAND_DISABLE_CE();
  98.         return 1;
  99. -   }
  100. +   }
  101.  
  102. -   NanD_Address(ADDR_COLUMN, 0);
  103. +   NanD_Address(ADDR_COLUMN, 0);
  104.  
  105. -   mfr = READ_NAND(NAND_ADDR);
  106. +   mfr = READ_NAND(NAND_ADDR);
  107.     id = READ_NAND(NAND_ADDR);
  108.  
  109.     NAND_DISABLE_CE();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement