diff options
| author | Richard Genoud <richard.genoud@bootlin.com> | 2025-10-28 08:35:07 +0100 |
|---|---|---|
| committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2025-10-28 17:18:13 +0100 |
| commit | 5ddfbc68ec7ac92ff64d8420909b1258be3ca8a1 (patch) | |
| tree | 9de0b419556720d461c0498d920607e05415e85d | |
| parent | 97d13bcea2306f47d5e54e5a347d5ca5817deb0d (diff) | |
mtd: rawnand: sunxi: introduce sram_size in sunxi_nfc_caps
The H6/H616 the SRAM is bigger than the A10/A23 one, so move its size
into sunxi_nfc_caps.
No functional change
Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
| -rw-r--r-- | drivers/mtd/nand/raw/sunxi_nand.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c index 0a9ac75bb229..5e030fc2fde5 100644 --- a/drivers/mtd/nand/raw/sunxi_nand.c +++ b/drivers/mtd/nand/raw/sunxi_nand.c @@ -167,8 +167,6 @@ #define NFC_DEFAULT_TIMEOUT_MS 1000 -#define NFC_SRAM_SIZE 1024 - #define NFC_MAX_CS 7 /* @@ -251,6 +249,7 @@ static inline struct sunxi_nand_chip *to_sunxi_nand(struct nand_chip *nand) * @dma_maxburst: DMA maxburst * @ecc_strengths: Available ECC strengths array * @nstrengths: Size of @ecc_strengths + * @sram_size: Size of the NAND controller SRAM */ struct sunxi_nfc_caps { bool has_mdma; @@ -269,6 +268,7 @@ struct sunxi_nfc_caps { unsigned int dma_maxburst; const u8 *ecc_strengths; unsigned int nstrengths; + int sram_size; }; /** @@ -506,7 +506,7 @@ static void sunxi_nfc_read_buf(struct nand_chip *nand, uint8_t *buf, int len) while (len > offs) { bool poll = false; - cnt = min(len - offs, NFC_SRAM_SIZE); + cnt = min(len - offs, nfc->caps->sram_size); ret = sunxi_nfc_wait_cmd_fifo_empty(nfc); if (ret) @@ -544,7 +544,7 @@ static void sunxi_nfc_write_buf(struct nand_chip *nand, const uint8_t *buf, while (len > offs) { bool poll = false; - cnt = min(len - offs, NFC_SRAM_SIZE); + cnt = min(len - offs, nfc->caps->sram_size); ret = sunxi_nfc_wait_cmd_fifo_empty(nfc); if (ret) @@ -1871,7 +1871,7 @@ static int sunxi_nfc_exec_subop(struct nand_chip *nand, case NAND_OP_DATA_OUT_INSTR: start = nand_subop_get_data_start_off(subop, i); remaining = nand_subop_get_data_len(subop, i); - cnt = min_t(u32, remaining, NFC_SRAM_SIZE); + cnt = min_t(u32, remaining, nfc->caps->sram_size); cmd |= NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD; if (instr->type == NAND_OP_DATA_OUT_INSTR) { @@ -2252,6 +2252,7 @@ static const struct sunxi_nfc_caps sunxi_nfc_a10_caps = { .dma_maxburst = 4, .ecc_strengths = sunxi_ecc_strengths_a10, .nstrengths = ARRAY_SIZE(sunxi_ecc_strengths_a10), + .sram_size = 1024, }; static const struct sunxi_nfc_caps sunxi_nfc_a23_caps = { @@ -2271,6 +2272,7 @@ static const struct sunxi_nfc_caps sunxi_nfc_a23_caps = { .dma_maxburst = 8, .ecc_strengths = sunxi_ecc_strengths_a10, .nstrengths = ARRAY_SIZE(sunxi_ecc_strengths_a10), + .sram_size = 1024, }; static const struct of_device_id sunxi_nfc_ids[] = { |
