432-mtd-bcm47xxpart-detect-T_Meter-partition.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  2. Subject: mtd: bcm47xxpart: detect T_Meter partition
  3. It can be found on many Netgear devices. It consists of many 0x30 blocks
  4. starting with 4D 54.
  5. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  6. ---
  7. drivers/mtd/bcm47xxpart.c | 10 ++++++++++
  8. 1 file changed, 10 insertions(+)
  9. --- a/drivers/mtd/bcm47xxpart.c
  10. +++ b/drivers/mtd/bcm47xxpart.c
  11. @@ -40,6 +40,7 @@
  12. #define NVRAM_HEADER 0x48534C46 /* FLSH */
  13. #define POT_MAGIC1 0x54544f50 /* POTT */
  14. #define POT_MAGIC2 0x504f /* OP */
  15. +#define T_METER_MAGIC 0x4D540000 /* MT */
  16. #define ML_MAGIC1 0x39685a42
  17. #define ML_MAGIC2 0x26594131
  18. #define TRX_MAGIC 0x30524448
  19. @@ -183,6 +184,15 @@ static int bcm47xxpart_parse(struct mtd_
  20. MTD_WRITEABLE);
  21. continue;
  22. }
  23. +
  24. + /* T_Meter */
  25. + if ((le32_to_cpu(buf[0x000 / 4]) & 0xFFFF0000) == T_METER_MAGIC &&
  26. + (le32_to_cpu(buf[0x030 / 4]) & 0xFFFF0000) == T_METER_MAGIC &&
  27. + (le32_to_cpu(buf[0x060 / 4]) & 0xFFFF0000) == T_METER_MAGIC) {
  28. + bcm47xxpart_add_part(&parts[curr_part++], "T_Meter", offset,
  29. + MTD_WRITEABLE);
  30. + continue;
  31. + }
  32. /* TRX */
  33. if (buf[0x000 / 4] == TRX_MAGIC) {