311-bcm63xxpart_use_cfedetection.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --- a/drivers/mtd/bcm63xxpart.c
  2. +++ b/drivers/mtd/bcm63xxpart.c
  3. @@ -35,6 +35,8 @@
  4. #include <linux/mtd/mtd.h>
  5. #include <linux/mtd/partitions.h>
  6. #include <linux/of.h>
  7. +
  8. +#include <asm/mach-bcm63xx/bcm63xx_board.h>
  9. #define BCM963XX_CFE_BLOCK_SIZE SZ_64K /* always at least 64KiB */
  10. @@ -46,30 +48,6 @@
  11. #define STR_NULL_TERMINATE(x) \
  12. do { char *_str = (x); _str[sizeof(x) - 1] = 0; } while (0)
  13. -static int bcm63xx_detect_cfe(struct mtd_info *master)
  14. -{
  15. - char buf[9];
  16. - int ret;
  17. - size_t retlen;
  18. -
  19. - ret = mtd_read(master, BCM963XX_CFE_VERSION_OFFSET, 5, &retlen,
  20. - (void *)buf);
  21. - buf[retlen] = 0;
  22. -
  23. - if (ret)
  24. - return ret;
  25. -
  26. - if (strncmp("cfe-v", buf, 5) == 0)
  27. - return 0;
  28. -
  29. - /* very old CFE's do not have the cfe-v string, so check for magic */
  30. - ret = mtd_read(master, BCM963XX_CFE_MAGIC_OFFSET, 8, &retlen,
  31. - (void *)buf);
  32. - buf[retlen] = 0;
  33. -
  34. - return strncmp("CFE1CFE1", buf, 8);
  35. -}
  36. -
  37. static int bcm63xx_read_nvram(struct mtd_info *master,
  38. struct bcm963xx_nvram *nvram)
  39. {
  40. @@ -152,7 +130,7 @@ static int bcm63xx_parse_cfe_partitions(
  41. struct bcm963xx_nvram *nvram = NULL;
  42. int ret;
  43. - if (bcm63xx_detect_cfe(master))
  44. + if (!bcm63xx_is_cfe_present())
  45. return -EINVAL;
  46. nvram = vzalloc(sizeof(*nvram));