Merge branch 'rmobile' of git://git.denx.de/u-boot-sh
[oweals/u-boot.git] / drivers / mtd / nand / vf610_nfc.c
index 3be8b02ccb70b41d27bb390841245609e20b4ebd..f99bdaf94da2be3dc216ff05f9580105a8049163 100644 (file)
@@ -146,7 +146,6 @@ enum vf610_nfc_alt_buf {
 };
 
 struct vf610_nfc {
-       struct mtd_info *mtd;
        struct nand_chip chip;
        void __iomem *regs;
        uint buf_offset;
@@ -155,8 +154,7 @@ struct vf610_nfc {
        enum vf610_nfc_alt_buf alt_buf;
 };
 
-#define mtd_to_nfc(_mtd) \
-       (struct vf610_nfc *)((struct nand_chip *)_mtd->priv)->priv
+#define mtd_to_nfc(_mtd) nand_get_controller_data(mtd_to_nand(_mtd))
 
 #if defined(CONFIG_SYS_NAND_VF610_NFC_45_ECC_BYTES)
 #define ECC_HW_MODE ECC_45_BYTE
@@ -608,7 +606,7 @@ static int vf610_nfc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
  * ECC will be calculated automatically
  */
 static int vf610_nfc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
-                              const uint8_t *buf, int oob_required)
+                              const uint8_t *buf, int oob_required, int page)
 {
        struct vf610_nfc *nfc = mtd_to_nfc(mtd);
 
@@ -653,9 +651,8 @@ static int vf610_nfc_nand_init(int devnum, void __iomem *addr)
        chip = &nfc->chip;
        nfc->regs = addr;
 
-       mtd = &chip->mtd;
-       mtd->priv = chip;
-       chip->priv = nfc;
+       mtd = nand_to_mtd(chip);
+       nand_set_controller_data(chip, nfc);
 
        if (cfg.width == 16)
                chip->options |= NAND_BUSWIDTH_16;