cpu_info.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * (C) Copyright 2010
  3. * David Mueller <d.mueller@elsoft.ch>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <asm/io.h>
  25. #include <asm/arch/s3c24x0_cpu.h>
  26. typedef ulong (*getfreq)(void);
  27. static const getfreq freq_f[] = {
  28. get_FCLK,
  29. get_HCLK,
  30. get_PCLK,
  31. };
  32. static const char freq_c[] = { 'F', 'H', 'P' };
  33. int print_cpuinfo(void)
  34. {
  35. int i;
  36. char buf[32];
  37. /* the S3C2400 seems to be lacking a CHIP ID register */
  38. #ifndef CONFIG_S3C2400
  39. ulong cpuid;
  40. struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
  41. cpuid = readl(&gpio->gstatus1);
  42. printf("CPUID: %8lX\n", cpuid);
  43. #endif
  44. for (i = 0; i < ARRAY_SIZE(freq_f); i++)
  45. printf("%cCLK: %8s MHz\n", freq_c[i], strmhz(buf, freq_f[i]()));
  46. return 0;
  47. }