sysinfo-common.c 662 B

1234567891011121314151617181920212223242526272829
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * System information routines for all OMAP based boards.
  4. *
  5. * (C) Copyright 2017 Linaro Ltd.
  6. * Sam Protsenko <semen.protsenko@linaro.org>
  7. */
  8. #include <asm/arch/omap.h>
  9. #include <asm/io.h>
  10. #include <asm/omap_common.h>
  11. /**
  12. * Tell if device is GP/HS/EMU/TST.
  13. */
  14. u32 get_device_type(void)
  15. {
  16. #if defined(CONFIG_OMAP34XX)
  17. /*
  18. * On OMAP3 systems we call this early enough that we must just
  19. * use the direct offset for safety.
  20. */
  21. return (readl(OMAP34XX_CTRL_BASE + 0x2f0) & DEVICE_TYPE_MASK) >>
  22. DEVICE_TYPE_SHIFT;
  23. #else
  24. return (readl((*ctrl)->control_status) & DEVICE_TYPE_MASK) >>
  25. DEVICE_TYPE_SHIFT;
  26. #endif
  27. }