cpu.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * (C) Copyright 2010
  3. * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
  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/hardware.h>
  26. #include <asm/arch/spr_misc.h>
  27. int arch_cpu_init(void)
  28. {
  29. struct misc_regs *const misc_p =
  30. (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
  31. u32 periph1_clken, periph_clk_cfg;
  32. periph1_clken = readl(&misc_p->periph1_clken);
  33. #if defined(CONFIG_SPEAR3XX)
  34. periph1_clken |= MISC_GPT2ENB;
  35. #elif defined(CONFIG_SPEAR600)
  36. periph1_clken |= MISC_GPT3ENB;
  37. #endif
  38. #if defined(CONFIG_PL011_SERIAL)
  39. periph1_clken |= MISC_UART0ENB;
  40. periph_clk_cfg = readl(&misc_p->periph_clk_cfg);
  41. periph_clk_cfg &= ~CONFIG_SPEAR_UARTCLKMSK;
  42. periph_clk_cfg |= CONFIG_SPEAR_UART48M;
  43. writel(periph_clk_cfg, &misc_p->periph_clk_cfg);
  44. #endif
  45. #if defined(CONFIG_DESIGNWARE_ETH)
  46. periph1_clken |= MISC_ETHENB;
  47. #endif
  48. #if defined(CONFIG_DW_UDC)
  49. periph1_clken |= MISC_USBDENB;
  50. #endif
  51. #if defined(CONFIG_DW_I2C)
  52. periph1_clken |= MISC_I2CENB;
  53. #endif
  54. #if defined(CONFIG_ST_SMI)
  55. periph1_clken |= MISC_SMIENB;
  56. #endif
  57. #if defined(CONFIG_NAND_FSMC)
  58. periph1_clken |= MISC_FSMCENB;
  59. #endif
  60. writel(periph1_clken, &misc_p->periph1_clken);
  61. return 0;
  62. }
  63. #ifdef CONFIG_DISPLAY_CPUINFO
  64. int print_cpuinfo(void)
  65. {
  66. #ifdef CONFIG_SPEAR300
  67. printf("CPU: SPEAr300\n");
  68. #elif defined(CONFIG_SPEAR310)
  69. printf("CPU: SPEAr310\n");
  70. #elif defined(CONFIG_SPEAR320)
  71. printf("CPU: SPEAr320\n");
  72. #elif defined(CONFIG_SPEAR600)
  73. printf("CPU: SPEAr600\n");
  74. #else
  75. #error CPU not supported in spear platform
  76. #endif
  77. return 0;
  78. }
  79. #endif