Skip to content

Commit ee00096

Browse files
Md Sadre Alammiquelraynal
authored andcommitted
mtd: rawnand: qcom: Pass 18 bit offset from NANDc base to BAM base
The BAM command descriptor provides only 18 bits to specify the BAM register offset. Additionally, in the BAM command descriptor, the BAM register offset is supposed to be specified as "(NANDc base - BAM base) + reg_off". Since, the BAM controller expecting the value in the form of "NANDc base - BAM base", so that added a new field 'bam_offset' in the NAND properties structure and use it while preparing the command descriptor. Previously, the driver was specifying the NANDc base address in the BAM command descriptor. Cc: [email protected] Fixes: 8d6b6d7 ("mtd: nand: qcom: support for command descriptor formation") Tested-by: Lakshmi Sowjanya D <[email protected]> Signed-off-by: Md Sadre Alam <[email protected]> Acked-by: Mark Brown <[email protected]> Tested-by: Gabor Juhos <[email protected]> # on IPQ9574 Reviewed-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
1 parent 2cf4bc0 commit ee00096

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

drivers/mtd/nand/qpic_common.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,21 +236,21 @@ int qcom_prep_bam_dma_desc_cmd(struct qcom_nand_controller *nandc, bool read,
236236
int i, ret;
237237
struct bam_cmd_element *bam_ce_buffer;
238238
struct bam_transaction *bam_txn = nandc->bam_txn;
239+
u32 offset;
239240

240241
bam_ce_buffer = &bam_txn->bam_ce[bam_txn->bam_ce_pos];
241242

242243
/* fill the command desc */
243244
for (i = 0; i < size; i++) {
245+
offset = nandc->props->bam_offset + reg_off + 4 * i;
244246
if (read)
245247
bam_prep_ce(&bam_ce_buffer[i],
246-
nandc_reg_phys(nandc, reg_off + 4 * i),
247-
BAM_READ_COMMAND,
248+
offset, BAM_READ_COMMAND,
248249
reg_buf_dma_addr(nandc,
249250
(__le32 *)vaddr + i));
250251
else
251252
bam_prep_ce_le32(&bam_ce_buffer[i],
252-
nandc_reg_phys(nandc, reg_off + 4 * i),
253-
BAM_WRITE_COMMAND,
253+
offset, BAM_WRITE_COMMAND,
254254
*((__le32 *)vaddr + i));
255255
}
256256

drivers/mtd/nand/raw/qcom_nandc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,20 +2360,23 @@ static const struct qcom_nandc_props ipq806x_nandc_props = {
23602360
.supports_bam = false,
23612361
.use_codeword_fixup = true,
23622362
.dev_cmd_reg_start = 0x0,
2363+
.bam_offset = 0x30000,
23632364
};
23642365

23652366
static const struct qcom_nandc_props ipq4019_nandc_props = {
23662367
.ecc_modes = (ECC_BCH_4BIT | ECC_BCH_8BIT),
23672368
.supports_bam = true,
23682369
.nandc_part_of_qpic = true,
23692370
.dev_cmd_reg_start = 0x0,
2371+
.bam_offset = 0x30000,
23702372
};
23712373

23722374
static const struct qcom_nandc_props ipq8074_nandc_props = {
23732375
.ecc_modes = (ECC_BCH_4BIT | ECC_BCH_8BIT),
23742376
.supports_bam = true,
23752377
.nandc_part_of_qpic = true,
23762378
.dev_cmd_reg_start = 0x7000,
2379+
.bam_offset = 0x30000,
23772380
};
23782381

23792382
static const struct qcom_nandc_props sdx55_nandc_props = {
@@ -2382,6 +2385,7 @@ static const struct qcom_nandc_props sdx55_nandc_props = {
23822385
.nandc_part_of_qpic = true,
23832386
.qpic_version2 = true,
23842387
.dev_cmd_reg_start = 0x7000,
2388+
.bam_offset = 0x30000,
23852389
};
23862390

23872391
/*

drivers/spi/spi-qpic-snand.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,7 @@ static void qcom_spi_remove(struct platform_device *pdev)
16051605

16061606
static const struct qcom_nandc_props ipq9574_snandc_props = {
16071607
.dev_cmd_reg_start = 0x7000,
1608+
.bam_offset = 0x30000,
16081609
.supports_bam = true,
16091610
};
16101611

include/linux/mtd/nand-qpic-common.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,6 @@
199199
*/
200200
#define dev_cmd_reg_addr(nandc, reg) ((nandc)->props->dev_cmd_reg_start + (reg))
201201

202-
/* Returns the NAND register physical address */
203-
#define nandc_reg_phys(chip, offset) ((chip)->base_phys + (offset))
204-
205202
/* Returns the dma address for reg read buffer */
206203
#define reg_buf_dma_addr(chip, vaddr) \
207204
((chip)->reg_read_dma + \
@@ -454,6 +451,7 @@ struct qcom_nand_controller {
454451
struct qcom_nandc_props {
455452
u32 ecc_modes;
456453
u32 dev_cmd_reg_start;
454+
u32 bam_offset;
457455
bool supports_bam;
458456
bool nandc_part_of_qpic;
459457
bool qpic_version2;

0 commit comments

Comments
 (0)