diff options
| author | Chuanxiao Dong <chuanxiao.dong@intel.com> | 2010-08-09 12:16:51 -0400 |
|---|---|---|
| committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-08-10 19:28:40 -0400 |
| commit | 7cfffac06ca0d45040db228ce1835f5cf8623916 (patch) | |
| tree | 150019f9e6f393971bc1ee56f32fbf536f207235 | |
| parent | 8ae61ebddba8a0cf96f61e592acaa12800e50727 (diff) | |
nand/denali: use dev_xx debug function to replace nand_dbg_print and some printk
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
| -rw-r--r-- | drivers/mtd/nand/denali.c | 208 | ||||
| -rw-r--r-- | drivers/mtd/nand/denali.h | 18 |
2 files changed, 42 insertions, 184 deletions
diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index e4462c0740b2..f59dd03f36d4 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c | |||
| @@ -119,9 +119,6 @@ static const uint32_t reset_complete[4] = {INTR_STATUS0__RST_COMP, | |||
| 119 | INTR_STATUS2__RST_COMP, | 119 | INTR_STATUS2__RST_COMP, |
| 120 | INTR_STATUS3__RST_COMP}; | 120 | INTR_STATUS3__RST_COMP}; |
| 121 | 121 | ||
| 122 | /* specifies the debug level of the driver */ | ||
| 123 | static int nand_debug_level; | ||
| 124 | |||
| 125 | /* forward declarations */ | 122 | /* forward declarations */ |
| 126 | static void clear_interrupts(struct denali_nand_info *denali); | 123 | static void clear_interrupts(struct denali_nand_info *denali); |
| 127 | static uint32_t wait_for_irq(struct denali_nand_info *denali, | 124 | static uint32_t wait_for_irq(struct denali_nand_info *denali, |
| @@ -130,8 +127,6 @@ static void denali_irq_enable(struct denali_nand_info *denali, | |||
| 130 | uint32_t int_mask); | 127 | uint32_t int_mask); |
| 131 | static uint32_t read_interrupt_status(struct denali_nand_info *denali); | 128 | static uint32_t read_interrupt_status(struct denali_nand_info *denali); |
| 132 | 129 | ||
| 133 | #define DEBUG_DENALI 0 | ||
| 134 | |||
| 135 | /* Certain operations for the denali NAND controller use | 130 | /* Certain operations for the denali NAND controller use |
| 136 | * an indexed mode to read/write data. The operation is | 131 | * an indexed mode to read/write data. The operation is |
| 137 | * performed by writing the address value of the command | 132 | * performed by writing the address value of the command |
| @@ -181,11 +176,6 @@ static void read_status(struct denali_nand_info *denali) | |||
| 181 | 176 | ||
| 182 | /* update buffer with status value */ | 177 | /* update buffer with status value */ |
| 183 | write_byte_to_buf(denali, ioread32(denali->flash_mem + 0x10)); | 178 | write_byte_to_buf(denali, ioread32(denali->flash_mem + 0x10)); |
| 184 | |||
| 185 | #if DEBUG_DENALI | ||
| 186 | printk(KERN_INFO "device reporting status value of 0x%2x\n", | ||
| 187 | denali->buf.buf[0]); | ||
| 188 | #endif | ||
| 189 | } | 179 | } |
| 190 | 180 | ||
| 191 | /* resets a specific device connected to the core */ | 181 | /* resets a specific device connected to the core */ |
| @@ -204,7 +194,7 @@ static void reset_bank(struct denali_nand_info *denali) | |||
| 204 | irq_status = wait_for_irq(denali, irq_mask); | 194 | irq_status = wait_for_irq(denali, irq_mask); |
| 205 | 195 | ||
| 206 | if (irq_status & operation_timeout[denali->flash_bank]) | 196 | if (irq_status & operation_timeout[denali->flash_bank]) |
| 207 | printk(KERN_ERR "reset bank failed.\n"); | 197 | dev_err(&denali->dev->dev, "reset bank failed.\n"); |
| 208 | } | 198 | } |
| 209 | 199 | ||
| 210 | /* Reset the flash controller */ | 200 | /* Reset the flash controller */ |
| @@ -212,7 +202,7 @@ static uint16_t denali_nand_reset(struct denali_nand_info *denali) | |||
| 212 | { | 202 | { |
| 213 | uint32_t i; | 203 | uint32_t i; |
| 214 | 204 | ||
| 215 | nand_dbg_print(NAND_DBG_TRACE, "%s, Line %d, Function: %s\n", | 205 | dev_dbg(&denali->dev->dev, "%s, Line %d, Function: %s\n", |
| 216 | __FILE__, __LINE__, __func__); | 206 | __FILE__, __LINE__, __func__); |
| 217 | 207 | ||
| 218 | for (i = 0 ; i < LLD_MAX_FLASH_BANKS; i++) | 208 | for (i = 0 ; i < LLD_MAX_FLASH_BANKS; i++) |
| @@ -228,7 +218,7 @@ static uint16_t denali_nand_reset(struct denali_nand_info *denali) | |||
| 228 | ; | 218 | ; |
| 229 | if (ioread32(denali->flash_reg + intr_status_addresses[i]) & | 219 | if (ioread32(denali->flash_reg + intr_status_addresses[i]) & |
| 230 | operation_timeout[i]) | 220 | operation_timeout[i]) |
| 231 | nand_dbg_print(NAND_DBG_WARN, | 221 | dev_dbg(&denali->dev->dev, |
| 232 | "NAND Reset operation timed out on bank %d\n", i); | 222 | "NAND Reset operation timed out on bank %d\n", i); |
| 233 | } | 223 | } |
| 234 | 224 | ||
| @@ -266,7 +256,7 @@ static void nand_onfi_timing_set(struct denali_nand_info *denali, | |||
| 266 | uint16_t acc_clks; | 256 | uint16_t acc_clks; |
| 267 | uint16_t addr_2_data, re_2_we, re_2_re, we_2_re, cs_cnt; | 257 | uint16_t addr_2_data, re_2_we, re_2_re, we_2_re, cs_cnt; |
| 268 | 258 | ||
| 269 | nand_dbg_print(NAND_DBG_TRACE, "%s, Line %d, Function: %s\n", | 259 | dev_dbg(&denali->dev->dev, "%s, Line %d, Function: %s\n", |
| 270 | __FILE__, __LINE__, __func__); | 260 | __FILE__, __LINE__, __func__); |
| 271 | 261 | ||
| 272 | en_lo = CEIL_DIV(Trp[mode], CLK_X); | 262 | en_lo = CEIL_DIV(Trp[mode], CLK_X); |
| @@ -303,7 +293,7 @@ static void nand_onfi_timing_set(struct denali_nand_info *denali, | |||
| 303 | acc_clks++; | 293 | acc_clks++; |
| 304 | 294 | ||
| 305 | if ((data_invalid - acc_clks * CLK_X) < 2) | 295 | if ((data_invalid - acc_clks * CLK_X) < 2) |
| 306 | nand_dbg_print(NAND_DBG_WARN, "%s, Line %d: Warning!\n", | 296 | dev_warn(&denali->dev->dev, "%s, Line %d: Warning!\n", |
| 307 | __FILE__, __LINE__); | 297 | __FILE__, __LINE__); |
| 308 | 298 | ||
| 309 | addr_2_data = CEIL_DIV(Tadl[mode], CLK_X); | 299 | addr_2_data = CEIL_DIV(Tadl[mode], CLK_X); |
| @@ -431,7 +421,7 @@ static void get_hynix_nand_para(struct denali_nand_info *denali, | |||
| 431 | #endif | 421 | #endif |
| 432 | break; | 422 | break; |
| 433 | default: | 423 | default: |
| 434 | nand_dbg_print(NAND_DBG_WARN, | 424 | dev_warn(&denali->dev->dev, |
| 435 | "Spectra: Unknown Hynix NAND (Device ID: 0x%x)." | 425 | "Spectra: Unknown Hynix NAND (Device ID: 0x%x)." |
| 436 | "Will use default parameter values instead.\n", | 426 | "Will use default parameter values instead.\n", |
| 437 | device_id); | 427 | device_id); |
| @@ -453,7 +443,7 @@ static void find_valid_banks(struct denali_nand_info *denali) | |||
| 453 | index_addr_read_data(denali, | 443 | index_addr_read_data(denali, |
| 454 | (uint32_t)(MODE_11 | (i << 24) | 2), &id[i]); | 444 | (uint32_t)(MODE_11 | (i << 24) | 2), &id[i]); |
| 455 | 445 | ||
| 456 | nand_dbg_print(NAND_DBG_DEBUG, | 446 | dev_dbg(&denali->dev->dev, |
| 457 | "Return 1st ID for bank[%d]: %x\n", i, id[i]); | 447 | "Return 1st ID for bank[%d]: %x\n", i, id[i]); |
| 458 | 448 | ||
| 459 | if (i == 0) { | 449 | if (i == 0) { |
| @@ -473,12 +463,13 @@ static void find_valid_banks(struct denali_nand_info *denali) | |||
| 473 | * Multichip support is not enabled. | 463 | * Multichip support is not enabled. |
| 474 | */ | 464 | */ |
| 475 | if (denali->total_used_banks != 1) { | 465 | if (denali->total_used_banks != 1) { |
| 476 | printk(KERN_ERR "Sorry, Intel CE4100 only supports " | 466 | dev_err(&denali->dev->dev, |
| 467 | "Sorry, Intel CE4100 only supports " | ||
| 477 | "a single NAND device.\n"); | 468 | "a single NAND device.\n"); |
| 478 | BUG(); | 469 | BUG(); |
| 479 | } | 470 | } |
| 480 | } | 471 | } |
| 481 | nand_dbg_print(NAND_DBG_DEBUG, | 472 | dev_dbg(&denali->dev->dev, |
| 482 | "denali->total_used_banks: %d\n", denali->total_used_banks); | 473 | "denali->total_used_banks: %d\n", denali->total_used_banks); |
| 483 | } | 474 | } |
| 484 | 475 | ||
| @@ -512,8 +503,9 @@ static uint16_t denali_nand_timing_set(struct denali_nand_info *denali) | |||
| 512 | uint32_t id_bytes[5], addr; | 503 | uint32_t id_bytes[5], addr; |
| 513 | uint8_t i, maf_id, device_id; | 504 | uint8_t i, maf_id, device_id; |
| 514 | 505 | ||
| 515 | nand_dbg_print(NAND_DBG_TRACE, "%s, Line %d, Function: %s\n", | 506 | dev_dbg(&denali->dev->dev, |
| 516 | __FILE__, __LINE__, __func__); | 507 | "%s, Line %d, Function: %s\n", |
| 508 | __FILE__, __LINE__, __func__); | ||
| 517 | 509 | ||
| 518 | /* Use read id method to get device ID and other | 510 | /* Use read id method to get device ID and other |
| 519 | * params. For some NAND chips, controller can't | 511 | * params. For some NAND chips, controller can't |
| @@ -540,12 +532,14 @@ static uint16_t denali_nand_timing_set(struct denali_nand_info *denali) | |||
| 540 | get_hynix_nand_para(denali, device_id); | 532 | get_hynix_nand_para(denali, device_id); |
| 541 | } | 533 | } |
| 542 | 534 | ||
| 543 | nand_dbg_print(NAND_DBG_DEBUG, "Dump timing register values:" | 535 | dev_info(&denali->dev->dev, |
| 544 | "acc_clks: %d, re_2_we: %d, we_2_re: %d," | 536 | "Dump timing register values:" |
| 545 | "addr_2_data: %d, rdwr_en_lo_cnt: %d, " | 537 | "acc_clks: %d, re_2_we: %d, re_2_re: %d\n" |
| 538 | "we_2_re: %d, addr_2_data: %d, rdwr_en_lo_cnt: %d\n" | ||
| 546 | "rdwr_en_hi_cnt: %d, cs_setup_cnt: %d\n", | 539 | "rdwr_en_hi_cnt: %d, cs_setup_cnt: %d\n", |
| 547 | ioread32(denali->flash_reg + ACC_CLKS), | 540 | ioread32(denali->flash_reg + ACC_CLKS), |
| 548 | ioread32(denali->flash_reg + RE_2_WE), | 541 | ioread32(denali->flash_reg + RE_2_WE), |
| 542 | ioread32(denali->flash_reg + RE_2_RE), | ||
| 549 | ioread32(denali->flash_reg + WE_2_RE), | 543 | ioread32(denali->flash_reg + WE_2_RE), |
| 550 | ioread32(denali->flash_reg + ADDR_2_DATA), | 544 | ioread32(denali->flash_reg + ADDR_2_DATA), |
| 551 | ioread32(denali->flash_reg + RDWR_EN_LO_CNT), | 545 | ioread32(denali->flash_reg + RDWR_EN_LO_CNT), |
| @@ -568,7 +562,7 @@ static uint16_t denali_nand_timing_set(struct denali_nand_info *denali) | |||
| 568 | static void denali_set_intr_modes(struct denali_nand_info *denali, | 562 | static void denali_set_intr_modes(struct denali_nand_info *denali, |
| 569 | uint16_t INT_ENABLE) | 563 | uint16_t INT_ENABLE) |
| 570 | { | 564 | { |
| 571 | nand_dbg_print(NAND_DBG_TRACE, "%s, Line %d, Function: %s\n", | 565 | dev_dbg(&denali->dev->dev, "%s, Line %d, Function: %s\n", |
| 572 | __FILE__, __LINE__, __func__); | 566 | __FILE__, __LINE__, __func__); |
