Merge tag 'v4.3-rc1' into MTD -next development
authorBrian Norris <computersforpeace@gmail.com>
Mon, 14 Sep 2015 01:41:29 +0000 (18:41 -0700)
committerBrian Norris <computersforpeace@gmail.com>
Mon, 14 Sep 2015 01:41:29 +0000 (18:41 -0700)
drivers/mtd/devices/m25p80.c
drivers/mtd/nand/brcmnand/brcmnand.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/pxa3xx_nand.c
drivers/mtd/nand/sunxi_nand.c
drivers/mtd/spi-nor/fsl-quadspi.c
drivers/mtd/spi-nor/nxp-spifi.c
drivers/mtd/spi-nor/spi-nor.c
include/linux/mtd/nand.h
include/linux/mtd/spi-nor.h
include/linux/platform_data/mtd-nand-pxa3xx.h

index 9cd3631..4b5d7a4 100644 (file)
@@ -31,7 +31,6 @@
 struct m25p {
        struct spi_device       *spi;
        struct spi_nor          spi_nor;
-       struct mtd_info         mtd;
        u8                      command[MAX_CMD_SIZE];
 };
 
@@ -62,8 +61,7 @@ static int m25p_cmdsz(struct spi_nor *nor)
        return 1 + nor->addr_width;
 }
 
-static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len,
-                       int wr_en)
+static int m25p80_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 {
        struct m25p *flash = nor->priv;
        struct spi_device *spi = flash->spi;
@@ -159,7 +157,7 @@ static int m25p80_erase(struct spi_nor *nor, loff_t offset)
        struct m25p *flash = nor->priv;
 
        dev_dbg(nor->dev, "%dKiB at 0x%08x\n",
-               flash->mtd.erasesize / 1024, (u32)offset);
+               flash->spi_nor.mtd.erasesize / 1024, (u32)offset);
 
        /* Set up command buffer. */
        flash->command[0] = nor->erase_opcode;
@@ -201,11 +199,10 @@ static int m25p_probe(struct spi_device *spi)
        nor->read_reg = m25p80_read_reg;
 
        nor->dev = &spi->dev;
-       nor->mtd = &flash->mtd;
+       nor->flash_node = spi->dev.of_node;
        nor->priv = flash;
 
        spi_set_drvdata(spi, flash);
-       flash->mtd.priv = nor;
        flash->spi = spi;
 
        if (spi->mode & SPI_RX_QUAD)
@@ -214,7 +211,7 @@ static int m25p_probe(struct spi_device *spi)
                mode = SPI_NOR_DUAL;
 
        if (data && data->name)
-               flash->mtd.name = data->name;
+               nor->mtd.name = data->name;
 
        /* For some (historical?) reason many platforms provide two different
         * names in flash_platform_data: "name" and "type". Quite often name is
@@ -232,7 +229,7 @@ static int m25p_probe(struct spi_device *spi)
 
        ppdata.of_node = spi->dev.of_node;
 
-       return mtd_device_parse_register(&flash->mtd, NULL, &ppdata,
+       return mtd_device_parse_register(&nor->mtd, NULL, &ppdata,
                        data ? data->parts : NULL,
                        data ? data->nr_parts : 0);
 }
@@ -243,7 +240,7 @@ static int m25p_remove(struct spi_device *spi)
        struct m25p     *flash = spi_get_drvdata(spi);
 
        /* Clean up MTD stuff. */
-       return mtd_device_unregister(&flash->mtd);
+       return mtd_device_unregister(&flash->spi_nor.mtd);
 }
 
 /*
index fddb795..048e4e0 100644 (file)
@@ -1792,7 +1792,8 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)
 
        memset(cfg, 0, sizeof(*cfg));
 
-       ret = of_property_read_u32(chip->dn, "brcm,nand-oob-sector-size",
+       ret = of_property_read_u32(chip->flash_node,
+                                  "brcm,nand-oob-sector-size",
                                   &oob_sector);
        if (ret) {
                /* Use detected size */
@@ -1899,7 +1900,7 @@ static int brcmnand_init_cs(struct brcmnand_host *host)
        mtd = &host->mtd;
        chip = &host->chip;
 
-       chip->dn = dn;
+       chip->flash_node = dn;
        chip->priv = host;
        mtd->priv = chip;
        mtd->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "brcmnand.%d",
index ceb68ca..51f7816 100644 (file)
@@ -3846,8 +3846,8 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
        struct nand_flash_dev *type;
        int ret;
 
-       if (chip->dn) {
-               ret = nand_dt_init(mtd, chip, chip->dn);
+       if (chip->flash_node) {
+               ret = nand_dt_init(mtd, chip, chip->flash_node);
                if (ret)
                        return ret;
        }
index 740983a..165112c 100644 (file)
@@ -252,6 +252,30 @@ static bool use_dma = 1;
 module_param(use_dma, bool, 0444);
 MODULE_PARM_DESC(use_dma, "enable DMA for data transferring to/from NAND HW");
 
+struct pxa3xx_nand_timing {
+       unsigned int    tCH;  /* Enable signal hold time */
+       unsigned int    tCS;  /* Enable signal setup time */
+       unsigned int    tWH;  /* ND_nWE high duration */
+       unsigned int    tWP;  /* ND_nWE pulse time */
+       unsigned int    tRH;  /* ND_nRE high duration */
+       unsigned int    tRP;  /* ND_nRE pulse width */
+       unsigned int    tR;   /* ND_nWE high to ND_nRE low for read */
+       unsigned int    tWHR; /* ND_nWE high to ND_nRE low for status read */
+       unsigned int    tAR;  /* ND_ALE low to ND_nRE low delay */
+};
+
+struct pxa3xx_nand_flash {
+       char            *name;
+       uint32_t        chip_id;
+       unsigned int    page_per_block; /* Pages per block (PG_PER_BLK) */
+       unsigned int    page_size;      /* Page size in bytes (PAGE_SZ) */
+       unsigned int    flash_width;    /* Width of Flash memory (DWIDTH_M) */
+       unsigned int    dfc_width;      /* Width of flash controller(DWIDTH_C) */
+       unsigned int    num_blocks;     /* Number of physical blocks in Flash */
+
+       struct pxa3xx_nand_timing *timing;      /* NAND Flash timing */
+};
+
 static struct pxa3xx_nand_timing timing[] = {
        { 40, 80, 60, 100, 80, 100, 90000, 400, 40, },
        { 10,  0, 20,  40, 30,  40, 11123, 110, 10, },
@@ -1491,19 +1515,16 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd)
                return -EINVAL;
        }
 
-       num = ARRAY_SIZE(builtin_flash_types) + pdata->num_flash - 1;
+       num = ARRAY_SIZE(builtin_flash_types) - 1;
        for (i = 0; i < num; i++) {
-               if (i < pdata->num_flash)
-                       f = pdata->flash + i;
-               else
-                       f = &builtin_flash_types[i - pdata->num_flash + 1];
+               f = &builtin_flash_types[i + 1];
 
                /* find the chip in default list */
                if (f->chip_id == id)
                        break;
        }
 
