160-cfi-swap.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --- a/drivers/mtd/chips/cfi_cmdset_0002.c
  2. +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
  3. @@ -1152,6 +1152,9 @@ static int __xipram do_write_oneword(str
  4. int retry_cnt = 0;
  5. adr += chip->start;
  6. +#ifdef CONFIG_AMAZON
  7. + adr ^= 2;
  8. +#endif
  9. mutex_lock(&chip->mutex);
  10. ret = get_chip(map, chip, adr, FL_WRITING);
  11. @@ -1420,7 +1423,11 @@ static int __xipram do_write_buffer(stru
  12. z = 0;
  13. while(z < words * map_bankwidth(map)) {
  14. datum = map_word_load(map, buf);
  15. +#ifdef CONFIG_AMAZON
  16. + map_write(map, datum, (adr + z) ^ 0x2);
  17. +#else
  18. map_write(map, datum, adr + z);
  19. +#endif
  20. z += map_bankwidth(map);
  21. buf += map_bankwidth(map);
  22. @@ -1665,6 +1672,9 @@ static int __xipram do_erase_oneblock(st
  23. int ret = 0;
  24. adr += chip->start;
  25. +#ifdef CONFIG_AMAZON
  26. + adr ^= 2;
  27. +#endif
  28. mutex_lock(&chip->mutex);
  29. ret = get_chip(map, chip, adr, FL_ERASING);
  30. @@ -1793,6 +1803,10 @@ static int do_atmel_lock(struct map_info
  31. struct cfi_private *cfi = map->fldrv_priv;
  32. int ret;
  33. +#ifdef CONFIG_AMAZON
  34. + adr ^= 2;
  35. +#endif
  36. +
  37. mutex_lock(&chip->mutex);
  38. ret = get_chip(map, chip, adr + chip->start, FL_LOCKING);
  39. if (ret)
  40. @@ -1828,6 +1842,10 @@ static int do_atmel_unlock(struct map_in
  41. struct cfi_private *cfi = map->fldrv_priv;
  42. int ret;
  43. +#ifdef CONFIG_AMAZON
  44. + adr ^= 2;
  45. +#endif
  46. +
  47. mutex_lock(&chip->mutex);
  48. ret = get_chip(map, chip, adr + chip->start, FL_UNLOCKING);
  49. if (ret)