cpu-imx25.c 964 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * MX25 CPU type detection
  3. *
  4. * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
  5. * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. */
  12. #include <linux/module.h>
  13. #include <linux/io.h>
  14. #include <mach/hardware.h>
  15. #include <mach/iim.h>
  16. static int mx25_cpu_rev = -1;
  17. static int mx25_read_cpu_rev(void)
  18. {
  19. u32 rev;
  20. rev = __raw_readl(MX25_IO_ADDRESS(MX25_IIM_BASE_ADDR + MXC_IIMSREV));
  21. switch (rev) {
  22. case 0x00:
  23. return IMX_CHIP_REVISION_1_0;
  24. case 0x01:
  25. return IMX_CHIP_REVISION_1_1;
  26. default:
  27. return IMX_CHIP_REVISION_UNKNOWN;
  28. }
  29. }
  30. int mx25_revision(void)
  31. {
  32. if (mx25_cpu_rev == -1)
  33. mx25_cpu_rev = mx25_read_cpu_rev();
  34. return mx25_cpu_rev;
  35. }
  36. EXPORT_SYMBOL(mx25_revision);