arch.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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/mach/arch.h>
  30. #include <mach/dma.h>
  31. #include <mach/hardware.h>
  32. #include <mach/csp/mm_io.h>
  33. #include <mach/csp/chipcHw_def.h>
  34. #include <mach/csp/chipcHw_inline.h>
  35. #include <cfg_global.h>
  36. #include "core.h"
  37. HW_DECLARE_SPINLOCK(arch)
  38. HW_DECLARE_SPINLOCK(gpio)
  39. #if defined(CONFIG_DEBUG_SPINLOCK)
  40. EXPORT_SYMBOL(bcmring_gpio_reg_lock);
  41. #endif
  42. /* sysctl */
  43. int bcmring_arch_warm_reboot; /* do a warm reboot on hard reset */
  44. static struct ctl_table_header *bcmring_sysctl_header;
  45. static struct ctl_table bcmring_sysctl_warm_reboot[] = {
  46. {
  47. .procname = "warm",
  48. .data = &bcmring_arch_warm_reboot,
  49. .maxlen = sizeof(int),
  50. .mode = 0644,
  51. .proc_handler = proc_dointvec},
  52. {}
  53. };
  54. static struct ctl_table bcmring_sysctl_reboot[] = {
  55. {
  56. .procname = "reboot",
  57. .mode = 0555,
  58. .child = bcmring_sysctl_warm_reboot},
  59. {}
  60. };
  61. static struct platform_device nand_device = {
  62. .name = "bcm-nand",
  63. .id = -1,
  64. };
  65. static struct platform_device *devices[] __initdata = {
  66. &nand_device,
  67. };
  68. /****************************************************************************
  69. *
  70. * Called from the customize_machine function in arch/arm/kernel/setup.c
  71. *
  72. * The customize_machine function is tagged as an arch_initcall
  73. * (see include/linux/init.h for the order that the various init sections
  74. * are called in.
  75. *
  76. *****************************************************************************/
  77. static void __init bcmring_init_machine(void)
  78. {
  79. bcmring_sysctl_header = register_sysctl_table(bcmring_sysctl_reboot);
  80. /* Enable spread spectrum */
  81. chipcHw_enableSpreadSpectrum();
  82. platform_add_devices(devices, ARRAY_SIZE(devices));
  83. bcmring_amba_init();
  84. dma_init();
  85. }
  86. /****************************************************************************
  87. *
  88. * Called from setup_arch (in arch/arm/kernel/setup.c) to fixup any tags
  89. * passed in by the boot loader.
  90. *
  91. *****************************************************************************/
  92. static void __init bcmring_fixup(struct machine_desc *desc,
  93. struct tag *t, char **cmdline, struct meminfo *mi) {
  94. #ifdef CONFIG_BLK_DEV_INITRD
  95. printk(KERN_NOTICE "bcmring_fixup\n");
  96. t->hdr.tag = ATAG_CORE;
  97. t->hdr.size = tag_size(tag_core);
  98. t->u.core.flags = 0;
  99. t->u.core.pagesize = PAGE_SIZE;
  100. t->u.core.rootdev = 31 << 8 | 0;
  101. t = tag_next(t);
  102. t->hdr.tag = ATAG_MEM;
  103. t->hdr.size = tag_size(tag_mem32);
  104. t->u.mem.start = CFG_GLOBAL_RAM_BASE;
  105. t->u.mem.size = CFG_GLOBAL_RAM_SIZE;
  106. t = tag_next(t);
  107. t->hdr.tag = ATAG_NONE;
  108. t->hdr.size = 0;
  109. #endif
  110. }
  111. /****************************************************************************
  112. *
  113. * Machine Description
  114. *
  115. *****************************************************************************/
  116. MACHINE_START(BCMRING, "BCMRING")
  117. /* Maintainer: Broadcom Corporation */
  118. .phys_io = MM_IO_START,
  119. .io_pg_offst = (MM_IO_BASE >> 18) & 0xfffc,
  120. .fixup = bcmring_fixup,
  121. .map_io = bcmring_map_io,
  122. .init_irq = bcmring_init_irq,
  123. .timer = &bcmring_timer,
  124. .init_machine = bcmring_init_machine
  125. MACHINE_END