167167
168168#define NFC_DEFAULT_TIMEOUT_MS 1000
169169
170- #define NFC_SRAM_SIZE 1024
171-
172170#define NFC_MAX_CS 7
173171
174172/*
@@ -251,6 +249,7 @@ static inline struct sunxi_nand_chip *to_sunxi_nand(struct nand_chip *nand)
251249 * @dma_maxburst: DMA maxburst
252250 * @ecc_strengths: Available ECC strengths array
253251 * @nstrengths: Size of @ecc_strengths
252+ * @sram_size: Size of the NAND controller SRAM
254253 */
255254struct sunxi_nfc_caps {
256255 bool has_mdma ;
@@ -269,6 +268,7 @@ struct sunxi_nfc_caps {
269268 unsigned int dma_maxburst ;
270269 const u8 * ecc_strengths ;
271270 unsigned int nstrengths ;
271+ int sram_size ;
272272};
273273
274274/**
@@ -506,7 +506,7 @@ static void sunxi_nfc_read_buf(struct nand_chip *nand, uint8_t *buf, int len)
506506 while (len > offs ) {
507507 bool poll = false;
508508
509- cnt = min (len - offs , NFC_SRAM_SIZE );
509+ cnt = min (len - offs , nfc -> caps -> sram_size );
510510
511511 ret = sunxi_nfc_wait_cmd_fifo_empty (nfc );
512512 if (ret )
@@ -544,7 +544,7 @@ static void sunxi_nfc_write_buf(struct nand_chip *nand, const uint8_t *buf,
544544 while (len > offs ) {
545545 bool poll = false;
546546
547- cnt = min (len - offs , NFC_SRAM_SIZE );
547+ cnt = min (len - offs , nfc -> caps -> sram_size );
548548
549549 ret = sunxi_nfc_wait_cmd_fifo_empty (nfc );
550550 if (ret )
@@ -1871,7 +1871,7 @@ static int sunxi_nfc_exec_subop(struct nand_chip *nand,
18711871 case NAND_OP_DATA_OUT_INSTR :
18721872 start = nand_subop_get_data_start_off (subop , i );
18731873 remaining = nand_subop_get_data_len (subop , i );
1874- cnt = min_t (u32 , remaining , NFC_SRAM_SIZE );
1874+ cnt = min_t (u32 , remaining , nfc -> caps -> sram_size );
18751875 cmd |= NFC_DATA_TRANS | NFC_DATA_SWAP_METHOD ;
18761876
18771877 if (instr -> type == NAND_OP_DATA_OUT_INSTR ) {
@@ -2252,6 +2252,7 @@ static const struct sunxi_nfc_caps sunxi_nfc_a10_caps = {
22522252 .dma_maxburst = 4 ,
22532253 .ecc_strengths = sunxi_ecc_strengths_a10 ,
22542254 .nstrengths = ARRAY_SIZE (sunxi_ecc_strengths_a10 ),
2255+ .sram_size = 1024 ,
22552256};
22562257
22572258static const struct sunxi_nfc_caps sunxi_nfc_a23_caps = {
@@ -2271,6 +2272,7 @@ static const struct sunxi_nfc_caps sunxi_nfc_a23_caps = {
22712272 .dma_maxburst = 8 ,
22722273 .ecc_strengths = sunxi_ecc_strengths_a10 ,
22732274 .nstrengths = ARRAY_SIZE (sunxi_ecc_strengths_a10 ),
2275+ .sram_size = 1024 ,
22742276};
22752277
22762278static const struct of_device_id sunxi_nfc_ids [] = {
0 commit comments