0400-mtd-mtdsplit-add-support-for-custom-trx-magic-for-Buffalo-WCR-1166DS.patch 924 B

123456789101112131415161718192021222324252627282930
  1. --- a/drivers/mtd/mtdsplit/mtdsplit_trx.c
  2. +++ b/drivers/mtd/mtdsplit/mtdsplit_trx.c
  3. @@ -13,6 +13,7 @@
  4. #include <linux/module.h>
  5. #include <linux/init.h>
  6. #include <linux/kernel.h>
  7. +#include <linux/of.h>
  8. #include <linux/slab.h>
  9. #include <linux/mtd/mtd.h>
  10. #include <linux/mtd/partitions.h>
  11. @@ -20,7 +21,8 @@
  12. #include "mtdsplit.h"
  13. -#define TRX_MAGIC 0x30524448 /* "HDR0" */
  14. +#define TRX_MAGIC 0x30524448 /* "HDR0" */
  15. +#define TRX_MAGIC_BUFFALO 0x746f435c
  16. struct trx_header {
  17. __le32 magic;
  18. @@ -82,7 +84,8 @@ mtdsplit_parse_trx(struct mtd_info *mast
  19. if (ret)
  20. continue;
  21. - if (hdr.magic != cpu_to_le32(TRX_MAGIC)) {
  22. + if (hdr.magic != cpu_to_le32(TRX_MAGIC) &&
  23. + !(of_machine_is_compatible("buffalo,wcr-1166ds") && hdr.magic == cpu_to_le32(TRX_MAGIC_BUFFALO))) {
  24. pr_debug("no valid trx header found in \"%s\" at offset %llx\n",
  25. master->name, (unsigned long long) offset);
  26. continue;