Fork of the vendor (Boundary Devices) u-boot for Reform 2, with minor tweaks. The goal is to migrate to mainstream u-boot or barebox ASAP. The main impediment so far is the 4GB RAM config.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
 

52 lines
1.3 KiB

  1. /*
  2. * (C) Copyright 2014 Andreas Bießmann <andreas@biessmann.org>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. /*
  7. * This is a host tool for generating an appropriate string out of board
  8. * configuration. The string is required for correct generation of PMECC
  9. * header which in turn is required for NAND flash booting of Atmel AT91 style
  10. * hardware.
  11. *
  12. * See doc/README.atmel_pmecc for more information.
  13. */
  14. #include <config.h>
  15. #include <stdlib.h>
  16. static int pmecc_get_ecc_bytes(int cap, int sector_size)
  17. {
  18. int m = 12 + sector_size / 512;
  19. return (m * cap + 7) / 8;
  20. }
  21. int main(int argc, char *argv[])
  22. {
  23. unsigned int use_pmecc = 0;
  24. unsigned int sector_per_page;
  25. unsigned int sector_size = CONFIG_PMECC_SECTOR_SIZE;
  26. unsigned int oob_size = CONFIG_SYS_NAND_OOBSIZE;
  27. unsigned int ecc_bits = CONFIG_PMECC_CAP;
  28. unsigned int ecc_offset;
  29. #ifdef CONFIG_ATMEL_NAND_HW_PMECC
  30. use_pmecc = 1;
  31. #endif
  32. sector_per_page = CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_PMECC_SECTOR_SIZE;
  33. ecc_offset = oob_size -
  34. pmecc_get_ecc_bytes(ecc_bits, sector_size) * sector_per_page;
  35. printf("usePmecc=%d,", use_pmecc);
  36. printf("sectorPerPage=%d,", sector_per_page);
  37. printf("sectorSize=%d,", sector_size);
  38. printf("spareSize=%d,", oob_size);
  39. printf("eccBits=%d,", ecc_bits);
  40. printf("eccOffset=%d", ecc_offset);
  41. printf("\n");
  42. exit(EXIT_SUCCESS);
  43. }