driver_chipcommon_nflash.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Broadcom specific AMBA
  3. * ChipCommon NAND flash interface
  4. *
  5. * Licensed under the GNU/GPL. See COPYING for details.
  6. */
  7. #include "bcma_private.h"
  8. #include <linux/platform_device.h>
  9. #include <linux/bcma/bcma.h>
  10. struct platform_device bcma_nflash_dev = {
  11. .name = "bcma_nflash",
  12. .num_resources = 0,
  13. };
  14. /* Initialize NAND flash access */
  15. int bcma_nflash_init(struct bcma_drv_cc *cc)
  16. {
  17. struct bcma_bus *bus = cc->core->bus;
  18. if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4706 &&
  19. cc->core->id.rev != 38) {
  20. bcma_err(bus, "NAND flash on unsupported board!\n");
  21. return -ENOTSUPP;
  22. }
  23. if (!(cc->capabilities & BCMA_CC_CAP_NFLASH)) {
  24. bcma_err(bus, "NAND flash not present according to ChipCommon\n");
  25. return -ENODEV;
  26. }
  27. cc->nflash.present = true;
  28. if (cc->core->id.rev == 38 &&
  29. (cc->status & BCMA_CC_CHIPST_5357_NAND_BOOT))
  30. cc->nflash.boot = true;
  31. /* Prepare platform device, but don't register it yet. It's too early,
  32. * malloc (required by device_private_init) is not available yet. */
  33. bcma_nflash_dev.dev.platform_data = &cc->nflash;
  34. return 0;
  35. }