cpu_info.c 738 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * (C) Copyright 2010
  3. * David Mueller <d.mueller@elsoft.ch>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <asm/io.h>
  9. #include <asm/arch/s3c24x0_cpu.h>
  10. typedef ulong (*getfreq)(void);
  11. static const getfreq freq_f[] = {
  12. get_FCLK,
  13. get_HCLK,
  14. get_PCLK,
  15. };
  16. static const char freq_c[] = { 'F', 'H', 'P' };
  17. int print_cpuinfo(void)
  18. {
  19. int i;
  20. char buf[32];
  21. /* the S3C2400 seems to be lacking a CHIP ID register */
  22. #ifndef CONFIG_S3C2400
  23. ulong cpuid;
  24. struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
  25. cpuid = readl(&gpio->gstatus1);
  26. printf("CPUID: %8lX\n", cpuid);
  27. #endif
  28. for (i = 0; i < ARRAY_SIZE(freq_f); i++)
  29. printf("%cCLK: %8s MHz\n", freq_c[i], strmhz(buf, freq_f[i]()));
  30. return 0;
  31. }