|
104 | 104 | #define NFC_TIMEOUT (HZ / 10) /* 1/10 s */
|
105 | 105 |
|
106 | 106 | struct mpc5121_nfc_prv {
|
| 107 | + struct nand_controller controller; |
107 | 108 | struct nand_chip chip;
|
108 | 109 | int irq;
|
109 | 110 | void __iomem *regs;
|
@@ -602,6 +603,18 @@ static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd)
|
602 | 603 | iounmap(prv->csreg);
|
603 | 604 | }
|
604 | 605 |
|
| 606 | +static int mpc5121_nfc_attach_chip(struct nand_chip *chip) |
| 607 | +{ |
| 608 | + chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; |
| 609 | + chip->ecc.algo = NAND_ECC_ALGO_HAMMING; |
| 610 | + |
| 611 | + return 0; |
| 612 | +} |
| 613 | + |
| 614 | +static const struct nand_controller_ops mpc5121_nfc_ops = { |
| 615 | + .attach_chip = mpc5121_nfc_attach_chip, |
| 616 | +}; |
| 617 | + |
605 | 618 | static int mpc5121_nfc_probe(struct platform_device *op)
|
606 | 619 | {
|
607 | 620 | struct device_node *dn = op->dev.of_node;
|
@@ -634,6 +647,10 @@ static int mpc5121_nfc_probe(struct platform_device *op)
|
634 | 647 | chip = &prv->chip;
|
635 | 648 | mtd = nand_to_mtd(chip);
|
636 | 649 |
|
| 650 | + nand_controller_init(&prv->controller); |
| 651 | + prv->controller.ops = &mpc5121_nfc_ops; |
| 652 | + chip->controller = &prv->controller; |
| 653 | + |
637 | 654 | mtd->dev.parent = dev;
|
638 | 655 | nand_set_controller_data(chip, prv);
|
639 | 656 | nand_set_flash_node(chip, dn);
|
@@ -688,8 +705,6 @@ static int mpc5121_nfc_probe(struct platform_device *op)
|
688 | 705 | chip->legacy.set_features = nand_get_set_features_notsupp;
|
689 | 706 | chip->legacy.get_features = nand_get_set_features_notsupp;
|
690 | 707 | chip->bbt_options = NAND_BBT_USE_FLASH;
|
691 |
| - chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; |
692 |
| - chip->ecc.algo = NAND_ECC_ALGO_HAMMING; |
693 | 708 |
|
694 | 709 | /* Support external chip-select logic on ADS5121 board */
|
695 | 710 | if (of_machine_is_compatible("fsl,mpc5121ads")) {
|
|
0 commit comments