2 * Broadcom specific AMBA
3 * ChipCommon NAND flash interface
5 * Licensed under the GNU/GPL. See COPYING for details.
8 #include "bcma_private.h"
10 #include <linux/bitops.h>
11 #include <linux/platform_device.h>
12 #include <linux/platform_data/brcmnand.h>
13 #include <linux/bcma/bcma.h>
15 /* Alternate NAND controller driver name in order to allow both bcm47xxnflash
16 * and bcma_brcmnand to be built into the same kernel image.
18 static const char *bcma_nflash_alt_name
= "bcma_brcmnand";
20 struct platform_device bcma_nflash_dev
= {
21 .name
= "bcma_nflash",
25 static const char *probes
[] = { "bcm47xxpart", NULL
};
27 /* Initialize NAND flash access */
28 int bcma_nflash_init(struct bcma_drv_cc
*cc
)
30 struct bcma_bus
*bus
= cc
->core
->bus
;
33 if (bus
->chipinfo
.id
!= BCMA_CHIP_ID_BCM4706
&&
34 cc
->core
->id
.rev
!= 38) {
35 bcma_err(bus
, "NAND flash on unsupported board!\n");
39 if (!(cc
->capabilities
& BCMA_CC_CAP_NFLASH
)) {
40 bcma_err(bus
, "NAND flash not present according to ChipCommon\n");
44 cc
->nflash
.present
= true;
45 if (cc
->core
->id
.rev
== 38 &&
46 (cc
->status
& BCMA_CC_CHIPST_5357_NAND_BOOT
)) {
47 cc
->nflash
.boot
= true;
48 /* Determine the chip select that is being used */
49 reg
= bcma_cc_read32(cc
, BCMA_CC_NAND_CS_NAND_SELECT
) & 0xff;
50 cc
->nflash
.brcmnand_info
.chip_select
= ffs(reg
) - 1;
51 cc
->nflash
.brcmnand_info
.part_probe_types
= probes
;
52 cc
->nflash
.brcmnand_info
.ecc_stepsize
= 512;
53 cc
->nflash
.brcmnand_info
.ecc_strength
= 1;
54 bcma_nflash_dev
.name
= bcma_nflash_alt_name
;
57 /* Prepare platform device, but don't register it yet. It's too early,
58 * malloc (required by device_private_init) is not available yet. */
59 bcma_nflash_dev
.dev
.platform_data
= &cc
->nflash
;