400-bcm963xx_flashmap.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. From a4d005c91d403d9f3d0272db6cc46202c06ec774 Mon Sep 17 00:00:00 2001
  2. From: Axel Gembe <ago@bastart.eu.org>
  3. Date: Mon, 12 May 2008 18:54:09 +0200
  4. Subject: [PATCH] bcm963xx: flashmap support
  5. Signed-off-by: Axel Gembe <ago@bastart.eu.org>
  6. ---
  7. arch/mips/bcm63xx/boards/board_bcm963xx.c | 19 +----------------
  8. drivers/mtd/maps/bcm963xx-flash.c | 32 ++++++++++++++++++++++++----
  9. drivers/mtd/redboot.c | 13 +++++++++--
  10. 3 files changed, 38 insertions(+), 26 deletions(-)
  11. --- a/arch/mips/bcm63xx/dev-flash.c
  12. +++ b/arch/mips/bcm63xx/dev-flash.c
  13. @@ -35,7 +35,7 @@ static struct mtd_partition mtd_partitio
  14. }
  15. };
  16. -static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL };
  17. +static const char *bcm63xx_part_types[] = { "bcm63xxpart", "RedBoot", NULL };
  18. static struct physmap_flash_data flash_data = {
  19. .width = 2,
  20. --- a/drivers/mtd/redboot.c
  21. +++ b/drivers/mtd/redboot.c
  22. @@ -72,6 +72,7 @@ static int parse_redboot_partitions(stru
  23. int nulllen = 0;
  24. int numslots;
  25. unsigned long offset;
  26. + unsigned long fis_origin = 0;
  27. #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
  28. static char nullstring[] = "unallocated";
  29. #endif
  30. @@ -176,6 +177,16 @@ static int parse_redboot_partitions(stru
  31. goto out;
  32. }
  33. + if (data && data->origin) {
  34. + fis_origin = data->origin;
  35. + } else {
  36. + for (i = 0; i < numslots; i++) {
  37. + if (!strncmp(buf[i].name, "RedBoot", 8)) {
  38. + fis_origin = (buf[i].flash_base & (master->size << 1) - 1);
  39. + }
  40. + }
  41. + }
  42. +
  43. for (i = 0; i < numslots; i++) {
  44. struct fis_list *new_fl, **prev;
  45. @@ -196,10 +207,10 @@ static int parse_redboot_partitions(stru
  46. goto out;
  47. }
  48. new_fl->img = &buf[i];
  49. - if (data && data->origin)
  50. - buf[i].flash_base -= data->origin;
  51. - else
  52. - buf[i].flash_base &= master->size-1;
  53. + if (fis_origin)
  54. + buf[i].flash_base -= fis_origin;
  55. +
  56. + buf[i].flash_base &= (master->size << 1) - 1;
  57. /* I'm sure the JFFS2 code has done me permanent damage.
  58. * I now think the following is _normal_