mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-22 18:44:44 +08:00
mtd: nand: make use of nand_set/get_controller_data() helpers
New helpers have been added to avoid directly accessing chip->field. Use them where appropriate. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> [Brian: fixed a few rebase conflicts] Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:
parent
d9dccc68c5
commit
d699ed250c
@ -65,7 +65,7 @@ static struct mtd_partition partition_info[] = {
|
||||
static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
void __iomem *io_base = this->priv;
|
||||
void __iomem *io_base = (void __iomem *)nand_get_controller_data(this);
|
||||
|
||||
writew(0, io_base + OMAP_MPUIO_IO_CNTL);
|
||||
writew(byte, this->IO_ADDR_W);
|
||||
@ -78,7 +78,7 @@ static u_char ams_delta_read_byte(struct mtd_info *mtd)
|
||||
{
|
||||
u_char res;
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
void __iomem *io_base = this->priv;
|
||||
void __iomem *io_base = (void __iomem *)nand_get_controller_data(this);
|
||||
|
||||
gpio_set_value(AMS_DELTA_GPIO_PIN_NAND_NRE, 0);
|
||||
ndelay(40);
|
||||
@ -206,7 +206,7 @@ static int ams_delta_init(struct platform_device *pdev)
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
this->priv = io_base;
|
||||
nand_set_controller_data(this, (void *)io_base);
|
||||
|
||||
/* Set address of NAND IO lines */
|
||||
this->IO_ADDR_R = io_base + OMAP_MPUIO_INPUT_LATCH;
|
||||
|
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
if (ctrl & NAND_CTRL_CHANGE) {
|
||||
if (ctrl & NAND_NCE)
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
return gpio_get_value(host->board.rdy_pin) ^
|
||||
!!host->board.rdy_pin_active_low;
|
||||
@ -215,7 +215,7 @@ static int atmel_nand_device_ready(struct mtd_info *mtd)
|
||||
static int atmel_nand_set_enable_ready_pins(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(chip);
|
||||
int res = 0;
|
||||
|
||||
if (gpio_is_valid(host->board.rdy_pin)) {
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
if (host->nfc && host->nfc->use_nfc_sram && host->nfc->data_in_sram) {
|
||||
memcpy(buf, host->nfc->data_in_sram, 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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
if (host->nfc && host->nfc->use_nfc_sram && host->nfc->data_in_sram) {
|
||||
memcpy(buf, host->nfc->data_in_sram, len);
|
||||
@ -354,7 +354,7 @@ static int atmel_nand_dma_op(struct mtd_info *mtd, void *buf, int len,
|
||||
struct dma_async_tx_descriptor *tx = NULL;
|
||||
dma_cookie_t cookie;
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(chip);
|
||||
void *p = buf;
|
||||
int err = -EIO;
|
||||
enum dma_data_direction dir = is_read ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
|
||||
@ -427,7 +427,7 @@ err_buf:
|
||||
static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(chip);
|
||||
|
||||
if (use_dma && len > mtd->oobsize)
|
||||
/* only use DMA for bigger than oob size: better performances */
|
||||
@ -443,7 +443,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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(chip);
|
||||
|
||||
if (use_dma && len > mtd->oobsize)
|
||||
/* only use DMA for bigger than oob size: better performances */
|
||||
@ -535,7 +535,7 @@ static int pmecc_data_alloc(struct atmel_nand_host *host)
|
||||
static void pmecc_gen_syndrome(struct mtd_info *mtd, int sector)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
int i;
|
||||
uint32_t value;
|
||||
|
||||
@ -552,7 +552,7 @@ static void pmecc_gen_syndrome(struct mtd_info *mtd, int sector)
|
||||
static void pmecc_substitute(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
int16_t __iomem *alpha_to = host->pmecc_alpha_to;
|
||||
int16_t __iomem *index_of = host->pmecc_index_of;
|
||||
int16_t *partial_syn = host->pmecc_partial_syn;
|
||||
@ -594,7 +594,7 @@ static void pmecc_substitute(struct mtd_info *mtd)
|
||||
static void pmecc_get_sigma(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
int16_t *lmu = host->pmecc_lmu;
|
||||
int16_t *si = host->pmecc_si;
|
||||
@ -752,7 +752,7 @@ static void pmecc_get_sigma(struct mtd_info *mtd)
|
||||
static int pmecc_err_location(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
unsigned long end_time;
|
||||
const int cap = host->pmecc_corr_cap;
|
||||
const int num = 2 * cap + 1;
|
||||
@ -804,7 +804,7 @@ static void pmecc_correct_data(struct mtd_info *mtd, uint8_t *buf, uint8_t *ecc,
|
||||
int sector_num, int extra_bytes, int err_nbr)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
int i = 0;
|
||||
int byte_pos, bit_pos, sector_size, pos;
|
||||
uint32_t tmp;
|
||||
@ -850,7 +850,7 @@ static int pmecc_correction(struct mtd_info *mtd, u32 pmecc_stat, uint8_t *buf,
|
||||
u8 *ecc)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
int i, err_nbr;
|
||||
uint8_t *buf_pos;
|
||||
int max_bitflips = 0;
|
||||
@ -920,7 +920,7 @@ static void pmecc_enable(struct atmel_nand_host *host, int ecc_op)
|
||||
static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct atmel_nand_host *host = chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(chip);
|
||||
int eccsize = chip->ecc.size * chip->ecc.steps;
|
||||
uint8_t *oob = chip->oob_poi;
|
||||
uint32_t *eccpos = chip->ecc.layout->eccpos;
|
||||
@ -958,7 +958,7 @@ static int atmel_nand_pmecc_write_page(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, const uint8_t *buf, int oob_required,
|
||||
int page)
|
||||
{
|
||||
struct atmel_nand_host *host = chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(chip);
|
||||
uint32_t *eccpos = chip->ecc.layout->eccpos;
|
||||
int i, j;
|
||||
unsigned long end_time;
|
||||
@ -994,7 +994,7 @@ static int atmel_nand_pmecc_write_page(struct mtd_info *mtd,
|
||||
static void atmel_pmecc_core_init(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
uint32_t val = 0;
|
||||
struct nand_ecclayout *ecc_layout;
|
||||
|
||||
@ -1310,7 +1310,7 @@ static int atmel_nand_calculate(struct mtd_info *mtd,
|
||||
const u_char *dat, unsigned char *ecc_code)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
unsigned int ecc_value;
|
||||
|
||||
/* get the first 2 ECC bytes */
|
||||
@ -1356,7 +1356,7 @@ static int atmel_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
* Workaround: Reset the parity registers before reading the
|
||||
* actual data.
|
||||
*/
|
||||
struct atmel_nand_host *host = chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(chip);
|
||||
if (host->board.need_reset_workaround)
|
||||
ecc_writel(host->ecc, CR, ATMEL_ECC_RST);
|
||||
|
||||
@ -1414,7 +1414,7 @@ static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat,
|
||||
u_char *read_ecc, u_char *isnull)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
unsigned int ecc_status;
|
||||
unsigned int ecc_word, ecc_bit;
|
||||
|
||||
@ -1480,7 +1480,7 @@ static int atmel_nand_correct(struct mtd_info *mtd, u_char *dat,
|
||||
static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
if (host->board.need_reset_workaround)
|
||||
ecc_writel(host->ecc, CR, ATMEL_ECC_RST);
|
||||
@ -1773,7 +1773,7 @@ static int nfc_device_ready(struct mtd_info *mtd)
|
||||
{
|
||||
u32 status, mask;
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
status = nfc_read_status(host);
|
||||
mask = nfc_readl(host->nfc->hsmc_regs, IMR);
|
||||
@ -1789,7 +1789,7 @@ static int nfc_device_ready(struct mtd_info *mtd)
|
||||
static void nfc_select_chip(struct mtd_info *mtd, int chip)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = nand_chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
if (chip == -1)
|
||||
nfc_writel(host->nfc->hsmc_regs, CTRL, NFC_CTRL_DISABLE);
|
||||
@ -1841,7 +1841,7 @@ static void nfc_nand_command(struct mtd_info *mtd, unsigned int command,
|
||||
int column, int page_addr)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(chip);
|
||||
unsigned long timeout;
|
||||
unsigned int nfc_addr_cmd = 0;
|
||||
|
||||
@ -1967,7 +1967,7 @@ static int nfc_sram_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
{
|
||||
int cfg, len;
|
||||
int status = 0;
|
||||
struct atmel_nand_host *host = chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(chip);
|
||||
void *sram = host->nfc->sram_bank0 + nfc_get_sram_off(host);
|
||||
|
||||
/* Subpage write is not supported */
|
||||
@ -2028,7 +2028,7 @@ static int nfc_sram_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
static int nfc_sram_init(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct atmel_nand_host *host = chip->priv;
|
||||
struct atmel_nand_host *host = nand_get_controller_data(chip);
|
||||
int res = 0;
|
||||
|
||||
/* Initialize the NFC CFG register */
|
||||
@ -2127,7 +2127,8 @@ static int atmel_nand_probe(struct platform_device *pdev)
|
||||
sizeof(struct atmel_nand_data));
|
||||
}
|
||||
|
||||
nand_chip->priv = host; /* link the private data structures */
|
||||
/* link the private data structures */
|
||||
nand_set_controller_data(nand_chip, host);
|
||||
mtd->dev.parent = &pdev->dev;
|
||||
|
||||
/* Set address of NAND IO lines */
|
||||
|
@ -34,7 +34,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
|
||||
if (!b47n)
|
||||
return -ENOMEM;
|
||||
|
||||
b47n->nand_chip.priv = b47n;
|
||||
nand_set_controller_data(&b47n->nand_chip, b47n);
|
||||
mtd = nand_to_mtd(&b47n->nand_chip);
|
||||
mtd->dev.parent = &pdev->dev;
|
||||
b47n->cc = container_of(nflash, struct bcma_drv_cc, nflash);
|
||||
|
@ -90,7 +90,7 @@ static void bcm47xxnflash_ops_bcm4706_read(struct mtd_info *mtd, uint8_t *buf,
|
||||
int len)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
|
||||
struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
|
||||
|
||||
u32 ctlcode;
|
||||
u32 *dest = (u32 *)buf;
|
||||
@ -140,7 +140,7 @@ static void bcm47xxnflash_ops_bcm4706_write(struct mtd_info *mtd,
|
||||
const uint8_t *buf, int len)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
|
||||
struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
|
||||
struct bcma_drv_cc *cc = b47n->cc;
|
||||
|
||||
u32 ctlcode;
|
||||
@ -174,7 +174,7 @@ static void bcm47xxnflash_ops_bcm4706_cmd_ctrl(struct mtd_info *mtd, int cmd,
|
||||
unsigned int ctrl)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
|
||||
struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
|
||||
u32 code = 0;
|
||||
|
||||
if (cmd == NAND_CMD_NONE)
|
||||
@ -200,7 +200,7 @@ static void bcm47xxnflash_ops_bcm4706_select_chip(struct mtd_info *mtd,
|
||||
static int bcm47xxnflash_ops_bcm4706_dev_ready(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
|
||||
struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
|
||||
|
||||
return !!(bcma_cc_read32(b47n->cc, BCMA_CC_NFLASH_CTL) & NCTL_READY);
|
||||
}
|
||||
@ -217,7 +217,7 @@ static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct mtd_info *mtd,
|
||||
int page_addr)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
|
||||
struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
|
||||
struct bcma_drv_cc *cc = b47n->cc;
|
||||
u32 ctlcode;
|
||||
int i;
|
||||
@ -313,7 +313,7 @@ static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct mtd_info *mtd,
|
||||
static u8 bcm47xxnflash_ops_bcm4706_read_byte(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
|
||||
struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
|
||||
struct bcma_drv_cc *cc = b47n->cc;
|
||||
u32 tmp = 0;
|
||||
|
||||
@ -342,7 +342,7 @@ static void bcm47xxnflash_ops_bcm4706_read_buf(struct mtd_info *mtd,
|
||||
uint8_t *buf, int len)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
|
||||
struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
|
||||
|
||||
switch (b47n->curr_command) {
|
||||
case NAND_CMD_READ0:
|
||||
@ -358,7 +358,7 @@ static void bcm47xxnflash_ops_bcm4706_write_buf(struct mtd_info *mtd,
|
||||
const uint8_t *buf, int len)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
|
||||
struct bcm47xxnflash *b47n = nand_get_controller_data(nand_chip);
|
||||
|
||||
switch (b47n->curr_command) {
|
||||
case NAND_CMD_SEQIN:
|
||||
|
@ -781,7 +781,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
|
||||
chip->cmd_ctrl = bf5xx_nand_hwcontrol;
|
||||
chip->dev_ready = bf5xx_nand_devready;
|
||||
|
||||
chip->priv = mtd;
|
||||
nand_set_controller_data(chip, mtd);
|
||||
chip->controller = &info->controller;
|
||||
|
||||
chip->IO_ADDR_R = (void __iomem *) NFC_READ;
|
||||
|
@ -877,7 +877,7 @@ static struct nand_ecclayout *brcmstb_choose_ecc_layout(
|
||||
static void brcmnand_wp(struct mtd_info *mtd, int wp)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
struct brcmnand_controller *ctrl = host->ctrl;
|
||||
|
||||
if ((ctrl->features & BRCMNAND_HAS_WP) && wp_on == 1) {
|
||||
@ -1043,7 +1043,7 @@ static void brcmnand_cmd_ctrl(struct mtd_info *mtd, int dat,
|
||||
static int brcmnand_waitfunc(struct mtd_info *mtd, struct nand_chip *this)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
struct brcmnand_controller *ctrl = host->ctrl;
|
||||
unsigned long timeo = msecs_to_jiffies(100);
|
||||
|
||||
@ -1117,7 +1117,7 @@ static void brcmnand_cmdfunc(struct mtd_info *mtd, unsigned command,
|
||||
int column, int page_addr)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
struct brcmnand_controller *ctrl = host->ctrl;
|
||||
u64 addr = (u64)page_addr << chip->page_shift;
|
||||
int native_cmd = 0;
|
||||
@ -1223,7 +1223,7 @@ static void brcmnand_cmdfunc(struct mtd_info *mtd, unsigned command,
|
||||
static uint8_t brcmnand_read_byte(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
struct brcmnand_controller *ctrl = host->ctrl;
|
||||
uint8_t ret = 0;
|
||||
int addr, offs;
|
||||
@ -1290,7 +1290,7 @@ static void brcmnand_write_buf(struct mtd_info *mtd, const uint8_t *buf,
|
||||
{
|
||||
int i;
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
|
||||
switch (host->last_cmd) {
|
||||
case NAND_CMD_SET_FEATURES:
|
||||
@ -1400,7 +1400,7 @@ static int brcmnand_read_by_pio(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
u64 addr, unsigned int trans, u32 *buf,
|
||||
u8 *oob, u64 *err_addr)
|
||||
{
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
struct brcmnand_controller *ctrl = host->ctrl;
|
||||
int i, j, ret = 0;
|
||||
|
||||
@ -1463,7 +1463,7 @@ static int brcmnand_read_by_pio(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
u64 addr, unsigned int trans, u32 *buf, u8 *oob)
|
||||
{
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
struct brcmnand_controller *ctrl = host->ctrl;
|
||||
u64 err_addr = 0;
|
||||
int err;
|
||||
@ -1513,7 +1513,7 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
static int brcmnand_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
u8 *oob = oob_required ? (u8 *)chip->oob_poi : NULL;
|
||||
|
||||
return brcmnand_read(mtd, chip, host->last_addr,
|
||||
@ -1523,7 +1523,7 @@ static int brcmnand_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
static int brcmnand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
u8 *oob = oob_required ? (u8 *)chip->oob_poi : NULL;
|
||||
int ret;
|
||||
|
||||
@ -1545,7 +1545,7 @@ static int brcmnand_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
static int brcmnand_read_oob_raw(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
int page)
|
||||
{
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
|
||||
brcmnand_set_ecc_enabled(host, 0);
|
||||
brcmnand_read(mtd, chip, (u64)page << chip->page_shift,
|
||||
@ -1558,7 +1558,7 @@ static int brcmnand_read_oob_raw(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
u64 addr, const u32 *buf, u8 *oob)
|
||||
{
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
struct brcmnand_controller *ctrl = host->ctrl;
|
||||
unsigned int i, j, trans = mtd->writesize >> FC_SHIFT;
|
||||
int status, ret = 0;
|
||||
@ -1629,7 +1629,7 @@ out:
|
||||
static int brcmnand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
const uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
void *oob = oob_required ? chip->oob_poi : NULL;
|
||||
|
||||
brcmnand_write(mtd, chip, host->last_addr, (const u32 *)buf, oob);
|
||||
@ -1640,7 +1640,7 @@ static int brcmnand_write_page_raw(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, const uint8_t *buf,
|
||||
int oob_required, int page)
|
||||
{
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
void *oob = oob_required ? chip->oob_poi : NULL;
|
||||
|
||||
brcmnand_set_ecc_enabled(host, 0);
|
||||
@ -1659,7 +1659,7 @@ static int brcmnand_write_oob(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
static int brcmnand_write_oob_raw(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
int page)
|
||||
{
|
||||
struct brcmnand_host *host = chip->priv;
|
||||
struct brcmnand_host *host = nand_get_controller_data(chip);
|
||||
int ret;
|
||||
|
||||
brcmnand_set_ecc_enabled(host, 0);
|
||||
@ -1923,7 +1923,7 @@ static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn)
|
||||
chip = &host->chip;
|
||||
|
||||
nand_set_flash_node(chip, dn);
|
||||
chip->priv = host;
|
||||
nand_set_controller_data(chip, host);
|
||||
mtd->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "brcmnand.%d",
|
||||
host->cs);
|
||||
mtd->owner = THIS_MODULE;
|
||||
|
@ -102,7 +102,7 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
|
||||
static int cafe_device_ready(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct cafe_priv *cafe = chip->priv;
|
||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||
int result = !!(cafe_readl(cafe, NAND_STATUS) & 0x40000000);
|
||||
uint32_t irqs = cafe_readl(cafe, NAND_IRQ);
|
||||
|
||||
@ -119,7 +119,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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct cafe_priv *cafe = chip->priv;
|
||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||
|
||||
if (usedma)
|
||||
memcpy(cafe->dmabuf + cafe->datalen, buf, len);
|
||||
@ -135,7 +135,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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct cafe_priv *cafe = chip->priv;
|
||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||
|
||||
if (usedma)
|
||||
memcpy(buf, cafe->dmabuf + cafe->datalen, len);
|
||||
@ -150,7 +150,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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct cafe_priv *cafe = chip->priv;
|
||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||
uint8_t d;
|
||||
|
||||
cafe_read_buf(mtd, &d, 1);
|
||||
@ -163,7 +163,7 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
|
||||
int column, int page_addr)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct cafe_priv *cafe = chip->priv;
|
||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||
int adrbytes = 0;
|
||||
uint32_t ctl1;
|
||||
uint32_t doneint = 0x80000000;
|
||||
@ -319,7 +319,7 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
|
||||
static void cafe_select_chip(struct mtd_info *mtd, int chipnr)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct cafe_priv *cafe = chip->priv;
|
||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||
|
||||
cafe_dev_dbg(&cafe->pdev->dev, "select_chip %d\n", chipnr);
|
||||
|
||||
@ -335,7 +335,7 @@ static irqreturn_t cafe_nand_interrupt(int irq, void *id)
|
||||
{
|
||||
struct mtd_info *mtd = id;
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct cafe_priv *cafe = chip->priv;
|
||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||
uint32_t irqs = cafe_readl(cafe, NAND_IRQ);
|
||||
cafe_writel(cafe, irqs & ~0x90000000, NAND_IRQ);
|
||||
if (!irqs)
|
||||
@ -384,7 +384,7 @@ static int cafe_nand_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
static int cafe_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct cafe_priv *cafe = chip->priv;
|
||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||
unsigned int max_bitflips = 0;
|
||||
|
||||
cafe_dev_dbg(&cafe->pdev->dev, "ECC result %08x SYN1,2 %08x\n",
|
||||
@ -526,7 +526,7 @@ static int cafe_nand_write_page_lowlevel(struct mtd_info *mtd,
|
||||
const uint8_t *buf, int oob_required,
|
||||
int page)
|
||||
{
|
||||
struct cafe_priv *cafe = chip->priv;
|
||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||
|
||||
chip->write_buf(mtd, buf, mtd->writesize);
|
||||
chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
|
||||
@ -611,7 +611,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
|
||||
|
||||
mtd = nand_to_mtd(&cafe->nand);
|
||||
mtd->dev.parent = &pdev->dev;
|
||||
cafe->nand.priv = cafe;
|
||||
nand_set_controller_data(&cafe->nand, cafe);
|
||||
|
||||
cafe->pdev = pdev;
|
||||
cafe->mmio = pci_iomap(pdev, 0, 0);
|
||||
@ -800,7 +800,7 @@ static void cafe_nand_remove(struct pci_dev *pdev)
|
||||
{
|
||||
struct mtd_info *mtd = pci_get_drvdata(pdev);
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct cafe_priv *cafe = chip->priv;
|
||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||
|
||||
/* Disable NAND IRQ in global IRQ mask register */
|
||||
cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK);
|
||||
@ -828,7 +828,7 @@ static int cafe_nand_resume(struct pci_dev *pdev)
|
||||
uint32_t ctrl;
|
||||
struct mtd_info *mtd = pci_get_drvdata(pdev);
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct cafe_priv *cafe = chip->priv;
|
||||
struct cafe_priv *cafe = nand_get_controller_data(chip);
|
||||
|
||||
/* Start off by resetting the NAND controller completely */
|
||||
cafe_writel(cafe, 1, NAND_RESET);
|
||||
|
@ -296,7 +296,7 @@ static inline int DoC_WaitReady(struct doc_priv *doc)
|
||||
static void doc2000_write_byte(struct mtd_info *mtd, u_char datum)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
if (debug)
|
||||
@ -308,7 +308,7 @@ static void doc2000_write_byte(struct mtd_info *mtd, u_char datum)
|
||||
static u_char doc2000_read_byte(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
u_char ret;
|
||||
|
||||
@ -323,7 +323,7 @@ static u_char doc2000_read_byte(struct mtd_info *mtd)
|
||||
static void doc2000_writebuf(struct mtd_info *mtd, const u_char *buf, int len)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int i;
|
||||
if (debug)
|
||||
@ -340,7 +340,7 @@ static void doc2000_writebuf(struct mtd_info *mtd, const u_char *buf, int len)
|
||||
static void doc2000_readbuf(struct mtd_info *mtd, u_char *buf, int len)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int i;
|
||||
|
||||
@ -355,7 +355,7 @@ static void doc2000_readbuf(struct mtd_info *mtd, u_char *buf, int len)
|
||||
static void doc2000_readbuf_dword(struct mtd_info *mtd, u_char *buf, int len)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int i;
|
||||
|
||||
@ -376,7 +376,7 @@ static void doc2000_readbuf_dword(struct mtd_info *mtd, u_char *buf, int len)
|
||||
static uint16_t __init doc200x_ident_chip(struct mtd_info *mtd, int nr)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
uint16_t ret;
|
||||
|
||||
doc200x_select_chip(mtd, nr);
|
||||
@ -422,7 +422,7 @@ static uint16_t __init doc200x_ident_chip(struct mtd_info *mtd, int nr)
|
||||
static void __init doc2000_count_chips(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
uint16_t mfrid;
|
||||
int i;
|
||||
|
||||
@ -443,7 +443,7 @@ static void __init doc2000_count_chips(struct mtd_info *mtd)
|
||||
|
||||
static int doc200x_wait(struct mtd_info *mtd, struct nand_chip *this)
|
||||
{
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
|
||||
int status;
|
||||
|
||||
@ -458,7 +458,7 @@ static int doc200x_wait(struct mtd_info *mtd, struct nand_chip *this)
|
||||
static void doc2001_write_byte(struct mtd_info *mtd, u_char datum)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
WriteDOC(datum, docptr, CDSNSlowIO);
|
||||
@ -469,7 +469,7 @@ static void doc2001_write_byte(struct mtd_info *mtd, u_char datum)
|
||||
static u_char doc2001_read_byte(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
//ReadDOC(docptr, CDSNSlowIO);
|
||||
@ -483,7 +483,7 @@ static u_char doc2001_read_byte(struct mtd_info *mtd)
|
||||
static void doc2001_writebuf(struct mtd_info *mtd, const u_char *buf, int len)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int i;
|
||||
|
||||
@ -496,7 +496,7 @@ static void doc2001_writebuf(struct mtd_info *mtd, const u_char *buf, int len)
|
||||
static void doc2001_readbuf(struct mtd_info *mtd, u_char *buf, int len)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int i;
|
||||
|
||||
@ -513,7 +513,7 @@ static void doc2001_readbuf(struct mtd_info *mtd, u_char *buf, int len)
|
||||
static u_char doc2001plus_read_byte(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
u_char ret;
|
||||
|
||||
@ -528,7 +528,7 @@ static u_char doc2001plus_read_byte(struct mtd_info *mtd)
|
||||
static void doc2001plus_writebuf(struct mtd_info *mtd, const u_char *buf, int len)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int i;
|
||||
|
||||
@ -546,7 +546,7 @@ static void doc2001plus_writebuf(struct mtd_info *mtd, const u_char *buf, int le
|
||||
static void doc2001plus_readbuf(struct mtd_info *mtd, u_char *buf, int len)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int i;
|
||||
|
||||
@ -577,7 +577,7 @@ static void doc2001plus_readbuf(struct mtd_info *mtd, u_char *buf, int len)
|
||||
static void doc2001plus_select_chip(struct mtd_info *mtd, int chip)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int floor = 0;
|
||||
|
||||
@ -604,7 +604,7 @@ static void doc2001plus_select_chip(struct mtd_info *mtd, int chip)
|
||||
static void doc200x_select_chip(struct mtd_info *mtd, int chip)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int floor = 0;
|
||||
|
||||
@ -635,7 +635,7 @@ static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd,
|
||||
unsigned int ctrl)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
if (ctrl & NAND_CTRL_CHANGE) {
|
||||
@ -658,7 +658,7 @@ static void doc200x_hwcontrol(struct mtd_info *mtd, int cmd,
|
||||
static void doc2001plus_command(struct mtd_info *mtd, unsigned command, int column, int page_addr)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
/*
|
||||
@ -764,7 +764,7 @@ static void doc2001plus_command(struct mtd_info *mtd, unsigned command, int colu
|
||||
static int doc200x_dev_ready(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
if (DoC_is_MillenniumPlus(doc)) {
|
||||
@ -804,7 +804,7 @@ static int doc200x_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
|
||||
static void doc200x_enable_hwecc(struct mtd_info *mtd, int mode)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
/* Prime the ECC engine */
|
||||
@ -823,7 +823,7 @@ static void doc200x_enable_hwecc(struct mtd_info *mtd, int mode)
|
||||
static void doc2001plus_enable_hwecc(struct mtd_info *mtd, int mode)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
/* Prime the ECC engine */
|
||||
@ -843,7 +843,7 @@ static void doc2001plus_enable_hwecc(struct mtd_info *mtd, int mode)
|
||||
static int doc200x_calculate_ecc(struct mtd_info *mtd, const u_char *dat, unsigned char *ecc_code)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int i;
|
||||
int emptymatch = 1;
|
||||
@ -904,7 +904,7 @@ static int doc200x_correct_data(struct mtd_info *mtd, u_char *dat,
|
||||
{
|
||||
int i, ret = 0;
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
uint8_t calc_ecc[6];
|
||||
volatile u_char dummy;
|
||||
@ -975,7 +975,7 @@ static struct nand_ecclayout doc200x_oobinfo = {
|
||||
static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const char *id, int findmirror)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
unsigned offs;
|
||||
int ret;
|
||||
size_t retlen;
|
||||
@ -1018,7 +1018,7 @@ static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const ch
|
||||
static inline int __init nftl_partscan(struct mtd_info *mtd, struct mtd_partition *parts)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
int ret = 0;
|
||||
u_char *buf;
|
||||
struct NFTLMediaHeader *mh;
|
||||
@ -1120,7 +1120,7 @@ static inline int __init nftl_partscan(struct mtd_info *mtd, struct mtd_partitio
|
||||
static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partition *parts)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
int ret = 0;
|
||||
u_char *buf;
|
||||
struct INFTLMediaHeader *mh;
|
||||
@ -1240,7 +1240,7 @@ static int __init nftl_scan_bbt(struct mtd_info *mtd)
|
||||
{
|
||||
int ret, numparts;
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
struct mtd_partition parts[2];
|
||||
|
||||
memset((char *)parts, 0, sizeof(parts));
|
||||
@ -1275,7 +1275,7 @@ static int __init inftl_scan_bbt(struct mtd_info *mtd)
|
||||
{
|
||||
int ret, numparts;
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
struct mtd_partition parts[5];
|
||||
|
||||
if (this->numchips > doc->chips_per_floor) {
|
||||
@ -1328,7 +1328,7 @@ static int __init inftl_scan_bbt(struct mtd_info *mtd)
|
||||
static inline int __init doc2000_init(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
|
||||
this->read_byte = doc2000_read_byte;
|
||||
this->write_buf = doc2000_writebuf;
|
||||
@ -1344,7 +1344,7 @@ static inline int __init doc2000_init(struct mtd_info *mtd)
|
||||
static inline int __init doc2001_init(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
|
||||
this->read_byte = doc2001_read_byte;
|
||||
this->write_buf = doc2001_writebuf;
|
||||
@ -1374,7 +1374,7 @@ static inline int __init doc2001_init(struct mtd_info *mtd)
|
||||
static inline int __init doc2001plus_init(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct doc_priv *doc = this->priv;
|
||||
struct doc_priv *doc = nand_get_controller_data(this);
|
||||
|
||||
this->read_byte = doc2001plus_read_byte;
|
||||
this->write_buf = doc2001plus_writebuf;
|
||||
@ -1491,7 +1491,7 @@ static int __init doc_probe(unsigned long physadr)
|
||||
unsigned char oldval;
|
||||
unsigned char newval;
|
||||
nand = mtd_to_nand(mtd);
|
||||
doc = nand->priv;
|
||||
doc = nand_get_controller_data(nand);
|
||||
/* Use the alias resolution register to determine if this is
|
||||
in fact the same DOC aliased to a new address. If writes
|
||||
to one chip's alias resolution register change the value on
|
||||
@ -1538,7 +1538,7 @@ static int __init doc_probe(unsigned long physadr)
|
||||
|
||||
mtd->owner = THIS_MODULE;
|
||||
|
||||
nand->priv = doc;
|
||||
nand_set_controller_data(nand, doc);
|
||||
nand->select_chip = doc200x_select_chip;
|
||||
nand->cmd_ctrl = doc200x_hwcontrol;
|
||||
nand->dev_ready = doc200x_dev_ready;
|
||||
@ -1611,7 +1611,7 @@ static void release_nanddoc(void)
|
||||
|
||||
for (mtd = doclist; mtd; mtd = nextmtd) {
|
||||
nand = mtd_to_nand(mtd);
|
||||
doc = nand->priv;
|
||||
doc = nand_get_controller_data(nand);
|
||||
|
||||
nextmtd = doc->nextdoc;
|
||||
nand_release(mtd);
|
||||
|
@ -297,7 +297,7 @@ static int poll_status(struct docg4_priv *doc)
|
||||
static int docg4_wait(struct mtd_info *mtd, struct nand_chip *nand)
|
||||
{
|
||||
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
int status = NAND_STATUS_WP; /* inverse logic?? */
|
||||
dev_dbg(doc->dev, "%s...\n", __func__);
|
||||
|
||||
@ -319,7 +319,7 @@ static void docg4_select_chip(struct mtd_info *mtd, int chip)
|
||||
* not yet supported, so the only valid non-negative value is 0.
|
||||
*/
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
dev_dbg(doc->dev, "%s: chip %d\n", __func__, chip);
|
||||
@ -338,7 +338,7 @@ static void reset(struct mtd_info *mtd)
|
||||
/* full device reset */
|
||||
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
writew(DOC_ASICMODE_RESET | DOC_ASICMODE_MDWREN,
|
||||
@ -376,7 +376,7 @@ static int correct_data(struct mtd_info *mtd, uint8_t *buf, int page)
|
||||
*/
|
||||
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int i, numerrs, errpos[4];
|
||||
const uint8_t blank_read_hwecc[8] = {
|
||||
@ -465,7 +465,7 @@ static int correct_data(struct mtd_info *mtd, uint8_t *buf, int page)
|
||||
static uint8_t docg4_read_byte(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
|
||||
dev_dbg(doc->dev, "%s\n", __func__);
|
||||
|
||||
@ -546,7 +546,7 @@ static int pageprog(struct mtd_info *mtd)
|
||||
*/
|
||||
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
int retval = 0;
|
||||
|
||||
@ -583,7 +583,7 @@ static void sequence_reset(struct mtd_info *mtd)
|
||||
/* common starting sequence for all operations */
|
||||
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
writew(DOC_CTRL_UNKNOWN | DOC_CTRL_CE, docptr + DOC_FLASHCONTROL);
|
||||
@ -600,7 +600,7 @@ static void read_page_prologue(struct mtd_info *mtd, uint32_t docg4_addr)
|
||||
/* first step in reading a page */
|
||||
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
dev_dbg(doc->dev,
|
||||
@ -627,7 +627,7 @@ static void write_page_prologue(struct mtd_info *mtd, uint32_t docg4_addr)
|
||||
/* first step in writing a page */
|
||||
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
|
||||
dev_dbg(doc->dev,
|
||||
@ -692,7 +692,7 @@ static void docg4_command(struct mtd_info *mtd, unsigned command, int column,
|
||||
/* handle standard nand commands */
|
||||
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
uint32_t g4_addr = mtd_to_docg4_address(page_addr, column);
|
||||
|
||||
dev_dbg(doc->dev, "%s %x, page_addr=%x, column=%x\n",
|
||||
@ -756,7 +756,7 @@ static void docg4_command(struct mtd_info *mtd, unsigned command, int column,
|
||||
static int read_page(struct mtd_info *mtd, struct nand_chip *nand,
|
||||
uint8_t *buf, int page, bool use_ecc)
|
||||
{
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
uint16_t status, edc_err, *buf16;
|
||||
int bits_corrected = 0;
|
||||
@ -836,7 +836,7 @@ static int docg4_read_page(struct mtd_info *mtd, struct nand_chip *nand,
|
||||
static int docg4_read_oob(struct mtd_info *mtd, struct nand_chip *nand,
|
||||
int page)
|
||||
{
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
uint16_t status;
|
||||
|
||||
@ -875,7 +875,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)
|
||||
{
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
uint16_t g4_page;
|
||||
|
||||
@ -923,7 +923,7 @@ static int docg4_erase_block(struct mtd_info *mtd, int page)
|
||||
static int write_page(struct mtd_info *mtd, struct nand_chip *nand,
|
||||
const uint8_t *buf, bool use_ecc)
|
||||
{
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
uint8_t ecc_buf[8];
|
||||
|
||||
@ -1003,7 +1003,7 @@ static int docg4_write_oob(struct mtd_info *mtd, struct nand_chip *nand,
|
||||
*/
|
||||
|
||||
/* note that bytes 7..14 are hw generated hamming/ecc and overwritten */
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
doc->oob_page = page;
|
||||
memcpy(doc->oob_buf, nand->oob_poi, 16);
|
||||
return 0;
|
||||
@ -1017,7 +1017,7 @@ static int __init read_factory_bbt(struct mtd_info *mtd)
|
||||
*/
|
||||
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
uint32_t g4_addr = mtd_to_docg4_address(DOCG4_FACTORY_BBT_PAGE, 0);
|
||||
uint8_t *buf;
|
||||
int i, block;
|
||||
@ -1090,7 +1090,7 @@ static int docg4_block_markbad(struct mtd_info *mtd, loff_t ofs)
|
||||
int ret, i;
|
||||
uint8_t *buf;
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
struct nand_bbt_descr *bbtd = nand->badblock_pattern;
|
||||
int page = (int)(ofs >> nand->page_shift);
|
||||
uint32_t g4_addr = mtd_to_docg4_address(page, 0);
|
||||
@ -1203,7 +1203,7 @@ static void __init init_mtd_structs(struct mtd_info *mtd)
|
||||
*/
|
||||
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
|
||||
mtd->size = DOCG4_CHIP_SIZE;
|
||||
mtd->name = "Msys_Diskonchip_G4";
|
||||
@ -1262,7 +1262,7 @@ static void __init init_mtd_structs(struct mtd_info *mtd)
|
||||
static int __init read_id_reg(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct docg4_priv *doc = nand->priv;
|
||||
struct docg4_priv *doc = nand_get_controller_data(nand);
|
||||
void __iomem *docptr = doc->virtadr;
|
||||
uint16_t id1, id2;
|
||||
|
||||
@ -1314,7 +1314,7 @@ static int __init probe_docg4(struct platform_device *pdev)
|
||||
|
||||
mtd = nand_to_mtd(nand);
|
||||
doc = (struct docg4_priv *) (nand + 1);
|
||||
nand->priv = doc;
|
||||
nand_set_controller_data(nand, doc);
|
||||
mtd->dev.parent = &pdev->dev;
|
||||
doc->virtadr = virtadr;
|
||||
doc->dev = dev;
|
||||
|
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_elbc_mtd *priv = chip->priv;
|
||||
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_lbc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
|
||||
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = ctrl->nand;
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_elbc_mtd *priv = chip->priv;
|
||||
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_lbc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = ctrl->nand;
|
||||
struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
|
||||
@ -267,7 +267,7 @@ static int fsl_elbc_run_command(struct mtd_info *mtd)
|
||||
|
||||
static void fsl_elbc_do_read(struct nand_chip *chip, int oob)
|
||||
{
|
||||
struct fsl_elbc_mtd *priv = chip->priv;
|
||||
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_lbc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
|
||||
|
||||
@ -300,7 +300,7 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
|
||||
int column, int page_addr)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_elbc_mtd *priv = chip->priv;
|
||||
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_lbc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = ctrl->nand;
|
||||
struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_elbc_mtd *priv = chip->priv;
|
||||
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
|
||||
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)
|
||||
static u8 fsl_elbc_read_byte(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_elbc_mtd *priv = chip->priv;
|
||||
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
|
||||
|
||||
/* If there are still bytes in the FCM, then use the next byte. */
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_elbc_mtd *priv = chip->priv;
|
||||
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
|
||||
int avail;
|
||||
|
||||
@ -604,7 +604,7 @@ static void fsl_elbc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
|
||||
*/
|
||||
static int fsl_elbc_wait(struct mtd_info *mtd, struct nand_chip *chip)
|
||||
{
|
||||
struct fsl_elbc_mtd *priv = chip->priv;
|
||||
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
|
||||
|
||||
if (elbc_fcm_ctrl->status != LTESR_CC)
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_elbc_mtd *priv = chip->priv;
|
||||
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_lbc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
|
||||
unsigned int al;
|
||||
@ -696,7 +696,7 @@ static int fsl_elbc_chip_init_tail(struct mtd_info *mtd)
|
||||
static int fsl_elbc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct fsl_elbc_mtd *priv = chip->priv;
|
||||
struct fsl_elbc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_lbc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = ctrl->nand;
|
||||
|
||||
@ -770,7 +770,7 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
|
||||
chip->bbt_options = NAND_BBT_USE_FLASH;
|
||||
|
||||
chip->controller = &elbc_fcm_ctrl->controller;
|
||||
chip->priv = priv;
|
||||
nand_set_controller_data(chip, priv);
|
||||
|
||||
chip->ecc.read_page = fsl_elbc_read_page;
|
||||
chip->ecc.write_page = fsl_elbc_write_page;
|
||||
|
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_ifc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_ifc_regs __iomem *ifc = ctrl->regs;
|
||||
int buf_num;
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
u8 __iomem *addr = priv->vbase + bufnum * (mtd->writesize * 2);
|
||||
u32 __iomem *mainarea = (u32 __iomem *)addr;
|
||||
u8 __iomem *oob = addr + mtd->writesize;
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_ifc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl;
|
||||
struct fsl_ifc_regs __iomem *ifc = ctrl->regs;
|
||||
@ -369,7 +369,7 @@ static void fsl_ifc_do_read(struct nand_chip *chip,
|
||||
int oob,
|
||||
struct mtd_info *mtd)
|
||||
{
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_ifc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_ifc_regs __iomem *ifc = ctrl->regs;
|
||||
|
||||
@ -409,7 +409,7 @@ static void fsl_ifc_do_read(struct nand_chip *chip,
|
||||
static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
|
||||
int column, int page_addr) {
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_ifc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_ifc_regs __iomem *ifc = ctrl->regs;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
unsigned int bufsize = mtd->writesize + mtd->oobsize;
|
||||
|
||||
if (len <= 0) {
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
unsigned int offset;
|
||||
|
||||
/*
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
uint16_t data;
|
||||
|
||||
/*
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
int avail;
|
||||
|
||||
if (len < 0) {
|
||||
@ -721,7 +721,7 @@ static void fsl_ifc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
|
||||
*/
|
||||
static int fsl_ifc_wait(struct mtd_info *mtd, struct nand_chip *chip)
|
||||
{
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_ifc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_ifc_regs __iomem *ifc = ctrl->regs;
|
||||
u32 nand_fsr;
|
||||
@ -750,7 +750,7 @@ static int fsl_ifc_wait(struct mtd_info *mtd, struct nand_chip *chip)
|
||||
static int fsl_ifc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
struct fsl_ifc_ctrl *ctrl = priv->ctrl;
|
||||
struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct fsl_ifc_mtd *priv = chip->priv;
|
||||
struct fsl_ifc_mtd *priv = nand_get_controller_data(chip);
|
||||
|
||||
dev_dbg(priv->dev, "%s: nand->numchips = %d\n", __func__,
|
||||
chip->numchips);
|
||||
@ -914,7 +914,7 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
|
||||
}
|
||||
|
||||
chip->controller = &ifc_nand_ctrl->controller;
|
||||
chip->priv = priv;
|
||||
nand_set_controller_data(chip, priv);
|
||||
|
||||
chip->ecc.read_page = fsl_ifc_read_page;
|
||||
chip->ecc.write_page = fsl_ifc_write_page;
|
||||
|
@ -1009,7 +1009,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
|
||||
/* Link all private pointers */
|
||||
mtd = nand_to_mtd(&host->nand);
|
||||
nand = &host->nand;
|
||||
nand->priv = host;
|
||||
nand_set_controller_data(nand, host);
|
||||
nand_set_flash_node(nand, np);
|
||||
|
||||
mtd->dev.parent = &pdev->dev;
|
||||
|
@ -857,7 +857,7 @@ error_alloc:
|
||||
static void gpmi_cmd_ctrl(struct mtd_info *mtd, int data, unsigned int ctrl)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
int ret;
|
||||
|
||||
/*
|
||||
@ -891,7 +891,7 @@ static void gpmi_cmd_ctrl(struct mtd_info *mtd, int data, unsigned int ctrl)
|
||||
static int gpmi_dev_ready(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
|
||||
return gpmi_is_ready(this, this->current_chip);
|
||||
}
|
||||
@ -899,7 +899,7 @@ static int gpmi_dev_ready(struct mtd_info *mtd)
|
||||
static void gpmi_select_chip(struct mtd_info *mtd, int chipnr)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
|
||||
if ((this->current_chip < 0) && (chipnr >= 0))
|
||||
gpmi_begin(this);
|
||||
@ -912,7 +912,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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
|
||||
dev_dbg(this->dev, "len is %d\n", len);
|
||||
this->upper_buf = buf;
|
||||
@ -924,7 +924,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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
|
||||
dev_dbg(this->dev, "len is %d\n", len);
|
||||
this->upper_buf = (uint8_t *)buf;
|
||||
@ -936,7 +936,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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
uint8_t *buf = this->data_buffer_dma;
|
||||
|
||||
gpmi_read_buf(mtd, buf, 1);
|
||||
@ -994,7 +994,7 @@ static void block_mark_swapping(struct gpmi_nand_data *this,
|
||||
static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
struct bch_geometry *nfc_geo = &this->bch_geometry;
|
||||
void *payload_virt;
|
||||
dma_addr_t payload_phys;
|
||||
@ -1074,7 +1074,7 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
static int gpmi_ecc_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint32_t offs, uint32_t len, uint8_t *buf, int page)
|
||||
{
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
void __iomem *bch_regs = this->resources.bch_regs;
|
||||
struct bch_geometry old_geo = this->bch_geometry;
|
||||
struct bch_geometry *geo = &this->bch_geometry;
|
||||
@ -1162,7 +1162,7 @@ static int gpmi_ecc_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
const uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
struct bch_geometry *nfc_geo = &this->bch_geometry;
|
||||
const void *payload_virt;
|
||||
dma_addr_t payload_phys;
|
||||
@ -1298,7 +1298,7 @@ exit_auxiliary:
|
||||
static int gpmi_ecc_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
int page)
|
||||
{
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
|
||||
dev_dbg(this->dev, "page number is %d\n", page);
|
||||
/* clear the OOB buffer */
|
||||
@ -1359,7 +1359,7 @@ static int gpmi_ecc_read_page_raw(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, uint8_t *buf,
|
||||
int oob_required, int page)
|
||||
{
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
struct bch_geometry *nfc_geo = &this->bch_geometry;
|
||||
int eccsize = nfc_geo->ecc_chunk_size;
|
||||
int eccbits = nfc_geo->ecc_strength * nfc_geo->gf_len;
|
||||
@ -1448,7 +1448,7 @@ static int gpmi_ecc_write_page_raw(struct mtd_info *mtd,
|
||||
const uint8_t *buf,
|
||||
int oob_required, int page)
|
||||
{
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
struct bch_geometry *nfc_geo = &this->bch_geometry;
|
||||
int eccsize = nfc_geo->ecc_chunk_size;
|
||||
int eccbits = nfc_geo->ecc_strength * nfc_geo->gf_len;
|
||||
@ -1539,7 +1539,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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct gpmi_nand_data *this = chip->priv;
|
||||
struct gpmi_nand_data *this = nand_get_controller_data(chip);
|
||||
int ret = 0;
|
||||
uint8_t *block_mark;
|
||||
int column, page, status, chipnr;
|
||||
@ -1897,7 +1897,7 @@ static int gpmi_nand_init(struct gpmi_nand_data *this)
|
||||
mtd->dev.parent = this->dev;
|
||||
|
||||
/* init the nand_chip{}, we don't support a 16-bit NAND Flash bus. */
|
||||
chip->priv = this;
|
||||
nand_set_controller_data(chip, this);
|
||||
nand_set_flash_node(chip, this->pdev->dev.of_node);
|
||||
chip->select_chip = gpmi_select_chip;
|
||||
chip->cmd_ctrl = gpmi_cmd_ctrl;
|
||||
|
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct hinfc_host *host = chip->priv;
|
||||
struct hinfc_host *host = nand_get_controller_data(chip);
|
||||
|
||||
if (chipselect < 0)
|
||||
return;
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct hinfc_host *host = chip->priv;
|
||||
struct hinfc_host *host = nand_get_controller_data(chip);
|
||||
|
||||
if (host->command == NAND_CMD_STATUS)
|
||||
return *(uint8_t *)(host->mmio);
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct hinfc_host *host = chip->priv;
|
||||
struct hinfc_host *host = nand_get_controller_data(chip);
|
||||
|
||||
host->offset += 2;
|
||||
return *(u16 *)(host->buffer + host->offset - 2);
|
||||
@ -394,7 +394,7 @@ static void
|
||||
hisi_nfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct hinfc_host *host = chip->priv;
|
||||
struct hinfc_host *host = nand_get_controller_data(chip);
|
||||
|
||||
memcpy(host->buffer + host->offset, buf, len);
|
||||
host->offset += 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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct hinfc_host *host = chip->priv;
|
||||
struct hinfc_host *host = nand_get_controller_data(chip);
|
||||
|
||||
memcpy(buf, host->buffer + host->offset, len);
|
||||
host->offset += 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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct hinfc_host *host = chip->priv;
|
||||
struct hinfc_host *host = nand_get_controller_data(chip);
|
||||
unsigned int command = host->command;
|
||||
|
||||
host->addr_cycle = 0;
|
||||
@ -448,7 +448,7 @@ static void hisi_nfc_cmdfunc(struct mtd_info *mtd, unsigned command, int column,
|
||||
int page_addr)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct hinfc_host *host = chip->priv;
|
||||
struct hinfc_host *host = nand_get_controller_data(chip);
|
||||
int is_cache_invalid = 1;
|
||||
unsigned int flag = 0;
|
||||
|
||||
@ -542,7 +542,7 @@ static irqreturn_t hinfc_irq_handle(int irq, void *devid)
|
||||
static int hisi_nand_read_page_hwecc(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct hinfc_host *host = chip->priv;
|
||||
struct hinfc_host *host = nand_get_controller_data(chip);
|
||||
int max_bitflips = 0, stat = 0, stat_max = 0, status_ecc;
|
||||
int stat_1, stat_2;
|
||||
|
||||
@ -574,7 +574,7 @@ static int hisi_nand_read_page_hwecc(struct mtd_info *mtd,
|
||||
static int hisi_nand_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
int page)
|
||||
{
|
||||
struct hinfc_host *host = chip->priv;
|
||||
struct hinfc_host *host = nand_get_controller_data(chip);
|
||||
|
||||
chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
|
||||
chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
|
||||
@ -738,7 +738,7 @@ static int hisi_nfc_probe(struct platform_device *pdev)
|
||||
mtd->name = "hisi_nand";
|
||||
mtd->dev.parent = &pdev->dev;
|
||||
|
||||
chip->priv = host;
|
||||
nand_set_controller_data(chip, host);
|
||||
nand_set_flash_node(chip, np);
|
||||
chip->cmdfunc = hisi_nfc_cmdfunc;
|
||||
chip->select_chip = hisi_nfc_select_chip;
|
||||
|
@ -275,7 +275,7 @@ static void lpc32xx_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
|
||||
unsigned int ctrl)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct lpc32xx_nand_host *host = nand_chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
if (cmd != NAND_CMD_NONE) {
|
||||
if (ctrl & NAND_CLE)
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct lpc32xx_nand_host *host = nand_chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
if ((readb(MLC_ISR(host->io_base)) &
|
||||
(MLCISR_CONTROLLER_READY | MLCISR_NAND_READY)) ==
|
||||
@ -317,7 +317,7 @@ static irqreturn_t lpc3xxx_nand_irq(int irq, struct lpc32xx_nand_host *host)
|
||||
|
||||
static int lpc32xx_waitfunc_nand(struct mtd_info *mtd, struct nand_chip *chip)
|
||||
{
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
|
||||
if (readb(MLC_ISR(host->io_base)) & MLCISR_NAND_READY)
|
||||
goto exit;
|
||||
@ -337,7 +337,7 @@ exit:
|
||||
static int lpc32xx_waitfunc_controller(struct mtd_info *mtd,
|
||||
struct nand_chip *chip)
|
||||
{
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
|
||||
if (readb(MLC_ISR(host->io_base)) & MLCISR_CONTROLLER_READY)
|
||||
goto exit;
|
||||
@ -389,7 +389,7 @@ static int lpc32xx_xmit_dma(struct mtd_info *mtd, void *mem, int len,
|
||||
enum dma_transfer_direction dir)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
struct dma_async_tx_descriptor *desc;
|
||||
int flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
|
||||
int res;
|
||||
@ -430,7 +430,7 @@ out1:
|
||||
static int lpc32xx_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
int i, j;
|
||||
uint8_t *oobbuf = chip->oob_poi;
|
||||
uint32_t mlc_isr;
|
||||
@ -497,7 +497,7 @@ static int lpc32xx_write_page_lowlevel(struct mtd_info *mtd,
|
||||
const uint8_t *buf, int oob_required,
|
||||
int page)
|
||||
{
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
const uint8_t *oobbuf = chip->oob_poi;
|
||||
uint8_t *dma_buf = (uint8_t *)buf;
|
||||
int res;
|
||||
@ -542,7 +542,7 @@ static int lpc32xx_write_page_lowlevel(struct mtd_info *mtd,
|
||||
static int lpc32xx_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
int page)
|
||||
{
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
|
||||
/* Read whole page - necessary with MLC controller! */
|
||||
lpc32xx_read_page(mtd, chip, host->dummy_buf, 1, page);
|
||||
@ -679,7 +679,8 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
|
||||
|
||||
host->pdata = dev_get_platdata(&pdev->dev);
|
||||
|
||||
nand_chip->priv = host; /* link the private data structures */
|
||||
/* link the private data structures */
|
||||
nand_set_controller_data(nand_chip, host);
|
||||
nand_set_flash_node(nand_chip, pdev->dev.of_node);
|
||||
mtd->dev.parent = &pdev->dev;
|
||||
|
||||
|
@ -260,7 +260,7 @@ static void lpc32xx_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
|
||||
{
|
||||
uint32_t tmp;
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
|
||||
/* Does CE state need to be changed? */
|
||||
tmp = readl(SLC_CFG(host->io_base));
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
int rdy = 0;
|
||||
|
||||
if ((readl(SLC_STAT(host->io_base)) & SLCSTAT_NAND_READY) != 0)
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
|
||||
return (uint8_t)readl(SLC_DATA(host->io_base));
|
||||
}
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
|
||||
/* Direct device read with no ECC */
|
||||
while (len-- > 0)
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
|
||||
/* Direct device write with no ECC */
|
||||
while (len-- > 0)
|
||||
@ -428,7 +428,7 @@ static int lpc32xx_xmit_dma(struct mtd_info *mtd, dma_addr_t dma,
|
||||
void *mem, int len, enum dma_transfer_direction dir)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
struct dma_async_tx_descriptor *desc;
|
||||
int flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
|
||||
int res;
|
||||
@ -488,7 +488,7 @@ static int lpc32xx_xfer(struct mtd_info *mtd, uint8_t *buf, int eccsubpages,
|
||||
int read)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
int i, status = 0;
|
||||
unsigned long timeout;
|
||||
int res;
|
||||
@ -603,7 +603,7 @@ static int lpc32xx_nand_read_page_syndrome(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, uint8_t *buf,
|
||||
int oob_required, int page)
|
||||
{
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
int stat, i, status;
|
||||
uint8_t *oobecc, tmpecc[LPC32XX_ECC_SAVE_SIZE];
|
||||
|
||||
@ -665,7 +665,7 @@ static int lpc32xx_nand_write_page_syndrome(struct mtd_info *mtd,
|
||||
const uint8_t *buf,
|
||||
int oob_required, int page)
|
||||
{
|
||||
struct lpc32xx_nand_host *host = chip->priv;
|
||||
struct lpc32xx_nand_host *host = nand_get_controller_data(chip);
|
||||
uint8_t *pb = chip->oob_poi + chip->ecc.layout->eccpos[0];
|
||||
int error;
|
||||
|
||||
@ -800,7 +800,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
|
||||
|
||||
chip = &host->nand_chip;
|
||||
mtd = nand_to_mtd(chip);
|
||||
chip->priv = host;
|
||||
nand_set_controller_data(chip, host);
|
||||
nand_set_flash_node(chip, pdev->dev.of_node);
|
||||
mtd->owner = THIS_MODULE;
|
||||
mtd->dev.parent = &pdev->dev;
|
||||
|
@ -135,7 +135,7 @@ static void mpc5121_nfc_done(struct mtd_info *mtd);
|
||||
static inline u16 nfc_read(struct mtd_info *mtd, uint reg)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct mpc5121_nfc_prv *prv = chip->priv;
|
||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
|
||||
|
||||
return in_be16(prv->regs + reg);
|
||||
}
|
||||
@ -144,7 +144,7 @@ static inline u16 nfc_read(struct mtd_info *mtd, uint reg)
|
||||
static inline void nfc_write(struct mtd_info *mtd, uint reg, u16 val)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct mpc5121_nfc_prv *prv = chip->priv;
|
||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
|
||||
|
||||
out_be16(prv->regs + reg, val);
|
||||
}
|
||||
@ -214,7 +214,7 @@ static irqreturn_t mpc5121_nfc_irq(int irq, void *data)
|
||||
{
|
||||
struct mtd_info *mtd = data;
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct mpc5121_nfc_prv *prv = chip->priv;
|
||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
|
||||
|
||||
nfc_set(mtd, NFC_CONFIG1, NFC_INT_MASK);
|
||||
wake_up(&prv->irq_waitq);
|
||||
@ -226,7 +226,7 @@ static irqreturn_t mpc5121_nfc_irq(int irq, void *data)
|
||||
static void mpc5121_nfc_done(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct mpc5121_nfc_prv *prv = chip->priv;
|
||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
|
||||
int rv;
|
||||
|
||||
if ((nfc_read(mtd, NFC_CONFIG2) & NFC_INT) == 0) {
|
||||
@ -281,7 +281,7 @@ static void mpc5121_nfc_select_chip(struct mtd_info *mtd, int chip)
|
||||
static int ads5121_chipselect_init(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct mpc5121_nfc_prv *prv = chip->priv;
|
||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
|
||||
struct device_node *dn;
|
||||
|
||||
dn = of_find_compatible_node(NULL, NULL, "fsl,mpc5121ads-cpld");
|
||||
@ -303,7 +303,7 @@ static int ads5121_chipselect_init(struct mtd_info *mtd)
|
||||
static void ads5121_select_chip(struct mtd_info *mtd, int chip)
|
||||
{
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct mpc5121_nfc_prv *prv = nand->priv;
|
||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(nand);
|
||||
u8 v;
|
||||
|
||||
v = in_8(prv->csreg);
|
||||
@ -333,7 +333,7 @@ static void mpc5121_nfc_command(struct mtd_info *mtd, unsigned command,
|
||||
int column, int page)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct mpc5121_nfc_prv *prv = chip->priv;
|
||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
|
||||
|
||||
prv->column = (column >= 0) ? column : 0;
|
||||
prv->spareonly = 0;
|
||||
@ -406,7 +406,7 @@ static void mpc5121_nfc_copy_spare(struct mtd_info *mtd, uint offset,
|
||||
u8 *buffer, uint size, int wr)
|
||||
{
|
||||
struct nand_chip *nand = mtd_to_nand(mtd);
|
||||
struct mpc5121_nfc_prv *prv = nand->priv;
|
||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(nand);
|
||||
uint o, s, sbsize, blksize;
|
||||
|
||||
/*
|
||||
@ -458,7 +458,7 @@ static void mpc5121_nfc_buf_copy(struct mtd_info *mtd, u_char *buf, int len,
|
||||
int wr)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct mpc5121_nfc_prv *prv = chip->priv;
|
||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
|
||||
uint c = prv->column;
|
||||
uint l;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct mpc5121_nfc_prv *prv = chip->priv;
|
||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
|
||||
struct mpc512x_reset_module *rm;
|
||||
struct device_node *rmnode;
|
||||
uint rcw_pagesize = 0;
|
||||
@ -615,7 +615,7 @@ out:
|
||||
static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct mpc5121_nfc_prv *prv = chip->priv;
|
||||
struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
|
||||
|
||||
if (prv->clk)
|
||||
clk_disable_unprepare(prv->clk);
|
||||
@ -657,7 +657,7 @@ static int mpc5121_nfc_probe(struct platform_device *op)
|
||||
mtd = nand_to_mtd(chip);
|
||||
|
||||
mtd->dev.parent = dev;
|
||||
chip->priv = prv;
|
||||
nand_set_controller_data(chip, prv);
|
||||
nand_set_flash_node(chip, dn);
|
||||
prv->dev = dev;
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
uint32_t tmp;
|
||||
|
||||
tmp = readl(NFC_V3_CONFIG1);
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
/* NANDFC buffer 0 is used for page read/write */
|
||||
writew(host->active_cs << 4, NFC_V1_V2_BUF_ADDR);
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
int bufs, i;
|
||||
|
||||
if (mtd->writesize > 512)
|
||||
@ -663,7 +663,7 @@ static int mxc_nand_correct_data_v1(struct mtd_info *mtd, u_char *dat,
|
||||
u_char *read_ecc, u_char *calc_ecc)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
/*
|
||||
* 1-Bit errors are automatically corrected in HW. No need for
|
||||
@ -684,7 +684,7 @@ static int mxc_nand_correct_data_v2_v3(struct mtd_info *mtd, u_char *dat,
|
||||
u_char *read_ecc, u_char *calc_ecc)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
u32 ecc_stat, err;
|
||||
int no_subpages = 1;
|
||||
int ret = 0;
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
uint8_t ret;
|
||||
|
||||
/* Check for status request */
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
uint16_t ret;
|
||||
|
||||
ret = *(uint16_t *)(host->data_buf + host->buf_start);
|
||||
@ -762,7 +762,7 @@ static void mxc_nand_write_buf(struct mtd_info *mtd,
|
||||
const u_char *buf, int len)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
u16 col = host->buf_start;
|
||||
int n = mtd->oobsize + mtd->writesize - col;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
u16 col = host->buf_start;
|
||||
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)
|
||||
static void mxc_nand_select_chip_v1_v3(struct mtd_info *mtd, int chip)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
if (chip == -1) {
|
||||
/* Disable the NFC clock */
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
if (chip == -1) {
|
||||
/* Disable the NFC clock */
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = this->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(this);
|
||||
u16 i, oob_chunk_size;
|
||||
u16 num_chunks = mtd->writesize / 512;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
/* Write out column address, if necessary */
|
||||
if (column != -1) {
|
||||
@ -979,7 +979,7 @@ static void ecc_8bit_layout_4k(struct nand_ecclayout *layout)
|
||||
static void preset_v1(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
uint16_t config1 = 0;
|
||||
|
||||
if (nand_chip->ecc.mode == NAND_ECC_HW && mtd->writesize)
|
||||
@ -1007,7 +1007,7 @@ static void preset_v1(struct mtd_info *mtd)
|
||||
static void preset_v2(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
uint16_t config1 = 0;
|
||||
|
||||
config1 |= NFC_V2_CONFIG1_FP_INT;
|
||||
@ -1053,7 +1053,7 @@ static void preset_v2(struct mtd_info *mtd)
|
||||
static void preset_v3(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(chip);
|
||||
uint32_t config2, config3;
|
||||
int i, addr_phases;
|
||||
|
||||
@ -1124,7 +1124,7 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
|
||||
int column, int page_addr)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct mxc_nand_host *host = nand_chip->priv;
|
||||
struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
pr_debug("mxc_nand_command (cmd = 0x%x, col = 0x%x, page = 0x%x)\n",
|
||||
command, column, page_addr);
|
||||
@ -1520,7 +1520,7 @@ static int mxcnd_probe(struct platform_device *pdev)
|
||||
/* 50 us command delay time */
|
||||
this->chip_delay = 5;
|
||||
|
||||
this->priv = host;
|
||||
nand_set_controller_data(this, host);
|
||||
nand_set_flash_node(this, pdev->dev.of_node),
|
||||
this->dev_ready = mxc_nand_dev_ready;
|
||||
this->cmdfunc = mxc_nand_command;
|
||||
|
@ -667,7 +667,7 @@ static char *get_partition_name(int i)
|
||||
static int init_nandsim(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct nandsim *ns = chip->priv;
|
||||
struct nandsim *ns = nand_get_controller_data(chip);
|
||||
int i, ret = 0;
|
||||
uint64_t remains;
|
||||
uint64_t next_offset;
|
||||
@ -2244,7 +2244,7 @@ static int __init ns_init_module(void)
|
||||
}
|
||||
nsmtd = nand_to_mtd(chip);
|
||||
nand = (struct nandsim *)(chip + 1);
|
||||
chip->priv = (void *)nand;
|
||||
nand_set_controller_data(chip, (void *)nand);
|
||||
|
||||
/*
|
||||
* Register simulator's callbacks.
|
||||
|
@ -48,7 +48,7 @@ static void ndfc_select_chip(struct mtd_info *mtd, int chip)
|
||||
{
|
||||
uint32_t ccr;
|
||||
struct nand_chip *nchip = mtd_to_nand(mtd);
|
||||
struct ndfc_controller *ndfc = nchip->priv;
|
||||
struct ndfc_controller *ndfc = nand_get_controller_data(nchip);
|
||||
|
||||
ccr = in_be32(ndfc->ndfcbase + NDFC_CCR);
|
||||
if (chip >= 0) {
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct ndfc_controller *ndfc = chip->priv;
|
||||
struct ndfc_controller *ndfc = nand_get_controller_data(chip);
|
||||
|
||||
if (cmd == NAND_CMD_NONE)
|
||||
return;
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct ndfc_controller *ndfc = chip->priv;
|
||||
struct ndfc_controller *ndfc = nand_get_controller_data(chip);
|
||||
|
||||
return in_be32(ndfc->ndfcbase + NDFC_STAT) & NDFC_STAT_IS_READY;
|
||||
}
|
||||
@ -85,7 +85,7 @@ static void ndfc_enable_hwecc(struct mtd_info *mtd, int mode)
|
||||
{
|
||||
uint32_t ccr;
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct ndfc_controller *ndfc = chip->priv;
|
||||
struct ndfc_controller *ndfc = nand_get_controller_data(chip);
|
||||
|
||||
ccr = in_be32(ndfc->ndfcbase + NDFC_CCR);
|
||||
ccr |= NDFC_CCR_RESET_ECC;
|
||||
@ -97,7 +97,7 @@ static int ndfc_calculate_ecc(struct mtd_info *mtd,
|
||||
const u_char *dat, u_char *ecc_code)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct ndfc_controller *ndfc = chip->priv;
|
||||
struct ndfc_controller *ndfc = nand_get_controller_data(chip);
|
||||
uint32_t ecc;
|
||||
uint8_t *p = (uint8_t *)&ecc;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct ndfc_controller *ndfc = chip->priv;
|
||||
struct ndfc_controller *ndfc = nand_get_controller_data(chip);
|
||||
uint32_t *p = (uint32_t *) buf;
|
||||
|
||||
for(;len > 0; len -= 4)
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct ndfc_controller *ndfc = chip->priv;
|
||||
struct ndfc_controller *ndfc = nand_get_controller_data(chip);
|
||||
uint32_t *p = (uint32_t *) buf;
|
||||
|
||||
for(;len > 0; len -= 4)
|
||||
@ -165,7 +165,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
|
||||
chip->ecc.size = 256;
|
||||
chip->ecc.bytes = 3;
|
||||
chip->ecc.strength = 1;
|
||||
chip->priv = ndfc;
|
||||
nand_set_controller_data(chip, ndfc);
|
||||
|
||||
mtd->dev.parent = &ndfc->ofdev->dev;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
static void orion_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
|
||||
{
|
||||
struct nand_chip *nc = mtd_to_nand(mtd);
|
||||
struct orion_nand_data *board = nc->priv;
|
||||
struct orion_nand_data *board = nand_get_controller_data(nc);
|
||||
u32 offs;
|
||||
|
||||
if (cmd == NAND_CMD_NONE)
|
||||
@ -124,7 +124,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
|
||||
|
||||
mtd->dev.parent = &pdev->dev;
|
||||
|
||||
nc->priv = board;
|
||||
nand_set_controller_data(nc, board);
|
||||
nand_set_flash_node(nc, pdev->dev.of_node);
|
||||
nc->IO_ADDR_R = nc->IO_ADDR_W = io_base;
|
||||
nc->cmd_ctrl = orion_nand_cmd_ctrl;
|
||||
|
@ -1114,7 +1114,7 @@ static void nand_cmdfunc(struct mtd_info *mtd, unsigned command,
|
||||
int column, int page_addr)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct pxa3xx_nand_host *host = chip->priv;
|
||||
struct pxa3xx_nand_host *host = nand_get_controller_data(chip);
|
||||
struct pxa3xx_nand_info *info = host->info_data;
|
||||
int exec_cmd;
|
||||
|
||||
@ -1163,7 +1163,7 @@ static void nand_cmdfunc_extended(struct mtd_info *mtd,
|
||||
int column, int page_addr)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct pxa3xx_nand_host *host = chip->priv;
|
||||
struct pxa3xx_nand_host *host = nand_get_controller_data(chip);
|
||||
struct pxa3xx_nand_info *info = host->info_data;
|
||||
int exec_cmd, ext_cmd_type;
|
||||
|
||||
@ -1283,7 +1283,7 @@ static int pxa3xx_nand_read_page_hwecc(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, uint8_t *buf, int oob_required,
|
||||
int page)
|
||||
{
|
||||
struct pxa3xx_nand_host *host = chip->priv;
|
||||
struct pxa3xx_nand_host *host = nand_get_controller_data(chip);
|
||||
struct pxa3xx_nand_info *info = host->info_data;
|
||||
|
||||
chip->read_buf(mtd, buf, mtd->writesize);
|
||||
@ -1310,7 +1310,7 @@ static int pxa3xx_nand_read_page_hwecc(struct mtd_info *mtd,
|
||||
static uint8_t pxa3xx_nand_read_byte(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct pxa3xx_nand_host *host = chip->priv;
|
||||
struct pxa3xx_nand_host *host = nand_get_controller_data(chip);
|
||||
struct pxa3xx_nand_info *info = host->info_data;
|
||||
char retval = 0xFF;
|
||||
|
||||
@ -1324,7 +1324,7 @@ static uint8_t pxa3xx_nand_read_byte(struct mtd_info *mtd)
|
||||
static u16 pxa3xx_nand_read_word(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct pxa3xx_nand_host *host = chip->priv;
|
||||
struct pxa3xx_nand_host *host = nand_get_controller_data(chip);
|
||||
struct pxa3xx_nand_info *info = host->info_data;
|
||||
u16 retval = 0xFFFF;
|
||||
|
||||
@ -1338,7 +1338,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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct pxa3xx_nand_host *host = chip->priv;
|
||||
struct pxa3xx_nand_host *host = nand_get_controller_data(chip);
|
||||
struct pxa3xx_nand_info *info = host->info_data;
|
||||
int real_len = min_t(size_t, len, info->buf_count - info->buf_start);
|
||||
|
||||
@ -1350,7 +1350,7 @@ static void pxa3xx_nand_write_buf(struct mtd_info *mtd,
|
||||
const uint8_t *buf, int len)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct pxa3xx_nand_host *host = chip->priv;
|
||||
struct pxa3xx_nand_host *host = nand_get_controller_data(chip);
|
||||
struct pxa3xx_nand_info *info = host->info_data;
|
||||
int real_len = min_t(size_t, len, info->buf_count - info->buf_start);
|
||||
|
||||
@ -1366,7 +1366,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)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct pxa3xx_nand_host *host = chip->priv;
|
||||
struct pxa3xx_nand_host *host = nand_get_controller_data(chip);
|
||||
struct pxa3xx_nand_info *info = host->info_data;
|
||||
|
||||
if (info->need_wait) {
|
||||
@ -1573,7 +1573,7 @@ static int pxa_ecc_init(struct pxa3xx_nand_info *info,
|
||||
static int pxa3xx_nand_scan(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct pxa3xx_nand_host *host = chip->priv;
|
||||
struct pxa3xx_nand_host *host = nand_get_controller_data(chip);
|
||||
struct pxa3xx_nand_info *info = host->info_data;
|
||||
struct platform_device *pdev = info->pdev;
|
||||
struct pxa3xx_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||
@ -1704,7 +1704,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
|
||||
for (cs = 0; cs < pdata->num_cs; cs++) {
|
||||
host = (void *)&info[1] + sizeof(*host) * cs;
|
||||
chip = &host->chip;
|
||||
chip->priv = host;
|
||||
nand_set_controller_data(chip, host);
|
||||
mtd = nand_to_mtd(chip);
|
||||
info->host[cs] = host;
|
||||
host->cs = cs;
|
||||
@ -1713,7 +1713,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
|
||||
/* FIXME: all chips use the same device tree partitions */
|
||||
nand_set_flash_node(chip, np);
|
||||
|
||||
chip->priv = host;
|
||||
nand_set_controller_data(chip, host);
|
||||
chip->ecc.read_page = pxa3xx_nand_read_page_hwecc;
|
||||
chip->ecc.write_page = pxa3xx_nand_write_page_hwecc;
|
||||
chip->controller = &info->controller;
|
||||
|
@ -65,7 +65,7 @@ static inline void r852_write_reg_dword(struct r852_device *dev,
|
||||
static inline struct r852_device *r852_get_dev(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
return chip->priv;
|
||||
return nand_get_controller_data(chip);
|
||||
}
|
||||
|
||||
|
||||
@ -361,7 +361,7 @@ static void r852_cmdctl(struct mtd_info *mtd, int dat, unsigned int ctrl)
|
||||
*/
|
||||
static int r852_wait(struct mtd_info *mtd, struct nand_chip *chip)
|
||||
{
|
||||
struct r852_device *dev = chip->priv;
|
||||
struct r852_device *dev = nand_get_controller_data(chip);
|
||||
|
||||
unsigned long timeout;
|
||||
int status;
|
||||
@ -879,7 +879,7 @@ static int r852_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
|
||||
if (!dev)
|
||||
goto error5;
|
||||
|
||||
chip->priv = dev;
|
||||
nand_set_controller_data(chip, dev);
|
||||
dev->chip = chip;
|
||||
dev->pci_dev = pci_dev;
|
||||
pci_set_drvdata(pci_dev, dev);
|
||||
|
@ -385,7 +385,7 @@ static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip)
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
unsigned long cur;
|
||||
|
||||
nmtd = this->priv;
|
||||
nmtd = nand_get_controller_data(this);
|
||||
info = nmtd->info;
|
||||
|
||||
if (chip != -1)
|
||||
@ -794,7 +794,7 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
|
||||
chip->read_buf = s3c2410_nand_read_buf;
|
||||
chip->select_chip = s3c2410_nand_select_chip;
|
||||
chip->chip_delay = 50;
|
||||
chip->priv = nmtd;
|
||||
nand_set_controller_data(chip, nmtd);
|
||||
chip->options = set->options;
|
||||
chip->controller = &info->controller;
|
||||
|
||||
|
@ -45,7 +45,7 @@ static void socrates_nand_write_buf(struct mtd_info *mtd,
|
||||
{
|
||||
int i;
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct socrates_nand_host *host = this->priv;
|
||||
struct socrates_nand_host *host = nand_get_controller_data(this);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
out_be32(host->io_base, FPGA_NAND_ENABLE |
|
||||
@ -64,7 +64,7 @@ static void socrates_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
|
||||
{
|
||||
int i;
|
||||
struct nand_chip *this = mtd_to_nand(mtd);
|
||||
struct socrates_nand_host *host = this->priv;
|
||||
struct socrates_nand_host *host = nand_get_controller_data(this);
|
||||
uint32_t val;
|
||||
|
||||
val = FPGA_NAND_ENABLE | FPGA_NAND_CMD_READ;
|
||||
@ -105,7 +105,7 @@ static void socrates_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
|
||||
unsigned int ctrl)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct socrates_nand_host *host = nand_chip->priv;
|
||||
struct socrates_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
uint32_t val;
|
||||
|
||||
if (cmd == NAND_CMD_NONE)
|
||||
@ -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)
|
||||
{
|
||||
struct nand_chip *nand_chip = mtd_to_nand(mtd);
|
||||
struct socrates_nand_host *host = nand_chip->priv;
|
||||
struct socrates_nand_host *host = nand_get_controller_data(nand_chip);
|
||||
|
||||
if (in_be32(host->io_base) & FPGA_NAND_BUSY)
|
||||
return 0; /* busy */
|
||||
@ -162,7 +162,8 @@ static int socrates_nand_probe(struct platform_device *ofdev)
|
||||
mtd = nand_to_mtd(nand_chip);
|
||||
host->dev = &ofdev->dev;
|
||||
|
||||
nand_chip->priv = host; /* link the private data structures */
|
||||
/* link the private data structures */
|
||||
nand_set_controller_data(nand_chip, host);
|
||||
nand_set_flash_node(nand_chip, ofdev->dev.of_node);
|
||||
mtd->name = "socrates_nand";
|
||||
mtd->dev.parent = &ofdev->dev;
|
||||
|
@ -79,7 +79,7 @@ struct txx9ndfmc_drvdata {
|
||||
static struct platform_device *mtd_to_platdev(struct mtd_info *mtd)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct txx9ndfmc_priv *txx9_priv = chip->priv;
|
||||
struct txx9ndfmc_priv *txx9_priv = nand_get_controller_data(chip);
|
||||
return txx9_priv->dev;
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ static void txx9ndfmc_cmd_ctrl(struct mtd_info *mtd, int cmd,
|
||||
unsigned int ctrl)
|
||||
{
|
||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||
struct txx9ndfmc_priv *txx9_priv = chip->priv;
|
||||
struct txx9ndfmc_priv *txx9_priv = nand_get_controller_data(chip);
|
||||
struct platform_device *dev = txx9_priv->dev;
|
||||
struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev);
|
||||
|
||||
@ -340,7 +340,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
|
||||
chip->chip_delay = 100;
|
||||
chip->controller = &drvdata->hw_control;
|
||||
|
||||
chip->priv = txx9_priv;
|
||||
nand_set_controller_data(chip, txx9_priv);
|
||||
txx9_priv->dev = dev;
|
||||
|
||||
if (plat->ch_mask != 1) {
|
||||
@ -389,7 +389,7 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev)
|
||||
if (!mtd)
|
||||
continue;
|
||||
chip = mtd_to_nand(mtd);
|
||||
txx9_priv = chip->priv;
|
||||
txx9_priv = nand_get_controller_data(chip);
|
||||
|
||||
nand_release(mtd);
|
||||
kfree(txx9_priv->mtdname);
|
||||
|
Loading…
Reference in New Issue
Block a user