-       if (i >= (ARRAY_SIZE(builtin_flash_types) + pdata->num_flash - 1)) {
+       if (i >= (ARRAY_SIZE(builtin_flash_types) - 1)) {
                dev_err(&info->pdev->dev, "ERROR!! flash not defined!!!\n");
 
                return -EINVAL;
index f97a58d..4f9db77 100644 (file)
@@ -978,17 +978,23 @@ static int sunxi_nand_chip_init_timings(struct sunxi_nand_chip *chip,
                mode = chip->nand.onfi_timing_mode_default;
        } else {
                uint8_t feature[ONFI_SUBFEATURE_PARAM_LEN] = {};
+               int i;
 
                mode = fls(mode) - 1;
                if (mode < 0)
                        mode = 0;
 
                feature[0] = mode;
-               ret = chip->nand.onfi_set_features(&chip->mtd, &chip->nand,
+               for (i = 0; i < chip->nsels; i++) {
+                       chip->nand.select_chip(&chip->mtd, i);
+                       ret = chip->nand.onfi_set_features(&chip->mtd,
+                                               &chip->nand,
                                                ONFI_FEATURE_ADDR_TIMING_MODE,
                                                feature);
-               if (ret)
-                       return ret;
+                       chip->nand.select_chip(&chip->mtd, -1);
+                       if (ret)
+                               return ret;
+               }
        }
 
        timings = onfi_async_timing_mode_to_sdr_timings(mode);
@@ -1162,16 +1168,9 @@ static int sunxi_nand_ecc_init(struct mtd_info *mtd, struct nand_ecc_ctrl *ecc,
                               struct device_node *np)
 {
        struct nand_chip *nand = mtd->priv;
-       int strength;
-       int blk_size;
        int ret;
 
-       blk_size = of_get_nand_ecc_step_size(np);
-       strength = of_get_nand_ecc_strength(np);
-       if (blk_size > 0 && strength > 0) {
-               ecc->size = blk_size;
-               ecc->strength = strength;
-       } else {
+       if (!ecc->size) {
                ecc->size = nand->ecc_step_ds;
                ecc->strength = nand->ecc_strength_ds;
        }
@@ -1179,12 +1178,6 @@ static int sunxi_nand_ecc_init(struct mtd_info *mtd, struct nand_ecc_ctrl *ecc,
        if (!ecc->size || !ecc->strength)
                return -EINVAL;
 
-       ecc->mode = NAND_ECC_HW;
-
-       ret = of_get_nand_ecc_mode(np);
-       if (ret >= 0)
-               ecc->mode = ret;
-
        switch (ecc->mode) {
        case NAND_ECC_SOFT_BCH:
                break;
@@ -1310,15 +1303,18 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
        /* Default tR value specified in the ONFI spec (chapter 4.15.1) */
        nand->chip_delay = 200;
        nand->controller = &nfc->controller;
+       /*
+        * Set the ECC mode to the default value in case nothing is specified
+        * in the DT.
+        */
+       nand->ecc.mode = NAND_ECC_HW;
+       nand->flash_node = np;
        nand->select_chip = sunxi_nfc_select_chip;
        nand->cmd_ctrl = sunxi_nfc_cmd_ctrl;
        nand->read_buf = sunxi_nfc_read_buf;
        nand->write_buf = sunxi_nfc_write_buf;
        nand->read_byte = sunxi_nfc_read_byte;
 
-       if (of_get_nand_on_flash_bbt(np))
-               nand->bbt_options |= NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB;
-
        mtd = &chip->mtd;
        mtd->dev.parent = dev;
        mtd->priv = nand;
@@ -1328,6 +1324,9 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
        if (ret)
                return ret;
 
+       if (nand->bbt_options & NAND_BBT_USE_FLASH)
+               nand->bbt_options |= NAND_BBT_NO_OOB;
+
        ret = sunxi_nand_chip_init_timings(chip, np);
        if (ret) {
                dev_err(dev, "could not configure chip timings: %d\n", ret);
index d32b7e0..2954f89 100644 (file)
@@ -259,7 +259,6 @@ static struct fsl_qspi_devtype_data imx6ul_data = {
 
 #define FSL_QSPI_MAX_CHIP      4
 struct fsl_qspi {
-       struct mtd_info mtd[FSL_QSPI_MAX_CHIP];
        struct spi_nor nor[FSL_QSPI_MAX_CHIP];
        void __iomem *iobase;
        void __iomem *ahb_addr;
@@ -798,8 +797,7 @@ static int fsl_qspi_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
        return 0;
 }
 
-static int fsl_qspi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len,
-                       int write_enable)
+static int fsl_qspi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 {
        struct fsl_qspi *q = nor->priv;
        int ret;
@@ -888,7 +886,7 @@ static int fsl_qspi_erase(struct spi_nor *nor, loff_t offs)
        int ret;
 
        dev_dbg(nor->dev, "%dKiB at 0x%08x:0x%08x\n",
-               nor->mtd->erasesize / 1024, q->chip_base_addr, (u32)offs);
+               nor->mtd.erasesize / 1024, q->chip_base_addr, (u32)offs);
 
        ret = fsl_qspi_runcmd(q, nor->erase_opcode, offs, 0);
        if (ret)
@@ -1006,19 +1004,16 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 
        /* iterate the subnodes. */
        for_each_available_child_of_node(dev->of_node, np) {
-               char modalias[40];
-
                /* skip the holes */
                if (!q->has_second_chip)
                        i *= 2;
 
                nor = &q->nor[i];
-               mtd = &q->mtd[i];
+               mtd = &nor->mtd;
 
-               nor->mtd = mtd;
                nor->dev = dev;
+               nor->flash_node = np;
                nor->priv = q;
-               mtd->priv = nor;
 
                /* fill the hooks */
                nor->read_reg = fsl_qspi_read_reg;
@@ -1030,10 +1025,6 @@ static int fsl_qspi_probe(struct platform_device *pdev)
                nor->prepare = fsl_qspi_prep;
                nor->unprepare = fsl_qspi_unprep;
 
-               ret = of_modalias_node(np, modalias, sizeof(modalias));
-               if (ret < 0)
-                       goto mutex_failed;
-
                ret = of_property_read_u32(np, "spi-max-frequency",
                                &q->clk_rate);
                if (ret < 0)
@@ -1042,7 +1033,7 @@ static int fsl_qspi_probe(struct platform_device *pdev)
                /* set the chip address for READID */
                fsl_qspi_set_base_addr(q, nor);
 
-               ret = spi_nor_scan(nor, modalias, SPI_NOR_QUAD);
+               ret = spi_nor_scan(nor, NULL, SPI_NOR_QUAD);
                if (ret)
                        goto mutex_failed;
 
@@ -1087,7 +1078,7 @@ last_init_failed:
                /* skip the holes */
                if (!q->has_second_chip)
                        i *= 2;
-               mtd_device_unregister(&q->mtd[i]);
+               mtd_device_unregister(&q->nor[i].mtd);
        }
 mutex_failed:
        mutex_destroy(&q->lock);
@@ -1107,7 +1098,7 @@ static int fsl_qspi_remove(struct platform_device *pdev)
                /* skip the holes */
                if (!q->has_second_chip)
                        i *= 2;
-               mtd_device_unregister(&q->mtd[i]);
+               mtd_device_unregister(&q->nor[i].mtd);
        }
 
        /* disable the hardware */
index 9ad1dd0..9e82098 100644 (file)
@@ -60,7 +60,6 @@ struct nxp_spifi {
        struct clk *clk_reg;
        void __iomem *io_base;
        void __iomem *flash_base;
-       struct mtd_info mtd;
        struct spi_nor nor;
        bool memory_mode;
        u32 mcmd;
@@ -150,8 +149,7 @@ static int nxp_spifi_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
        return nxp_spifi_wait_for_cmd(spifi);
 }
 
-static int nxp_spifi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf,
-                              int len, int write_enable)
+static int nxp_spifi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 {
        struct nxp_spifi *spifi = nor->priv;
        u32 cmd;
@@ -331,9 +329,8 @@ static int nxp_spifi_setup_flash(struct nxp_spifi *spifi,
 
        writel(ctrl, spifi->io_base + SPIFI_CTRL);
 
-       spifi->mtd.priv  = &spifi->nor;
-       spifi->nor.mtd   = &spifi->mtd;
        spifi->nor.dev   = spifi->dev;
+       spifi->nor.flash_node = np;
        spifi->nor.priv  = spifi;
        spifi->nor.read  = nxp_spifi_read;
        spifi->nor.write = nxp_spifi_write;
@@ -365,7 +362,7 @@ static int nxp_spifi_setup_flash(struct nxp_spifi *spifi,
        }
 
        ppdata.of_node = np;
-       ret = mtd_device_parse_register(&spifi->mtd, NULL, &ppdata, NULL, 0);
+       ret = mtd_device_parse_register(&spifi->nor.mtd, NULL, &ppdata, NULL, 0);
        if (ret) {
                dev_err(spifi->dev, "mtd device parse failed\n");
                return ret;
@@ -454,7 +451,7 @@ static int nxp_spifi_remove(struct platform_device *pdev)
 {
        struct nxp_spifi *spifi = platform_get_drvdata(pdev);
 
-       mtd_device_unregister(&spifi->mtd);
+       mtd_device_unregister(&spifi->nor.mtd);
        clk_disable_unprepare(spifi->clk_spifi);
        clk_disable_unprepare(spifi->clk_reg);
 
index f59aedf..8818d43 100644 (file)
@@ -145,7 +145,7 @@ static inline int spi_nor_read_dummy_cycles(struct spi_nor *nor)
 static inline int write_sr(struct spi_nor *nor, u8 val)
 {
        nor->cmd_buf[0] = val;
-       return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1, 0);
+       return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1);
 }
 
 /*
@@ -154,7 +154,7 @@ static inline int write_sr(struct spi_nor *nor, u8 val)
  */
 static inline int write_enable(struct spi_nor *nor)
 {
-       return nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0, 0);
+       return nor->write_reg(nor, SPINOR_OP_WREN, NULL, 0);
 }
 
 /*
@@ -162,7 +162,7 @@ static inline int write_enable(struct spi_nor *nor)
  */
 static inline int write_disable(struct spi_nor *nor)
 {
-       return nor->write_reg(nor, SPINOR_OP_WRDI, NULL, 0, 0);
+       return nor->write_reg(nor, SPINOR_OP_WRDI, NULL, 0);
 }
 
 static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd)
@@ -188,7 +188,7 @@ static inline int set_4byte(struct spi_nor *nor, const struct flash_info *info,
                        write_enable(nor);
 
                cmd = enable ? SPINOR_OP_EN4B : SPINOR_OP_EX4B;
-               status = nor->write_reg(nor, cmd, NULL, 0, 0);
+               status = nor->write_reg(nor, cmd, NULL, 0);
                if (need_wren)
                        write_disable(nor);
 
@@ -196,7 +196,7 @@ static inline int set_4byte(struct spi_nor *nor, const struct flash_info *info,
        default:
                /* Spansion style */
                nor->cmd_buf[0] = enable << 7;
-               return nor->write_reg(nor, SPINOR_OP_BRWR, nor->cmd_buf, 1, 0);
+               return nor->write_reg(nor, SPINOR_OP_BRWR, nor->cmd_buf, 1);
        }
 }
 static inline int spi_nor_sr_ready(struct spi_nor *nor)
@@ -265,9 +265,9 @@ static int spi_nor_wait_till_ready(struct spi_nor *nor)
  */
 static int erase_chip(struct spi_nor *nor)
 {
-       dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd->size >> 10));
+       dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd.size >> 10));
 
-       return nor->write_reg(nor, SPINOR_OP_CHIP_ERASE, NULL, 0, 0);
+       return nor->write_reg(nor, SPINOR_OP_CHIP_ERASE, NULL, 0);
 }
 
 static int spi_nor_lock_and_prep(struct spi_nor *nor, enum spi_nor_ops ops)
@@ -373,7 +373,7 @@ erase_err:
 
 static int stm_lock(struct spi_nor *nor, loff_t ofs, uint64_t len)
 {
-       struct mtd_info *mtd = nor->mtd;
+       struct mtd_info *mtd = &nor->mtd;
        uint32_t offset = ofs;
        uint8_t status_old, status_new;
        int ret = 0;
@@ -407,7 +407,7 @@ static int stm_lock(struct spi_nor *nor, loff_t ofs, uint64_t len)
 
 static int stm_unlock(struct spi_nor *nor, loff_t ofs, uint64_t len)
 {
-       struct mtd_info *mtd = nor->mtd;
+       struct mtd_info *mtd = &nor->mtd;
        uint32_t offset = ofs;
        uint8_t status_old, status_new;
        int ret = 0;
@@ -868,8 +868,7 @@ static int macronix_quad_enable(struct spi_nor *nor)
        val = read_sr(nor);
        write_enable(nor);
 
-       nor->cmd_buf[0] = val | SR_QUAD_EN_MX;
-       nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1, 0);
+       write_sr(nor, val | SR_QUAD_EN_MX);
 
        if (spi_nor_wait_till_ready(nor))
                return 1;
@@ -894,7 +893,7 @@ static int write_sr_cr(struct spi_nor *nor, u16 val)
        nor->cmd_buf[0] = val & 0xff;
        nor->cmd_buf[1] = (val >> 8);
 
-       return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 2, 0);
+       return nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 2);
 }
 
 static int spansion_quad_enable(struct spi_nor *nor)
