cpu.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * (C) Copyright 2011
  3. * Marvell Semiconductor <www.marvell.com>
  4. * Written-by: Lei Wen <leiwen@marvell.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  22. * MA 02110-1301 USA
  23. */
  24. #include <common.h>
  25. #include <asm/arch/cpu.h>
  26. #include <asm/arch/pantheon.h>
  27. #define UARTCLK14745KHZ (APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(1))
  28. #define SET_MRVL_ID (1<<8)
  29. #define L2C_RAM_SEL (1<<4)
  30. int arch_cpu_init(void)
  31. {
  32. u32 val;
  33. struct panthcpu_registers *cpuregs =
  34. (struct panthcpu_registers*) PANTHEON_CPU_BASE;
  35. struct panthapb_registers *apbclkres =
  36. (struct panthapb_registers*) PANTHEON_APBC_BASE;
  37. struct panthmpmu_registers *mpmu =
  38. (struct panthmpmu_registers*) PANTHEON_MPMU_BASE;
  39. struct panthapmu_registers *apmu =
  40. (struct panthapmu_registers *) PANTHEON_APMU_BASE;
  41. /* set SEL_MRVL_ID bit in PANTHEON_CPU_CONF register */
  42. val = readl(&cpuregs->cpu_conf);
  43. val = val | SET_MRVL_ID;
  44. writel(val, &cpuregs->cpu_conf);
  45. /* Turn on clock gating (PMUM_CCGR) */
  46. writel(0xFFFFFFFF, &mpmu->ccgr);
  47. /* Turn on clock gating (PMUM_ACGR) */
  48. writel(0xFFFFFFFF, &mpmu->acgr);
  49. /* Turn on uart2 clock */
  50. writel(UARTCLK14745KHZ, &apbclkres->uart0);
  51. /* Enable GPIO clock */
  52. writel(APBC_APBCLK, &apbclkres->gpio);
  53. #ifdef CONFIG_I2C_MV
  54. /* Enable I2C clock */
  55. writel(APBC_RST | APBC_FNCLK | APBC_APBCLK, &apbclkres->twsi);
  56. writel(APBC_FNCLK | APBC_APBCLK, &apbclkres->twsi);
  57. #endif
  58. #ifdef CONFIG_MV_SDHCI
  59. /* Enable mmc clock */
  60. writel(APMU_PERI_CLK | APMU_AXI_CLK | APMU_PERI_RST | APMU_AXI_RST,
  61. &apmu->sd1);
  62. writel(APMU_PERI_CLK | APMU_AXI_CLK | APMU_PERI_RST | APMU_AXI_RST,
  63. &apmu->sd3);
  64. #endif
  65. icache_enable();
  66. return 0;
  67. }
  68. #if defined(CONFIG_DISPLAY_CPUINFO)
  69. int print_cpuinfo(void)
  70. {
  71. u32 id;
  72. struct panthcpu_registers *cpuregs =
  73. (struct panthcpu_registers*) PANTHEON_CPU_BASE;
  74. id = readl(&cpuregs->chip_id);
  75. printf("SoC: PANTHEON 88AP%X-%X\n", (id & 0xFFF), (id >> 0x10));
  76. return 0;
  77. }
  78. #endif
  79. #ifdef CONFIG_I2C_MV
  80. void i2c_clk_enable(void)
  81. {
  82. }
  83. #endif