// SPDX-License-Identifier: GPL-2.0-or-later /* * Overview: * Platform independent driver for NDFC (NanD Flash Controller) * integrated into EP440 cores * * Ported to an OF platform driver by Sean MacLennan * * The NDFC supports multiple chips, but this driver only supports a * single chip since I do not have access to any boards with * multiple chips. * * Author: Thomas Gleixner * * Copyright 2006 IBM * Copyright 2008 PIKA Technologies * Sean MacLennan <smaclennan@pikatech.com>
*/ #include <linux/module.h> #include <linux/mtd/rawnand.h> #include <linux/mtd/partitions.h> #include <linux/mtd/ndfc.h> #include <linux/slab.h> #include <linux/mtd/mtd.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/platform_device.h> #include <asm/io.h>
wmb();
ecc = in_be32(ndfc->ndfcbase + NDFC_ECC); /* The NDFC uses Smart Media (SMC) bytes order */
ecc_code[0] = p[1];
ecc_code[1] = p[2];
ecc_code[2] = p[3];
return 0;
}
/* * Speedups for buffer read/write/verify * * NDFC allows 32bit read/write of data. So we can speed up the buffer * functions. No further checking, as nand_base will always read/write * page aligned.
*/ staticvoid ndfc_read_buf(struct nand_chip *chip, uint8_t *buf, int len)
{ struct ndfc_controller *ndfc = nand_get_controller_data(chip);
uint32_t *p = (uint32_t *) buf;
ndfc->ndfcbase = of_iomap(ofdev->dev.of_node, 0); if (!ndfc->ndfcbase) {
dev_err(&ofdev->dev, "failed to get memory\n"); return -EIO;
}
ccr = NDFC_CCR_BS(ndfc->chip_select);
/* It is ok if ccr does not exist - just default to 0 */
reg = of_get_property(ofdev->dev.of_node, "ccr", NULL); if (reg)
ccr |= be32_to_cpup(reg);
out_be32(ndfc->ndfcbase + NDFC_CCR, ccr);
/* Set the bank settings if given */
reg = of_get_property(ofdev->dev.of_node, "bank-settings", NULL); if (reg) { int offset = NDFC_BCFG0 + (ndfc->chip_select << 2);
out_be32(ndfc->ndfcbase + offset, be32_to_cpup(reg));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.