aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-05 22:07:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-05 22:07:57 -0400
commit0e63665a1bfd606f538da90473648ca5b827d60f (patch)
treeb7a764d703427d4f787d5799aa76177393ad962d
parent881ed91f7db58fcbe8fdca056907991c3c9d8f2d (diff)
parentc7a87ceb17aee9222c069a97aee4647260c7b3a6 (diff)
Merge tag 'mtd/fixes-for-5.2-final' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux
Pull mtf fixes from Miquel Raynal: - Fix the memory organization structure of a Macronix SPI-NAND chip. - Fix a build dependency wrongly described. - Fix the sunxi NAND driver for A23/A33 SoCs by (a) reverting the faulty commit introducing broken DMA support and (b) applying another commit bringing working DMA support. * tag 'mtd/fixes-for-5.2-final' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: mtd: rawnand: sunxi: Add A23/A33 DMA support with extra MBUS configuration Revert "mtd: rawnand: sunxi: Add A23/A33 DMA support" mtd: rawnand: ingenic: Fix ingenic_ecc dependency mtd: spinand: Fix max_bad_eraseblocks_per_lun info in memorg
-rw-r--r--drivers/mtd/nand/raw/ingenic/Kconfig2
-rw-r--r--drivers/mtd/nand/raw/ingenic/Makefile4
-rw-r--r--drivers/mtd/nand/raw/ingenic/ingenic_ecc.c9
-rw-r--r--drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c (renamed from drivers/mtd/nand/raw/ingenic/ingenic_nand.c)0
-rw-r--r--drivers/mtd/nand/raw/sunxi_nand.c40
-rw-r--r--drivers/mtd/nand/spi/gigadevice.c2
-rw-r--r--drivers/mtd/nand/spi/macronix.c4
7 files changed, 22 insertions, 39 deletions
diff --git a/drivers/mtd/nand/raw/ingenic/Kconfig b/drivers/mtd/nand/raw/ingenic/Kconfig
index 19a96ce515c1..66b7cffdb0c2 100644
--- a/drivers/mtd/nand/raw/ingenic/Kconfig
+++ b/drivers/mtd/nand/raw/ingenic/Kconfig
@@ -16,7 +16,7 @@ config MTD_NAND_JZ4780
16if MTD_NAND_JZ4780 16if MTD_NAND_JZ4780
17 17
18config MTD_NAND_INGENIC_ECC 18config MTD_NAND_INGENIC_ECC
19 tristate 19 bool
20 20
21config MTD_NAND_JZ4740_ECC 21config MTD_NAND_JZ4740_ECC
22 tristate "Hardware BCH support for JZ4740 SoC" 22 tristate "Hardware BCH support for JZ4740 SoC"
diff --git a/drivers/mtd/nand/raw/ingenic/Makefile b/drivers/mtd/nand/raw/ingenic/Makefile
index 1ac4f455baea..b63d36889263 100644
--- a/drivers/mtd/nand/raw/ingenic/Makefile
+++ b/drivers/mtd/nand/raw/ingenic/Makefile
@@ -2,7 +2,9 @@
2obj-$(CONFIG_MTD_NAND_JZ4740) += jz4740_nand.o 2obj-$(CONFIG_MTD_NAND_JZ4740) += jz4740_nand.o
3obj-$(CONFIG_MTD_NAND_JZ4780) += ingenic_nand.o 3obj-$(CONFIG_MTD_NAND_JZ4780) += ingenic_nand.o
4 4
5obj-$(CONFIG_MTD_NAND_INGENIC_ECC) += ingenic_ecc.o 5ingenic_nand-y += ingenic_nand_drv.o
6ingenic_nand-$(CONFIG_MTD_NAND_INGENIC_ECC) += ingenic_ecc.o
7
6obj-$(CONFIG_MTD_NAND_JZ4740_ECC) += jz4740_ecc.o 8obj-$(CONFIG_MTD_NAND_JZ4740_ECC) += jz4740_ecc.o
7obj-$(CONFIG_MTD_NAND_JZ4725B_BCH) += jz4725b_bch.o 9obj-$(CONFIG_MTD_NAND_JZ4725B_BCH) += jz4725b_bch.o
8obj-$(CONFIG_MTD_NAND_JZ4780_BCH) += jz4780_bch.o 10obj-$(CONFIG_MTD_NAND_JZ4780_BCH) += jz4780_bch.o
diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c b/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c
index d3e085c5685a..c954189606f6 100644
--- a/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c
+++ b/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c
@@ -30,7 +30,6 @@ int ingenic_ecc_calculate(struct ingenic_ecc *ecc,
30{ 30{
31 return ecc->ops->calculate(ecc, params, buf, ecc_code); 31 return ecc->ops->calculate(ecc, params, buf, ecc_code);
32} 32}
33EXPORT_SYMBOL(ingenic_ecc_calculate);
34 33
35/** 34/**
36 * ingenic_ecc_correct() - detect and correct bit errors 35 * ingenic_ecc_correct() - detect and correct bit errors
@@ -51,7 +50,6 @@ int ingenic_ecc_correct(struct ingenic_ecc *ecc,
51{ 50{
52 return ecc->ops->correct(ecc, params, buf, ecc_code); 51 return ecc->ops->correct(ecc, params, buf, ecc_code);
53} 52}
54EXPORT_SYMBOL(ingenic_ecc_correct);
55 53
56/** 54/**
57 * ingenic_ecc_get() - get the ECC controller device 55 * ingenic_ecc_get() - get the ECC controller device
@@ -111,7 +109,6 @@ struct ingenic_ecc *of_ingenic_ecc_get(struct device_node *of_node)
111 } 109 }
112 return ecc; 110 return ecc;
113} 111}
114EXPORT_SYMBOL(of_ingenic_ecc_get);
115 112
116/** 113/**
117 * ingenic_ecc_release() - release the ECC controller device 114 * ingenic_ecc_release() - release the ECC controller device
@@ -122,7 +119,6 @@ void ingenic_ecc_release(struct ingenic_ecc *ecc)
122 clk_disable_unprepare(ecc->clk); 119 clk_disable_unprepare(ecc->clk);
123 put_device(ecc->dev); 120 put_device(ecc->dev);
124} 121}
125EXPORT_SYMBOL(ingenic_ecc_release);
126 122
127int ingenic_ecc_probe(struct platform_device *pdev) 123int ingenic_ecc_probe(struct platform_device *pdev)
128{ 124{
@@ -159,8 +155,3 @@ int ingenic_ecc_probe(struct platform_device *pdev)
159 return 0; 155 return 0;
160} 156}
161EXPORT_SYMBOL(ingenic_ecc_probe); 157EXPORT_SYMBOL(ingenic_ecc_probe);
162
163MODULE_AUTHOR("Alex Smith <alex@alex-smith.me.uk>");
164MODULE_AUTHOR("Harvey Hunt <harveyhuntnexus@gmail.com>");
165MODULE_DESCRIPTION("Ingenic ECC common driver");
166MODULE_LICENSE("GPL v2");
diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand.c b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
index d7b7c0f13909..d7b7c0f13909 100644
--- a/drivers/mtd/nand/raw/ingenic/ingenic_nand.c
+++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index b021a5720b42..89773293c64d 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -51,6 +51,7 @@
51#define NFC_REG_USER_DATA(x) (0x0050 + ((x) * 4)) 51#define NFC_REG_USER_DATA(x) (0x0050 + ((x) * 4))
52#define NFC_REG_SPARE_AREA 0x00A0 52#define NFC_REG_SPARE_AREA 0x00A0
53#define NFC_REG_PAT_ID 0x00A4 53#define NFC_REG_PAT_ID 0x00A4
54#define NFC_REG_MDMA_CNT 0x00C4
54#define NFC_RAM0_BASE 0x0400 55#define NFC_RAM0_BASE 0x0400
55#define NFC_RAM1_BASE 0x0800 56#define NFC_RAM1_BASE 0x0800
56 57
@@ -69,6 +70,7 @@
69#define NFC_PAGE_SHIFT(x) (((x) < 10 ? 0 : (x) - 10) << 8) 70#define NFC_PAGE_SHIFT(x) (((x) < 10 ? 0 : (x) - 10) << 8)
70#define NFC_SAM BIT(12) 71#define NFC_SAM BIT(12)
71#define NFC_RAM_METHOD BIT(14) 72#define NFC_RAM_METHOD BIT(14)
73#define NFC_DMA_TYPE_NORMAL BIT(15)
72#define NFC_DEBUG_CTL BIT(31) 74#define NFC_DEBUG_CTL BIT(31)
73 75
74/* define bit use in NFC_ST */ 76/* define bit use in NFC_ST */
@@ -205,14 +207,13 @@ static inline struct sunxi_nand_chip *to_sunxi_nand(struct nand_chip *nand)
205 * NAND Controller capabilities structure: stores NAND controller capabilities 207 * NAND Controller capabilities structure: stores NAND controller capabilities
206 * for distinction between compatible strings. 208 * for distinction between compatible strings.
207 * 209 *
208 * @sram_through_ahb: On A23, we choose to access the internal RAM through AHB 210 * @extra_mbus_conf: Contrary to A10, A10s and A13, accessing internal RAM
209 * instead of MBUS (less configuration). A10, A10s, A13 and 211 * through MBUS on A23/A33 needs extra configuration.
210 * A20 use the MBUS but no extra configuration is needed.
211 * @reg_io_data: I/O data register 212 * @reg_io_data: I/O data register
212 * @dma_maxburst: DMA maxburst 213 * @dma_maxburst: DMA maxburst
213 */ 214 */
214struct sunxi_nfc_caps { 215struct sunxi_nfc_caps {
215 bool sram_through_ahb; 216 bool extra_mbus_conf;
216 unsigned int reg_io_data; 217 unsigned int reg_io_data;
217 unsigned int dma_maxburst; 218 unsigned int dma_maxburst;
218}; 219};
@@ -368,28 +369,12 @@ static int sunxi_nfc_dma_op_prepare(struct sunxi_nfc *nfc, const void *buf,
368 goto err_unmap_buf; 369 goto err_unmap_buf;
369 } 370 }
370 371
371 /* 372 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) 373 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); 374 writel(nchunks, nfc->regs + NFC_REG_SECTOR_NUM);
392 writel(chunksize, nfc->regs + NFC_REG_CNT); 375 writel(chunksize, nfc->regs + NFC_REG_CNT);
376 if (nfc->caps->extra_mbus_conf)
377 writel(chunksize * nchunks, nfc->regs + NFC_REG_MDMA_CNT);
393 378
394 dmat = dmaengine_submit(dmad); 379 dmat = dmaengine_submit(dmad);
395 380
@@ -2151,6 +2136,11 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
2151 dmac_cfg.src_maxburst = nfc->caps->dma_maxburst; 2136 dmac_cfg.src_maxburst = nfc->caps->dma_maxburst;
2152 dmac_cfg.dst_maxburst = nfc->caps->dma_maxburst; 2137 dmac_cfg.dst_maxburst = nfc->caps->dma_maxburst;
2153 dmaengine_slave_config(nfc->dmac, &dmac_cfg); 2138 dmaengine_slave_config(nfc->dmac, &dmac_cfg);
2139
2140 if (nfc->caps->extra_mbus_conf)
2141 writel(readl(nfc->regs + NFC_REG_CTL) |
2142 NFC_DMA_TYPE_NORMAL, nfc->regs + NFC_REG_CTL);
2143
2154 } else { 2144 } else {
2155 dev_warn(dev, "failed to request rxtx DMA channel\n"); 2145 dev_warn(dev, "failed to request rxtx DMA channel\n");
2156 } 2146 }
@@ -2200,7 +2190,7 @@ static const struct sunxi_nfc_caps sunxi_nfc_a10_caps = {
2200}; 2190};
2201 2191
2202static const struct sunxi_nfc_caps sunxi_nfc_a23_caps = { 2192static const struct sunxi_nfc_caps sunxi_nfc_a23_caps = {
2203 .sram_through_ahb = true, 2193 .extra_mbus_conf = true,
2204 .reg_io_data = NFC_REG_A23_IO_DATA, 2194 .reg_io_data = NFC_REG_A23_IO_DATA,
2205 .dma_maxburst = 8, 2195 .dma_maxburst = 8,
2206}; 2196};
diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c
index e5586390026a..e6c646007cda 100644
--- a/drivers/mtd/nand/spi/gigadevice.c
+++ b/drivers/mtd/nand/spi/gigadevice.c
@@ -180,7 +180,7 @@ static const struct spinand_info gigadevice_spinand_table[] = {
180 SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout, 180 SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
181 gd5fxgq4xa_ecc_get_status)), 181 gd5fxgq4xa_ecc_get_status)),
182 SPINAND_INFO("GD5F4GQ4xA", 0xF4, 182 SPINAND_INFO("GD5F4GQ4xA", 0xF4,
183 NAND_MEMORG(1, 2048, 64, 64, 4096, 40, 1, 1, 1), 183 NAND_MEMORG(1, 2048, 64, 64, 4096, 80, 1, 1, 1),
184 NAND_ECCREQ(8, 512), 184 NAND_ECCREQ(8, 512),
185 SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 185 SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
186 &write_cache_variants, 186 &write_cache_variants,
diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
index 6502727049a8..21def3f8fb36 100644
--- a/drivers/mtd/nand/spi/macronix.c
+++ b/drivers/mtd/nand/spi/macronix.c
@@ -100,7 +100,7 @@ static int mx35lf1ge4ab_ecc_get_status(struct spinand_device *spinand,
100 100
101static const struct spinand_info macronix_spinand_table[] = { 101static const struct spinand_info macronix_spinand_table[] = {
102 SPINAND_INFO("MX35LF1GE4AB", 0x12, 102 SPINAND_INFO("MX35LF1GE4AB", 0x12,
103 NAND_MEMORG(1, 2048, 64, 64, 1024, 40, 1, 1, 1), 103 NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
104 NAND_ECCREQ(4, 512), 104 NAND_ECCREQ(4, 512),
105 SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 105 SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
106 &write_cache_variants, 106 &write_cache_variants,
@@ -109,7 +109,7 @@ static const struct spinand_info macronix_spinand_table[] = {
109 SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, 109 SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
110 mx35lf1ge4ab_ecc_get_status)), 110 mx35lf1ge4ab_ecc_get_status)),
111 SPINAND_INFO("MX35LF2GE4AB", 0x22, 111 SPINAND_INFO("MX35LF2GE4AB", 0x22,
112 NAND_MEMORG(1, 2048, 64, 64, 2048, 20, 2, 1, 1), 112 NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 2, 1, 1),
113 NAND_ECCREQ(4, 512), 113 NAND_ECCREQ(4, 512),
114 SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 114 SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
115 &write_cache_variants, 115 &write_cache_variants,