18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Broadcom specific AMBA 38c2ecf20Sopenharmony_ci * ChipCommon NAND flash interface 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Licensed under the GNU/GPL. See COPYING for details. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include "bcma_private.h" 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 118c2ecf20Sopenharmony_ci#include <linux/bcma/bcma.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cistruct platform_device bcma_nflash_dev = { 148c2ecf20Sopenharmony_ci .name = "bcma_nflash", 158c2ecf20Sopenharmony_ci .num_resources = 0, 168c2ecf20Sopenharmony_ci}; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* Initialize NAND flash access */ 198c2ecf20Sopenharmony_ciint bcma_nflash_init(struct bcma_drv_cc *cc) 208c2ecf20Sopenharmony_ci{ 218c2ecf20Sopenharmony_ci struct bcma_bus *bus = cc->core->bus; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4706 && 248c2ecf20Sopenharmony_ci cc->core->id.rev != 38) { 258c2ecf20Sopenharmony_ci bcma_err(bus, "NAND flash on unsupported board!\n"); 268c2ecf20Sopenharmony_ci return -ENOTSUPP; 278c2ecf20Sopenharmony_ci } 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci if (!(cc->capabilities & BCMA_CC_CAP_NFLASH)) { 308c2ecf20Sopenharmony_ci bcma_err(bus, "NAND flash not present according to ChipCommon\n"); 318c2ecf20Sopenharmony_ci return -ENODEV; 328c2ecf20Sopenharmony_ci } 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci cc->nflash.present = true; 358c2ecf20Sopenharmony_ci if (cc->core->id.rev == 38 && 368c2ecf20Sopenharmony_ci (cc->status & BCMA_CC_CHIPST_5357_NAND_BOOT)) 378c2ecf20Sopenharmony_ci cc->nflash.boot = true; 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci /* Prepare platform device, but don't register it yet. It's too early, 408c2ecf20Sopenharmony_ci * malloc (required by device_private_init) is not available yet. */ 418c2ecf20Sopenharmony_ci bcma_nflash_dev.dev.platform_data = &cc->nflash; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci return 0; 448c2ecf20Sopenharmony_ci} 45