soc-info.c 670 B

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2017 Socionext Inc.
  4. * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  5. */
  6. #include <linux/bitfield.h>
  7. #include <linux/io.h>
  8. #include <linux/types.h>
  9. #include "sg-regs.h"
  10. #include "soc-info.h"
  11. unsigned int uniphier_get_soc_id(void)
  12. {
  13. u32 rev = readl(sg_base + SG_REVISION);
  14. return FIELD_GET(SG_REVISION_TYPE_MASK, rev);
  15. }
  16. unsigned int uniphier_get_soc_model(void)
  17. {
  18. u32 rev = readl(sg_base + SG_REVISION);
  19. return FIELD_GET(SG_REVISION_MODEL_MASK, rev);
  20. }
  21. unsigned int uniphier_get_soc_revision(void)
  22. {
  23. u32 rev = readl(sg_base + SG_REVISION);
  24. return FIELD_GET(SG_REVISION_REV_MASK, rev);
  25. }