Commit 89dcb27b authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Boris Brezillon

mtd: nand: denali: change the setup_dma choice into hook

The previous commit added some hooks into struct denali_nand_info,
so here is one more for clean-up.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent 29c4dd92
...@@ -519,15 +519,6 @@ static void denali_setup_dma32(struct denali_nand_info *denali, ...@@ -519,15 +519,6 @@ static void denali_setup_dma32(struct denali_nand_info *denali,
denali->host_write(denali, mode | 0x14000, 0x2400); denali->host_write(denali, mode | 0x14000, 0x2400);
} }
static void denali_setup_dma(struct denali_nand_info *denali,
dma_addr_t dma_addr, int page, int write)
{
if (denali->caps & DENALI_CAP_DMA_64BIT)
denali_setup_dma64(denali, dma_addr, page, write);
else
denali_setup_dma32(denali, dma_addr, page, write);
}
static int denali_pio_read(struct denali_nand_info *denali, void *buf, static int denali_pio_read(struct denali_nand_info *denali, void *buf,
size_t size, int page, int raw) size_t size, int page, int raw)
{ {
...@@ -619,7 +610,7 @@ static int denali_dma_xfer(struct denali_nand_info *denali, void *buf, ...@@ -619,7 +610,7 @@ static int denali_dma_xfer(struct denali_nand_info *denali, void *buf,
iowrite32(DMA_ENABLE__FLAG, denali->reg + DMA_ENABLE); iowrite32(DMA_ENABLE__FLAG, denali->reg + DMA_ENABLE);
denali_reset_irq(denali); denali_reset_irq(denali);
denali_setup_dma(denali, dma_addr, page, write); denali->setup_dma(denali, dma_addr, page, write);
irq_status = denali_wait_for_irq(denali, irq_mask); irq_status = denali_wait_for_irq(denali, irq_mask);
if (!(irq_status & INTR__DMA_CMD_COMP)) if (!(irq_status & INTR__DMA_CMD_COMP))
...@@ -1314,6 +1305,10 @@ int denali_init(struct denali_nand_info *denali) ...@@ -1314,6 +1305,10 @@ int denali_init(struct denali_nand_info *denali)
if (denali->dma_avail) { if (denali->dma_avail) {
chip->options |= NAND_USE_BOUNCE_BUFFER; chip->options |= NAND_USE_BOUNCE_BUFFER;
chip->buf_align = 16; chip->buf_align = 16;
if (denali->caps & DENALI_CAP_DMA_64BIT)
denali->setup_dma = denali_setup_dma64;
else
denali->setup_dma = denali_setup_dma32;
} }
chip->bbt_options |= NAND_BBT_USE_FLASH; chip->bbt_options |= NAND_BBT_USE_FLASH;
......
...@@ -321,6 +321,8 @@ struct denali_nand_info { ...@@ -321,6 +321,8 @@ struct denali_nand_info {
const struct nand_ecc_caps *ecc_caps; const struct nand_ecc_caps *ecc_caps;
u32 (*host_read)(struct denali_nand_info *denali, u32 addr); u32 (*host_read)(struct denali_nand_info *denali, u32 addr);
void (*host_write)(struct denali_nand_info *denali, u32 addr, u32 data); void (*host_write)(struct denali_nand_info *denali, u32 addr, u32 data);
void (*setup_dma)(struct denali_nand_info *denali, dma_addr_t dma_addr,
int page, int write);
}; };
#define DENALI_CAP_HW_ECC_FIXUP BIT(0) #define DENALI_CAP_HW_ECC_FIXUP BIT(0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment