002-add-init-size-param.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Add --chip_0_size param to override the size of the mtd partition which is
  2. required if the SPL does not occupy the entire partition. For Gateworks
  3. Ventana boards the 'uboot' partition contains both the SPL and uboot.
  4. --- a/src/main.c
  5. +++ b/src/main.c
  6. @@ -94,6 +94,7 @@ void usage(void)
  7. " [KOBS] boot structures config options\n"
  8. " --chip_0_device_path=<path> .......... Device of boot (default /dev/mtd0)\n"
  9. " --chip_1_device_path=<path> .......... The second chip in case of multichip NAND\n"
  10. + " --chip_0_size=<size> ................. Override size of chip_0 device\n"
  11. " --search_exponent=<value> ............ NCB field (default 2)\n"
  12. " --data_setup_time=<value> ............ NCB field (default 80)\n"
  13. " --data_hold_time=<value> ............. NCB field (default 60)\n"
  14. --- a/src/mtd.c
  15. +++ b/src/mtd.c
  16. @@ -876,6 +876,11 @@ struct mtd_data *mtd_open(const struct m
  17. goto out;
  18. }
  19. + /* override MTD size */
  20. + if (md->cfg.chip_0_size) {
  21. + miu->size = md->cfg.chip_0_size;
  22. + }
  23. +
  24. /* verify it's a nand */
  25. if (miu->type != MTD_NANDFLASH
  26. && miu->type != MTD_MLCNANDFLASH) {
  27. @@ -3385,7 +3390,7 @@ static const struct {
  28. } mtd_int_args[] = {
  29. ARG_IGNORE(chip_count),
  30. ARG_IGNORE(chip_0_offset),
  31. - ARG_IGNORE(chip_0_size),
  32. + ARG(chip_0_size),
  33. ARG_IGNORE(chip_1_offset),
  34. ARG_IGNORE(chip_1_size),
  35. ARG(search_exponent),
  36. @@ -3578,7 +3583,7 @@ void mtd_cfg_dump(struct mtd_config *cfg
  37. // Pd(chip_count);
  38. Ps(chip_0_device_path);
  39. // Pd(chip_0_offset);
  40. -// Pd(chip_0_size);
  41. + Pd(chip_0_size);
  42. Ps(chip_1_device_path);
  43. // Pd(chip_1_offset);
  44. // Pd(chip_1_size);