mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-30 07:34:12 +08:00
mtd: rawnand: tango: convert driver to nand_scan()
Two helpers have been added to the core to do all kind of controller side configuration/initialization between the detection phase and the final NAND scan. Implement these hooks so that we can convert the driver to just use nand_scan() instead of the nand_scan_ident() + nand_scan_tail() pair. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
This commit is contained in:
parent
2a4d9c16e8
commit
6a9035ceb9
@ -517,6 +517,28 @@ static int tango_set_timings(struct mtd_info *mtd, int csline,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int tango_attach_chip(struct nand_chip *chip)
|
||||||
|
{
|
||||||
|
struct nand_ecc_ctrl *ecc = &chip->ecc;
|
||||||
|
|
||||||
|
ecc->mode = NAND_ECC_HW;
|
||||||
|
ecc->algo = NAND_ECC_BCH;
|
||||||
|
ecc->bytes = DIV_ROUND_UP(ecc->strength * FIELD_ORDER, BITS_PER_BYTE);
|
||||||
|
|
||||||
|
ecc->read_page_raw = tango_read_page_raw;
|
||||||
|
ecc->write_page_raw = tango_write_page_raw;
|
||||||
|
ecc->read_page = tango_read_page;
|
||||||
|
ecc->write_page = tango_write_page;
|
||||||
|
ecc->read_oob = tango_read_oob;
|
||||||
|
ecc->write_oob = tango_write_oob;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct nand_controller_ops tango_controller_ops = {
|
||||||
|
.attach_chip = tango_attach_chip,
|
||||||
|
};
|
||||||
|
|
||||||
static int chip_init(struct device *dev, struct device_node *np)
|
static int chip_init(struct device *dev, struct device_node *np)
|
||||||
{
|
{
|
||||||
u32 cs;
|
u32 cs;
|
||||||
@ -566,22 +588,7 @@ static int chip_init(struct device *dev, struct device_node *np)
|
|||||||
mtd_set_ooblayout(mtd, &tango_nand_ooblayout_ops);
|
mtd_set_ooblayout(mtd, &tango_nand_ooblayout_ops);
|
||||||
mtd->dev.parent = dev;
|
mtd->dev.parent = dev;
|
||||||
|
|
||||||
err = nand_scan_ident(mtd, 1, NULL);
|
err = nand_scan(mtd, 1);
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
ecc->mode = NAND_ECC_HW;
|
|
||||||
ecc->algo = NAND_ECC_BCH;
|
|
||||||
ecc->bytes = DIV_ROUND_UP(ecc->strength * FIELD_ORDER, BITS_PER_BYTE);
|
|
||||||
|
|
||||||
ecc->read_page_raw = tango_read_page_raw;
|
|
||||||
ecc->write_page_raw = tango_write_page_raw;
|
|
||||||
ecc->read_page = tango_read_page;
|
|
||||||
ecc->write_page = tango_write_page;
|
|
||||||
ecc->read_oob = tango_read_oob;
|
|
||||||
ecc->write_oob = tango_write_oob;
|
|
||||||
|
|
||||||
err = nand_scan_tail(mtd);
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -655,6 +662,7 @@ static int tango_nand_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
platform_set_drvdata(pdev, nfc);
|
platform_set_drvdata(pdev, nfc);
|
||||||
nand_controller_init(&nfc->hw);
|
nand_controller_init(&nfc->hw);
|
||||||
|
nfc->hw.ops = &tango_controller_ops;
|
||||||
nfc->freq_kHz = clk_get_rate(clk) / 1000;
|
nfc->freq_kHz = clk_get_rate(clk) / 1000;
|
||||||
|
|
||||||
for_each_child_of_node(pdev->dev.of_node, np) {
|
for_each_child_of_node(pdev->dev.of_node, np) {
|
||||||
|
Loading…
Reference in New Issue
Block a user