aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/raw/sunxi_nand.c38
1 files changed, 2 insertions, 36 deletions
diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index b021a5720b42..e93f39bc2bc5 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -43,7 +43,6 @@
43#define NFC_REG_RCMD_SET 0x0028 43#define NFC_REG_RCMD_SET 0x0028
44#define NFC_REG_WCMD_SET 0x002C 44#define NFC_REG_WCMD_SET 0x002C
45#define NFC_REG_A10_IO_DATA 0x0030 45#define NFC_REG_A10_IO_DATA 0x0030
46#define NFC_REG_A23_IO_DATA 0x0300
47#define NFC_REG_ECC_CTL 0x0034 46#define NFC_REG_ECC_CTL 0x0034
48#define NFC_REG_ECC_ST 0x0038 47#define NFC_REG_ECC_ST 0x0038
49#define NFC_REG_DEBUG 0x003C 48#define NFC_REG_DEBUG 0x003C
@@ -205,14 +204,10 @@ static inline struct sunxi_nand_chip *to_sunxi_nand(struct nand_chip *nand)
205 * NAND Controller capabilities structure: stores NAND controller capabilities 204 * NAND Controller capabilities structure: stores NAND controller capabilities
206 * for distinction between compatible strings. 205 * for distinction between compatible strings.
207 * 206 *
208 * @sram_through_ahb: On A23, we choose to access the internal RAM through AHB
209 * instead of MBUS (less configuration). A10, A10s, A13 and
210 * A20 use the MBUS but no extra configuration is needed.
211 * @reg_io_data: I/O data register 207 * @reg_io_data: I/O data register
212 * @dma_maxburst: DMA maxburst 208 * @dma_maxburst: DMA maxburst
213 */ 209 */
214struct sunxi_nfc_caps { 210struct sunxi_nfc_caps {
215 bool sram_through_ahb;
216 unsigned int reg_io_data; 211 unsigned int reg_io_data;
217 unsigned int dma_maxburst; 212 unsigned int dma_maxburst;
218}; 213};
@@ -368,29 +363,10 @@ static int sunxi_nfc_dma_op_prepare(struct sunxi_nfc *nfc, const void *buf,
368 goto err_unmap_buf; 363 goto err_unmap_buf;
369 } 364 }
370 365
371 /* 366 writel(readl(nfc->regs + NFC_REG_CTL) | NFC_RAM_METHOD,
372 * On A23, we suppose the "internal RAM" (p.12 of the NFC user manual) 367 nfc->regs + NFC_REG_CTL);
373 * refers to the NAND controller's internal SRAM. This memory is mapped
374 * and so is accessible from the AHB. It seems that it can also be
375 * accessed by the MBUS. MBUS accesses are mandatory when using the
376 * internal DMA instead of the external DMA engine.
377 *
378 * During DMA I/O operation, either we access this memory from the AHB
379 * by clearing the NFC_RAM_METHOD bit, or we set the bit and use the
380 * MBUS. In this case, we should also configure the MBUS DMA length
381 * NFC_REG_MDMA_CNT(0xC4) to be chunksize * nchunks. NAND I/O over MBUS
382 * are also limited to 32kiB pages.
383 */
384 if (nfc->caps->sram_through_ahb)
385 writel(readl(nfc->regs + NFC_REG_CTL) & ~NFC_RAM_METHOD,
386 nfc->regs + NFC_REG_CTL);
387 else
388 writel(readl(nfc->regs + NFC_REG_CTL) | NFC_RAM_METHOD,
389 nfc->regs + NFC_REG_CTL);
390
391 writel(nchunks, nfc->regs + NFC_REG_SECTOR_NUM); 368 writel(nchunks, nfc->regs + NFC_REG_SECTOR_NUM);
392 writel(chunksize, nfc->regs + NFC_REG_CNT); 369 writel(chunksize, nfc->regs + NFC_REG_CNT);
393
394 dmat = dmaengine_submit(dmad); 370 dmat = dmaengine_submit(dmad);
395 371
396 ret = dma_submit_error(dmat); 372 ret = dma_submit_error(dmat);
@@ -2199,21 +2175,11 @@ static const struct sunxi_nfc_caps sunxi_nfc_a10_caps = {
2199 .dma_maxburst = 4, 2175 .dma_maxburst = 4,
2200}; 2176};
2201 2177
2202static const struct sunxi_nfc_caps sunxi_nfc_a23_caps = {
2203 .sram_through_ahb = true,
2204 .reg_io_data = NFC_REG_A23_IO_DATA,
2205 .dma_maxburst = 8,
2206};
2207
2208static const struct of_device_id sunxi_nfc_ids[] = { 2178static const struct of_device_id sunxi_nfc_ids[] = {
2209 { 2179 {
2210 .compatible = "allwinner,sun4i-a10-nand", 2180 .compatible = "allwinner,sun4i-a10-nand",
2211 .data = &sunxi_nfc_a10_caps, 2181 .data = &sunxi_nfc_a10_caps,
2212 }, 2182 },
2213 {
2214 .compatible = "allwinner,sun8i-a23-nand-controller",
2215 .data = &sunxi_nfc_a23_caps,
2216 },
2217 { /* sentinel */ } 2183 { /* sentinel */ }
2218}; 2184};
2219MODULE_DEVICE_TABLE(of, sunxi_nfc_ids); 2185MODULE_DEVICE_TABLE(of, sunxi_nfc_ids);