Path: blob/master/drivers/bcma/driver_chipcommon_nflash.c
26278 views
/*1* Broadcom specific AMBA2* ChipCommon NAND flash interface3*4* Licensed under the GNU/GPL. See COPYING for details.5*/67#include "bcma_private.h"89#include <linux/bitops.h>10#include <linux/platform_device.h>11#include <linux/platform_data/brcmnand.h>12#include <linux/bcma/bcma.h>1314/* Alternate NAND controller driver name in order to allow both bcm47xxnflash15* and bcma_brcmnand to be built into the same kernel image.16*/17static const char *bcma_nflash_alt_name = "bcma_brcmnand";1819struct platform_device bcma_nflash_dev = {20.name = "bcma_nflash",21.num_resources = 0,22};2324static const char *probes[] = { "bcm47xxpart", NULL };2526/* Initialize NAND flash access */27int bcma_nflash_init(struct bcma_drv_cc *cc)28{29struct bcma_bus *bus = cc->core->bus;30u32 reg;3132if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4706 &&33cc->core->id.rev != 38) {34bcma_err(bus, "NAND flash on unsupported board!\n");35return -ENOTSUPP;36}3738if (!(cc->capabilities & BCMA_CC_CAP_NFLASH)) {39bcma_err(bus, "NAND flash not present according to ChipCommon\n");40return -ENODEV;41}4243cc->nflash.present = true;44if (cc->core->id.rev == 38 &&45(cc->status & BCMA_CC_CHIPST_5357_NAND_BOOT)) {46cc->nflash.boot = true;47/* Determine the chip select that is being used */48reg = bcma_cc_read32(cc, BCMA_CC_NAND_CS_NAND_SELECT) & 0xff;49cc->nflash.brcmnand_info.chip_select = ffs(reg) - 1;50cc->nflash.brcmnand_info.part_probe_types = probes;51cc->nflash.brcmnand_info.ecc_stepsize = 512;52cc->nflash.brcmnand_info.ecc_strength = 1;53bcma_nflash_dev.name = bcma_nflash_alt_name;54}5556/* Prepare platform device, but don't register it yet. It's too early,57* malloc (required by device_private_init) is not available yet. */58bcma_nflash_dev.dev.platform_data = &cc->nflash;5960return 0;61}626364