Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: brcmnand: Fix v7.1 register offsets

The BRCMNAND controller revision 7.1 is almost 100% compatible with the
previous v6.0 register offset layout, except for the Correctable Error
Reporting Threshold registers. Fix this by adding another table with the
correct offsets for CORR_THRESHOLD and CORR_THRESHOLD_EXT.

Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>

authored by

Florian Fainelli and committed by
David Woodhouse
d267aefc 5e64c29e

+33 -1
+33 -1
drivers/mtd/nand/brcmnand/brcmnand.c
··· 311 311 [BRCMNAND_FC_BASE] = 0x400, 312 312 }; 313 313 314 + /* BRCMNAND v7.1 */ 315 + static const u16 brcmnand_regs_v71[] = { 316 + [BRCMNAND_CMD_START] = 0x04, 317 + [BRCMNAND_CMD_EXT_ADDRESS] = 0x08, 318 + [BRCMNAND_CMD_ADDRESS] = 0x0c, 319 + [BRCMNAND_INTFC_STATUS] = 0x14, 320 + [BRCMNAND_CS_SELECT] = 0x18, 321 + [BRCMNAND_CS_XOR] = 0x1c, 322 + [BRCMNAND_LL_OP] = 0x20, 323 + [BRCMNAND_CS0_BASE] = 0x50, 324 + [BRCMNAND_CS1_BASE] = 0, 325 + [BRCMNAND_CORR_THRESHOLD] = 0xdc, 326 + [BRCMNAND_CORR_THRESHOLD_EXT] = 0xe0, 327 + [BRCMNAND_UNCORR_COUNT] = 0xfc, 328 + [BRCMNAND_CORR_COUNT] = 0x100, 329 + [BRCMNAND_CORR_EXT_ADDR] = 0x10c, 330 + [BRCMNAND_CORR_ADDR] = 0x110, 331 + [BRCMNAND_UNCORR_EXT_ADDR] = 0x114, 332 + [BRCMNAND_UNCORR_ADDR] = 0x118, 333 + [BRCMNAND_SEMAPHORE] = 0x150, 334 + [BRCMNAND_ID] = 0x194, 335 + [BRCMNAND_ID_EXT] = 0x198, 336 + [BRCMNAND_LL_RDATA] = 0x19c, 337 + [BRCMNAND_OOB_READ_BASE] = 0x200, 338 + [BRCMNAND_OOB_READ_10_BASE] = 0, 339 + [BRCMNAND_OOB_WRITE_BASE] = 0x280, 340 + [BRCMNAND_OOB_WRITE_10_BASE] = 0, 341 + [BRCMNAND_FC_BASE] = 0x400, 342 + }; 343 + 314 344 enum brcmnand_cs_reg { 315 345 BRCMNAND_CS_CFG_EXT = 0, 316 346 BRCMNAND_CS_CFG, ··· 436 406 } 437 407 438 408 /* Register offsets */ 439 - if (ctrl->nand_version >= 0x0600) 409 + if (ctrl->nand_version >= 0x0701) 410 + ctrl->reg_offsets = brcmnand_regs_v71; 411 + else if (ctrl->nand_version >= 0x0600) 440 412 ctrl->reg_offsets = brcmnand_regs_v60; 441 413 else if (ctrl->nand_version >= 0x0500) 442 414 ctrl->reg_offsets = brcmnand_regs_v50;