/* * NAND support for Marvell Orion SoC platforms * * Tzachi Perelstein <tzachi@marvell.com> * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied.
*/
staticvoid orion_nand_read_buf(struct nand_chip *chip, uint8_t *buf, int len)
{ void __iomem *io_base = chip->legacy.IO_ADDR_R; #ifdefined(__LINUX_ARM_ARCH__) && __LINUX_ARM_ARCH__ >= 5
uint64_t *buf64; #endif int i = 0;
while (len && (unsignedlong)buf & 7) {
*buf++ = readb(io_base);
len--;
} #ifdefined(__LINUX_ARM_ARCH__) && __LINUX_ARM_ARCH__ >= 5
buf64 = (uint64_t *)buf; while (i < len/8) { /* * Since GCC has no proper constraint (PR 43518) * force x variable to r2/r3 registers as ldrd instruction * requires first register to be even.
*/ register uint64_t x asm ("r2");
asmvolatile ("ldrd\t%0, [%1]" : "=&r" (x) : "r" (io_base));
buf64[i++] = x;
}
i *= 8; #else
readsl(io_base, buf, len/4);
i = len / 4 * 4; #endif while (i < len)
buf[i++] = readb(io_base);
}
if (board->chip_delay)
nc->legacy.chip_delay = board->chip_delay;
WARN(board->width > 16, "%d bit bus width out of range",
board->width);
if (board->width == 16)
nc->options |= NAND_BUSWIDTH_16;
platform_set_drvdata(pdev, info);
/* Not all platforms can gate the clock, so it is optional. */
info->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL); if (IS_ERR(info->clk)) return dev_err_probe(&pdev->dev, PTR_ERR(info->clk), "failed to get and enable clock!\n");
/* * This driver assumes that the default ECC engine should be TYPE_SOFT. * Set ->engine_type before registering the NAND devices in order to * provide a driver specific default value.
*/
nc->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
ret = nand_scan(nc, 1); if (ret) return ret;
mtd->name = "orion_nand";
ret = mtd_device_register(mtd, board->parts, board->nr_parts); if (ret)
nand_cleanup(nc);
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.