cpu.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * (C) Copyright 2010
  3. * Marvell Semiconductor <www.marvell.com>
  4. * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
  5. * Contributor: Mahavir Jain <mjain@marvell.com>
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23. * MA 02110-1301 USA
  24. */
  25. #include <common.h>
  26. #include <asm/arch/cpu.h>
  27. #include <asm/arch/armada100.h>
  28. #define UARTCLK14745KHZ (APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(1))
  29. #define SET_MRVL_ID (1<<8)
  30. #define L2C_RAM_SEL (1<<4)
  31. int arch_cpu_init(void)
  32. {
  33. u32 val;
  34. struct armd1cpu_registers *cpuregs =
  35. (struct armd1cpu_registers *) ARMD1_CPU_BASE;
  36. struct armd1apb1_registers *apb1clkres =
  37. (struct armd1apb1_registers *) ARMD1_APBC1_BASE;
  38. struct armd1mpmu_registers *mpmu =
  39. (struct armd1mpmu_registers *) ARMD1_MPMU_BASE;
  40. /* set SEL_MRVL_ID bit in ARMADA100_CPU_CONF register */
  41. val = readl(&cpuregs->cpu_conf);
  42. val = val | SET_MRVL_ID;
  43. writel(val, &cpuregs->cpu_conf);
  44. /* Enable Clocks for all hardware units */
  45. writel(0xFFFFFFFF, &mpmu->acgr);
  46. /* Turn on AIB and AIB-APB Functional clock */
  47. writel(APBC_APBCLK | APBC_FNCLK, &apb1clkres->aib);
  48. /* ensure L2 cache is not mapped as SRAM */
  49. val = readl(&cpuregs->cpu_conf);
  50. val = val & ~(L2C_RAM_SEL);
  51. writel(val, &cpuregs->cpu_conf);
  52. /* Enable GPIO clock */
  53. writel(APBC_APBCLK, &apb1clkres->gpio);
  54. #ifdef CONFIG_I2C_MV
  55. /* Enable general I2C clock */
  56. writel(APBC_RST | APBC_FNCLK | APBC_APBCLK, &apb1clkres->twsi0);
  57. writel(APBC_FNCLK | APBC_APBCLK, &apb1clkres->twsi0);
  58. /* Enable power I2C clock */
  59. writel(APBC_RST | APBC_FNCLK | APBC_APBCLK, &apb1clkres->twsi1);
  60. writel(APBC_FNCLK | APBC_APBCLK, &apb1clkres->twsi1);
  61. #endif
  62. /*
  63. * Enable Functional and APB clock at 14.7456MHz
  64. * for configured UART console
  65. */
  66. #if (CONFIG_SYS_NS16550_COM1 == ARMD1_UART3_BASE)
  67. writel(UARTCLK14745KHZ, &apb1clkres->uart3);
  68. #elif (CONFIG_SYS_NS16550_COM1 == ARMD1_UART2_BASE)
  69. writel(UARTCLK14745KHZ, &apb1clkres->uart2);
  70. #else
  71. writel(UARTCLK14745KHZ, &apb1clkres->uart1);
  72. #endif
  73. icache_enable();
  74. return 0;
  75. }
  76. #if defined(CONFIG_DISPLAY_CPUINFO)
  77. int print_cpuinfo(void)
  78. {
  79. u32 id;
  80. struct armd1cpu_registers *cpuregs =
  81. (struct armd1cpu_registers *) ARMD1_CPU_BASE;
  82. id = readl(&cpuregs->chip_id);
  83. printf("SoC: Armada 88AP%X-%X\n", (id & 0xFFF), (id >> 0x10));
  84. return 0;
  85. }
  86. #endif
  87. #ifdef CONFIG_I2C_MV
  88. void i2c_clk_enable(void)
  89. {
  90. }
  91. #endif