Commit 4bd4ebcc authored by Boris BREZILLON's avatar Boris BREZILLON Committed by Brian Norris

mtd: nand: make use of mtd_to_nand() in NAND drivers

mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Update all NAND drivers to use it.
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent a83dfa92
...@@ -64,7 +64,7 @@ static struct mtd_partition partition_info[] = { ...@@ -64,7 +64,7 @@ static struct mtd_partition partition_info[] = {
static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte) static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
void __iomem *io_base = this->priv; void __iomem *io_base = this->priv;
writew(0, io_base + OMAP_MPUIO_IO_CNTL); writew(0, io_base + OMAP_MPUIO_IO_CNTL);
...@@ -77,7 +77,7 @@ static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte) ...@@ -77,7 +77,7 @@ static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte)
static u_char ams_delta_read_byte(struct mtd_info *mtd) static u_char ams_delta_read_byte(struct mtd_info *mtd)
{ {
u_char res; u_char res;
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
void __iomem *io_base = this->priv; void __iomem *io_base = this->priv;
gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NRE, 0); gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NRE, 0);
......
...@@ -182,7 +182,7 @@ static void atmel_nand_disable(struct atmel_nand_host *host) ...@@ -182,7 +182,7 @@ static void atmel_nand_disable(struct atmel_nand_host *host)
*/ */
static void atmel_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) static void atmel_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_CTRL_CHANGE) {
...@@ -205,7 +205,7 @@ static void atmel_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl ...@@ -205,7 +205,7 @@ static void atmel_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl
*/ */
static int atmel_nand_device_ready(struct mtd_info *mtd) static int atmel_nand_device_ready(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
return gpio_get_value(host->board.rdy_pin) ^ return gpio_get_value(host->board.rdy_pin) ^
...@@ -215,7 +215,7 @@ static int atmel_nand_device_ready(struct mtd_info *mtd) ...@@ -215,7 +215,7 @@ static int atmel_nand_device_ready(struct mtd_info *mtd)
/* Set up for hardware ready pin and enable pin. */ /* Set up for hardware ready pin and enable pin. */
static int atmel_nand_set_enable_ready_pins(struct mtd_info *mtd) static int atmel_nand_set_enable_ready_pins(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = chip->priv; struct atmel_nand_host *host = chip->priv;
int res = 0; int res = 0;
...@@ -267,7 +267,7 @@ static int atmel_nand_set_enable_ready_pins(struct mtd_info *mtd) ...@@ -267,7 +267,7 @@ static int atmel_nand_set_enable_ready_pins(struct mtd_info *mtd)
*/ */
static void atmel_read_buf8(struct mtd_info *mtd, u8 *buf, int len) static void atmel_read_buf8(struct mtd_info *mtd, u8 *buf, int len)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
if (host->nfc && host->nfc->use_nfc_sram && host->nfc->data_in_sram) { if (host->nfc && host->nfc->use_nfc_sram && host->nfc->data_in_sram) {
...@@ -280,7 +280,7 @@ static void atmel_read_buf8(struct mtd_info *mtd, u8 *buf, int len) ...@@ -280,7 +280,7 @@ static void atmel_read_buf8(struct mtd_info *mtd, u8 *buf, int len)
static void atmel_read_buf16(struct mtd_info *mtd, u8 *buf, int len) static void atmel_read_buf16(struct mtd_info *mtd, u8 *buf, int len)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
if (host->nfc && host->nfc->use_nfc_sram && host->nfc->data_in_sram) { if (host->nfc && host->nfc->use_nfc_sram && host->nfc->data_in_sram) {
...@@ -293,14 +293,14 @@ static void atmel_read_buf16(struct mtd_info *mtd, u8 *buf, int len) ...@@ -293,14 +293,14 @@ static void atmel_read_buf16(struct mtd_info *mtd, u8 *buf, int len)
static void atmel_write_buf8(struct mtd_info *mtd, const u8 *buf, int len) static void atmel_write_buf8(struct mtd_info *mtd, const u8 *buf, int len)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
__raw_writesb(nand_chip->IO_ADDR_W, buf, len); __raw_writesb(nand_chip->IO_ADDR_W, buf, len);
} }
static void atmel_write_buf16(struct mtd_info *mtd, const u8 *buf, int len) static void atmel_write_buf16(struct mtd_info *mtd, const u8 *buf, int len)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
__raw_writesw(nand_chip->IO_ADDR_W, buf, len / 2); __raw_writesw(nand_chip->IO_ADDR_W, buf, len / 2);
} }
...@@ -352,7 +352,7 @@ static int atmel_nand_dma_op(struct mtd_info *mtd, void *buf, int len, ...@@ -352,7 +352,7 @@ static int atmel_nand_dma_op(struct mtd_info *mtd, void *buf, int len,
dma_addr_t dma_src_addr, dma_dst_addr, phys_addr; dma_addr_t dma_src_addr, dma_dst_addr, phys_addr;
struct dma_async_tx_descriptor *tx = NULL; struct dma_async_tx_descriptor *tx = NULL;
dma_cookie_t cookie; dma_cookie_t cookie;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = chip->priv; struct atmel_nand_host *host = chip->priv;
void *p = buf; void *p = buf;
int err = -EIO; int err = -EIO;
...@@ -425,7 +425,7 @@ static int atmel_nand_dma_op(struct mtd_info *mtd, void *buf, int len, ...@@ -425,7 +425,7 @@ static int atmel_nand_dma_op(struct mtd_info *mtd, void *buf, int len,
static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len) static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = chip->priv; struct atmel_nand_host *host = chip->priv;
if (use_dma && len > mtd->oobsize) if (use_dma && len > mtd->oobsize)
...@@ -441,7 +441,7 @@ static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len) ...@@ -441,7 +441,7 @@ static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len)
static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len) static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = chip->priv; struct atmel_nand_host *host = chip->priv;
if (use_dma && len > mtd->oobsize) if (use_dma && len > mtd->oobsize)
...@@ -533,7 +533,7 @@ static int pmecc_data_alloc(struct atmel_nand_host *host) ...@@ -533,7 +533,7 @@ static int pmecc_data_alloc(struct atmel_nand_host *host)
static void pmecc_gen_syndrome(struct mtd_info *mtd, int sector) static void pmecc_gen_syndrome(struct mtd_info *mtd, int sector)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
int i; int i;
uint32_t value; uint32_t value;
...@@ -550,7 +550,7 @@ static void pmecc_gen_syndrome(struct mtd_info *mtd, int sector) ...@@ -550,7 +550,7 @@ static void pmecc_gen_syndrome(struct mtd_info *mtd, int sector)
static void pmecc_substitute(struct mtd_info *mtd) static void pmecc_substitute(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
int16_t __iomem *alpha_to = host->pmecc_alpha_to; int16_t __iomem *alpha_to = host->pmecc_alpha_to;
int16_t __iomem *index_of = host->pmecc_index_of; int16_t __iomem *index_of = host->pmecc_index_of;
...@@ -592,7 +592,7 @@ static void pmecc_substitute(struct mtd_info *mtd) ...@@ -592,7 +592,7 @@ static void pmecc_substitute(struct mtd_info *mtd)
static void pmecc_get_sigma(struct mtd_info *mtd) static void pmecc_get_sigma(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
int16_t *lmu = host->pmecc_lmu; int16_t *lmu = host->pmecc_lmu;
...@@ -750,7 +750,7 @@ static void pmecc_get_sigma(struct mtd_info *mtd) ...@@ -750,7 +750,7 @@ static void pmecc_get_sigma(struct mtd_info *mtd)
static int pmecc_err_location(struct mtd_info *mtd) static int pmecc_err_location(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
unsigned long end_time; unsigned long end_time;
const int cap = host->pmecc_corr_cap; const int cap = host->pmecc_corr_cap;
...@@ -802,7 +802,7 @@ static int pmecc_err_location(struct mtd_info *mtd) ...@@ -802,7 +802,7 @@ static int pmecc_err_location(struct mtd_info *mtd)
static void pmecc_correct_data(struct mtd_info *mtd, uint8_t *buf, uint8_t *ecc, static void pmecc_correct_data(struct mtd_info *mtd, uint8_t *buf, uint8_t *ecc,
int sector_num, int extra_bytes, int err_nbr) int sector_num, int extra_bytes, int err_nbr)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
int i = 0; int i = 0;
int byte_pos, bit_pos, sector_size, pos; int byte_pos, bit_pos, sector_size, pos;
...@@ -848,7 +848,7 @@ static void pmecc_correct_data(struct mtd_info *mtd, uint8_t *buf, uint8_t *ecc, ...@@ -848,7 +848,7 @@ static void pmecc_correct_data(struct mtd_info *mtd, uint8_t *buf, uint8_t *ecc,
static int pmecc_correction(struct mtd_info *mtd, u32 pmecc_stat, uint8_t *buf, static int pmecc_correction(struct mtd_info *mtd, u32 pmecc_stat, uint8_t *buf,
u8 *ecc) u8 *ecc)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
int i, err_nbr; int i, err_nbr;
uint8_t *buf_pos; uint8_t *buf_pos;
...@@ -992,7 +992,7 @@ static int atmel_nand_pmecc_write_page(struct mtd_info *mtd, ...@@ -992,7 +992,7 @@ static int atmel_nand_pmecc_write_page(struct mtd_info *mtd,
static void atmel_pmecc_core_init(struct mtd_info *mtd) static void atmel_pmecc_core_init(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
uint32_t val = 0; uint32_t val = 0;
struct nand_ecclayout *ecc_layout; struct nand_ecclayout *ecc_layout;
...@@ -1308,7 +1308,7 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev, ...@@ -1308,7 +1308,7 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
static int atmel_nand_calculate(struct mtd_info *mtd, static int atmel_nand_calculate(struct mtd_info *mtd,
const u_char *dat, unsigned char *ecc_code) const u_char *dat, unsigned char *ecc_code)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
unsigned int ecc_value; unsigned int ecc_value;
...@@ -1412,7 +1412,7 @@ static int atmel_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -1412,7 +1412,7 @@ static int atmel_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip,
static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat, static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat,
u_char *read_ecc, u_char *isnull) u_char *read_ecc, u_char *isnull)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
unsigned int ecc_status; unsigned int ecc_status;
unsigned int ecc_word, ecc_bit; unsigned int ecc_word, ecc_bit;
...@@ -1478,7 +1478,7 @@ static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat, ...@@ -1478,7 +1478,7 @@ static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat,
*/ */
static void atmel_nand_hwctl(struct mtd_info *mtd, int mode) static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
if (host->board.need_reset_workaround) if (host->board.need_reset_workaround)
...@@ -1771,7 +1771,7 @@ static int nfc_send_command(struct atmel_nand_host *host, ...@@ -1771,7 +1771,7 @@ static int nfc_send_command(struct atmel_nand_host *host,
static int nfc_device_ready(struct mtd_info *mtd) static int nfc_device_ready(struct mtd_info *mtd)
{ {
u32 status, mask; u32 status, mask;
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
status = nfc_read_status(host); status = nfc_read_status(host);
...@@ -1787,7 +1787,7 @@ static int nfc_device_ready(struct mtd_info *mtd) ...@@ -1787,7 +1787,7 @@ static int nfc_device_ready(struct mtd_info *mtd)
static void nfc_select_chip(struct mtd_info *mtd, int chip) static void nfc_select_chip(struct mtd_info *mtd, int chip)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = nand_chip->priv; struct atmel_nand_host *host = nand_chip->priv;
if (chip == -1) if (chip == -1)
...@@ -1799,7 +1799,7 @@ static void nfc_select_chip(struct mtd_info *mtd, int chip) ...@@ -1799,7 +1799,7 @@ static void nfc_select_chip(struct mtd_info *mtd, int chip)
static int nfc_make_addr(struct mtd_info *mtd, int command, int column, static int nfc_make_addr(struct mtd_info *mtd, int command, int column,
int page_addr, unsigned int *addr1234, unsigned int *cycle0) int page_addr, unsigned int *addr1234, unsigned int *cycle0)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
int acycle = 0; int acycle = 0;
unsigned char addr_bytes[8]; unsigned char addr_bytes[8];
...@@ -1839,7 +1839,7 @@ static int nfc_make_addr(struct mtd_info *mtd, int command, int column, ...@@ -1839,7 +1839,7 @@ static int nfc_make_addr(struct mtd_info *mtd, int command, int column,
static void nfc_nand_command(struct mtd_info *mtd, unsigned int command, static void nfc_nand_command(struct mtd_info *mtd, unsigned int command,
int column, int page_addr) int column, int page_addr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = chip->priv; struct atmel_nand_host *host = chip->priv;
unsigned long timeout; unsigned long timeout;
unsigned int nfc_addr_cmd = 0; unsigned int nfc_addr_cmd = 0;
...@@ -2026,7 +2026,7 @@ static int nfc_sram_write_page(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -2026,7 +2026,7 @@ static int nfc_sram_write_page(struct mtd_info *mtd, struct nand_chip *chip,
static int nfc_sram_init(struct mtd_info *mtd) static int nfc_sram_init(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct atmel_nand_host *host = chip->priv; struct atmel_nand_host *host = chip->priv;
int res = 0; int res = 0;
......
...@@ -39,7 +39,7 @@ struct au1550nd_ctx { ...@@ -39,7 +39,7 @@ struct au1550nd_ctx {
*/ */
static u_char au_read_byte(struct mtd_info *mtd) static u_char au_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
u_char ret = readb(this->IO_ADDR_R); u_char ret = readb(this->IO_ADDR_R);
wmb(); /* drain writebuffer */ wmb(); /* drain writebuffer */
return ret; return ret;
...@@ -54,7 +54,7 @@ static u_char au_read_byte(struct mtd_info *mtd) ...@@ -54,7 +54,7 @@ static u_char au_read_byte(struct mtd_info *mtd)
*/ */
static void au_write_byte(struct mtd_info *mtd, u_char byte) static void au_write_byte(struct mtd_info *mtd, u_char byte)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
writeb(byte, this->IO_ADDR_W); writeb(byte, this->IO_ADDR_W);
wmb(); /* drain writebuffer */ wmb(); /* drain writebuffer */
} }
...@@ -67,7 +67,7 @@ static void au_write_byte(struct mtd_info *mtd, u_char byte) ...@@ -67,7 +67,7 @@ static void au_write_byte(struct mtd_info *mtd, u_char byte)
*/ */
static u_char au_read_byte16(struct mtd_info *mtd) static u_char au_read_byte16(struct mtd_info *mtd)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
u_char ret = (u_char) cpu_to_le16(readw(this->IO_ADDR_R)); u_char ret = (u_char) cpu_to_le16(readw(this->IO_ADDR_R));
wmb(); /* drain writebuffer */ wmb(); /* drain writebuffer */
return ret; return ret;
...@@ -82,7 +82,7 @@ static u_char au_read_byte16(struct mtd_info *mtd) ...@@ -82,7 +82,7 @@ static u_char au_read_byte16(struct mtd_info *mtd)
*/ */
static void au_write_byte16(struct mtd_info *mtd, u_char byte) static void au_write_byte16(struct mtd_info *mtd, u_char byte)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
writew(le16_to_cpu((u16) byte), this->IO_ADDR_W); writew(le16_to_cpu((u16) byte), this->IO_ADDR_W);
wmb(); /* drain writebuffer */ wmb(); /* drain writebuffer */
} }
...@@ -95,7 +95,7 @@ static void au_write_byte16(struct mtd_info *mtd, u_char byte) ...@@ -95,7 +95,7 @@ static void au_write_byte16(struct mtd_info *mtd, u_char byte)
*/ */
static u16 au_read_word(struct mtd_info *mtd) static u16 au_read_word(struct mtd_info *mtd)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
u16 ret = readw(this->IO_ADDR_R); u16 ret = readw(this->IO_ADDR_R);
wmb(); /* drain writebuffer */ wmb(); /* drain writebuffer */
return ret; return ret;
...@@ -112,7 +112,7 @@ static u16 au_read_word(struct mtd_info *mtd) ...@@ -112,7 +112,7 @@ static u16 au_read_word(struct mtd_info *mtd)
static void au_write_buf(struct mtd_info *mtd, const u_char *buf, int len) static void au_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
{ {
int i; int i;
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
writeb(buf[i], this->IO_ADDR_W); writeb(buf[i], this->IO_ADDR_W);
...@@ -131,7 +131,7 @@ static void au_write_buf(struct mtd_info *mtd, const u_char *buf, int len) ...@@ -131,7 +131,7 @@ static void au_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
static void au_read_buf(struct mtd_info *mtd, u_char *buf, int len) static void au_read_buf(struct mtd_info *mtd, u_char *buf, int len)
{ {
int i; int i;
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
buf[i] = readb(this->IO_ADDR_R); buf[i] = readb(this->IO_ADDR_R);
...@@ -150,7 +150,7 @@ static void au_read_buf(struct mtd_info *mtd, u_char *buf, int len) ...@@ -150,7 +150,7 @@ static void au_read_buf(struct mtd_info *mtd, u_char *buf, int len)
static void au_write_buf16(struct mtd_info *mtd, const u_char *buf, int len) static void au_write_buf16(struct mtd_info *mtd, const u_char *buf, int len)
{ {
int i; int i;
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
u16 *p = (u16 *) buf; u16 *p = (u16 *) buf;
len >>= 1; len >>= 1;
...@@ -172,7 +172,7 @@ static void au_write_buf16(struct mtd_info *mtd, const u_char *buf, int len) ...@@ -172,7 +172,7 @@ static void au_write_buf16(struct mtd_info *mtd, const u_char *buf, int len)
static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len) static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len)
{ {
int i; int i;
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
u16 *p = (u16 *) buf; u16 *p = (u16 *) buf;
len >>= 1; len >>= 1;
...@@ -198,7 +198,7 @@ static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len) ...@@ -198,7 +198,7 @@ static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len)
static void au1550_hwcontrol(struct mtd_info *mtd, int cmd) static void au1550_hwcontrol(struct mtd_info *mtd, int cmd)
{ {
struct au1550nd_ctx *ctx = container_of(mtd, struct au1550nd_ctx, info); struct au1550nd_ctx *ctx = container_of(mtd, struct au1550nd_ctx, info);
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
switch (cmd) { switch (cmd) {
...@@ -268,7 +268,7 @@ static void au1550_select_chip(struct mtd_info *mtd, int chip) ...@@ -268,7 +268,7 @@ static void au1550_select_chip(struct mtd_info *mtd, int chip)
static void au1550_command(struct mtd_info *mtd, unsigned command, int column, int page_addr) static void au1550_command(struct mtd_info *mtd, unsigned command, int column, int page_addr)
{ {
struct au1550nd_ctx *ctx = container_of(mtd, struct au1550nd_ctx, info); struct au1550nd_ctx *ctx = container_of(mtd, struct au1550nd_ctx, info);
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
int ce_override = 0, i; int ce_override = 0, i;
unsigned long flags = 0; unsigned long flags = 0;
......
...@@ -89,7 +89,7 @@ static int bcm47xxnflash_ops_bcm4706_poll(struct bcma_drv_cc *cc) ...@@ -89,7 +89,7 @@ static int bcm47xxnflash_ops_bcm4706_poll(struct bcma_drv_cc *cc)
static void bcm47xxnflash_ops_bcm4706_read(struct mtd_info *mtd, uint8_t *buf, static void bcm47xxnflash_ops_bcm4706_read(struct mtd_info *mtd, uint8_t *buf,
int len) int len)
{ {
struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv; struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
u32 ctlcode; u32 ctlcode;
...@@ -139,7 +139,7 @@ static void bcm47xxnflash_ops_bcm4706_read(struct mtd_info *mtd, uint8_t *buf, ...@@ -139,7 +139,7 @@ static void bcm47xxnflash_ops_bcm4706_read(struct mtd_info *mtd, uint8_t *buf,
static void bcm47xxnflash_ops_bcm4706_write(struct mtd_info *mtd, static void bcm47xxnflash_ops_bcm4706_write(struct mtd_info *mtd,
const uint8_t *buf, int len) const uint8_t *buf, int len)
{ {
struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv; struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
struct bcma_drv_cc *cc = b47n->cc; struct bcma_drv_cc *cc = b47n->cc;
...@@ -173,7 +173,7 @@ static void bcm47xxnflash_ops_bcm4706_write(struct mtd_info *mtd, ...@@ -173,7 +173,7 @@ static void bcm47xxnflash_ops_bcm4706_write(struct mtd_info *mtd,
static void bcm47xxnflash_ops_bcm4706_cmd_ctrl(struct mtd_info *mtd, int cmd, static void bcm47xxnflash_ops_bcm4706_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl) unsigned int ctrl)
{ {
struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv; struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
u32 code = 0; u32 code = 0;
...@@ -199,7 +199,7 @@ static void bcm47xxnflash_ops_bcm4706_select_chip(struct mtd_info *mtd, ...@@ -199,7 +199,7 @@ static void bcm47xxnflash_ops_bcm4706_select_chip(struct mtd_info *mtd,
static int bcm47xxnflash_ops_bcm4706_dev_ready(struct mtd_info *mtd) static int bcm47xxnflash_ops_bcm4706_dev_ready(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv; struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
return !!(bcma_cc_read32(b47n->cc, BCMA_CC_NFLASH_CTL) & NCTL_READY); return !!(bcma_cc_read32(b47n->cc, BCMA_CC_NFLASH_CTL) & NCTL_READY);
...@@ -216,7 +216,7 @@ static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct mtd_info *mtd, ...@@ -216,7 +216,7 @@ static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct mtd_info *mtd,
unsigned command, int column, unsigned command, int column,
int page_addr) int page_addr)
{ {
struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv; struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
struct bcma_drv_cc *cc = b47n->cc; struct bcma_drv_cc *cc = b47n->cc;
u32 ctlcode; u32 ctlcode;
...@@ -312,7 +312,7 @@ static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct mtd_info *mtd, ...@@ -312,7 +312,7 @@ static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct mtd_info *mtd,
static u8 bcm47xxnflash_ops_bcm4706_read_byte(struct mtd_info *mtd) static u8 bcm47xxnflash_ops_bcm4706_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv; struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
struct bcma_drv_cc *cc = b47n->cc; struct bcma_drv_cc *cc = b47n->cc;
u32 tmp = 0; u32 tmp = 0;
...@@ -341,7 +341,7 @@ static u8 bcm47xxnflash_ops_bcm4706_read_byte(struct mtd_info *mtd) ...@@ -341,7 +341,7 @@ static u8 bcm47xxnflash_ops_bcm4706_read_byte(struct mtd_info *mtd)
static void bcm47xxnflash_ops_bcm4706_read_buf(struct mtd_info *mtd, static void bcm47xxnflash_ops_bcm4706_read_buf(struct mtd_info *mtd,
uint8_t *buf, int len) uint8_t *buf, int len)
{ {
struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv; struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
switch (b47n->curr_command) { switch (b47n->curr_command) {
...@@ -357,7 +357,7 @@ static void bcm47xxnflash_ops_bcm4706_read_buf(struct mtd_info *mtd, ...@@ -357,7 +357,7 @@ static void bcm47xxnflash_ops_bcm4706_read_buf(struct mtd_info *mtd,
static void bcm47xxnflash_ops_bcm4706_write_buf(struct mtd_info *mtd, static void bcm47xxnflash_ops_bcm4706_write_buf(struct mtd_info *mtd,
const uint8_t *buf, int len) const uint8_t *buf, int len)
{ {
struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv; struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
switch (b47n->curr_command) { switch (b47n->curr_command) {
......
...@@ -304,7 +304,7 @@ static int bf5xx_nand_correct_data_256(struct mtd_info *mtd, u_char *dat, ...@@ -304,7 +304,7 @@ static int bf5xx_nand_correct_data_256(struct mtd_info *mtd, u_char *dat,
static int bf5xx_nand_correct_data(struct mtd_info *mtd, u_char *dat, static int bf5xx_nand_correct_data(struct mtd_info *mtd, u_char *dat,
u_char *read_ecc, u_char *calc_ecc) u_char *read_ecc, u_char *calc_ecc)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
int ret; int ret;
ret = bf5xx_nand_correct_data_256(mtd, dat, read_ecc, calc_ecc); ret = bf5xx_nand_correct_data_256(mtd, dat, read_ecc, calc_ecc);
...@@ -329,7 +329,7 @@ static int bf5xx_nand_calculate_ecc(struct mtd_info *mtd, ...@@ -329,7 +329,7 @@ static int bf5xx_nand_calculate_ecc(struct mtd_info *mtd,
const u_char *dat, u_char *ecc_code) const u_char *dat, u_char *ecc_code)
{ {
struct bf5xx_nand_info *info = mtd_to_nand_info(mtd); struct bf5xx_nand_info *info = mtd_to_nand_info(mtd);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
u16 ecc0, ecc1; u16 ecc0, ecc1;
u32 code[2]; u32 code[2];
u8 *p; u8 *p;
...@@ -466,7 +466,7 @@ static void bf5xx_nand_dma_rw(struct mtd_info *mtd, ...@@ -466,7 +466,7 @@ static void bf5xx_nand_dma_rw(struct mtd_info *mtd,
uint8_t *buf, int is_read) uint8_t *buf, int is_read)
{ {
struct bf5xx_nand_info *info = mtd_to_nand_info(mtd); struct bf5xx_nand_info *info = mtd_to_nand_info(mtd);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
unsigned short val; unsigned short val;
dev_dbg(info->device, " mtd->%p, buf->%p, is_read %d\n", dev_dbg(info->device, " mtd->%p, buf->%p, is_read %d\n",
...@@ -532,7 +532,7 @@ static void bf5xx_nand_dma_read_buf(struct mtd_info *mtd, ...@@ -532,7 +532,7 @@ static void bf5xx_nand_dma_read_buf(struct mtd_info *mtd,
uint8_t *buf, int len) uint8_t *buf, int len)
{ {
struct bf5xx_nand_info *info = mtd_to_nand_info(mtd); struct bf5xx_nand_info *info = mtd_to_nand_info(mtd);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
dev_dbg(info->device, "mtd->%p, buf->%p, int %d\n", mtd, buf, len); dev_dbg(info->device, "mtd->%p, buf->%p, int %d\n", mtd, buf, len);
...@@ -546,7 +546,7 @@ static void bf5xx_nand_dma_write_buf(struct mtd_info *mtd, ...@@ -546,7 +546,7 @@ static void bf5xx_nand_dma_write_buf(struct mtd_info *mtd,
const uint8_t *buf, int len) const uint8_t *buf, int len)
{ {
struct bf5xx_nand_info *info = mtd_to_nand_info(mtd); struct bf5xx_nand_info *info = mtd_to_nand_info(mtd);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
dev_dbg(info->device, "mtd->%p, buf->%p, len %d\n", mtd, buf, len); dev_dbg(info->device, "mtd->%p, buf->%p, len %d\n", mtd, buf, len);
...@@ -685,7 +685,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev) ...@@ -685,7 +685,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev)
static int bf5xx_nand_scan(struct mtd_info *mtd) static int bf5xx_nand_scan(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
int ret; int ret;
ret = nand_scan_ident(mtd, 1, NULL); ret = nand_scan_ident(mtd, 1, NULL);
......
...@@ -873,7 +873,7 @@ static struct nand_ecclayout *brcmstb_choose_ecc_layout( ...@@ -873,7 +873,7 @@ static struct nand_ecclayout *brcmstb_choose_ecc_layout(
static void brcmnand_wp(struct mtd_info *mtd, int wp) static void brcmnand_wp(struct mtd_info *mtd, int wp)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct brcmnand_host *host = chip->priv; struct brcmnand_host *host = chip->priv;
struct brcmnand_controller *ctrl = host->ctrl; struct brcmnand_controller *ctrl = host->ctrl;
...@@ -1039,7 +1039,7 @@ static void brcmnand_cmd_ctrl(struct mtd_info *mtd, int dat, ...@@ -1039,7 +1039,7 @@ static void brcmnand_cmd_ctrl(struct mtd_info *mtd, int dat,
static int brcmnand_waitfunc(struct mtd_info *mtd, struct nand_chip *this) static int brcmnand_waitfunc(struct mtd_info *mtd, struct nand_chip *this)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct brcmnand_host *host = chip->priv; struct brcmnand_host *host = chip->priv;
struct brcmnand_controller *ctrl = host->ctrl; struct brcmnand_controller *ctrl = host->ctrl;
unsigned long timeo = msecs_to_jiffies(100); unsigned long timeo = msecs_to_jiffies(100);
...@@ -1113,7 +1113,7 @@ static int brcmnand_low_level_op(struct brcmnand_host *host, ...@@ -1113,7 +1113,7 @@ static int brcmnand_low_level_op(struct brcmnand_host *host,
static void brcmnand_cmdfunc(struct mtd_info *mtd, unsigned command, static void brcmnand_cmdfunc(struct mtd_info *mtd, unsigned command,
int column, int page_addr) int column, int page_addr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct brcmnand_host *host = chip->priv; struct brcmnand_host *host = chip->priv;
struct brcmnand_controller *ctrl = host->ctrl; struct brcmnand_controller *ctrl = host->ctrl;
u64 addr = (u64)page_addr << chip->page_shift; u64 addr = (u64)page_addr << chip->page_shift;
...@@ -1219,7 +1219,7 @@ static void brcmnand_cmdfunc(struct mtd_info *mtd, unsigned command, ...@@ -1219,7 +1219,7 @@ static void brcmnand_cmdfunc(struct mtd_info *mtd, unsigned command,
static uint8_t brcmnand_read_byte(struct mtd_info *mtd) static uint8_t brcmnand_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct brcmnand_host *host = chip->priv; struct brcmnand_host *host = chip->priv;
struct brcmnand_controller *ctrl = host->ctrl; struct brcmnand_controller *ctrl = host->ctrl;
uint8_t ret = 0; uint8_t ret = 0;
...@@ -1286,7 +1286,7 @@ static void brcmnand_write_buf(struct mtd_info *mtd, const uint8_t *buf, ...@@ -1286,7 +1286,7 @@ static void brcmnand_write_buf(struct mtd_info *mtd, const uint8_t *buf,
int len) int len)
{ {
int i; int i;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct brcmnand_host *host = chip->priv; struct brcmnand_host *host = chip->priv;
switch (host->last_cmd) { switch (host->last_cmd) {
...@@ -2061,7 +2061,7 @@ static int brcmnand_resume(struct device *dev) ...@@ -2061,7 +2061,7 @@ static int brcmnand_resume(struct device *dev)
list_for_each_entry(host, &ctrl->host_list, node) { list_for_each_entry(host, &ctrl->host_list, node) {
struct mtd_info *mtd = &host->mtd; struct mtd_info *mtd = &host->mtd;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
brcmnand_save_restore_cs_config(host, 1); brcmnand_save_restore_cs_config(host, 1);
......
...@@ -101,7 +101,7 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; ...@@ -101,7 +101,7 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
static int cafe_device_ready(struct mtd_info *mtd) static int cafe_device_ready(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct cafe_priv *cafe = chip->priv; struct cafe_priv *cafe = chip->priv;
int result = !!(cafe_readl(cafe, NAND_STATUS) & 0x40000000); int result = !!(cafe_readl(cafe, NAND_STATUS) & 0x40000000);
uint32_t irqs = cafe_readl(cafe, NAND_IRQ); uint32_t irqs = cafe_readl(cafe, NAND_IRQ);
...@@ -118,7 +118,7 @@ static int cafe_device_ready(struct mtd_info *mtd) ...@@ -118,7 +118,7 @@ static int cafe_device_ready(struct mtd_info *mtd)
static void cafe_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) static void cafe_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct cafe_priv *cafe = chip->priv; struct cafe_priv *cafe = chip->priv;
if (usedma) if (usedma)
...@@ -134,7 +134,7 @@ static void cafe_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) ...@@ -134,7 +134,7 @@ static void cafe_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
static void cafe_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void cafe_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct cafe_priv *cafe = chip->priv; struct cafe_priv *cafe = chip->priv;
if (usedma) if (usedma)
...@@ -149,7 +149,7 @@ static void cafe_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) ...@@ -149,7 +149,7 @@ static void cafe_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
static uint8_t cafe_read_byte(struct mtd_info *mtd) static uint8_t cafe_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct cafe_priv *cafe = chip->priv; struct cafe_priv *cafe = chip->priv;
uint8_t d; uint8_t d;
...@@ -162,7 +162,7 @@ static uint8_t cafe_read_byte(struct mtd_info *mtd) ...@@ -162,7 +162,7 @@ static uint8_t cafe_read_byte(struct mtd_info *mtd)
static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
int column, int page_addr) int column, int page_addr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct cafe_priv *cafe = chip->priv; struct cafe_priv *cafe = chip->priv;
int adrbytes = 0; int adrbytes = 0;
uint32_t ctl1; uint32_t ctl1;
...@@ -318,7 +318,7 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, ...@@ -318,7 +318,7 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
static void cafe_select_chip(struct mtd_info *mtd, int chipnr) static void cafe_select_chip(struct mtd_info *mtd, int chipnr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct cafe_priv *cafe = chip->priv; struct cafe_priv *cafe = chip->priv;
cafe_dev_dbg(&cafe->pdev->dev, "select_chip %d\n", chipnr); cafe_dev_dbg(&cafe->pdev->dev, "select_chip %d\n", chipnr);
...@@ -334,7 +334,7 @@ static void cafe_select_chip(struct mtd_info *mtd, int chipnr) ...@@ -334,7 +334,7 @@ static void cafe_select_chip(struct mtd_info *mtd, int chipnr)
static irqreturn_t cafe_nand_interrupt(int irq, void *id) static irqreturn_t cafe_nand_interrupt(int irq, void *id)
{ {
struct mtd_info *mtd = id; struct mtd_info *mtd = id;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct cafe_priv *cafe = chip->priv; struct cafe_priv *cafe = chip->priv;
uint32_t irqs = cafe_readl(cafe, NAND_IRQ); uint32_t irqs = cafe_readl(cafe, NAND_IRQ);
cafe_writel(cafe, irqs & ~0x90000000, NAND_IRQ); cafe_writel(cafe, irqs & ~0x90000000, NAND_IRQ);
...@@ -800,7 +800,7 @@ static int cafe_nand_probe(struct pci_dev *pdev, ...@@ -800,7 +800,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
static void cafe_nand_remove(struct pci_dev *pdev) static void cafe_nand_remove(struct pci_dev *pdev)
{ {
struct mtd_info *mtd = pci_get_drvdata(pdev); struct mtd_info *mtd = pci_get_drvdata(pdev);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct cafe_priv *cafe = chip->priv; struct cafe_priv *cafe = chip->priv;
/* Disable NAND IRQ in global IRQ mask register */ /* Disable NAND IRQ in global IRQ mask register */
...@@ -828,7 +828,7 @@ static int cafe_nand_resume(struct pci_dev *pdev) ...@@ -828,7 +828,7 @@ static int cafe_nand_resume(struct pci_dev *pdev)
{ {
uint32_t ctrl; uint32_t ctrl;
struct mtd_info *mtd = pci_get_drvdata(pdev); struct mtd_info *mtd = pci_get_drvdata(pdev);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct cafe_priv *cafe = chip->priv; struct cafe_priv *cafe = chip->priv;
/* Start off by resetting the NAND controller completely */ /* Start off by resetting the NAND controller completely */
......
...@@ -53,7 +53,7 @@ static struct mtd_partition partition_info[] = { ...@@ -53,7 +53,7 @@ static struct mtd_partition partition_info[] = {
static u_char cmx270_read_byte(struct mtd_info *mtd) static u_char cmx270_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
return (readl(this->IO_ADDR_R) >> 16); return (readl(this->IO_ADDR_R) >> 16);
} }
...@@ -61,7 +61,7 @@ static u_char cmx270_read_byte(struct mtd_info *mtd) ...@@ -61,7 +61,7 @@ static u_char cmx270_read_byte(struct mtd_info *mtd)
static void cmx270_write_buf(struct mtd_info *mtd, const u_char *buf, int len) static void cmx270_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
{ {
int i; int i;
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
for (i=0; i<len; i++) for (i=0; i<len; i++)
writel((*buf++ << 16), this->IO_ADDR_W); writel((*buf++ << 16), this->IO_ADDR_W);
...@@ -70,7 +70,7 @@ static void cmx270_write_buf(struct mtd_info *mtd, const u_char *buf, int len) ...@@ -70,7 +70,7 @@ static void cmx270_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
static void cmx270_read_buf(struct mtd_info *mtd, u_char *buf, int len) static void cmx270_read_buf(struct mtd_info *mtd, u_char *buf, int len)
{ {
int i; int i;
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
for (i=0; i<len; i++) for (i=0; i<len; i++)
*buf++ = readl(this->IO_ADDR_R) >> 16; *buf++ = readl(this->IO_ADDR_R) >> 16;
...@@ -94,7 +94,7 @@ static void nand_cs_off(void) ...@@ -94,7 +94,7 @@ static void nand_cs_off(void)
static void cmx270_hwcontrol(struct mtd_info *mtd, int dat, static void cmx270_hwcontrol(struct mtd_info *mtd, int dat,
unsigned int ctrl) unsigned int ctrl)
{ {
struct nand_chip* this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
unsigned int nandaddr = (unsigned int)this->IO_ADDR_W; unsigned int nandaddr = (unsigned int)this->IO_ADDR_W;
dsb(); dsb();
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
static void cs553x_read_buf(struct mtd_info *mtd, u_char *buf, int len) static void cs553x_read_buf(struct mtd_info *mtd, u_char *buf, int len)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
while (unlikely(len > 0x800)) { while (unlikely(len > 0x800)) {
memcpy_fromio(buf, this->IO_ADDR_R, 0x800); memcpy_fromio(buf, this->IO_ADDR_R, 0x800);
...@@ -109,7 +109,7 @@ static void cs553x_read_buf(struct mtd_info *mtd, u_char *buf, int len) ...@@ -109,7 +109,7 @@ static void cs553x_read_buf(struct mtd_info *mtd, u_char *buf, int len)
static void cs553x_write_buf(struct mtd_info *mtd, const u_char *buf, int len) static void cs553x_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
while (unlikely(len > 0x800)) { while (unlikely(len > 0x800)) {
memcpy_toio(this->IO_ADDR_R, buf, 0x800); memcpy_toio(this->IO_ADDR_R, buf, 0x800);
...@@ -121,13 +121,13 @@ static void cs553x_write_buf(struct mtd_info *mtd, const u_char *buf, int len) ...@@ -121,13 +121,13 @@ static void cs553x_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
static unsigned char cs553x_read_byte(struct mtd_info *mtd) static unsigned char cs553x_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
return readb(this->IO_ADDR_R); return readb(this->IO_ADDR_R);
} }
static void cs553x_write_byte(struct mtd_info *mtd, u_char byte) static void cs553x_write_byte(struct mtd_info *mtd, u_char byte)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
int i = 100000; int i = 100000;
while (i && readb(this->IO_ADDR_R + MM_NAND_STS) & CS_NAND_CTLR_BUSY) { while (i && readb(this->IO_ADDR_R + MM_NAND_STS) & CS_NAND_CTLR_BUSY) {
...@@ -140,7 +140,7 @@ static void cs553x_write_byte(struct mtd_info *mtd, u_char byte) ...@@ -140,7 +140,7 @@ static void cs553x_write_byte(struct mtd_info *mtd, u_char byte)
static void cs553x_hwcontrol(struct mtd_info *mtd, int cmd, static void cs553x_hwcontrol(struct mtd_info *mtd, int cmd,
unsigned int ctrl) unsigned int ctrl)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
void __iomem *mmio_base = this->IO_ADDR_R; void __iomem *mmio_base = this->IO_ADDR_R;
if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_CTRL_CHANGE) {
unsigned char ctl = (ctrl & ~NAND_CTRL_CHANGE ) ^ 0x01; unsigned char ctl = (ctrl & ~NAND_CTRL_CHANGE ) ^ 0x01;
...@@ -152,7 +152,7 @@ static void cs553x_hwcontrol(struct mtd_info *mtd, int cmd, ...@@ -152,7 +152,7 @@ static void cs553x_hwcontrol(struct mtd_info *mtd, int cmd,
static int cs553x_device_ready(struct mtd_info *mtd) static int cs553x_device_ready(struct mtd_info *mtd)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
void __iomem *mmio_base = this->IO_ADDR_R; void __iomem *mmio_base = this->IO_ADDR_R;
unsigned char foo = readb(mmio_base + MM_NAND_STS); unsigned char foo = readb(mmio_base + MM_NAND_STS);
...@@ -161,7 +161,7 @@ static int cs553x_device_ready(struct mtd_info *mtd) ...@@ -161,7 +161,7 @@ static int cs553x_device_ready(struct mtd_info *mtd)
static void cs_enable_hwecc(struct mtd_info *mtd, int mode) static void cs_enable_hwecc(struct mtd_info *mtd, int mode)
{ {
struct nand_chip *this = mtd->priv; 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);
...@@ -170,7 +170,7 @@ static void cs_enable_hwecc(struct mtd_info *mtd, int mode) ...@@ -170,7 +170,7 @@ static void cs_enable_hwecc(struct mtd_info *mtd, int mode)
static int cs_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code) static int cs_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
{ {
uint32_t ecc; uint32_t ecc;
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
void __iomem *mmio_base = this->IO_ADDR_R; void __iomem *mmio_base = this->IO_ADDR_R;
ecc = readl(mmio_base + MM_NAND_STS); ecc = readl(mmio_base + MM_NAND_STS);
...@@ -337,7 +337,7 @@ static void __exit cs553x_cleanup(void) ...@@ -337,7 +337,7 @@ static void __exit cs553x_cleanup(void)
if (!mtd) if (!mtd)
continue; continue;
this = cs553x_mtd[i]->priv; this = mtd_to_nand(cs553x_mtd[i]);
mmio_base = this->IO_ADDR_R; mmio_base = this->IO_ADDR_R;
/* Release resources, unregister device */ /* Release resources, unregister device */
......
...@@ -106,7 +106,7 @@ static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd, ...@@ -106,7 +106,7 @@ static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd,
{ {
struct davinci_nand_info *info = to_davinci_nand(mtd); struct davinci_nand_info *info = to_davinci_nand(mtd);
uint32_t addr = info->current_cs; uint32_t addr = info->current_cs;
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
/* Did the control lines change? */ /* Did the control lines change? */
if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_CTRL_CHANGE) {
...@@ -192,7 +192,7 @@ static int nand_davinci_calculate_1bit(struct mtd_info *mtd, ...@@ -192,7 +192,7 @@ static int nand_davinci_calculate_1bit(struct mtd_info *mtd,
static int nand_davinci_correct_1bit(struct mtd_info *mtd, u_char *dat, static int nand_davinci_correct_1bit(struct mtd_info *mtd, u_char *dat,
u_char *read_ecc, u_char *calc_ecc) u_char *read_ecc, u_char *calc_ecc)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
uint32_t eccNand = read_ecc[0] | (read_ecc[1] << 8) | uint32_t eccNand = read_ecc[0] | (read_ecc[1] << 8) |
(read_ecc[2] << 16); (read_ecc[2] << 16);
uint32_t eccCalc = calc_ecc[0] | (calc_ecc[1] << 8) | uint32_t eccCalc = calc_ecc[0] | (calc_ecc[1] << 8) |
...@@ -447,7 +447,7 @@ static int nand_davinci_correct_4bit(struct mtd_info *mtd, ...@@ -447,7 +447,7 @@ static int nand_davinci_correct_4bit(struct mtd_info *mtd,
*/ */
static void nand_davinci_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void nand_davinci_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
if ((0x03 & ((unsigned)buf)) == 0 && (0x03 & len) == 0) if ((0x03 & ((unsigned)buf)) == 0 && (0x03 & len) == 0)
ioread32_rep(chip->IO_ADDR_R, buf, len >> 2); ioread32_rep(chip->IO_ADDR_R, buf, len >> 2);
...@@ -460,7 +460,7 @@ static void nand_davinci_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) ...@@ -460,7 +460,7 @@ static void nand_davinci_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
static void nand_davinci_write_buf(struct mtd_info *mtd, static void nand_davinci_write_buf(struct mtd_info *mtd,
const uint8_t *buf, int len) const uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
if ((0x03 & ((unsigned)buf)) == 0 && (0x03 & len) == 0) if ((0x03 & ((unsigned)buf)) == 0 && (0x03 & len) == 0)
iowrite32_rep(chip->IO_ADDR_R, buf, len >> 2); iowrite32_rep(chip->IO_ADDR_R, buf, len >> 2);
......
This diff is collapsed.
...@@ -242,7 +242,7 @@ static inline void write_nop(void __iomem *docptr) ...@@ -242,7 +242,7 @@ static inline void write_nop(void __iomem *docptr)
static void docg4_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void docg4_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{ {
int i; int i;
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
uint16_t *p = (uint16_t *) buf; uint16_t *p = (uint16_t *) buf;
len >>= 1; len >>= 1;
...@@ -253,7 +253,7 @@ static void docg4_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) ...@@ -253,7 +253,7 @@ static void docg4_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
static void docg4_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len) static void docg4_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len)
{ {
int i; int i;
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
uint16_t *p = (uint16_t *) buf; uint16_t *p = (uint16_t *) buf;
len >>= 1; len >>= 1;
...@@ -318,7 +318,7 @@ static void docg4_select_chip(struct mtd_info *mtd, int chip) ...@@ -318,7 +318,7 @@ static void docg4_select_chip(struct mtd_info *mtd, int chip)
* Select among multiple cascaded chips ("floors"). Multiple floors are * Select among multiple cascaded chips ("floors"). Multiple floors are
* not yet supported, so the only valid non-negative value is 0. * not yet supported, so the only valid non-negative value is 0.
*/ */
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
void __iomem *docptr = doc->virtadr; void __iomem *docptr = doc->virtadr;
...@@ -337,7 +337,7 @@ static void reset(struct mtd_info *mtd) ...@@ -337,7 +337,7 @@ static void reset(struct mtd_info *mtd)
{ {
/* full device reset */ /* full device reset */
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
void __iomem *docptr = doc->virtadr; void __iomem *docptr = doc->virtadr;
...@@ -375,7 +375,7 @@ static int correct_data(struct mtd_info *mtd, uint8_t *buf, int page) ...@@ -375,7 +375,7 @@ static int correct_data(struct mtd_info *mtd, uint8_t *buf, int page)
* Up to four bitflips can be corrected. * Up to four bitflips can be corrected.
*/ */
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
void __iomem *docptr = doc->virtadr; void __iomem *docptr = doc->virtadr;
int i, numerrs, errpos[4]; int i, numerrs, errpos[4];
...@@ -464,7 +464,7 @@ static int correct_data(struct mtd_info *mtd, uint8_t *buf, int page) ...@@ -464,7 +464,7 @@ static int correct_data(struct mtd_info *mtd, uint8_t *buf, int page)
static uint8_t docg4_read_byte(struct mtd_info *mtd) static uint8_t docg4_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
dev_dbg(doc->dev, "%s\n", __func__); dev_dbg(doc->dev, "%s\n", __func__);
...@@ -545,7 +545,7 @@ static int pageprog(struct mtd_info *mtd) ...@@ -545,7 +545,7 @@ static int pageprog(struct mtd_info *mtd)
* internal buffer out to the flash array, or some such. * internal buffer out to the flash array, or some such.
*/ */
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
void __iomem *docptr = doc->virtadr; void __iomem *docptr = doc->virtadr;
int retval = 0; int retval = 0;
...@@ -582,7 +582,7 @@ static void sequence_reset(struct mtd_info *mtd) ...@@ -582,7 +582,7 @@ static void sequence_reset(struct mtd_info *mtd)
{ {
/* common starting sequence for all operations */ /* common starting sequence for all operations */
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
void __iomem *docptr = doc->virtadr; void __iomem *docptr = doc->virtadr;
...@@ -599,7 +599,7 @@ static void read_page_prologue(struct mtd_info *mtd, uint32_t docg4_addr) ...@@ -599,7 +599,7 @@ static void read_page_prologue(struct mtd_info *mtd, uint32_t docg4_addr)
{ {
/* first step in reading a page */ /* first step in reading a page */
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
void __iomem *docptr = doc->virtadr; void __iomem *docptr = doc->virtadr;
...@@ -626,7 +626,7 @@ static void write_page_prologue(struct mtd_info *mtd, uint32_t docg4_addr) ...@@ -626,7 +626,7 @@ static void write_page_prologue(struct mtd_info *mtd, uint32_t docg4_addr)
{ {
/* first step in writing a page */ /* first step in writing a page */
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
void __iomem *docptr = doc->virtadr; void __iomem *docptr = doc->virtadr;
...@@ -691,7 +691,7 @@ static void docg4_command(struct mtd_info *mtd, unsigned command, int column, ...@@ -691,7 +691,7 @@ static void docg4_command(struct mtd_info *mtd, unsigned command, int column,
{ {
/* handle standard nand commands */ /* handle standard nand commands */
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
uint32_t g4_addr = mtd_to_docg4_address(page_addr, column); uint32_t g4_addr = mtd_to_docg4_address(page_addr, column);
...@@ -874,7 +874,7 @@ static int docg4_read_oob(struct mtd_info *mtd, struct nand_chip *nand, ...@@ -874,7 +874,7 @@ static int docg4_read_oob(struct mtd_info *mtd, struct nand_chip *nand,
static int docg4_erase_block(struct mtd_info *mtd, int page) static int docg4_erase_block(struct mtd_info *mtd, int page)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
void __iomem *docptr = doc->virtadr; void __iomem *docptr = doc->virtadr;
uint16_t g4_page; uint16_t g4_page;
...@@ -1016,7 +1016,7 @@ static int __init read_factory_bbt(struct mtd_info *mtd) ...@@ -1016,7 +1016,7 @@ static int __init read_factory_bbt(struct mtd_info *mtd)
* update the memory-based bbt accordingly. * update the memory-based bbt accordingly.
*/ */
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
uint32_t g4_addr = mtd_to_docg4_address(DOCG4_FACTORY_BBT_PAGE, 0); uint32_t g4_addr = mtd_to_docg4_address(DOCG4_FACTORY_BBT_PAGE, 0);
uint8_t *buf; uint8_t *buf;
...@@ -1089,7 +1089,7 @@ static int docg4_block_markbad(struct mtd_info *mtd, loff_t ofs) ...@@ -1089,7 +1089,7 @@ static int docg4_block_markbad(struct mtd_info *mtd, loff_t ofs)
int ret, i; int ret, i;
uint8_t *buf; uint8_t *buf;
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
struct nand_bbt_descr *bbtd = nand->badblock_pattern; struct nand_bbt_descr *bbtd = nand->badblock_pattern;
int page = (int)(ofs >> nand->page_shift); int page = (int)(ofs >> nand->page_shift);
...@@ -1202,7 +1202,7 @@ static void __init init_mtd_structs(struct mtd_info *mtd) ...@@ -1202,7 +1202,7 @@ static void __init init_mtd_structs(struct mtd_info *mtd)
* things as well, such as call nand_set_defaults(). * things as well, such as call nand_set_defaults().
*/ */
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
mtd->size = DOCG4_CHIP_SIZE; mtd->size = DOCG4_CHIP_SIZE;
...@@ -1261,7 +1261,7 @@ static void __init init_mtd_structs(struct mtd_info *mtd) ...@@ -1261,7 +1261,7 @@ static void __init init_mtd_structs(struct mtd_info *mtd)
static int __init read_id_reg(struct mtd_info *mtd) static int __init read_id_reg(struct mtd_info *mtd)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
void __iomem *docptr = doc->virtadr; void __iomem *docptr = doc->virtadr;
uint16_t id1, id2; uint16_t id1, id2;
...@@ -1357,7 +1357,7 @@ static int __init probe_docg4(struct platform_device *pdev) ...@@ -1357,7 +1357,7 @@ static int __init probe_docg4(struct platform_device *pdev)
iounmap(virtadr); iounmap(virtadr);
if (mtd) { if (mtd) {
/* re-declarations avoid compiler warning */ /* re-declarations avoid compiler warning */
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct docg4_priv *doc = nand->priv; struct docg4_priv *doc = nand->priv;
nand_release(mtd); /* deletes partitions and mtd devices */ nand_release(mtd); /* deletes partitions and mtd devices */
free_bch(doc->bch); free_bch(doc->bch);
......
...@@ -144,7 +144,7 @@ static struct nand_bbt_descr bbt_mirror_descr = { ...@@ -144,7 +144,7 @@ static struct nand_bbt_descr bbt_mirror_descr = {
*/ */
static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob) static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_elbc_mtd *priv = chip->priv; struct fsl_elbc_mtd *priv = chip->priv;
struct fsl_lbc_ctrl *ctrl = priv->ctrl; struct fsl_lbc_ctrl *ctrl = priv->ctrl;
struct fsl_lbc_regs __iomem *lbc = ctrl->regs; struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
...@@ -195,7 +195,7 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob) ...@@ -195,7 +195,7 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob)
*/ */
static int fsl_elbc_run_command(struct mtd_info *mtd) static int fsl_elbc_run_command(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_elbc_mtd *priv = chip->priv; struct fsl_elbc_mtd *priv = chip->priv;
struct fsl_lbc_ctrl *ctrl = priv->ctrl; struct fsl_lbc_ctrl *ctrl = priv->ctrl;
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = ctrl->nand; struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = ctrl->nand;
...@@ -300,7 +300,7 @@ static void fsl_elbc_do_read(struct nand_chip *chip, int oob) ...@@ -300,7 +300,7 @@ static void fsl_elbc_do_read(struct nand_chip *chip, int oob)
static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command, static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
int column, int page_addr) int column, int page_addr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_elbc_mtd *priv = chip->priv; struct fsl_elbc_mtd *priv = chip->priv;
struct fsl_lbc_ctrl *ctrl = priv->ctrl; struct fsl_lbc_ctrl *ctrl = priv->ctrl;
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = ctrl->nand; struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = ctrl->nand;
...@@ -525,7 +525,7 @@ static void fsl_elbc_select_chip(struct mtd_info *mtd, int chip) ...@@ -525,7 +525,7 @@ static void fsl_elbc_select_chip(struct mtd_info *mtd, int chip)
*/ */
static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_elbc_mtd *priv = chip->priv; struct fsl_elbc_mtd *priv = chip->priv;
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand; struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
unsigned int bufsize = mtd->writesize + mtd->oobsize; unsigned int bufsize = mtd->writesize + mtd->oobsize;
...@@ -563,7 +563,7 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) ...@@ -563,7 +563,7 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
*/ */
static u8 fsl_elbc_read_byte(struct mtd_info *mtd) static u8 fsl_elbc_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_elbc_mtd *priv = chip->priv; struct fsl_elbc_mtd *priv = chip->priv;
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand; struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
...@@ -580,7 +580,7 @@ static u8 fsl_elbc_read_byte(struct mtd_info *mtd) ...@@ -580,7 +580,7 @@ static u8 fsl_elbc_read_byte(struct mtd_info *mtd)
*/ */
static void fsl_elbc_read_buf(struct mtd_info *mtd, u8 *buf, int len) static void fsl_elbc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_elbc_mtd *priv = chip->priv; struct fsl_elbc_mtd *priv = chip->priv;
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand; struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
int avail; int avail;
...@@ -619,7 +619,7 @@ static int fsl_elbc_wait(struct mtd_info *mtd, struct nand_chip *chip) ...@@ -619,7 +619,7 @@ static int fsl_elbc_wait(struct mtd_info *mtd, struct nand_chip *chip)
static int fsl_elbc_chip_init_tail(struct mtd_info *mtd) static int fsl_elbc_chip_init_tail(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_elbc_mtd *priv = chip->priv; struct fsl_elbc_mtd *priv = chip->priv;
struct fsl_lbc_ctrl *ctrl = priv->ctrl; struct fsl_lbc_ctrl *ctrl = priv->ctrl;
struct fsl_lbc_regs __iomem *lbc = ctrl->regs; struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
......
...@@ -230,7 +230,7 @@ static struct nand_bbt_descr bbt_mirror_descr = { ...@@ -230,7 +230,7 @@ static struct nand_bbt_descr bbt_mirror_descr = {
*/ */
static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob) static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_ifc_mtd *priv = chip->priv; struct fsl_ifc_mtd *priv = chip->priv;
struct fsl_ifc_ctrl *ctrl = priv->ctrl; struct fsl_ifc_ctrl *ctrl = priv->ctrl;
struct fsl_ifc_regs __iomem *ifc = ctrl->regs; struct fsl_ifc_regs __iomem *ifc = ctrl->regs;
...@@ -253,7 +253,7 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob) ...@@ -253,7 +253,7 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob)
static int is_blank(struct mtd_info *mtd, unsigned int bufnum) static int is_blank(struct mtd_info *mtd, unsigned int bufnum)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_ifc_mtd *priv = chip->priv; struct fsl_ifc_mtd *priv = chip->priv;
u8 __iomem *addr = priv->vbase + bufnum * (mtd->writesize * 2); u8 __iomem *addr = priv->vbase + bufnum * (mtd->writesize * 2);
u32 __iomem *mainarea = (u32 __iomem *)addr; u32 __iomem *mainarea = (u32 __iomem *)addr;
...@@ -292,7 +292,7 @@ static int check_read_ecc(struct mtd_info *mtd, struct fsl_ifc_ctrl *ctrl, ...@@ -292,7 +292,7 @@ static int check_read_ecc(struct mtd_info *mtd, struct fsl_ifc_ctrl *ctrl,
*/ */
static void fsl_ifc_run_command(struct mtd_info *mtd) static void fsl_ifc_run_command(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_ifc_mtd *priv = chip->priv; struct fsl_ifc_mtd *priv = chip->priv;
struct fsl_ifc_ctrl *ctrl = priv->ctrl; struct fsl_ifc_ctrl *ctrl = priv->ctrl;
struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl; struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl;
...@@ -409,7 +409,7 @@ static void fsl_ifc_do_read(struct nand_chip *chip, ...@@ -409,7 +409,7 @@ static void fsl_ifc_do_read(struct nand_chip *chip,
/* cmdfunc send commands to the IFC NAND Machine */ /* cmdfunc send commands to the IFC NAND Machine */
static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command, static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
int column, int page_addr) { int column, int page_addr) {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_ifc_mtd *priv = chip->priv; struct fsl_ifc_mtd *priv = chip->priv;
struct fsl_ifc_ctrl *ctrl = priv->ctrl; struct fsl_ifc_ctrl *ctrl = priv->ctrl;
struct fsl_ifc_regs __iomem *ifc = ctrl->regs; struct fsl_ifc_regs __iomem *ifc = ctrl->regs;
...@@ -624,7 +624,7 @@ static void fsl_ifc_select_chip(struct mtd_info *mtd, int chip) ...@@ -624,7 +624,7 @@ static void fsl_ifc_select_chip(struct mtd_info *mtd, int chip)
*/ */
static void fsl_ifc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) static void fsl_ifc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_ifc_mtd *priv = chip->priv; struct fsl_ifc_mtd *priv = chip->priv;
unsigned int bufsize = mtd->writesize + mtd->oobsize; unsigned int bufsize = mtd->writesize + mtd->oobsize;
...@@ -650,7 +650,7 @@ static void fsl_ifc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) ...@@ -650,7 +650,7 @@ static void fsl_ifc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
*/ */
static uint8_t fsl_ifc_read_byte(struct mtd_info *mtd) static uint8_t fsl_ifc_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_ifc_mtd *priv = chip->priv; struct fsl_ifc_mtd *priv = chip->priv;
unsigned int offset; unsigned int offset;
...@@ -673,7 +673,7 @@ static uint8_t fsl_ifc_read_byte(struct mtd_info *mtd) ...@@ -673,7 +673,7 @@ static uint8_t fsl_ifc_read_byte(struct mtd_info *mtd)
*/ */
static uint8_t fsl_ifc_read_byte16(struct mtd_info *mtd) static uint8_t fsl_ifc_read_byte16(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_ifc_mtd *priv = chip->priv; struct fsl_ifc_mtd *priv = chip->priv;
uint16_t data; uint16_t data;
...@@ -696,7 +696,7 @@ static uint8_t fsl_ifc_read_byte16(struct mtd_info *mtd) ...@@ -696,7 +696,7 @@ static uint8_t fsl_ifc_read_byte16(struct mtd_info *mtd)
*/ */
static void fsl_ifc_read_buf(struct mtd_info *mtd, u8 *buf, int len) static void fsl_ifc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_ifc_mtd *priv = chip->priv; struct fsl_ifc_mtd *priv = chip->priv;
int avail; int avail;
...@@ -782,7 +782,7 @@ static int fsl_ifc_write_page(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -782,7 +782,7 @@ static int fsl_ifc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
static int fsl_ifc_chip_init_tail(struct mtd_info *mtd) static int fsl_ifc_chip_init_tail(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_ifc_mtd *priv = chip->priv; struct fsl_ifc_mtd *priv = chip->priv;
dev_dbg(priv->dev, "%s: nand->numchips = %d\n", __func__, dev_dbg(priv->dev, "%s: nand->numchips = %d\n", __func__,
......
...@@ -79,7 +79,7 @@ static void fun_wait_rnb(struct fsl_upm_nand *fun) ...@@ -79,7 +79,7 @@ static void fun_wait_rnb(struct fsl_upm_nand *fun)
static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_upm_nand *fun = to_fsl_upm_nand(mtd); struct fsl_upm_nand *fun = to_fsl_upm_nand(mtd);
u32 mar; u32 mar;
...@@ -109,7 +109,7 @@ static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) ...@@ -109,7 +109,7 @@ static void fun_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
static void fun_select_chip(struct mtd_info *mtd, int mchip_nr) static void fun_select_chip(struct mtd_info *mtd, int mchip_nr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsl_upm_nand *fun = to_fsl_upm_nand(mtd); struct fsl_upm_nand *fun = to_fsl_upm_nand(mtd);
if (mchip_nr == -1) { if (mchip_nr == -1) {
......
...@@ -329,7 +329,7 @@ struct fsmc_nand_data { ...@@ -329,7 +329,7 @@ struct fsmc_nand_data {
/* Assert CS signal based on chipnr */ /* Assert CS signal based on chipnr */
static void fsmc_select_chip(struct mtd_info *mtd, int chipnr) static void fsmc_select_chip(struct mtd_info *mtd, int chipnr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct fsmc_nand_data *host; struct fsmc_nand_data *host;
host = container_of(mtd, struct fsmc_nand_data, mtd); host = container_of(mtd, struct fsmc_nand_data, mtd);
...@@ -358,7 +358,7 @@ static void fsmc_select_chip(struct mtd_info *mtd, int chipnr) ...@@ -358,7 +358,7 @@ static void fsmc_select_chip(struct mtd_info *mtd, int chipnr)
*/ */
static void fsmc_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) static void fsmc_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
struct fsmc_nand_data *host = container_of(mtd, struct fsmc_nand_data *host = container_of(mtd,
struct fsmc_nand_data, mtd); struct fsmc_nand_data, mtd);
void __iomem *regs = host->regs_va; void __iomem *regs = host->regs_va;
...@@ -629,7 +629,7 @@ static int dma_xfer(struct fsmc_nand_data *host, void *buffer, int len, ...@@ -629,7 +629,7 @@ static int dma_xfer(struct fsmc_nand_data *host, void *buffer, int len,
static void fsmc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) static void fsmc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
{ {
int i; int i;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
if (IS_ALIGNED((uint32_t)buf, sizeof(uint32_t)) && if (IS_ALIGNED((uint32_t)buf, sizeof(uint32_t)) &&
IS_ALIGNED(len, sizeof(uint32_t))) { IS_ALIGNED(len, sizeof(uint32_t))) {
...@@ -652,7 +652,7 @@ static void fsmc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) ...@@ -652,7 +652,7 @@ static void fsmc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
static void fsmc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void fsmc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{ {
int i; int i;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
if (IS_ALIGNED((uint32_t)buf, sizeof(uint32_t)) && if (IS_ALIGNED((uint32_t)buf, sizeof(uint32_t)) &&
IS_ALIGNED(len, sizeof(uint32_t))) { IS_ALIGNED(len, sizeof(uint32_t))) {
...@@ -784,7 +784,7 @@ static int fsmc_bch8_correct_data(struct mtd_info *mtd, uint8_t *dat, ...@@ -784,7 +784,7 @@ static int fsmc_bch8_correct_data(struct mtd_info *mtd, uint8_t *dat,
{ {
struct fsmc_nand_data *host = container_of(mtd, struct fsmc_nand_data *host = container_of(mtd,
struct fsmc_nand_data, mtd); struct fsmc_nand_data, mtd);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
void __iomem *regs = host->regs_va; void __iomem *regs = host->regs_va;
unsigned int bank = host->bank; unsigned int bank = host->bank;
uint32_t err_idx[8]; uint32_t err_idx[8];
......
...@@ -140,7 +140,7 @@ static bool set_geometry_by_ecc_info(struct gpmi_nand_data *this) ...@@ -140,7 +140,7 @@ static bool set_geometry_by_ecc_info(struct gpmi_nand_data *this)
{ {
struct bch_geometry *geo = &this->bch_geometry; struct bch_geometry *geo = &this->bch_geometry;
struct mtd_info *mtd = &this->mtd; struct mtd_info *mtd = &this->mtd;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct nand_oobfree *of = gpmi_hw_ecclayout.oobfree; struct nand_oobfree *of = gpmi_hw_ecclayout.oobfree;
unsigned int block_mark_bit_offset; unsigned int block_mark_bit_offset;
...@@ -856,7 +856,7 @@ static int gpmi_alloc_dma_buffer(struct gpmi_nand_data *this) ...@@ -856,7 +856,7 @@ static int gpmi_alloc_dma_buffer(struct gpmi_nand_data *this)
static void gpmi_cmd_ctrl(struct mtd_info *mtd, int data, unsigned int ctrl) static void gpmi_cmd_ctrl(struct mtd_info *mtd, int data, unsigned int ctrl)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct gpmi_nand_data *this = chip->priv; struct gpmi_nand_data *this = chip->priv;
int ret; int ret;
...@@ -890,7 +890,7 @@ static void gpmi_cmd_ctrl(struct mtd_info *mtd, int data, unsigned int ctrl) ...@@ -890,7 +890,7 @@ static void gpmi_cmd_ctrl(struct mtd_info *mtd, int data, unsigned int ctrl)
static int gpmi_dev_ready(struct mtd_info *mtd) static int gpmi_dev_ready(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct gpmi_nand_data *this = chip->priv; struct gpmi_nand_data *this = chip->priv;
return gpmi_is_ready(this, this->current_chip); return gpmi_is_ready(this, this->current_chip);
...@@ -898,7 +898,7 @@ static int gpmi_dev_ready(struct mtd_info *mtd) ...@@ -898,7 +898,7 @@ static int gpmi_dev_ready(struct mtd_info *mtd)
static void gpmi_select_chip(struct mtd_info *mtd, int chipnr) static void gpmi_select_chip(struct mtd_info *mtd, int chipnr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct gpmi_nand_data *this = chip->priv; struct gpmi_nand_data *this = chip->priv;
if ((this->current_chip < 0) && (chipnr >= 0)) if ((this->current_chip < 0) && (chipnr >= 0))
...@@ -911,7 +911,7 @@ static void gpmi_select_chip(struct mtd_info *mtd, int chipnr) ...@@ -911,7 +911,7 @@ static void gpmi_select_chip(struct mtd_info *mtd, int chipnr)
static void gpmi_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void gpmi_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct gpmi_nand_data *this = chip->priv; struct gpmi_nand_data *this = chip->priv;
dev_dbg(this->dev, "len is %d\n", len); dev_dbg(this->dev, "len is %d\n", len);
...@@ -923,7 +923,7 @@ static void gpmi_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) ...@@ -923,7 +923,7 @@ static void gpmi_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
static void gpmi_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) static void gpmi_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct gpmi_nand_data *this = chip->priv; struct gpmi_nand_data *this = chip->priv;
dev_dbg(this->dev, "len is %d\n", len); dev_dbg(this->dev, "len is %d\n", len);
...@@ -935,7 +935,7 @@ static void gpmi_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) ...@@ -935,7 +935,7 @@ static void gpmi_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
static uint8_t gpmi_read_byte(struct mtd_info *mtd) static uint8_t gpmi_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct gpmi_nand_data *this = chip->priv; struct gpmi_nand_data *this = chip->priv;
uint8_t *buf = this->data_buffer_dma; uint8_t *buf = this->data_buffer_dma;
...@@ -1538,7 +1538,7 @@ static int gpmi_ecc_write_oob_raw(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -1538,7 +1538,7 @@ static int gpmi_ecc_write_oob_raw(struct mtd_info *mtd, struct nand_chip *chip,
static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs) static int gpmi_block_markbad(struct mtd_info *mtd, loff_t ofs)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct gpmi_nand_data *this = chip->priv; struct gpmi_nand_data *this = chip->priv;
int ret = 0; int ret = 0;
uint8_t *block_mark; uint8_t *block_mark;
...@@ -1838,7 +1838,7 @@ static void gpmi_nand_exit(struct gpmi_nand_data *this) ...@@ -1838,7 +1838,7 @@ static void gpmi_nand_exit(struct gpmi_nand_data *this)
static int gpmi_init_last(struct gpmi_nand_data *this) static int gpmi_init_last(struct gpmi_nand_data *this)
{ {
struct mtd_info *mtd = &this->mtd; struct mtd_info *mtd = &this->mtd;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct nand_ecc_ctrl *ecc = &chip->ecc; struct nand_ecc_ctrl *ecc = &chip->ecc;
struct bch_geometry *bch_geo = &this->bch_geometry; struct bch_geometry *bch_geo = &this->bch_geometry;
int ret; int ret;
......
...@@ -190,7 +190,7 @@ static void wait_controller_finished(struct hinfc_host *host) ...@@ -190,7 +190,7 @@ static void wait_controller_finished(struct hinfc_host *host)
static void hisi_nfc_dma_transfer(struct hinfc_host *host, int todev) static void hisi_nfc_dma_transfer(struct hinfc_host *host, int todev)
{ {
struct mtd_info *mtd = &host->mtd; struct mtd_info *mtd = &host->mtd;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
unsigned long val; unsigned long val;
int ret; int ret;
...@@ -357,7 +357,7 @@ static int hisi_nfc_send_cmd_reset(struct hinfc_host *host, int chipselect) ...@@ -357,7 +357,7 @@ static int hisi_nfc_send_cmd_reset(struct hinfc_host *host, int chipselect)
static void hisi_nfc_select_chip(struct mtd_info *mtd, int chipselect) static void hisi_nfc_select_chip(struct mtd_info *mtd, int chipselect)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct hinfc_host *host = chip->priv; struct hinfc_host *host = chip->priv;
if (chipselect < 0) if (chipselect < 0)
...@@ -368,7 +368,7 @@ static void hisi_nfc_select_chip(struct mtd_info *mtd, int chipselect) ...@@ -368,7 +368,7 @@ static void hisi_nfc_select_chip(struct mtd_info *mtd, int chipselect)
static uint8_t hisi_nfc_read_byte(struct mtd_info *mtd) static uint8_t hisi_nfc_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct hinfc_host *host = chip->priv; struct hinfc_host *host = chip->priv;
if (host->command == NAND_CMD_STATUS) if (host->command == NAND_CMD_STATUS)
...@@ -384,7 +384,7 @@ static uint8_t hisi_nfc_read_byte(struct mtd_info *mtd) ...@@ -384,7 +384,7 @@ static uint8_t hisi_nfc_read_byte(struct mtd_info *mtd)
static u16 hisi_nfc_read_word(struct mtd_info *mtd) static u16 hisi_nfc_read_word(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct hinfc_host *host = chip->priv; struct hinfc_host *host = chip->priv;
host->offset += 2; host->offset += 2;
...@@ -394,7 +394,7 @@ static u16 hisi_nfc_read_word(struct mtd_info *mtd) ...@@ -394,7 +394,7 @@ static u16 hisi_nfc_read_word(struct mtd_info *mtd)
static void static void
hisi_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) hisi_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct hinfc_host *host = chip->priv; struct hinfc_host *host = chip->priv;
memcpy(host->buffer + host->offset, buf, len); memcpy(host->buffer + host->offset, buf, len);
...@@ -403,7 +403,7 @@ hisi_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) ...@@ -403,7 +403,7 @@ hisi_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
static void hisi_nfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void hisi_nfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct hinfc_host *host = chip->priv; struct hinfc_host *host = chip->priv;
memcpy(buf, host->buffer + host->offset, len); memcpy(buf, host->buffer + host->offset, len);
...@@ -412,7 +412,7 @@ static void hisi_nfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) ...@@ -412,7 +412,7 @@ static void hisi_nfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
static void set_addr(struct mtd_info *mtd, int column, int page_addr) static void set_addr(struct mtd_info *mtd, int column, int page_addr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct hinfc_host *host = chip->priv; struct hinfc_host *host = chip->priv;
unsigned int command = host->command; unsigned int command = host->command;
...@@ -448,7 +448,7 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr) ...@@ -448,7 +448,7 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr)
static void hisi_nfc_cmdfunc(struct mtd_info *mtd, unsigned command, int column, static void hisi_nfc_cmdfunc(struct mtd_info *mtd, unsigned command, int column,
int page_addr) int page_addr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct hinfc_host *host = chip->priv; struct hinfc_host *host = chip->priv;
int is_cache_invalid = 1; int is_cache_invalid = 1;
unsigned int flag = 0; unsigned int flag = 0;
......
...@@ -82,7 +82,7 @@ static inline struct jz_nand *mtd_to_jz_nand(struct mtd_info *mtd) ...@@ -82,7 +82,7 @@ static inline struct jz_nand *mtd_to_jz_nand(struct mtd_info *mtd)
static void jz_nand_select_chip(struct mtd_info *mtd, int chipnr) static void jz_nand_select_chip(struct mtd_info *mtd, int chipnr)
{ {
struct jz_nand *nand = mtd_to_jz_nand(mtd); struct jz_nand *nand = mtd_to_jz_nand(mtd);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
uint32_t ctrl; uint32_t ctrl;
int banknr; int banknr;
...@@ -104,7 +104,7 @@ static void jz_nand_select_chip(struct mtd_info *mtd, int chipnr) ...@@ -104,7 +104,7 @@ static void jz_nand_select_chip(struct mtd_info *mtd, int chipnr)
static void jz_nand_cmd_ctrl(struct mtd_info *mtd, int dat, unsigned int ctrl) static void jz_nand_cmd_ctrl(struct mtd_info *mtd, int dat, unsigned int ctrl)
{ {
struct jz_nand *nand = mtd_to_jz_nand(mtd); struct jz_nand *nand = mtd_to_jz_nand(mtd);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
uint32_t reg; uint32_t reg;
void __iomem *bank_base = nand->bank_base[nand->selected_bank]; void __iomem *bank_base = nand->bank_base[nand->selected_bank];
......
...@@ -275,7 +275,7 @@ static void lpc32xx_nand_setup(struct lpc32xx_nand_host *host) ...@@ -275,7 +275,7 @@ static void lpc32xx_nand_setup(struct lpc32xx_nand_host *host)
static void lpc32xx_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, static void lpc32xx_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl) unsigned int ctrl)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct lpc32xx_nand_host *host = nand_chip->priv; struct lpc32xx_nand_host *host = nand_chip->priv;
if (cmd != NAND_CMD_NONE) { if (cmd != NAND_CMD_NONE) {
...@@ -291,7 +291,7 @@ static void lpc32xx_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, ...@@ -291,7 +291,7 @@ static void lpc32xx_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
*/ */
static int lpc32xx_nand_device_ready(struct mtd_info *mtd) static int lpc32xx_nand_device_ready(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct lpc32xx_nand_host *host = nand_chip->priv; struct lpc32xx_nand_host *host = nand_chip->priv;
if ((readb(MLC_ISR(host->io_base)) & if ((readb(MLC_ISR(host->io_base)) &
...@@ -389,7 +389,7 @@ static void lpc32xx_dma_complete_func(void *completion) ...@@ -389,7 +389,7 @@ static void lpc32xx_dma_complete_func(void *completion)
static int lpc32xx_xmit_dma(struct mtd_info *mtd, void *mem, int len, static int lpc32xx_xmit_dma(struct mtd_info *mtd, void *mem, int len,
enum dma_transfer_direction dir) enum dma_transfer_direction dir)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct lpc32xx_nand_host *host = chip->priv; struct lpc32xx_nand_host *host = chip->priv;
struct dma_async_tx_descriptor *desc; struct dma_async_tx_descriptor *desc;
int flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT; int flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
......
...@@ -260,7 +260,7 @@ static void lpc32xx_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, ...@@ -260,7 +260,7 @@ static void lpc32xx_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl) unsigned int ctrl)
{ {
uint32_t tmp; uint32_t tmp;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct lpc32xx_nand_host *host = chip->priv; struct lpc32xx_nand_host *host = chip->priv;
/* Does CE state need to be changed? */ /* Does CE state need to be changed? */
...@@ -284,7 +284,7 @@ static void lpc32xx_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, ...@@ -284,7 +284,7 @@ static void lpc32xx_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
*/ */
static int lpc32xx_nand_device_ready(struct mtd_info *mtd) static int lpc32xx_nand_device_ready(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct lpc32xx_nand_host *host = chip->priv; struct lpc32xx_nand_host *host = chip->priv;
int rdy = 0; int rdy = 0;
...@@ -339,7 +339,7 @@ static int lpc32xx_nand_ecc_calculate(struct mtd_info *mtd, ...@@ -339,7 +339,7 @@ static int lpc32xx_nand_ecc_calculate(struct mtd_info *mtd,
*/ */
static uint8_t lpc32xx_nand_read_byte(struct mtd_info *mtd) static uint8_t lpc32xx_nand_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct lpc32xx_nand_host *host = chip->priv; struct lpc32xx_nand_host *host = chip->priv;
return (uint8_t)readl(SLC_DATA(host->io_base)); return (uint8_t)readl(SLC_DATA(host->io_base));
...@@ -350,7 +350,7 @@ static uint8_t lpc32xx_nand_read_byte(struct mtd_info *mtd) ...@@ -350,7 +350,7 @@ static uint8_t lpc32xx_nand_read_byte(struct mtd_info *mtd)
*/ */
static void lpc32xx_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) static void lpc32xx_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct lpc32xx_nand_host *host = chip->priv; struct lpc32xx_nand_host *host = chip->priv;
/* Direct device read with no ECC */ /* Direct device read with no ECC */
...@@ -363,7 +363,7 @@ static void lpc32xx_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) ...@@ -363,7 +363,7 @@ static void lpc32xx_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
*/ */
static void lpc32xx_nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) static void lpc32xx_nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct lpc32xx_nand_host *host = chip->priv; struct lpc32xx_nand_host *host = chip->priv;
/* Direct device write with no ECC */ /* Direct device write with no ECC */
...@@ -428,7 +428,7 @@ static void lpc32xx_dma_complete_func(void *completion) ...@@ -428,7 +428,7 @@ static void lpc32xx_dma_complete_func(void *completion)
static int lpc32xx_xmit_dma(struct mtd_info *mtd, dma_addr_t dma, static int lpc32xx_xmit_dma(struct mtd_info *mtd, dma_addr_t dma,
void *mem, int len, enum dma_transfer_direction dir) void *mem, int len, enum dma_transfer_direction dir)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct lpc32xx_nand_host *host = chip->priv; struct lpc32xx_nand_host *host = chip->priv;
struct dma_async_tx_descriptor *desc; struct dma_async_tx_descriptor *desc;
int flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT; int flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
...@@ -488,7 +488,7 @@ static int lpc32xx_xmit_dma(struct mtd_info *mtd, dma_addr_t dma, ...@@ -488,7 +488,7 @@ static int lpc32xx_xmit_dma(struct mtd_info *mtd, dma_addr_t dma,
static int lpc32xx_xfer(struct mtd_info *mtd, uint8_t *buf, int eccsubpages, static int lpc32xx_xfer(struct mtd_info *mtd, uint8_t *buf, int eccsubpages,
int read) int read)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct lpc32xx_nand_host *host = chip->priv; struct lpc32xx_nand_host *host = chip->priv;
int i, status = 0; int i, status = 0;
unsigned long timeout; unsigned long timeout;
......
...@@ -135,7 +135,7 @@ static void mpc5121_nfc_done(struct mtd_info *mtd); ...@@ -135,7 +135,7 @@ static void mpc5121_nfc_done(struct mtd_info *mtd);
/* Read NFC register */ /* Read NFC register */
static inline u16 nfc_read(struct mtd_info *mtd, uint reg) static inline u16 nfc_read(struct mtd_info *mtd, uint reg)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct mpc5121_nfc_prv *prv = chip->priv; struct mpc5121_nfc_prv *prv = chip->priv;
return in_be16(prv->regs + reg); return in_be16(prv->regs + reg);
...@@ -144,7 +144,7 @@ static inline u16 nfc_read(struct mtd_info *mtd, uint reg) ...@@ -144,7 +144,7 @@ static inline u16 nfc_read(struct mtd_info *mtd, uint reg)
/* Write NFC register */ /* Write NFC register */
static inline void nfc_write(struct mtd_info *mtd, uint reg, u16 val) static inline void nfc_write(struct mtd_info *mtd, uint reg, u16 val)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct mpc5121_nfc_prv *prv = chip->priv; struct mpc5121_nfc_prv *prv = chip->priv;
out_be16(prv->regs + reg, val); out_be16(prv->regs + reg, val);
...@@ -214,7 +214,7 @@ static inline void mpc5121_nfc_send_read_status(struct mtd_info *mtd) ...@@ -214,7 +214,7 @@ static inline void mpc5121_nfc_send_read_status(struct mtd_info *mtd)
static irqreturn_t mpc5121_nfc_irq(int irq, void *data) static irqreturn_t mpc5121_nfc_irq(int irq, void *data)
{ {
struct mtd_info *mtd = data; struct mtd_info *mtd = data;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct mpc5121_nfc_prv *prv = chip->priv; struct mpc5121_nfc_prv *prv = chip->priv;
nfc_set(mtd, NFC_CONFIG1, NFC_INT_MASK); nfc_set(mtd, NFC_CONFIG1, NFC_INT_MASK);
...@@ -226,7 +226,7 @@ static irqreturn_t mpc5121_nfc_irq(int irq, void *data) ...@@ -226,7 +226,7 @@ static irqreturn_t mpc5121_nfc_irq(int irq, void *data)
/* Wait for operation complete */ /* Wait for operation complete */
static void mpc5121_nfc_done(struct mtd_info *mtd) static void mpc5121_nfc_done(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct mpc5121_nfc_prv *prv = chip->priv; struct mpc5121_nfc_prv *prv = chip->priv;
int rv; int rv;
...@@ -246,7 +246,7 @@ static void mpc5121_nfc_done(struct mtd_info *mtd) ...@@ -246,7 +246,7 @@ static void mpc5121_nfc_done(struct mtd_info *mtd)
/* Do address cycle(s) */ /* Do address cycle(s) */
static void mpc5121_nfc_addr_cycle(struct mtd_info *mtd, int column, int page) static void mpc5121_nfc_addr_cycle(struct mtd_info *mtd, int column, int page)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
u32 pagemask = chip->pagemask; u32 pagemask = chip->pagemask;
if (column != -1) { if (column != -1) {
...@@ -281,7 +281,7 @@ static void mpc5121_nfc_select_chip(struct mtd_info *mtd, int chip) ...@@ -281,7 +281,7 @@ static void mpc5121_nfc_select_chip(struct mtd_info *mtd, int chip)
/* Init external chip select logic on ADS5121 board */ /* Init external chip select logic on ADS5121 board */
static int ads5121_chipselect_init(struct mtd_info *mtd) static int ads5121_chipselect_init(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct mpc5121_nfc_prv *prv = chip->priv; struct mpc5121_nfc_prv *prv = chip->priv;
struct device_node *dn; struct device_node *dn;
...@@ -303,7 +303,7 @@ static int ads5121_chipselect_init(struct mtd_info *mtd) ...@@ -303,7 +303,7 @@ static int ads5121_chipselect_init(struct mtd_info *mtd)
/* Control chips select signal on ADS5121 board */ /* Control chips select signal on ADS5121 board */
static void ads5121_select_chip(struct mtd_info *mtd, int chip) static void ads5121_select_chip(struct mtd_info *mtd, int chip)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct mpc5121_nfc_prv *prv = nand->priv; struct mpc5121_nfc_prv *prv = nand->priv;
u8 v; u8 v;
...@@ -333,7 +333,7 @@ static int mpc5121_nfc_dev_ready(struct mtd_info *mtd) ...@@ -333,7 +333,7 @@ static int mpc5121_nfc_dev_ready(struct mtd_info *mtd)
static void mpc5121_nfc_command(struct mtd_info *mtd, unsigned command, static void mpc5121_nfc_command(struct mtd_info *mtd, unsigned command,
int column, int page) int column, int page)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct mpc5121_nfc_prv *prv = chip->priv; struct mpc5121_nfc_prv *prv = chip->priv;
prv->column = (column >= 0) ? column : 0; prv->column = (column >= 0) ? column : 0;
...@@ -406,7 +406,7 @@ static void mpc5121_nfc_command(struct mtd_info *mtd, unsigned command, ...@@ -406,7 +406,7 @@ static void mpc5121_nfc_command(struct mtd_info *mtd, unsigned command,
static void mpc5121_nfc_copy_spare(struct mtd_info *mtd, uint offset, static void mpc5121_nfc_copy_spare(struct mtd_info *mtd, uint offset,
u8 *buffer, uint size, int wr) u8 *buffer, uint size, int wr)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct mpc5121_nfc_prv *prv = nand->priv; struct mpc5121_nfc_prv *prv = nand->priv;
uint o, s, sbsize, blksize; uint o, s, sbsize, blksize;
...@@ -458,7 +458,7 @@ static void mpc5121_nfc_copy_spare(struct mtd_info *mtd, uint offset, ...@@ -458,7 +458,7 @@ static void mpc5121_nfc_copy_spare(struct mtd_info *mtd, uint offset,
static void mpc5121_nfc_buf_copy(struct mtd_info *mtd, u_char *buf, int len, static void mpc5121_nfc_buf_copy(struct mtd_info *mtd, u_char *buf, int len,
int wr) int wr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct mpc5121_nfc_prv *prv = chip->priv; struct mpc5121_nfc_prv *prv = chip->priv;
uint c = prv->column; uint c = prv->column;
uint l; uint l;
...@@ -536,7 +536,7 @@ static u16 mpc5121_nfc_read_word(struct mtd_info *mtd) ...@@ -536,7 +536,7 @@ static u16 mpc5121_nfc_read_word(struct mtd_info *mtd)
*/ */
static int mpc5121_nfc_read_hw_config(struct mtd_info *mtd) static int mpc5121_nfc_read_hw_config(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct mpc5121_nfc_prv *prv = chip->priv; struct mpc5121_nfc_prv *prv = chip->priv;
struct mpc512x_reset_module *rm; struct mpc512x_reset_module *rm;
struct device_node *rmnode; struct device_node *rmnode;
...@@ -615,7 +615,7 @@ static int mpc5121_nfc_read_hw_config(struct mtd_info *mtd) ...@@ -615,7 +615,7 @@ static int mpc5121_nfc_read_hw_config(struct mtd_info *mtd)
/* Free driver resources */ /* Free driver resources */
static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd) static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct mpc5121_nfc_prv *prv = chip->priv; struct mpc5121_nfc_prv *prv = chip->priv;
if (prv->clk) if (prv->clk)
......
...@@ -532,7 +532,7 @@ static void send_addr_v1_v2(struct mxc_nand_host *host, uint16_t addr, int islas ...@@ -532,7 +532,7 @@ static void send_addr_v1_v2(struct mxc_nand_host *host, uint16_t addr, int islas
static void send_page_v3(struct mtd_info *mtd, unsigned int ops) static void send_page_v3(struct mtd_info *mtd, unsigned int ops)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
uint32_t tmp; uint32_t tmp;
...@@ -548,7 +548,7 @@ static void send_page_v3(struct mtd_info *mtd, unsigned int ops) ...@@ -548,7 +548,7 @@ static void send_page_v3(struct mtd_info *mtd, unsigned int ops)
static void send_page_v2(struct mtd_info *mtd, unsigned int ops) static void send_page_v2(struct mtd_info *mtd, unsigned int ops)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
/* NANDFC buffer 0 is used for page read/write */ /* NANDFC buffer 0 is used for page read/write */
...@@ -562,7 +562,7 @@ static void send_page_v2(struct mtd_info *mtd, unsigned int ops) ...@@ -562,7 +562,7 @@ static void send_page_v2(struct mtd_info *mtd, unsigned int ops)
static void send_page_v1(struct mtd_info *mtd, unsigned int ops) static void send_page_v1(struct mtd_info *mtd, unsigned int ops)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
int bufs, i; int bufs, i;
...@@ -663,7 +663,7 @@ static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode) ...@@ -663,7 +663,7 @@ static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode)
static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat, static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat,
u_char *read_ecc, u_char *calc_ecc) u_char *read_ecc, u_char *calc_ecc)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
/* /*
...@@ -684,7 +684,7 @@ static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat, ...@@ -684,7 +684,7 @@ static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat,
static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat, static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat,
u_char *read_ecc, u_char *calc_ecc) u_char *read_ecc, u_char *calc_ecc)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
u32 ecc_stat, err; u32 ecc_stat, err;
int no_subpages = 1; int no_subpages = 1;
...@@ -722,7 +722,7 @@ static int mxc_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, ...@@ -722,7 +722,7 @@ static int mxc_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
static u_char mxc_nand_read_byte(struct mtd_info *mtd) static u_char mxc_nand_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
uint8_t ret; uint8_t ret;
...@@ -746,7 +746,7 @@ static u_char mxc_nand_read_byte(struct mtd_info *mtd) ...@@ -746,7 +746,7 @@ static u_char mxc_nand_read_byte(struct mtd_info *mtd)
static uint16_t mxc_nand_read_word(struct mtd_info *mtd) static uint16_t mxc_nand_read_word(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
uint16_t ret; uint16_t ret;
...@@ -762,7 +762,7 @@ static uint16_t mxc_nand_read_word(struct mtd_info *mtd) ...@@ -762,7 +762,7 @@ static uint16_t mxc_nand_read_word(struct mtd_info *mtd)
static void mxc_nand_write_buf(struct mtd_info *mtd, static void mxc_nand_write_buf(struct mtd_info *mtd,
const u_char *buf, int len) const u_char *buf, int len)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
u16 col = host->buf_start; u16 col = host->buf_start;
int n = mtd->oobsize + mtd->writesize - col; int n = mtd->oobsize + mtd->writesize - col;
...@@ -780,7 +780,7 @@ static void mxc_nand_write_buf(struct mtd_info *mtd, ...@@ -780,7 +780,7 @@ static void mxc_nand_write_buf(struct mtd_info *mtd,
*/ */
static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
u16 col = host->buf_start; u16 col = host->buf_start;
int n = mtd->oobsize + mtd->writesize - col; int n = mtd->oobsize + mtd->writesize - col;
...@@ -796,7 +796,7 @@ static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) ...@@ -796,7 +796,7 @@ static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
* deselect of the NAND chip */ * deselect of the NAND chip */
static void mxc_nand_select_chip_v1_v3(struct mtd_info *mtd, int chip) static void mxc_nand_select_chip_v1_v3(struct mtd_info *mtd, int chip)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
if (chip == -1) { if (chip == -1) {
...@@ -817,7 +817,7 @@ static void mxc_nand_select_chip_v1_v3(struct mtd_info *mtd, int chip) ...@@ -817,7 +817,7 @@ static void mxc_nand_select_chip_v1_v3(struct mtd_info *mtd, int chip)
static void mxc_nand_select_chip_v2(struct mtd_info *mtd, int chip) static void mxc_nand_select_chip_v2(struct mtd_info *mtd, int chip)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
if (chip == -1) { if (chip == -1) {
...@@ -850,7 +850,7 @@ static void mxc_nand_select_chip_v2(struct mtd_info *mtd, int chip) ...@@ -850,7 +850,7 @@ static void mxc_nand_select_chip_v2(struct mtd_info *mtd, int chip)
*/ */
static void copy_spare(struct mtd_info *mtd, bool bfrom) static void copy_spare(struct mtd_info *mtd, bool bfrom)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
struct mxc_nand_host *host = this->priv; struct mxc_nand_host *host = this->priv;
u16 i, oob_chunk_size; u16 i, oob_chunk_size;
u16 num_chunks = mtd->writesize / 512; u16 num_chunks = mtd->writesize / 512;
...@@ -893,7 +893,7 @@ static void copy_spare(struct mtd_info *mtd, bool bfrom) ...@@ -893,7 +893,7 @@ static void copy_spare(struct mtd_info *mtd, bool bfrom)
*/ */
static void mxc_do_addr_cycle(struct mtd_info *mtd, int column, int page_addr) static void mxc_do_addr_cycle(struct mtd_info *mtd, int column, int page_addr)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
/* Write out column address, if necessary */ /* Write out column address, if necessary */
...@@ -979,7 +979,7 @@ static void ecc_8bit_layout_4k(struct nand_ecclayout *layout) ...@@ -979,7 +979,7 @@ static void ecc_8bit_layout_4k(struct nand_ecclayout *layout)
static void preset_v1(struct mtd_info *mtd) static void preset_v1(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
uint16_t config1 = 0; uint16_t config1 = 0;
...@@ -1007,7 +1007,7 @@ static void preset_v1(struct mtd_info *mtd) ...@@ -1007,7 +1007,7 @@ static void preset_v1(struct mtd_info *mtd)
static void preset_v2(struct mtd_info *mtd) static void preset_v2(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
uint16_t config1 = 0; uint16_t config1 = 0;
...@@ -1053,7 +1053,7 @@ static void preset_v2(struct mtd_info *mtd) ...@@ -1053,7 +1053,7 @@ static void preset_v2(struct mtd_info *mtd)
static void preset_v3(struct mtd_info *mtd) static void preset_v3(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = chip->priv; struct mxc_nand_host *host = chip->priv;
uint32_t config2, config3; uint32_t config2, config3;
int i, addr_phases; int i, addr_phases;
...@@ -1124,7 +1124,7 @@ static void preset_v3(struct mtd_info *mtd) ...@@ -1124,7 +1124,7 @@ static void preset_v3(struct mtd_info *mtd)
static void mxc_nand_command(struct mtd_info *mtd, unsigned command, static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
int column, int page_addr) int column, int page_addr)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
pr_debug("mxc_nand_command (cmd = 0x%x, col = 0x%x, page = 0x%x)\n", pr_debug("mxc_nand_command (cmd = 0x%x, col = 0x%x, page = 0x%x)\n",
......
...@@ -48,7 +48,7 @@ static struct ndfc_controller ndfc_ctrl[NDFC_MAX_CS]; ...@@ -48,7 +48,7 @@ static struct ndfc_controller ndfc_ctrl[NDFC_MAX_CS];
static void ndfc_select_chip(struct mtd_info *mtd, int chip) static void ndfc_select_chip(struct mtd_info *mtd, int chip)
{ {
uint32_t ccr; uint32_t ccr;
struct nand_chip *nchip = mtd->priv; struct nand_chip *nchip = mtd_to_nand(mtd);
struct ndfc_controller *ndfc = nchip->priv; struct ndfc_controller *ndfc = nchip->priv;
ccr = in_be32(ndfc->ndfcbase + NDFC_CCR); ccr = in_be32(ndfc->ndfcbase + NDFC_CCR);
...@@ -62,7 +62,7 @@ static void ndfc_select_chip(struct mtd_info *mtd, int chip) ...@@ -62,7 +62,7 @@ static void ndfc_select_chip(struct mtd_info *mtd, int chip)
static void ndfc_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) static void ndfc_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct ndfc_controller *ndfc = chip->priv; struct ndfc_controller *ndfc = chip->priv;
if (cmd == NAND_CMD_NONE) if (cmd == NAND_CMD_NONE)
...@@ -76,7 +76,7 @@ static void ndfc_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) ...@@ -76,7 +76,7 @@ static void ndfc_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
static int ndfc_ready(struct mtd_info *mtd) static int ndfc_ready(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct ndfc_controller *ndfc = chip->priv; struct ndfc_controller *ndfc = chip->priv;
return in_be32(ndfc->ndfcbase + NDFC_STAT) & NDFC_STAT_IS_READY; return in_be32(ndfc->ndfcbase + NDFC_STAT) & NDFC_STAT_IS_READY;
...@@ -85,7 +85,7 @@ static int ndfc_ready(struct mtd_info *mtd) ...@@ -85,7 +85,7 @@ static int ndfc_ready(struct mtd_info *mtd)
static void ndfc_enable_hwecc(struct mtd_info *mtd, int mode) static void ndfc_enable_hwecc(struct mtd_info *mtd, int mode)
{ {
uint32_t ccr; uint32_t ccr;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct ndfc_controller *ndfc = chip->priv; struct ndfc_controller *ndfc = chip->priv;
ccr = in_be32(ndfc->ndfcbase + NDFC_CCR); ccr = in_be32(ndfc->ndfcbase + NDFC_CCR);
...@@ -97,7 +97,7 @@ static void ndfc_enable_hwecc(struct mtd_info *mtd, int mode) ...@@ -97,7 +97,7 @@ static void ndfc_enable_hwecc(struct mtd_info *mtd, int mode)
static int ndfc_calculate_ecc(struct mtd_info *mtd, static int ndfc_calculate_ecc(struct mtd_info *mtd,
const u_char *dat, u_char *ecc_code) const u_char *dat, u_char *ecc_code)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct ndfc_controller *ndfc = chip->priv; struct ndfc_controller *ndfc = chip->priv;
uint32_t ecc; uint32_t ecc;
uint8_t *p = (uint8_t *)&ecc; uint8_t *p = (uint8_t *)&ecc;
...@@ -121,7 +121,7 @@ static int ndfc_calculate_ecc(struct mtd_info *mtd, ...@@ -121,7 +121,7 @@ static int ndfc_calculate_ecc(struct mtd_info *mtd,
*/ */
static void ndfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void ndfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct ndfc_controller *ndfc = chip->priv; struct ndfc_controller *ndfc = chip->priv;
uint32_t *p = (uint32_t *) buf; uint32_t *p = (uint32_t *) buf;
...@@ -131,7 +131,7 @@ static void ndfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) ...@@ -131,7 +131,7 @@ static void ndfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
static void ndfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) static void ndfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct ndfc_controller *ndfc = chip->priv; struct ndfc_controller *ndfc = chip->priv;
uint32_t *p = (uint32_t *) buf; uint32_t *p = (uint32_t *) buf;
......
...@@ -136,7 +136,7 @@ static int nuc900_nand_devready(struct mtd_info *mtd) ...@@ -136,7 +136,7 @@ static int nuc900_nand_devready(struct mtd_info *mtd)
static void nuc900_nand_command_lp(struct mtd_info *mtd, unsigned int command, static void nuc900_nand_command_lp(struct mtd_info *mtd, unsigned int command,
int column, int page_addr) int column, int page_addr)
{ {
register struct nand_chip *chip = mtd->priv; register struct nand_chip *chip = mtd_to_nand(mtd);
struct nuc900_nand *nand; struct nuc900_nand *nand;
nand = container_of(mtd, struct nuc900_nand, mtd); nand = container_of(mtd, struct nuc900_nand, mtd);
......
...@@ -270,7 +270,7 @@ static void omap_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl) ...@@ -270,7 +270,7 @@ static void omap_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
*/ */
static void omap_read_buf8(struct mtd_info *mtd, u_char *buf, int len) static void omap_read_buf8(struct mtd_info *mtd, u_char *buf, int len)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
ioread8_rep(nand->IO_ADDR_R, buf, len); ioread8_rep(nand->IO_ADDR_R, buf, len);
} }
...@@ -306,7 +306,7 @@ static void omap_write_buf8(struct mtd_info *mtd, const u_char *buf, int len) ...@@ -306,7 +306,7 @@ static void omap_write_buf8(struct mtd_info *mtd, const u_char *buf, int len)
*/ */
static void omap_read_buf16(struct mtd_info *mtd, u_char *buf, int len) static void omap_read_buf16(struct mtd_info *mtd, u_char *buf, int len)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
ioread16_rep(nand->IO_ADDR_R, buf, len / 2); ioread16_rep(nand->IO_ADDR_R, buf, len / 2);
} }
...@@ -955,7 +955,7 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int mode) ...@@ -955,7 +955,7 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int mode)
{ {
struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
mtd); mtd);
struct nand_chip *chip = mtd->priv; 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;
...@@ -1001,7 +1001,7 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int mode) ...@@ -1001,7 +1001,7 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int mode)
*/ */
static int omap_wait(struct mtd_info *mtd, struct nand_chip *chip) static int omap_wait(struct mtd_info *mtd, struct nand_chip *chip)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
mtd); mtd);
unsigned long timeo = jiffies; unsigned long timeo = jiffies;
...@@ -1061,7 +1061,7 @@ static void __maybe_unused omap_enable_hwecc_bch(struct mtd_info *mtd, int mode) ...@@ -1061,7 +1061,7 @@ static void __maybe_unused omap_enable_hwecc_bch(struct mtd_info *mtd, int mode)
struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
mtd); mtd);
enum omap_ecc ecc_opt = info->ecc_opt; enum omap_ecc ecc_opt = info->ecc_opt;
struct nand_chip *chip = mtd->priv; 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;
...@@ -2056,7 +2056,7 @@ static int omap_nand_probe(struct platform_device *pdev) ...@@ -2056,7 +2056,7 @@ static int omap_nand_probe(struct platform_device *pdev)
static int omap_nand_remove(struct platform_device *pdev) static int omap_nand_remove(struct platform_device *pdev)
{ {
struct mtd_info *mtd = platform_get_drvdata(pdev); struct mtd_info *mtd = platform_get_drvdata(pdev);
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
mtd); mtd);
if (nand_chip->ecc.priv) { if (nand_chip->ecc.priv) {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
static void orion_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) static void orion_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{ {
struct nand_chip *nc = mtd->priv; struct nand_chip *nc = mtd_to_nand(mtd);
struct orion_nand_data *board = nc->priv; struct orion_nand_data *board = nc->priv;
u32 offs; u32 offs;
...@@ -47,7 +47,7 @@ static void orion_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl ...@@ -47,7 +47,7 @@ static void orion_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl
static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
void __iomem *io_base = chip->IO_ADDR_R; void __iomem *io_base = chip->IO_ADDR_R;
uint64_t *buf64; uint64_t *buf64;
int i = 0; int i = 0;
......
...@@ -45,7 +45,7 @@ static const char driver_name[] = "pasemi-nand"; ...@@ -45,7 +45,7 @@ static const char driver_name[] = "pasemi-nand";
static void pasemi_read_buf(struct mtd_info *mtd, u_char *buf, int len) static void pasemi_read_buf(struct mtd_info *mtd, u_char *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
while (len > 0x800) { while (len > 0x800) {
memcpy_fromio(buf, chip->IO_ADDR_R, 0x800); memcpy_fromio(buf, chip->IO_ADDR_R, 0x800);
...@@ -57,7 +57,7 @@ static void pasemi_read_buf(struct mtd_info *mtd, u_char *buf, int len) ...@@ -57,7 +57,7 @@ static void pasemi_read_buf(struct mtd_info *mtd, u_char *buf, int len)
static void pasemi_write_buf(struct mtd_info *mtd, const u_char *buf, int len) static void pasemi_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
while (len > 0x800) { while (len > 0x800) {
memcpy_toio(chip->IO_ADDR_R, buf, 0x800); memcpy_toio(chip->IO_ADDR_R, buf, 0x800);
...@@ -70,7 +70,7 @@ static void pasemi_write_buf(struct mtd_info *mtd, const u_char *buf, int len) ...@@ -70,7 +70,7 @@ static void pasemi_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
static void pasemi_hwcontrol(struct mtd_info *mtd, int cmd, static void pasemi_hwcontrol(struct mtd_info *mtd, int cmd,
unsigned int ctrl) unsigned int ctrl)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
if (cmd == NAND_CMD_NONE) if (cmd == NAND_CMD_NONE)
return; return;
...@@ -192,7 +192,7 @@ static int pasemi_nand_remove(struct platform_device *ofdev) ...@@ -192,7 +192,7 @@ static int pasemi_nand_remove(struct platform_device *ofdev)
if (!pasemi_nand_mtd) if (!pasemi_nand_mtd)
return 0; return 0;
chip = pasemi_nand_mtd->priv; chip = mtd_to_nand(pasemi_nand_mtd);
/* Release resources, unregister device */ /* Release resources, unregister device */
nand_release(pasemi_nand_mtd); nand_release(pasemi_nand_mtd);
......
...@@ -1113,7 +1113,7 @@ static int prepare_set_command(struct pxa3xx_nand_info *info, int command, ...@@ -1113,7 +1113,7 @@ static int prepare_set_command(struct pxa3xx_nand_info *info, int command,
static void nand_cmdfunc(struct mtd_info *mtd, unsigned command, static void nand_cmdfunc(struct mtd_info *mtd, unsigned command,
int column, int page_addr) int column, int page_addr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct pxa3xx_nand_host *host = chip->priv; struct pxa3xx_nand_host *host = chip->priv;
struct pxa3xx_nand_info *info = host->info_data; struct pxa3xx_nand_info *info = host->info_data;
int exec_cmd; int exec_cmd;
...@@ -1162,7 +1162,7 @@ static void nand_cmdfunc_extended(struct mtd_info *mtd, ...@@ -1162,7 +1162,7 @@ static void nand_cmdfunc_extended(struct mtd_info *mtd,
const unsigned command, const unsigned command,
int column, int page_addr) int column, int page_addr)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct pxa3xx_nand_host *host = chip->priv; struct pxa3xx_nand_host *host = chip->priv;
struct pxa3xx_nand_info *info = host->info_data; struct pxa3xx_nand_info *info = host->info_data;
int exec_cmd, ext_cmd_type; int exec_cmd, ext_cmd_type;
...@@ -1309,7 +1309,7 @@ static int pxa3xx_nand_read_page_hwecc(struct mtd_info *mtd, ...@@ -1309,7 +1309,7 @@ static int pxa3xx_nand_read_page_hwecc(struct mtd_info *mtd,
static uint8_t pxa3xx_nand_read_byte(struct mtd_info *mtd) static uint8_t pxa3xx_nand_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct pxa3xx_nand_host *host = chip->priv; struct pxa3xx_nand_host *host = chip->priv;
struct pxa3xx_nand_info *info = host->info_data; struct pxa3xx_nand_info *info = host->info_data;
char retval = 0xFF; char retval = 0xFF;
...@@ -1323,7 +1323,7 @@ static uint8_t pxa3xx_nand_read_byte(struct mtd_info *mtd) ...@@ -1323,7 +1323,7 @@ static uint8_t pxa3xx_nand_read_byte(struct mtd_info *mtd)
static u16 pxa3xx_nand_read_word(struct mtd_info *mtd) static u16 pxa3xx_nand_read_word(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct pxa3xx_nand_host *host = chip->priv; struct pxa3xx_nand_host *host = chip->priv;
struct pxa3xx_nand_info *info = host->info_data; struct pxa3xx_nand_info *info = host->info_data;
u16 retval = 0xFFFF; u16 retval = 0xFFFF;
...@@ -1337,7 +1337,7 @@ static u16 pxa3xx_nand_read_word(struct mtd_info *mtd) ...@@ -1337,7 +1337,7 @@ static u16 pxa3xx_nand_read_word(struct mtd_info *mtd)
static void pxa3xx_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void pxa3xx_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct pxa3xx_nand_host *host = chip->priv; struct pxa3xx_nand_host *host = chip->priv;
struct pxa3xx_nand_info *info = host->info_data; struct pxa3xx_nand_info *info = host->info_data;
int real_len = min_t(size_t, len, info->buf_count - info->buf_start); int real_len = min_t(size_t, len, info->buf_count - info->buf_start);
...@@ -1349,7 +1349,7 @@ static void pxa3xx_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) ...@@ -1349,7 +1349,7 @@ static void pxa3xx_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
static void pxa3xx_nand_write_buf(struct mtd_info *mtd, static void pxa3xx_nand_write_buf(struct mtd_info *mtd,
const uint8_t *buf, int len) const uint8_t *buf, int len)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct pxa3xx_nand_host *host = chip->priv; struct pxa3xx_nand_host *host = chip->priv;
struct pxa3xx_nand_info *info = host->info_data; struct pxa3xx_nand_info *info = host->info_data;
int real_len = min_t(size_t, len, info->buf_count - info->buf_start); int real_len = min_t(size_t, len, info->buf_count - info->buf_start);
...@@ -1365,7 +1365,7 @@ static void pxa3xx_nand_select_chip(struct mtd_info *mtd, int chip) ...@@ -1365,7 +1365,7 @@ static void pxa3xx_nand_select_chip(struct mtd_info *mtd, int chip)
static int pxa3xx_nand_waitfunc(struct mtd_info *mtd, struct nand_chip *this) static int pxa3xx_nand_waitfunc(struct mtd_info *mtd, struct nand_chip *this)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct pxa3xx_nand_host *host = chip->priv; struct pxa3xx_nand_host *host = chip->priv;
struct pxa3xx_nand_info *info = host->info_data; struct pxa3xx_nand_info *info = host->info_data;
...@@ -1416,7 +1416,7 @@ static void pxa3xx_nand_config_tail(struct pxa3xx_nand_info *info) ...@@ -1416,7 +1416,7 @@ static void pxa3xx_nand_config_tail(struct pxa3xx_nand_info *info)
{ {
struct pxa3xx_nand_host *host = info->host[info->cs]; struct pxa3xx_nand_host *host = info->host[info->cs];
struct mtd_info *mtd = host->mtd; struct mtd_info *mtd = host->mtd;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
info->reg_ndcr |= (host->col_addr_cycles == 2) ? NDCR_RA_START : 0; info->reg_ndcr |= (host->col_addr_cycles == 2) ? NDCR_RA_START : 0;
info->reg_ndcr |= (chip->page_shift == 6) ? NDCR_PG_PER_BLK : 0; info->reg_ndcr |= (chip->page_shift == 6) ? NDCR_PG_PER_BLK : 0;
...@@ -1572,7 +1572,7 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info, ...@@ -1572,7 +1572,7 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info,
static int pxa3xx_nand_scan(struct mtd_info *mtd) static int pxa3xx_nand_scan(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct pxa3xx_nand_host *host = chip->priv; struct pxa3xx_nand_host *host = chip->priv;
struct pxa3xx_nand_info *info = host->info_data; struct pxa3xx_nand_info *info = host->info_data;
struct platform_device *pdev = info->pdev; struct platform_device *pdev = info->pdev;
......
...@@ -64,7 +64,7 @@ static inline void r852_write_reg_dword(struct r852_device *dev, ...@@ -64,7 +64,7 @@ static inline void r852_write_reg_dword(struct r852_device *dev,
/* returns pointer to our private structure */ /* returns pointer to our private structure */
static inline struct r852_device *r852_get_dev(struct mtd_info *mtd) static inline struct r852_device *r852_get_dev(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
return chip->priv; return chip->priv;
} }
......
...@@ -382,7 +382,7 @@ static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip) ...@@ -382,7 +382,7 @@ static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip)
{ {
struct s3c2410_nand_info *info; struct s3c2410_nand_info *info;
struct s3c2410_nand_mtd *nmtd; struct s3c2410_nand_mtd *nmtd;
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
unsigned long cur; unsigned long cur;
nmtd = this->priv; nmtd = this->priv;
...@@ -634,7 +634,7 @@ static int s3c2440_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, ...@@ -634,7 +634,7 @@ static int s3c2440_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
static void s3c2410_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) static void s3c2410_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
readsb(this->IO_ADDR_R, buf, len); readsb(this->IO_ADDR_R, buf, len);
} }
...@@ -656,7 +656,7 @@ static void s3c2440_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len) ...@@ -656,7 +656,7 @@ static void s3c2440_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
static void s3c2410_nand_write_buf(struct mtd_info *mtd, const u_char *buf, static void s3c2410_nand_write_buf(struct mtd_info *mtd, const u_char *buf,
int len) int len)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
writesb(this->IO_ADDR_W, buf, len); writesb(this->IO_ADDR_W, buf, len);
} }
......
...@@ -66,7 +66,7 @@ static void sharpsl_nand_hwcontrol(struct mtd_info *mtd, int cmd, ...@@ -66,7 +66,7 @@ static void sharpsl_nand_hwcontrol(struct mtd_info *mtd, int cmd,
unsigned int ctrl) unsigned int ctrl)
{ {
struct sharpsl_nand *sharpsl = mtd_to_sharpsl(mtd); struct sharpsl_nand *sharpsl = mtd_to_sharpsl(mtd);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_CTRL_CHANGE) {
unsigned char bits = ctrl & 0x07; unsigned char bits = ctrl & 0x07;
......
...@@ -102,7 +102,7 @@ static struct nand_flash_dev nand_xd_flash_ids[] = { ...@@ -102,7 +102,7 @@ static struct nand_flash_dev nand_xd_flash_ids[] = {
int sm_register_device(struct mtd_info *mtd, int smartmedia) int sm_register_device(struct mtd_info *mtd, int smartmedia)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
int ret; int ret;
chip->options |= NAND_SKIP_BBTSCAN; chip->options |= NAND_SKIP_BBTSCAN;
......
...@@ -45,7 +45,7 @@ static void socrates_nand_write_buf(struct mtd_info *mtd, ...@@ -45,7 +45,7 @@ static void socrates_nand_write_buf(struct mtd_info *mtd,
const uint8_t *buf, int len) const uint8_t *buf, int len)
{ {
int i; int i;
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
struct socrates_nand_host *host = this->priv; struct socrates_nand_host *host = this->priv;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
...@@ -64,7 +64,7 @@ static void socrates_nand_write_buf(struct mtd_info *mtd, ...@@ -64,7 +64,7 @@ static void socrates_nand_write_buf(struct mtd_info *mtd,
static void socrates_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void socrates_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{ {
int i; int i;
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
struct socrates_nand_host *host = this->priv; struct socrates_nand_host *host = this->priv;
uint32_t val; uint32_t val;
...@@ -105,7 +105,7 @@ static uint16_t socrates_nand_read_word(struct mtd_info *mtd) ...@@ -105,7 +105,7 @@ static uint16_t socrates_nand_read_word(struct mtd_info *mtd)
static void socrates_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, static void socrates_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl) unsigned int ctrl)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct socrates_nand_host *host = nand_chip->priv; struct socrates_nand_host *host = nand_chip->priv;
uint32_t val; uint32_t val;
...@@ -130,7 +130,7 @@ static void socrates_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, ...@@ -130,7 +130,7 @@ static void socrates_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
*/ */
static int socrates_nand_device_ready(struct mtd_info *mtd) static int socrates_nand_device_ready(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct socrates_nand_host *host = nand_chip->priv; struct socrates_nand_host *host = nand_chip->priv;
if (in_be32(host->io_base) & FPGA_NAND_BUSY) if (in_be32(host->io_base) & FPGA_NAND_BUSY)
......
...@@ -350,7 +350,7 @@ static int sunxi_nfc_rst(struct sunxi_nfc *nfc) ...@@ -350,7 +350,7 @@ static int sunxi_nfc_rst(struct sunxi_nfc *nfc)
static int sunxi_nfc_dev_ready(struct mtd_info *mtd) static int sunxi_nfc_dev_ready(struct mtd_info *mtd)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand); struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand);
struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller); struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller);
struct sunxi_nand_rb *rb; struct sunxi_nand_rb *rb;
...@@ -388,7 +388,7 @@ static int sunxi_nfc_dev_ready(struct mtd_info *mtd) ...@@ -388,7 +388,7 @@ static int sunxi_nfc_dev_ready(struct mtd_info *mtd)
static void sunxi_nfc_select_chip(struct mtd_info *mtd, int chip) static void sunxi_nfc_select_chip(struct mtd_info *mtd, int chip)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand); struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand);
struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller); struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller);
struct sunxi_nand_chip_sel *sel; struct sunxi_nand_chip_sel *sel;
...@@ -433,7 +433,7 @@ static void sunxi_nfc_select_chip(struct mtd_info *mtd, int chip) ...@@ -433,7 +433,7 @@ static void sunxi_nfc_select_chip(struct mtd_info *mtd, int chip)
static void sunxi_nfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) static void sunxi_nfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand); struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand);
struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller); struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller);
int ret; int ret;
...@@ -466,7 +466,7 @@ static void sunxi_nfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) ...@@ -466,7 +466,7 @@ static void sunxi_nfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
static void sunxi_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, static void sunxi_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf,
int len) int len)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand); struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand);
struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller); struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller);
int ret; int ret;
...@@ -507,7 +507,7 @@ static uint8_t sunxi_nfc_read_byte(struct mtd_info *mtd) ...@@ -507,7 +507,7 @@ static uint8_t sunxi_nfc_read_byte(struct mtd_info *mtd)
static void sunxi_nfc_cmd_ctrl(struct mtd_info *mtd, int dat, static void sunxi_nfc_cmd_ctrl(struct mtd_info *mtd, int dat,
unsigned int ctrl) unsigned int ctrl)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand); struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand);
struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller); struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller);
int ret; int ret;
...@@ -541,7 +541,7 @@ static void sunxi_nfc_cmd_ctrl(struct mtd_info *mtd, int dat, ...@@ -541,7 +541,7 @@ static void sunxi_nfc_cmd_ctrl(struct mtd_info *mtd, int dat,
static void sunxi_nfc_hw_ecc_enable(struct mtd_info *mtd) static void sunxi_nfc_hw_ecc_enable(struct mtd_info *mtd)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller); struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller);
struct sunxi_nand_hw_ecc *data = nand->ecc.priv; struct sunxi_nand_hw_ecc *data = nand->ecc.priv;
u32 ecc_ctl; u32 ecc_ctl;
...@@ -556,7 +556,7 @@ static void sunxi_nfc_hw_ecc_enable(struct mtd_info *mtd) ...@@ -556,7 +556,7 @@ static void sunxi_nfc_hw_ecc_enable(struct mtd_info *mtd)
static void sunxi_nfc_hw_ecc_disable(struct mtd_info *mtd) static void sunxi_nfc_hw_ecc_disable(struct mtd_info *mtd)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller); struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller);
writel(readl(nfc->regs + NFC_REG_ECC_CTL) & ~NFC_ECC_EN, writel(readl(nfc->regs + NFC_REG_ECC_CTL) & ~NFC_ECC_EN,
...@@ -577,7 +577,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd, ...@@ -577,7 +577,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,
int *cur_off, int *cur_off,
unsigned int *max_bitflips) unsigned int *max_bitflips)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller); struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller);
struct nand_ecc_ctrl *ecc = &nand->ecc; struct nand_ecc_ctrl *ecc = &nand->ecc;
u32 status; u32 status;
...@@ -638,7 +638,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd, ...@@ -638,7 +638,7 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct mtd_info *mtd,
static void sunxi_nfc_hw_ecc_read_extra_oob(struct mtd_info *mtd, static void sunxi_nfc_hw_ecc_read_extra_oob(struct mtd_info *mtd,
u8 *oob, int *cur_off) u8 *oob, int *cur_off)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct nand_ecc_ctrl *ecc = &nand->ecc; struct nand_ecc_ctrl *ecc = &nand->ecc;
int offset = ((ecc->bytes + 4) * ecc->steps); int offset = ((ecc->bytes + 4) * ecc->steps);
int len = mtd->oobsize - offset; int len = mtd->oobsize - offset;
...@@ -665,7 +665,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd, ...@@ -665,7 +665,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd,
const u8 *oob, int oob_off, const u8 *oob, int oob_off,
int *cur_off) int *cur_off)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller); struct sunxi_nfc *nfc = to_sunxi_nfc(nand->controller);
struct nand_ecc_ctrl *ecc = &nand->ecc; struct nand_ecc_ctrl *ecc = &nand->ecc;
int ret; int ret;
...@@ -702,7 +702,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd, ...@@ -702,7 +702,7 @@ static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd,
static void sunxi_nfc_hw_ecc_write_extra_oob(struct mtd_info *mtd, static void sunxi_nfc_hw_ecc_write_extra_oob(struct mtd_info *mtd,
u8 *oob, int *cur_off) u8 *oob, int *cur_off)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct nand_ecc_ctrl *ecc = &nand->ecc; struct nand_ecc_ctrl *ecc = &nand->ecc;
int offset = ((ecc->bytes + 4) * ecc->steps); int offset = ((ecc->bytes + 4) * ecc->steps);
int len = mtd->oobsize - offset; int len = mtd->oobsize - offset;
...@@ -1031,7 +1031,7 @@ static int sunxi_nand_hw_common_ecc_ctrl_init(struct mtd_info *mtd, ...@@ -1031,7 +1031,7 @@ static int sunxi_nand_hw_common_ecc_ctrl_init(struct mtd_info *mtd,
struct device_node *np) struct device_node *np)
{ {
static const u8 strengths[] = { 16, 24, 28, 32, 40, 48, 56, 60, 64 }; static const u8 strengths[] = { 16, 24, 28, 32, 40, 48, 56, 60, 64 };
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand); struct sunxi_nand_chip *sunxi_nand = to_sunxi_nand(nand);
struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller); struct sunxi_nfc *nfc = to_sunxi_nfc(sunxi_nand->nand.controller);
struct sunxi_nand_hw_ecc *data; struct sunxi_nand_hw_ecc *data;
...@@ -1189,7 +1189,7 @@ static void sunxi_nand_ecc_cleanup(struct nand_ecc_ctrl *ecc) ...@@ -1189,7 +1189,7 @@ static void sunxi_nand_ecc_cleanup(struct nand_ecc_ctrl *ecc)
static int sunxi_nand_ecc_init(struct mtd_info *mtd, struct nand_ecc_ctrl *ecc, static int sunxi_nand_ecc_init(struct mtd_info *mtd, struct nand_ecc_ctrl *ecc,
struct device_node *np) struct device_node *np)
{ {
struct nand_chip *nand = mtd->priv; struct nand_chip *nand = mtd_to_nand(mtd);
int ret; int ret;
if (!ecc->size) { if (!ecc->size) {
......
...@@ -128,7 +128,7 @@ static void tmio_nand_hwcontrol(struct mtd_info *mtd, int cmd, ...@@ -128,7 +128,7 @@ static void tmio_nand_hwcontrol(struct mtd_info *mtd, int cmd,
unsigned int ctrl) unsigned int ctrl)
{ {
struct tmio_nand *tmio = mtd_to_tmio(mtd); struct tmio_nand *tmio = mtd_to_tmio(mtd);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_CTRL_CHANGE) {
u8 mode; u8 mode;
......
...@@ -79,7 +79,7 @@ struct txx9ndfmc_drvdata { ...@@ -79,7 +79,7 @@ struct txx9ndfmc_drvdata {
static struct platform_device *mtd_to_platdev(struct mtd_info *mtd) static struct platform_device *mtd_to_platdev(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct txx9ndfmc_priv *txx9_priv = chip->priv; struct txx9ndfmc_priv *txx9_priv = chip->priv;
return txx9_priv->dev; return txx9_priv->dev;
} }
...@@ -135,7 +135,7 @@ static void txx9ndfmc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) ...@@ -135,7 +135,7 @@ static void txx9ndfmc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
static void txx9ndfmc_cmd_ctrl(struct mtd_info *mtd, int cmd, static void txx9ndfmc_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl) unsigned int ctrl)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
struct txx9ndfmc_priv *txx9_priv = chip->priv; struct txx9ndfmc_priv *txx9_priv = chip->priv;
struct platform_device *dev = txx9_priv->dev; struct platform_device *dev = txx9_priv->dev;
struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev);
...@@ -175,7 +175,7 @@ static int txx9ndfmc_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat, ...@@ -175,7 +175,7 @@ static int txx9ndfmc_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat,
uint8_t *ecc_code) uint8_t *ecc_code)
{ {
struct platform_device *dev = mtd_to_platdev(mtd); struct platform_device *dev = mtd_to_platdev(mtd);
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
int eccbytes; int eccbytes;
u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR);
...@@ -195,7 +195,7 @@ static int txx9ndfmc_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat, ...@@ -195,7 +195,7 @@ static int txx9ndfmc_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat,
static int txx9ndfmc_correct_data(struct mtd_info *mtd, unsigned char *buf, static int txx9ndfmc_correct_data(struct mtd_info *mtd, unsigned char *buf,
unsigned char *read_ecc, unsigned char *calc_ecc) unsigned char *read_ecc, unsigned char *calc_ecc)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
int eccsize; int eccsize;
int corrected = 0; int corrected = 0;
int stat; int stat;
...@@ -257,7 +257,7 @@ static void txx9ndfmc_initialize(struct platform_device *dev) ...@@ -257,7 +257,7 @@ static void txx9ndfmc_initialize(struct platform_device *dev)
static int txx9ndfmc_nand_scan(struct mtd_info *mtd) static int txx9ndfmc_nand_scan(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd_to_nand(mtd);
int ret; int ret;
ret = nand_scan_ident(mtd, 1, NULL); ret = nand_scan_ident(mtd, 1, NULL);
...@@ -391,7 +391,7 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev) ...@@ -391,7 +391,7 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev)
if (!mtd) if (!mtd)
continue; continue;
chip = mtd->priv; chip = mtd_to_nand(mtd);
txx9_priv = chip->priv; txx9_priv = chip->priv;
nand_release(mtd); nand_release(mtd);
......
...@@ -89,7 +89,7 @@ static void xway_select_chip(struct mtd_info *mtd, int chip) ...@@ -89,7 +89,7 @@ static void xway_select_chip(struct mtd_info *mtd, int chip)
static void xway_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) static void xway_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
unsigned long nandaddr = (unsigned long) this->IO_ADDR_W; unsigned long nandaddr = (unsigned long) this->IO_ADDR_W;
unsigned long flags; unsigned long flags;
...@@ -118,7 +118,7 @@ static int xway_dev_ready(struct mtd_info *mtd) ...@@ -118,7 +118,7 @@ static int xway_dev_ready(struct mtd_info *mtd)
static unsigned char xway_read_byte(struct mtd_info *mtd) static unsigned char xway_read_byte(struct mtd_info *mtd)
{ {
struct nand_chip *this = mtd->priv; struct nand_chip *this = mtd_to_nand(mtd);
unsigned long nandaddr = (unsigned long) this->IO_ADDR_R; unsigned long nandaddr = (unsigned long) this->IO_ADDR_R;
unsigned long flags; unsigned long flags;
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment