cpu-imx35.c 925 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * MX35 CPU type detection
  3. *
  4. * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #include <linux/module.h>
  12. #include <linux/io.h>
  13. #include "hardware.h"
  14. #include "iim.h"
  15. static int mx35_cpu_rev = -1;
  16. static int mx35_read_cpu_rev(void)
  17. {
  18. u32 rev;
  19. rev = imx_readl(MX35_IO_ADDRESS(MX35_IIM_BASE_ADDR + MXC_IIMSREV));
  20. switch (rev) {
  21. case 0x00:
  22. return IMX_CHIP_REVISION_1_0;
  23. case 0x10:
  24. return IMX_CHIP_REVISION_2_0;
  25. case 0x11:
  26. return IMX_CHIP_REVISION_2_1;
  27. default:
  28. return IMX_CHIP_REVISION_UNKNOWN;
  29. }
  30. }
  31. int mx35_revision(void)
  32. {
  33. if (mx35_cpu_rev == -1)
  34. mx35_cpu_rev = mx35_read_cpu_rev();
  35. return mx35_cpu_rev;
  36. }
  37. EXPORT_SYMBOL(mx35_revision);