#include <linux/platform_device.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
-#include <linux/of_mtd.h>
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
 #include <linux/omap-gpmc.h>
 
        if (of_device_is_compatible(child, "ti,omap2-nand")) {
                /* NAND specific setup */
-               val = of_get_nand_bus_width(child);
+               val = 8;
+               of_property_read_u32(child, "nand-bus-width", &val);
                switch (val) {
                case 8:
                        gpmc_s.device_width = GPMC_DEVWIDTH_8BIT;
 
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
-#include <linux/of_mtd.h>
 
 #include <linux/mtd/nand_bch.h>
 #include <linux/platform_data/elm.h>
                for (i = 0; i < ARRAY_SIZE(nand_xfer_types); i++) {
                        if (!strcasecmp(s, nand_xfer_types[i])) {
                                info->xfer_type = i;
-                               goto next;
+                               return 0;
                        }
                }
 
                return -EINVAL;
        }
 
-next:
-       of_get_nand_on_flash_bbt(child);
-
-       if (of_get_nand_bus_width(child) == 16)
-               info->devsize = NAND_BUSWIDTH_16;
-
        return 0;
 }
 
        }
 
        if (info->flash_bbt)
-               nand_chip->bbt_options |= NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB;
-       else
-               nand_chip->options |= NAND_SKIP_BBTSCAN;
+               nand_chip->bbt_options |= NAND_BBT_USE_FLASH;
 
        /* scan NAND device connected to chip controller */
        nand_chip->options |= info->devsize & NAND_BUSWIDTH_16;
                goto return_error;
        }
 
+       if (nand_chip->bbt_options & NAND_BBT_USE_FLASH)
+               nand_chip->bbt_options |= NAND_BBT_NO_OOB;
+       else
+               nand_chip->options |= NAND_SKIP_BBTSCAN;
+
        /* re-populate low-level callbacks based on xfer modes */
        switch (info->xfer_type) {
        case NAND_OMAP_PREFETCH_POLLED: