fsl_8xxx_misc.c 1014 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2008 Extreme Engineering Solutions, Inc.
  4. */
  5. #include <common.h>
  6. #include <asm/mmu.h>
  7. #ifdef CONFIG_PCA953X
  8. #include <pca953x.h>
  9. /*
  10. * Determine if a board's flashes are write protected
  11. */
  12. int board_flash_wp_on(void)
  13. {
  14. if (pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) &
  15. CONFIG_SYS_PCA953X_NVM_WP)
  16. return 1;
  17. return 0;
  18. }
  19. #endif
  20. /*
  21. * Return a board's derivative model number. For example:
  22. * return 2 for the XPedite5372 and return 1 for the XPedite5201.
  23. */
  24. uint get_board_derivative(void)
  25. {
  26. #if defined(CONFIG_MPC85xx)
  27. volatile ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
  28. #elif defined(CONFIG_MPC86xx)
  29. volatile immap_t *immap = (immap_t *)CONFIG_SYS_CCSRBAR;
  30. volatile ccsr_gur_t *gur = &immap->im_gur;
  31. #endif
  32. /*
  33. * The top 4 lines of the local bus address are pulled low/high and
  34. * can be read to determine the least significant digit of a board's
  35. * model number.
  36. */
  37. return gur->gpporcr >> 28;
  38. }