common.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * arch/arm/mach-loki/common.c
  3. *
  4. * Core functions for Marvell Loki (88RC8480) SoCs
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/serial_8250.h>
  14. #include <linux/mbus.h>
  15. #include <linux/dma-mapping.h>
  16. #include <asm/page.h>
  17. #include <asm/timex.h>
  18. #include <asm/mach/map.h>
  19. #include <asm/mach/time.h>
  20. #include <mach/bridge-regs.h>
  21. #include <mach/loki.h>
  22. #include <plat/orion_nand.h>
  23. #include <plat/time.h>
  24. #include <plat/common.h>
  25. #include "common.h"
  26. /*****************************************************************************
  27. * I/O Address Mapping
  28. ****************************************************************************/
  29. static struct map_desc loki_io_desc[] __initdata = {
  30. {
  31. .virtual = LOKI_REGS_VIRT_BASE,
  32. .pfn = __phys_to_pfn(LOKI_REGS_PHYS_BASE),
  33. .length = LOKI_REGS_SIZE,
  34. .type = MT_DEVICE,
  35. },
  36. };
  37. void __init loki_map_io(void)
  38. {
  39. iotable_init(loki_io_desc, ARRAY_SIZE(loki_io_desc));
  40. }
  41. /*****************************************************************************
  42. * GE00
  43. ****************************************************************************/
  44. void __init loki_ge0_init(struct mv643xx_eth_platform_data *eth_data)
  45. {
  46. writel(0x00079220, GE0_VIRT_BASE + 0x20b0);
  47. orion_ge00_init(eth_data, &loki_mbus_dram_info,
  48. GE0_PHYS_BASE, IRQ_LOKI_GBE_A_INT,
  49. 0, LOKI_TCLK);
  50. }
  51. /*****************************************************************************
  52. * GE01
  53. ****************************************************************************/
  54. void __init loki_ge1_init(struct mv643xx_eth_platform_data *eth_data)
  55. {
  56. writel(0x00079220, GE1_VIRT_BASE + 0x20b0);
  57. orion_ge01_init(eth_data, &loki_mbus_dram_info,
  58. GE1_PHYS_BASE, IRQ_LOKI_GBE_B_INT,
  59. 0, LOKI_TCLK);
  60. }
  61. /*****************************************************************************
  62. * SAS/SATA
  63. ****************************************************************************/
  64. static struct resource loki_sas_resources[] = {
  65. {
  66. .name = "mvsas0 mem",
  67. .start = SAS0_PHYS_BASE,
  68. .end = SAS0_PHYS_BASE + 0x01ff,
  69. .flags = IORESOURCE_MEM,
  70. }, {
  71. .name = "mvsas0 irq",
  72. .start = IRQ_LOKI_SAS_A,
  73. .end = IRQ_LOKI_SAS_A,
  74. .flags = IORESOURCE_IRQ,
  75. }, {
  76. .name = "mvsas1 mem",
  77. .start = SAS1_PHYS_BASE,
  78. .end = SAS1_PHYS_BASE + 0x01ff,
  79. .flags = IORESOURCE_MEM,
  80. }, {
  81. .name = "mvsas1 irq",
  82. .start = IRQ_LOKI_SAS_B,
  83. .end = IRQ_LOKI_SAS_B,
  84. .flags = IORESOURCE_IRQ,
  85. },
  86. };
  87. static struct platform_device loki_sas = {
  88. .name = "mvsas",
  89. .id = 0,
  90. .dev = {
  91. .coherent_dma_mask = DMA_BIT_MASK(32),
  92. },
  93. .num_resources = ARRAY_SIZE(loki_sas_resources),
  94. .resource = loki_sas_resources,
  95. };
  96. void __init loki_sas_init(void)
  97. {
  98. writel(0x8300f707, DDR_REG(0x1424));
  99. platform_device_register(&loki_sas);
  100. }
  101. /*****************************************************************************
  102. * UART0
  103. ****************************************************************************/
  104. void __init loki_uart0_init(void)
  105. {
  106. orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
  107. IRQ_LOKI_UART0, LOKI_TCLK);
  108. }
  109. /*****************************************************************************
  110. * UART1
  111. ****************************************************************************/
  112. void __init loki_uart1_init(void)
  113. {
  114. orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
  115. IRQ_LOKI_UART1, LOKI_TCLK);
  116. }
  117. /*****************************************************************************
  118. * Time handling
  119. ****************************************************************************/
  120. void __init loki_init_early(void)
  121. {
  122. orion_time_set_base(TIMER_VIRT_BASE);
  123. }
  124. static void loki_timer_init(void)
  125. {
  126. orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
  127. IRQ_LOKI_BRIDGE, LOKI_TCLK);
  128. }
  129. struct sys_timer loki_timer = {
  130. .init = loki_timer_init,
  131. };
  132. /*****************************************************************************
  133. * General
  134. ****************************************************************************/
  135. void __init loki_init(void)
  136. {
  137. printk(KERN_INFO "Loki ID: 88RC8480. TCLK=%d.\n", LOKI_TCLK);
  138. loki_setup_cpu_mbus();
  139. }