mtd: rawnand: Pass a nand_chip object to ecc->hwctl()
Let's make the raw NAND API consistent by patching all helpers and hooks to take a nand_chip object instead of an mtd_info one. Now is ecc->hwctl()'s turn. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:

committed by
Miquel Raynal

parent
2b356ab46e
commit
ec47636cd7
@@ -157,9 +157,8 @@ static int cs553x_device_ready(struct mtd_info *mtd)
|
|||||||
return (foo & CS_NAND_STS_FLASH_RDY) && !(foo & CS_NAND_CTLR_BUSY);
|
return (foo & CS_NAND_STS_FLASH_RDY) && !(foo & CS_NAND_CTLR_BUSY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cs_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void cs_enable_hwecc(struct nand_chip *this, int mode)
|
||||||
{
|
{
|
||||||
struct nand_chip *this = mtd_to_nand(mtd);
|
|
||||||
void __iomem *mmio_base = this->IO_ADDR_R;
|
void __iomem *mmio_base = this->IO_ADDR_R;
|
||||||
|
|
||||||
writeb(0x07, mmio_base + MM_NAND_ECC_CTL);
|
writeb(0x07, mmio_base + MM_NAND_ECC_CTL);
|
||||||
|
@@ -146,16 +146,16 @@ static inline uint32_t nand_davinci_readecc_1bit(struct mtd_info *mtd)
|
|||||||
+ 4 * info->core_chipsel);
|
+ 4 * info->core_chipsel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nand_davinci_hwctl_1bit(struct mtd_info *mtd, int mode)
|
static void nand_davinci_hwctl_1bit(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct davinci_nand_info *info;
|
struct davinci_nand_info *info;
|
||||||
uint32_t nandcfr;
|
uint32_t nandcfr;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
info = to_davinci_nand(mtd);
|
info = to_davinci_nand(nand_to_mtd(chip));
|
||||||
|
|
||||||
/* Reset ECC hardware */
|
/* Reset ECC hardware */
|
||||||
nand_davinci_readecc_1bit(mtd);
|
nand_davinci_readecc_1bit(nand_to_mtd(chip));
|
||||||
|
|
||||||
spin_lock_irqsave(&davinci_nand_lock, flags);
|
spin_lock_irqsave(&davinci_nand_lock, flags);
|
||||||
|
|
||||||
@@ -231,9 +231,9 @@ static int nand_davinci_correct_1bit(struct mtd_info *mtd, u_char *dat,
|
|||||||
* OOB without recomputing ECC.
|
* OOB without recomputing ECC.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void nand_davinci_hwctl_4bit(struct mtd_info *mtd, int mode)
|
static void nand_davinci_hwctl_4bit(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct davinci_nand_info *info = to_davinci_nand(mtd);
|
struct davinci_nand_info *info = to_davinci_nand(nand_to_mtd(chip));
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
|
@@ -797,9 +797,8 @@ static int doc200x_block_bad(struct mtd_info *mtd, loff_t ofs)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doc200x_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void doc200x_enable_hwecc(struct nand_chip *this, int mode)
|
||||||
{
|
{
|
||||||
struct nand_chip *this = mtd_to_nand(mtd);
|
|
||||||
struct doc_priv *doc = nand_get_controller_data(this);
|
struct doc_priv *doc = nand_get_controller_data(this);
|
||||||
void __iomem *docptr = doc->virtadr;
|
void __iomem *docptr = doc->virtadr;
|
||||||
|
|
||||||
@@ -816,9 +815,8 @@ static void doc200x_enable_hwecc(struct mtd_info *mtd, int mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doc2001plus_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void doc2001plus_enable_hwecc(struct nand_chip *this, int mode)
|
||||||
{
|
{
|
||||||
struct nand_chip *this = mtd_to_nand(mtd);
|
|
||||||
struct doc_priv *doc = nand_get_controller_data(this);
|
struct doc_priv *doc = nand_get_controller_data(this);
|
||||||
void __iomem *docptr = doc->virtadr;
|
void __iomem *docptr = doc->virtadr;
|
||||||
|
|
||||||
|
@@ -368,9 +368,9 @@ static int fsmc_setup_data_interface(struct mtd_info *mtd, int csline,
|
|||||||
/*
|
/*
|
||||||
* fsmc_enable_hwecc - Enables Hardware ECC through FSMC registers
|
* fsmc_enable_hwecc - Enables Hardware ECC through FSMC registers
|
||||||
*/
|
*/
|
||||||
static void fsmc_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void fsmc_enable_hwecc(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct fsmc_nand_data *host = mtd_to_fsmc(mtd);
|
struct fsmc_nand_data *host = mtd_to_fsmc(nand_to_mtd(chip));
|
||||||
|
|
||||||
writel_relaxed(readl(host->regs_va + FSMC_PC) & ~FSMC_ECCPLEN_256,
|
writel_relaxed(readl(host->regs_va + FSMC_PC) & ~FSMC_ECCPLEN_256,
|
||||||
host->regs_va + FSMC_PC);
|
host->regs_va + FSMC_PC);
|
||||||
@@ -740,7 +740,7 @@ static int fsmc_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
|
|||||||
|
|
||||||
for (i = 0, s = 0; s < eccsteps; s++, i += eccbytes, p += eccsize) {
|
for (i = 0, s = 0; s < eccsteps; s++, i += eccbytes, p += eccsize) {
|
||||||
nand_read_page_op(chip, page, s * eccsize, NULL, 0);
|
nand_read_page_op(chip, page, s * eccsize, NULL, 0);
|
||||||
chip->ecc.hwctl(mtd, NAND_ECC_READ);
|
chip->ecc.hwctl(chip, NAND_ECC_READ);
|
||||||
nand_read_data_op(chip, p, eccsize, false);
|
nand_read_data_op(chip, p, eccsize, false);
|
||||||
|
|
||||||
for (j = 0; j < eccbytes;) {
|
for (j = 0; j < eccbytes;) {
|
||||||
|
@@ -134,9 +134,9 @@ static int jz_nand_dev_ready(struct mtd_info *mtd)
|
|||||||
return gpiod_get_value_cansleep(nand->busy_gpio);
|
return gpiod_get_value_cansleep(nand->busy_gpio);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jz_nand_hwctl(struct mtd_info *mtd, int mode)
|
static void jz_nand_hwctl(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct jz_nand *nand = mtd_to_jz_nand(mtd);
|
struct jz_nand *nand = mtd_to_jz_nand(nand_to_mtd(chip));
|
||||||
uint32_t reg;
|
uint32_t reg;
|
||||||
|
|
||||||
writel(0, nand->base + JZ_REG_NAND_IRQ_STAT);
|
writel(0, nand->base + JZ_REG_NAND_IRQ_STAT);
|
||||||
|
@@ -116,9 +116,9 @@ static int jz4780_nand_dev_ready(struct mtd_info *mtd)
|
|||||||
return !gpiod_get_value_cansleep(nand->busy_gpio);
|
return !gpiod_get_value_cansleep(nand->busy_gpio);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jz4780_nand_ecc_hwctl(struct mtd_info *mtd, int mode)
|
static void jz4780_nand_ecc_hwctl(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct jz4780_nand_chip *nand = to_jz4780_nand_chip(mtd);
|
struct jz4780_nand_chip *nand = to_jz4780_nand_chip(nand_to_mtd(chip));
|
||||||
|
|
||||||
nand->reading = (mode == NAND_ECC_READ);
|
nand->reading = (mode == NAND_ECC_READ);
|
||||||
}
|
}
|
||||||
|
@@ -576,7 +576,7 @@ static int lpc32xx_write_oob(struct mtd_info *mtd, struct nand_chip *chip,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Prepares MLC for transfers with H/W ECC enabled: always enabled anyway */
|
/* Prepares MLC for transfers with H/W ECC enabled: always enabled anyway */
|
||||||
static void lpc32xx_ecc_enable(struct mtd_info *mtd, int mode)
|
static void lpc32xx_ecc_enable(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
/* Always enabled! */
|
/* Always enabled! */
|
||||||
}
|
}
|
||||||
|
@@ -337,7 +337,7 @@ static void lpc32xx_wp_disable(struct lpc32xx_nand_host *host)
|
|||||||
/*
|
/*
|
||||||
* Prepares SLC for transfers with H/W ECC enabled
|
* Prepares SLC for transfers with H/W ECC enabled
|
||||||
*/
|
*/
|
||||||
static void lpc32xx_nand_ecc_enable(struct mtd_info *mtd, int mode)
|
static void lpc32xx_nand_ecc_enable(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
/* Hardware ECC is enabled automatically in hardware as needed */
|
/* Hardware ECC is enabled automatically in hardware as needed */
|
||||||
}
|
}
|
||||||
|
@@ -3272,7 +3272,7 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
||||||
chip->ecc.hwctl(mtd, NAND_ECC_READ);
|
chip->ecc.hwctl(chip, NAND_ECC_READ);
|
||||||
|
|
||||||
ret = nand_read_data_op(chip, p, eccsize, false);
|
ret = nand_read_data_op(chip, p, eccsize, false);
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -3358,7 +3358,7 @@ static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
|
|||||||
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
||||||
int stat;
|
int stat;
|
||||||
|
|
||||||
chip->ecc.hwctl(mtd, NAND_ECC_READ);
|
chip->ecc.hwctl(chip, NAND_ECC_READ);
|
||||||
|
|
||||||
ret = nand_read_data_op(chip, p, eccsize, false);
|
ret = nand_read_data_op(chip, p, eccsize, false);
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -3415,7 +3415,7 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
|
|||||||
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
||||||
int stat;
|
int stat;
|
||||||
|
|
||||||
chip->ecc.hwctl(mtd, NAND_ECC_READ);
|
chip->ecc.hwctl(chip, NAND_ECC_READ);
|
||||||
|
|
||||||
ret = nand_read_data_op(chip, p, eccsize, false);
|
ret = nand_read_data_op(chip, p, eccsize, false);
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -3430,7 +3430,7 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
|
|||||||
oob += chip->ecc.prepad;
|
oob += chip->ecc.prepad;
|
||||||
}
|
}
|
||||||
|
|
||||||
chip->ecc.hwctl(mtd, NAND_ECC_READSYN);
|
chip->ecc.hwctl(chip, NAND_ECC_READSYN);
|
||||||
|
|
||||||
ret = nand_read_data_op(chip, oob, eccbytes, false);
|
ret = nand_read_data_op(chip, oob, eccbytes, false);
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -4151,7 +4151,7 @@ static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
||||||
chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
|
chip->ecc.hwctl(chip, NAND_ECC_WRITE);
|
||||||
|
|
||||||
ret = nand_write_data_op(chip, p, eccsize, false);
|
ret = nand_write_data_op(chip, p, eccsize, false);
|
||||||
if (ret)
|
if (ret)
|
||||||
@@ -4204,7 +4204,7 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd,
|
|||||||
|
|
||||||
for (step = 0; step < ecc_steps; step++) {
|
for (step = 0; step < ecc_steps; step++) {
|
||||||
/* configure controller for WRITE access */
|
/* configure controller for WRITE access */
|
||||||
chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
|
chip->ecc.hwctl(chip, NAND_ECC_WRITE);
|
||||||
|
|
||||||
/* write data (untouched subpages already masked by 0xFF) */
|
/* write data (untouched subpages already masked by 0xFF) */
|
||||||
ret = nand_write_data_op(chip, buf, ecc_size, false);
|
ret = nand_write_data_op(chip, buf, ecc_size, false);
|
||||||
@@ -4272,7 +4272,7 @@ static int nand_write_page_syndrome(struct mtd_info *mtd,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
|
||||||
chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
|
chip->ecc.hwctl(chip, NAND_ECC_WRITE);
|
||||||
|
|
||||||
ret = nand_write_data_op(chip, p, eccsize, false);
|
ret = nand_write_data_op(chip, p, eccsize, false);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@@ -81,10 +81,9 @@ static int ndfc_ready(struct mtd_info *mtd)
|
|||||||
return in_be32(ndfc->ndfcbase + NDFC_STAT) & NDFC_STAT_IS_READY;
|
return in_be32(ndfc->ndfcbase + NDFC_STAT) & NDFC_STAT_IS_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ndfc_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void ndfc_enable_hwecc(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
uint32_t ccr;
|
uint32_t ccr;
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
|
||||||
struct ndfc_controller *ndfc = nand_get_controller_data(chip);
|
struct ndfc_controller *ndfc = nand_get_controller_data(chip);
|
||||||
|
|
||||||
ccr = in_be32(ndfc->ndfcbase + NDFC_CCR);
|
ccr = in_be32(ndfc->ndfcbase + NDFC_CCR);
|
||||||
|
@@ -935,10 +935,9 @@ static int omap_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
|
|||||||
* @mtd: MTD device structure
|
* @mtd: MTD device structure
|
||||||
* @mode: Read/Write mode
|
* @mode: Read/Write mode
|
||||||
*/
|
*/
|
||||||
static void omap_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void omap_enable_hwecc(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct omap_nand_info *info = mtd_to_omap(mtd);
|
struct omap_nand_info *info = mtd_to_omap(nand_to_mtd(chip));
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
|
||||||
unsigned int dev_width = (chip->options & NAND_BUSWIDTH_16) ? 1 : 0;
|
unsigned int dev_width = (chip->options & NAND_BUSWIDTH_16) ? 1 : 0;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
@@ -1030,13 +1029,13 @@ static int omap_dev_ready(struct mtd_info *mtd)
|
|||||||
* eccsize0 = 0 (no additional protected byte in spare area)
|
* eccsize0 = 0 (no additional protected byte in spare area)
|
||||||
* eccsize1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area)
|
* eccsize1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area)
|
||||||
*/
|
*/
|
||||||
static void __maybe_unused omap_enable_hwecc_bch(struct mtd_info *mtd, int mode)
|
static void __maybe_unused omap_enable_hwecc_bch(struct nand_chip *chip,
|
||||||
|
int mode)
|
||||||
{
|
{
|
||||||
unsigned int bch_type;
|
unsigned int bch_type;
|
||||||
unsigned int dev_width, nsectors;
|
unsigned int dev_width, nsectors;
|
||||||
struct omap_nand_info *info = mtd_to_omap(mtd);
|
struct omap_nand_info *info = mtd_to_omap(nand_to_mtd(chip));
|
||||||
enum omap_ecc ecc_opt = info->ecc_opt;
|
enum omap_ecc ecc_opt = info->ecc_opt;
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
|
||||||
u32 val, wr_mode;
|
u32 val, wr_mode;
|
||||||
unsigned int ecc_size1, ecc_size0;
|
unsigned int ecc_size1, ecc_size0;
|
||||||
|
|
||||||
@@ -1529,7 +1528,7 @@ static int omap_write_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
|
|||||||
nand_prog_page_begin_op(chip, page, 0, NULL, 0);
|
nand_prog_page_begin_op(chip, page, 0, NULL, 0);
|
||||||
|
|
||||||
/* Enable GPMC ecc engine */
|
/* Enable GPMC ecc engine */
|
||||||
chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
|
chip->ecc.hwctl(chip, NAND_ECC_WRITE);
|
||||||
|
|
||||||
/* Write data */
|
/* Write data */
|
||||||
chip->write_buf(mtd, buf, mtd->writesize);
|
chip->write_buf(mtd, buf, mtd->writesize);
|
||||||
@@ -1582,7 +1581,7 @@ static int omap_write_subpage_bch(struct mtd_info *mtd,
|
|||||||
nand_prog_page_begin_op(chip, page, 0, NULL, 0);
|
nand_prog_page_begin_op(chip, page, 0, NULL, 0);
|
||||||
|
|
||||||
/* Enable GPMC ECC engine */
|
/* Enable GPMC ECC engine */
|
||||||
chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
|
chip->ecc.hwctl(chip, NAND_ECC_WRITE);
|
||||||
|
|
||||||
/* Write data */
|
/* Write data */
|
||||||
chip->write_buf(mtd, buf, mtd->writesize);
|
chip->write_buf(mtd, buf, mtd->writesize);
|
||||||
@@ -1641,7 +1640,7 @@ static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
|
|||||||
nand_read_page_op(chip, page, 0, NULL, 0);
|
nand_read_page_op(chip, page, 0, NULL, 0);
|
||||||
|
|
||||||
/* Enable GPMC ecc engine */
|
/* Enable GPMC ecc engine */
|
||||||
chip->ecc.hwctl(mtd, NAND_ECC_READ);
|
chip->ecc.hwctl(chip, NAND_ECC_READ);
|
||||||
|
|
||||||
/* Read data */
|
/* Read data */
|
||||||
chip->read_buf(mtd, buf, mtd->writesize);
|
chip->read_buf(mtd, buf, mtd->writesize);
|
||||||
|
@@ -401,9 +401,9 @@ static int r852_ready(struct mtd_info *mtd)
|
|||||||
* Set ECC engine mode
|
* Set ECC engine mode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void r852_ecc_hwctl(struct mtd_info *mtd, int mode)
|
static void r852_ecc_hwctl(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct r852_device *dev = r852_get_dev(mtd);
|
struct r852_device *dev = r852_get_dev(nand_to_mtd(chip));
|
||||||
|
|
||||||
if (dev->card_unstable)
|
if (dev->card_unstable)
|
||||||
return;
|
return;
|
||||||
|
@@ -591,31 +591,34 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
|
|||||||
* generator block to ECC the data as it passes through]
|
* generator block to ECC the data as it passes through]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void s3c2410_nand_enable_hwecc(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
|
struct s3c2410_nand_info *info;
|
||||||
unsigned long ctrl;
|
unsigned long ctrl;
|
||||||
|
|
||||||
|
info = s3c2410_nand_mtd_toinfo(nand_to_mtd(chip));
|
||||||
ctrl = readl(info->regs + S3C2410_NFCONF);
|
ctrl = readl(info->regs + S3C2410_NFCONF);
|
||||||
ctrl |= S3C2410_NFCONF_INITECC;
|
ctrl |= S3C2410_NFCONF_INITECC;
|
||||||
writel(ctrl, info->regs + S3C2410_NFCONF);
|
writel(ctrl, info->regs + S3C2410_NFCONF);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void s3c2412_nand_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void s3c2412_nand_enable_hwecc(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
|
struct s3c2410_nand_info *info;
|
||||||
unsigned long ctrl;
|
unsigned long ctrl;
|
||||||
|
|
||||||
|
info = s3c2410_nand_mtd_toinfo(nand_to_mtd(chip));
|
||||||
ctrl = readl(info->regs + S3C2440_NFCONT);
|
ctrl = readl(info->regs + S3C2440_NFCONT);
|
||||||
writel(ctrl | S3C2412_NFCONT_INIT_MAIN_ECC,
|
writel(ctrl | S3C2412_NFCONT_INIT_MAIN_ECC,
|
||||||
info->regs + S3C2440_NFCONT);
|
info->regs + S3C2440_NFCONT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void s3c2440_nand_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void s3c2440_nand_enable_hwecc(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
|
struct s3c2410_nand_info *info;
|
||||||
unsigned long ctrl;
|
unsigned long ctrl;
|
||||||
|
|
||||||
|
info = s3c2410_nand_mtd_toinfo(nand_to_mtd(chip));
|
||||||
ctrl = readl(info->regs + S3C2440_NFCONT);
|
ctrl = readl(info->regs + S3C2440_NFCONT);
|
||||||
writel(ctrl | S3C2440_NFCONT_INITECC, info->regs + S3C2440_NFCONT);
|
writel(ctrl | S3C2440_NFCONT_INITECC, info->regs + S3C2440_NFCONT);
|
||||||
}
|
}
|
||||||
|
@@ -85,9 +85,9 @@ static int sharpsl_nand_dev_ready(struct mtd_info *mtd)
|
|||||||
return !((readb(sharpsl->io + FLASHCTL) & FLRYBY) == 0);
|
return !((readb(sharpsl->io + FLASHCTL) & FLRYBY) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sharpsl_nand_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void sharpsl_nand_enable_hwecc(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct sharpsl_nand *sharpsl = mtd_to_sharpsl(mtd);
|
struct sharpsl_nand *sharpsl = mtd_to_sharpsl(nand_to_mtd(chip));
|
||||||
writeb(0, sharpsl->io + ECCCLRR);
|
writeb(0, sharpsl->io + ECCCLRR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -259,9 +259,9 @@ static void tmio_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
|
|||||||
tmio_ioread16_rep(tmio->fcr + FCR_DATA, buf, len >> 1);
|
tmio_ioread16_rep(tmio->fcr + FCR_DATA, buf, len >> 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tmio_nand_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void tmio_nand_enable_hwecc(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct tmio_nand *tmio = mtd_to_tmio(mtd);
|
struct tmio_nand *tmio = mtd_to_tmio(nand_to_mtd(chip));
|
||||||
|
|
||||||
tmio_iowrite8(FCR_MODE_HWECC_RESET, tmio->fcr + FCR_MODE);
|
tmio_iowrite8(FCR_MODE_HWECC_RESET, tmio->fcr + FCR_MODE);
|
||||||
tmio_ioread8(tmio->fcr + FCR_DATA); /* dummy read */
|
tmio_ioread8(tmio->fcr + FCR_DATA); /* dummy read */
|
||||||
|
@@ -211,9 +211,9 @@ static int txx9ndfmc_correct_data(struct mtd_info *mtd, unsigned char *buf,
|
|||||||
return corrected;
|
return corrected;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void txx9ndfmc_enable_hwecc(struct mtd_info *mtd, int mode)
|
static void txx9ndfmc_enable_hwecc(struct nand_chip *chip, int mode)
|
||||||
{
|
{
|
||||||
struct platform_device *dev = mtd_to_platdev(mtd);
|
struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip));
|
||||||
u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR);
|
u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR);
|
||||||
|
|
||||||
mcr &= ~TXX9_NDFMCR_ECC_ALL;
|
mcr &= ~TXX9_NDFMCR_ECC_ALL;
|
||||||
|
@@ -647,7 +647,7 @@ struct nand_ecc_ctrl {
|
|||||||
void *priv;
|
void *priv;
|
||||||
u8 *calc_buf;
|
u8 *calc_buf;
|
||||||
u8 *code_buf;
|
u8 *code_buf;
|
||||||
void (*hwctl)(struct mtd_info *mtd, int mode);
|
void (*hwctl)(struct nand_chip *chip, int mode);
|
||||||
int (*calculate)(struct mtd_info *mtd, const uint8_t *dat,
|
int (*calculate)(struct mtd_info *mtd, const uint8_t *dat,
|
||||||
uint8_t *ecc_code);
|
uint8_t *ecc_code);
|
||||||
int (*correct)(struct mtd_info *mtd, uint8_t *dat, uint8_t *read_ecc,
|
int (*correct)(struct mtd_info *mtd, uint8_t *dat, uint8_t *read_ecc,
|
||||||
|
Reference in New Issue
Block a user