fsl_8xxx_misc.c 1017 B

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