|
@@ -23,6 +23,42 @@ struct plat_nand_data {
|
|
void __iomem *io_base;
|
|
void __iomem *io_base;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+static void plat_nand_cmd_ctrl(struct mtd_info *mtd, int dat, unsigned int ctrl)
|
|
|
|
+{
|
|
|
|
+ struct platform_nand_data *pdata = dev_get_platdata(mtd->dev.parent);
|
|
|
|
+
|
|
|
|
+ pdata->ctrl.cmd_ctrl(mtd_to_nand(mtd), dat, ctrl);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int plat_nand_dev_ready(struct mtd_info *mtd)
|
|
|
|
+{
|
|
|
|
+ struct platform_nand_data *pdata = dev_get_platdata(mtd->dev.parent);
|
|
|
|
+
|
|
|
|
+ return pdata->ctrl.dev_ready(mtd_to_nand(mtd));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void plat_nand_select_chip(struct mtd_info *mtd, int cs)
|
|
|
|
+{
|
|
|
|
+ struct platform_nand_data *pdata = dev_get_platdata(mtd->dev.parent);
|
|
|
|
+
|
|
|
|
+ pdata->ctrl.select_chip(mtd_to_nand(mtd), cs);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void plat_nand_write_buf(struct mtd_info *mtd, const uint8_t *buf,
|
|
|
|
+ int len)
|
|
|
|
+{
|
|
|
|
+ struct platform_nand_data *pdata = dev_get_platdata(mtd->dev.parent);
|
|
|
|
+
|
|
|
|
+ pdata->ctrl.write_buf(mtd_to_nand(mtd), buf, len);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void plat_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
|
|
|
|
+{
|
|
|
|
+ struct platform_nand_data *pdata = dev_get_platdata(mtd->dev.parent);
|
|
|
|
+
|
|
|
|
+ pdata->ctrl.read_buf(mtd_to_nand(mtd), buf, len);
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Probe for the NAND device.
|
|
* Probe for the NAND device.
|
|
*/
|
|
*/
|
|
@@ -62,11 +98,22 @@ static int plat_nand_probe(struct platform_device *pdev)
|
|
|
|
|
|
data->chip.IO_ADDR_R = data->io_base;
|
|
data->chip.IO_ADDR_R = data->io_base;
|
|
data->chip.IO_ADDR_W = data->io_base;
|
|
data->chip.IO_ADDR_W = data->io_base;
|
|
- data->chip.cmd_ctrl = pdata->ctrl.cmd_ctrl;
|
|
|
|
- data->chip.dev_ready = pdata->ctrl.dev_ready;
|
|
|
|
- data->chip.select_chip = pdata->ctrl.select_chip;
|
|
|
|
- data->chip.write_buf = pdata->ctrl.write_buf;
|
|
|
|
- data->chip.read_buf = pdata->ctrl.read_buf;
|
|
|
|
|
|
+
|
|
|
|
+ if (pdata->ctrl.cmd_ctrl)
|
|
|
|
+ data->chip.cmd_ctrl = plat_nand_cmd_ctrl;
|
|
|
|
+
|
|
|
|
+ if (pdata->ctrl.dev_ready)
|
|
|
|
+ data->chip.dev_ready = plat_nand_dev_ready;
|
|
|
|
+
|
|
|
|
+ if (pdata->ctrl.select_chip)
|
|
|
|
+ data->chip.select_chip = plat_nand_select_chip;
|
|
|
|
+
|
|
|
|
+ if (pdata->ctrl.write_buf)
|
|
|
|
+ data->chip.write_buf = plat_nand_write_buf;
|
|
|
|
+
|
|
|
|
+ if (pdata->ctrl.read_buf)
|
|
|
|
+ data->chip.read_buf = plat_nand_read_buf;
|
|
|
|
+
|
|
data->chip.chip_delay = pdata->chip.chip_delay;
|
|
data->chip.chip_delay = pdata->chip.chip_delay;
|
|
data->chip.options |= pdata->chip.options;
|
|
data->chip.options |= pdata->chip.options;
|
|
data->chip.bbt_options |= pdata->chip.bbt_options;
|
|
data->chip.bbt_options |= pdata->chip.bbt_options;
|