@@ -936,7 +935,7 @@ static int micron_quad_enable(struct spi_nor *nor)
 
        /* set EVCR, enable quad I/O */
        nor->cmd_buf[0] = val & ~EVCR_QUAD_EN_MICRON;
-       ret = nor->write_reg(nor, SPINOR_OP_WD_EVCR, nor->cmd_buf, 1, 0);
+       ret = nor->write_reg(nor, SPINOR_OP_WD_EVCR, nor->cmd_buf, 1);
        if (ret < 0) {
                dev_err(nor->dev, "error while writing EVCR register\n");
                return ret;
@@ -1004,8 +1003,8 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
 {
        const struct flash_info *info = NULL;
        struct device *dev = nor->dev;
-       struct mtd_info *mtd = nor->mtd;
-       struct device_node *np = dev->of_node;
+       struct mtd_info *mtd = &nor->mtd;
+       struct device_node *np = nor->flash_node;
        int ret;
        int i;
 
@@ -1061,6 +1060,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
 
        if (!mtd->name)
                mtd->name = dev_name(dev);
+       mtd->priv = nor;
        mtd->type = MTD_NORFLASH;
        mtd->writesize = 1;
        mtd->flags = MTD_CAP_NORFLASH;
index 272f429..3140b3d 100644 (file)
@@ -544,7 +544,7 @@ struct nand_buffers {
  *                     flash device
  * @IO_ADDR_W:         [BOARDSPECIFIC] address to write the 8 I/O lines of the
  *                     flash device.
- * @dn:                        [BOARDSPECIFIC] device node describing this instance
+ * @flash_node:                [BOARDSPECIFIC] device node describing this instance
  * @read_byte:         [REPLACEABLE] read one byte from the chip
  * @read_word:         [REPLACEABLE] read one word from the chip
  * @write_byte:                [REPLACEABLE] write a single byte to the chip on the
@@ -647,7 +647,7 @@ struct nand_chip {
        void __iomem *IO_ADDR_R;
        void __iomem *IO_ADDR_W;
 
-       struct device_node *dn;
+       struct device_node *flash_node;
 
        uint8_t (*read_byte)(struct mtd_info *mtd);
        u16 (*read_word)(struct mtd_info *mtd);
index e540952..e9c912d 100644 (file)
@@ -127,11 +127,14 @@ enum spi_nor_option_flags {
        SNOR_F_USE_FSR          = BIT(0),
 };
 
+struct mtd_info;
+
 /**
  * struct spi_nor - Structure for defining a the SPI NOR layer
  * @mtd:               point to a mtd_info structure
  * @lock:              the lock for the read/write/erase/lock/unlock operations
  * @dev:               point to a spi device, or a spi nor controller device.
+ * @flash_node:                point to a device node describing this flash instance.
  * @page_size:         the page size of the SPI NOR
  * @addr_width:                number of address bytes
  * @erase_opcode:      the opcode for erasing a sector
@@ -160,9 +163,10 @@ enum spi_nor_option_flags {
  * @priv:              the private data
  */
 struct spi_nor {
-       struct mtd_info         *mtd;
+       struct mtd_info         mtd;
        struct mutex            lock;
        struct device           *dev;
+       struct device_node      *flash_node;
        u32                     page_size;
        u8                      addr_width;
        u8                      erase_opcode;
@@ -182,8 +186,7 @@ struct spi_nor {
        int (*write_xfer)(struct spi_nor *nor, struct spi_nor_xfer_cfg *cfg,
                          u8 *buf, size_t len);
        int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
-       int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len,
-                       int write_enable);
+       int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
 
        int (*read)(struct spi_nor *nor, loff_t from,
                        size_t len, size_t *retlen, u_char *read_buf);
index ac4ea2e..394d155 100644 (file)
@@ -4,30 +4,6 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 
-struct pxa3xx_nand_timing {
-       unsigned int    tCH;  /* Enable signal hold time */
-       unsigned int    tCS;  /* Enable signal setup time */
-       unsigned int    tWH;  /* ND_nWE high duration */
-       unsigned int    tWP;  /* ND_nWE pulse time */
-       unsigned int    tRH;  /* ND_nRE high duration */
-       unsigned int    tRP;  /* ND_nRE pulse width */
-       unsigned int    tR;   /* ND_nWE high to ND_nRE low for read */
-       unsigned int    tWHR; /* ND_nWE high to ND_nRE low for status read */
-       unsigned int    tAR;  /* ND_ALE low to ND_nRE low delay */
-};
-
-struct pxa3xx_nand_flash {
-       char            *name;
-       uint32_t        chip_id;
-       unsigned int    page_per_block; /* Pages per block (PG_PER_BLK) */
-       unsigned int    page_size;      /* Page size in bytes (PAGE_SZ) */
-       unsigned int    flash_width;    /* Width of Flash memory (DWIDTH_M) */
-       unsigned int    dfc_width;      /* Width of flash controller(DWIDTH_C) */
-       unsigned int    num_blocks;     /* Number of physical blocks in Flash */
-
-       struct pxa3xx_nand_timing *timing;      /* NAND Flash timing */
-};
-
 /*
  * Current pxa3xx_nand controller has two chip select which
  * both be workable.
@@ -63,9 +39,6 @@ struct pxa3xx_nand_platform_data {
 
        const struct mtd_partition              *parts[NUM_CHIP_SELECT];
        unsigned int                            nr_parts[NUM_CHIP_SELECT];
-
-       const struct pxa3xx_nand_flash *        flash;
-       size_t                                  num_flash;
 };
 
 extern void pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info);