arch.c 4.2 KB

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