004-fix-cal_nfc_geometry.patch 1.2 KB

123456789101112131415161718192021222324252627
  1. The Freescale downstream vendor kernel has a patch that exports the bch
  2. flash geometry via a debugfs file. This is not available in mainline linux
  3. kernels so the fallback method calculates the geometry based on known info
  4. from the mtd partition. A bug exists in this funcion where it fails to
  5. assume that block0 ECC is the same as the other blocks by default.
  6. --- a/src/mtd.c
  7. +++ b/src/mtd.c
  8. @@ -610,7 +610,7 @@ static int cal_nfc_geometry(struct mtd_d
  9. /* The two are fixed, please change them when the driver changes. */
  10. geo->metadata_size_in_bytes = 10;
  11. geo->gf_len = 13;
  12. - geo->ecc_chunkn_size_in_bytes = 512;
  13. + geo->ecc_chunkn_size_in_bytes = geo->ecc_chunk0_size_in_bytes = 512;
  14. if (mtd->oobsize > geo->ecc_chunkn_size_in_bytes) {
  15. geo->gf_len = 14;
  16. @@ -700,8 +700,9 @@ int parse_nfc_geometry(struct mtd_data *
  17. unsigned int value;
  18. if (!plat_config_data->m_u32UseNfcGeo) {
  19. + /* fsl kernel patch provides bch_geometry via debugfs */
  20. if (!(node = fopen(dbg_geometry_node_path, "r"))) {
  21. - fprintf(stderr, "Cannot open BCH geometry node: \"%s\"",
  22. + fprintf(stderr, "Cannot open BCH geometry node: \"%s\"\n",
  23. dbg_geometry_node_path);
  24. return cal_nfc_geometry(md);
  25. }