driver_chipcommon_pflash.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Broadcom specific AMBA
  3. * ChipCommon parallel flash
  4. *
  5. * Licensed under the GNU/GPL. See COPYING for details.
  6. */
  7. #include "bcma_private.h"
  8. #include <linux/bcma/bcma.h>
  9. #include <linux/mtd/physmap.h>
  10. #include <linux/platform_device.h>
  11. static const char * const part_probes[] = { "bcm47xxpart", NULL };
  12. static struct physmap_flash_data bcma_pflash_data = {
  13. .part_probe_types = part_probes,
  14. };
  15. static struct resource bcma_pflash_resource = {
  16. .name = "bcma_pflash",
  17. .flags = IORESOURCE_MEM,
  18. };
  19. struct platform_device bcma_pflash_dev = {
  20. .name = "physmap-flash",
  21. .dev = {
  22. .platform_data = &bcma_pflash_data,
  23. },
  24. .resource = &bcma_pflash_resource,
  25. .num_resources = 1,
  26. };
  27. int bcma_pflash_init(struct bcma_drv_cc *cc)
  28. {
  29. struct bcma_pflash *pflash = &cc->pflash;
  30. pflash->present = true;
  31. if (!(bcma_read32(cc->core, BCMA_CC_FLASH_CFG) & BCMA_CC_FLASH_CFG_DS))
  32. bcma_pflash_data.width = 1;
  33. else
  34. bcma_pflash_data.width = 2;
  35. bcma_pflash_resource.start = BCMA_SOC_FLASH2;
  36. bcma_pflash_resource.end = BCMA_SOC_FLASH2 + BCMA_SOC_FLASH2_SZ;
  37. return 0;
  38. }