arch.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /*****************************************************************************
  2. * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved.
  3. *
  4. * Unless you and Broadcom execute a separate written software license
  5. * agreement governing use of this software, this software is licensed to you
  6. * under the terms of the GNU General Public License version 2, available at
  7. * http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
  8. *
  9. * Notwithstanding the above, under no circumstances may you combine this
  10. * software in any way with any other Broadcom software provided under a
  11. * license other than the GPL, without Broadcom's express prior written
  12. * consent.
  13. *****************************************************************************/
  14. #include <linux/kernel.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/types.h>
  17. #include <linux/sched.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/init.h>
  20. #include <linux/errno.h>
  21. #include <linux/spinlock.h>
  22. #include <linux/module.h>
  23. #include <linux/proc_fs.h>
  24. #include <linux/sysctl.h>
  25. #include <asm/irq.h>
  26. #include <asm/setup.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/time.h>
  29. #include <asm/pmu.h>
  30. #include <asm/mach/arch.h>
  31. #include <mach/dma.h>
  32. #include <mach/hardware.h>
  33. #include <mach/csp/mm_io.h>
  34. #include <mach/csp/chipcHw_def.h>
  35. #include <mach/csp/chipcHw_inline.h>
  36. #include <cfg_global.h>
  37. #include "core.h"
  38. HW_DECLARE_SPINLOCK(arch)
  39. HW_DECLARE_SPINLOCK(gpio)
  40. #if defined(CONFIG_DEBUG_SPINLOCK)
  41. EXPORT_SYMBOL(bcmring_gpio_reg_lock);
  42. #endif
  43. /* sysctl */
  44. int bcmring_arch_warm_reboot; /* do a warm reboot on hard reset */
  45. static struct ctl_table_header *bcmring_sysctl_header;
  46. static struct ctl_table bcmring_sysctl_warm_reboot[] = {
  47. {
  48. .procname = "warm",
  49. .data = &bcmring_arch_warm_reboot,
  50. .maxlen = sizeof(int),
  51. .mode = 0644,
  52. .proc_handler = proc_dointvec},
  53. {}
  54. };
  55. static struct ctl_table bcmring_sysctl_reboot[] = {
  56. {
  57. .procname = "reboot",
  58. .mode = 0555,
  59. .child = bcmring_sysctl_warm_reboot},
  60. {}
  61. };
  62. static struct resource nand_resource[] = {
  63. [0] = {
  64. .start = MM_ADDR_IO_NAND,
  65. .end = MM_ADDR_IO_NAND + 0x1000 - 1,
  66. .flags = IORESOURCE_MEM,
  67. },
  68. };
  69. static struct platform_device nand_device = {
  70. .name = "bcm-nand",
  71. .id = -1,
  72. .resource = nand_resource,
  73. .num_resources = ARRAY_SIZE(nand_resource),
  74. };
  75. static struct resource pmu_resource = {
  76. .start = IRQ_PMUIRQ,
  77. .end = IRQ_PMUIRQ,
  78. .flags = IORESOURCE_IRQ,
  79. };
  80. static struct platform_device pmu_device = {
  81. .name = "arm-pmu",
  82. .id = ARM_PMU_DEVICE_CPU,
  83. .resource = &pmu_resource,
  84. .num_resources = 1,
  85. };
  86. static struct platform_device *devices[] __initdata = {
  87. &nand_device,
  88. &pmu_device,
  89. };
  90. /****************************************************************************
  91. *
  92. * Called from the customize_machine function in arch/arm/kernel/setup.c
  93. *
  94. * The customize_machine function is tagged as an arch_initcall
  95. * (see include/linux/init.h for the order that the various init sections
  96. * are called in.
  97. *
  98. *****************************************************************************/
  99. static void __init bcmring_init_machine(void)
  100. {
  101. bcmring_sysctl_header = register_sysctl_table(bcmring_sysctl_reboot);
  102. /* Enable spread spectrum */
  103. chipcHw_enableSpreadSpectrum();
  104. platform_add_devices(devices, ARRAY_SIZE(devices));
  105. bcmring_amba_init();
  106. dma_init();
  107. }
  108. /****************************************************************************
  109. *
  110. * Called from setup_arch (in arch/arm/kernel/setup.c) to fixup any tags
  111. * passed in by the boot loader.
  112. *
  113. *****************************************************************************/
  114. static void __init bcmring_fixup(struct machine_desc *desc,
  115. struct tag *t, char **cmdline, struct meminfo *mi) {
  116. #ifdef CONFIG_BLK_DEV_INITRD
  117. printk(KERN_NOTICE "bcmring_fixup\n");
  118. t->hdr.tag = ATAG_CORE;
  119. t->hdr.size = tag_size(tag_core);
  120. t->u.core.flags = 0;
  121. t->u.core.pagesize = PAGE_SIZE;
  122. t->u.core.rootdev = 31 << 8 | 0;
  123. t = tag_next(t);
  124. t->hdr.tag = ATAG_MEM;
  125. t->hdr.size = tag_size(tag_mem32);
  126. t->u.mem.start = CFG_GLOBAL_RAM_BASE;
  127. t->u.mem.size = CFG_GLOBAL_RAM_SIZE;
  128. t = tag_next(t);
  129. t->hdr.tag = ATAG_NONE;
  130. t->hdr.size = 0;
  131. #endif
  132. }
  133. /****************************************************************************
  134. *
  135. * Machine Description
  136. *
  137. *****************************************************************************/
  138. MACHINE_START(BCMRING, "BCMRING")
  139. /* Maintainer: Broadcom Corporation */
  140. .phys_io = MM_IO_START,
  141. .io_pg_offst = (MM_IO_BASE >> 18) & 0xfffc,
  142. .fixup = bcmring_fixup,
  143. .map_io = bcmring_map_io,
  144. .init_irq = bcmring_init_irq,
  145. .timer = &bcmring_timer,
  146. .init_machine = bcmring_init_machine
  147. MACHINE_END