diff options
Diffstat (limited to 'drivers/mtd/nand/mxc_nand.c')
-rw-r--r-- | drivers/mtd/nand/mxc_nand.c | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 90df34c4d26c..74a43b818d0e 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -41,7 +41,7 @@ | |||
41 | 41 | ||
42 | #define nfc_is_v21() (cpu_is_mx25() || cpu_is_mx35()) | 42 | #define nfc_is_v21() (cpu_is_mx25() || cpu_is_mx35()) |
43 | #define nfc_is_v1() (cpu_is_mx31() || cpu_is_mx27() || cpu_is_mx21()) | 43 | #define nfc_is_v1() (cpu_is_mx31() || cpu_is_mx27() || cpu_is_mx21()) |
44 | #define nfc_is_v3_2() cpu_is_mx51() | 44 | #define nfc_is_v3_2() (cpu_is_mx51() || cpu_is_mx53()) |
45 | #define nfc_is_v3() nfc_is_v3_2() | 45 | #define nfc_is_v3() nfc_is_v3_2() |
46 | 46 | ||
47 | /* Addresses for NFC registers */ | 47 | /* Addresses for NFC registers */ |
@@ -143,7 +143,6 @@ | |||
143 | struct mxc_nand_host { | 143 | struct mxc_nand_host { |
144 | struct mtd_info mtd; | 144 | struct mtd_info mtd; |
145 | struct nand_chip nand; | 145 | struct nand_chip nand; |
146 | struct mtd_partition *parts; | ||
147 | struct device *dev; | 146 | struct device *dev; |
148 | 147 | ||
149 | void *spare0; | 148 | void *spare0; |
@@ -350,8 +349,7 @@ static void wait_op_done(struct mxc_nand_host *host, int useirq) | |||
350 | udelay(1); | 349 | udelay(1); |
351 | } | 350 | } |
352 | if (max_retries < 0) | 351 | if (max_retries < 0) |
353 | DEBUG(MTD_DEBUG_LEVEL0, "%s: INT not set\n", | 352 | pr_debug("%s: INT not set\n", __func__); |
354 | __func__); | ||
355 | } | 353 | } |
356 | } | 354 | } |
357 | 355 | ||
@@ -371,7 +369,7 @@ static void send_cmd_v3(struct mxc_nand_host *host, uint16_t cmd, int useirq) | |||
371 | * waits for completion. */ | 369 | * waits for completion. */ |
372 | static void send_cmd_v1_v2(struct mxc_nand_host *host, uint16_t cmd, int useirq) | 370 | static void send_cmd_v1_v2(struct mxc_nand_host *host, uint16_t cmd, int useirq) |
373 | { | 371 | { |
374 | DEBUG(MTD_DEBUG_LEVEL3, "send_cmd(host, 0x%x, %d)\n", cmd, useirq); | 372 | pr_debug("send_cmd(host, 0x%x, %d)\n", cmd, useirq); |
375 | 373 | ||
376 | writew(cmd, NFC_V1_V2_FLASH_CMD); | 374 | writew(cmd, NFC_V1_V2_FLASH_CMD); |
377 | writew(NFC_CMD, NFC_V1_V2_CONFIG2); | 375 | writew(NFC_CMD, NFC_V1_V2_CONFIG2); |
@@ -387,8 +385,7 @@ static void send_cmd_v1_v2(struct mxc_nand_host *host, uint16_t cmd, int useirq) | |||
387 | udelay(1); | 385 | udelay(1); |
388 | } | 386 | } |
389 | if (max_retries < 0) | 387 | if (max_retries < 0) |
390 | DEBUG(MTD_DEBUG_LEVEL0, "%s: RESET failed\n", | 388 | pr_debug("%s: RESET failed\n", __func__); |
391 | __func__); | ||
392 | } else { | 389 | } else { |
393 | /* Wait for operation to complete */ | 390 | /* Wait for operation to complete */ |
394 | wait_op_done(host, useirq); | 391 | wait_op_done(host, useirq); |
@@ -411,7 +408,7 @@ static void send_addr_v3(struct mxc_nand_host *host, uint16_t addr, int islast) | |||
411 | * a NAND command. */ | 408 | * a NAND command. */ |
412 | static void send_addr_v1_v2(struct mxc_nand_host *host, uint16_t addr, int islast) | 409 | static void send_addr_v1_v2(struct mxc_nand_host *host, uint16_t addr, int islast) |
413 | { | 410 | { |
414 | DEBUG(MTD_DEBUG_LEVEL3, "send_addr(host, 0x%x %d)\n", addr, islast); | 411 | pr_debug("send_addr(host, 0x%x %d)\n", addr, islast); |
415 | 412 | ||
416 | writew(addr, NFC_V1_V2_FLASH_ADDR); | 413 | writew(addr, NFC_V1_V2_FLASH_ADDR); |
417 | writew(NFC_ADDR, NFC_V1_V2_CONFIG2); | 414 | writew(NFC_ADDR, NFC_V1_V2_CONFIG2); |
@@ -561,8 +558,7 @@ static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat, | |||
561 | uint16_t ecc_status = readw(NFC_V1_V2_ECC_STATUS_RESULT); | 558 | uint16_t ecc_status = readw(NFC_V1_V2_ECC_STATUS_RESULT); |
562 | 559 | ||
563 | if (((ecc_status & 0x3) == 2) || ((ecc_status >> 2) == 2)) { | 560 | if (((ecc_status & 0x3) == 2) || ((ecc_status >> 2) == 2)) { |
564 | DEBUG(MTD_DEBUG_LEVEL0, | 561 | pr_debug("MXC_NAND: HWECC uncorrectable 2-bit ECC error\n"); |
565 | "MXC_NAND: HWECC uncorrectable 2-bit ECC error\n"); | ||
566 | return -1; | 562 | return -1; |
567 | } | 563 | } |
568 | 564 | ||
@@ -849,7 +845,7 @@ static void preset_v1_v2(struct mtd_info *mtd) | |||
849 | writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR3); | 845 | writew(0xffff, NFC_V21_UNLOCKEND_BLKADDR3); |
850 | } else if (nfc_is_v1()) { | 846 | } else if (nfc_is_v1()) { |
851 | writew(0x0, NFC_V1_UNLOCKSTART_BLKADDR); | 847 | writew(0x0, NFC_V1_UNLOCKSTART_BLKADDR); |
852 | writew(0x4000, NFC_V1_UNLOCKEND_BLKADDR); | 848 | writew(0xffff, NFC_V1_UNLOCKEND_BLKADDR); |
853 | } else | 849 | } else |
854 | BUG(); | 850 | BUG(); |
855 | 851 | ||
@@ -932,8 +928,7 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command, | |||
932 | struct nand_chip *nand_chip = mtd->priv; | 928 | struct nand_chip *nand_chip = mtd->priv; |
933 | struct mxc_nand_host *host = nand_chip->priv; | 929 | struct mxc_nand_host *host = nand_chip->priv; |
934 | 930 | ||
935 | DEBUG(MTD_DEBUG_LEVEL3, | 931 | pr_debug("mxc_nand_command (cmd = 0x%x, col = 0x%x, page = 0x%x)\n", |
936 | "mxc_nand_command (cmd = 0x%x, col = 0x%x, page = 0x%x)\n", | ||
937 | command, column, page_addr); | 932 | command, column, page_addr); |
938 | 933 | ||
939 | /* Reset command state information */ | 934 | /* Reset command state information */ |
@@ -1044,7 +1039,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
1044 | struct mxc_nand_platform_data *pdata = pdev->dev.platform_data; | 1039 | struct mxc_nand_platform_data *pdata = pdev->dev.platform_data; |
1045 | struct mxc_nand_host *host; | 1040 | struct mxc_nand_host *host; |
1046 | struct resource *res; | 1041 | struct resource *res; |
1047 | int err = 0, __maybe_unused nr_parts = 0; | 1042 | int err = 0; |
1048 | struct nand_ecclayout *oob_smallpage, *oob_largepage; | 1043 | struct nand_ecclayout *oob_smallpage, *oob_largepage; |
1049 | 1044 | ||
1050 | /* Allocate memory for MTD device structure and private data */ | 1045 | /* Allocate memory for MTD device structure and private data */ |
@@ -1179,7 +1174,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
1179 | this->bbt_td = &bbt_main_descr; | 1174 | this->bbt_td = &bbt_main_descr; |
1180 | this->bbt_md = &bbt_mirror_descr; | 1175 | this->bbt_md = &bbt_mirror_descr; |
1181 | /* update flash based bbt */ | 1176 | /* update flash based bbt */ |
1182 | this->options |= NAND_USE_FLASH_BBT; | 1177 | this->bbt_options |= NAND_BBT_USE_FLASH; |
1183 | } | 1178 | } |
1184 | 1179 | ||
1185 | init_completion(&host->op_completion); | 1180 | init_completion(&host->op_completion); |
@@ -1231,16 +1226,8 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
1231 | } | 1226 | } |
1232 | 1227 | ||
1233 | /* Register the partitions */ | 1228 | /* Register the partitions */ |
1234 | nr_parts = | 1229 | mtd_device_parse_register(mtd, part_probes, 0, |
1235 | parse_mtd_partitions(mtd, part_probes, &host->parts, 0); | 1230 | pdata->parts, pdata->nr_parts); |
1236 | if (nr_parts > 0) | ||
1237 | mtd_device_register(mtd, host->parts, nr_parts); | ||
1238 | else if (pdata->parts) | ||
1239 | mtd_device_register(mtd, pdata->parts, pdata->nr_parts); | ||
1240 | else { | ||
1241 | pr_info("Registering %s as whole device\n", mtd->name); | ||
1242 | mtd_device_register(mtd, NULL, 0); | ||
1243 | } | ||
1244 | 1231 | ||
1245 | platform_set_drvdata(pdev, host); | 1232 | platform_set_drvdata(pdev, host); |
1246 | 1233 | ||