xilinx_ml300.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Xilinx ML300 evaluation board initialization
  3. *
  4. * Author: MontaVista Software, Inc.
  5. * source@mvista.com
  6. *
  7. * 2002-2004 (c) MontaVista Software, Inc. This file is licensed under the
  8. * terms of the GNU General Public License version 2. This program is licensed
  9. * "as is" without any warranty of any kind, whether express or implied.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/irq.h>
  13. #include <linux/tty.h>
  14. #include <linux/serial.h>
  15. #include <linux/serial_core.h>
  16. #include <linux/serial_8250.h>
  17. #include <linux/serialP.h>
  18. #include <asm/io.h>
  19. #include <asm/machdep.h>
  20. #include <syslib/gen550.h>
  21. #include <syslib/virtex_devices.h>
  22. #include <platforms/4xx/xparameters/xparameters.h>
  23. /*
  24. * As an overview of how the following functions (platform_init,
  25. * ml300_map_io, ml300_setup_arch and ml300_init_IRQ) fit into the
  26. * kernel startup procedure, here's a call tree:
  27. *
  28. * start_here arch/ppc/kernel/head_4xx.S
  29. * early_init arch/ppc/kernel/setup.c
  30. * machine_init arch/ppc/kernel/setup.c
  31. * platform_init this file
  32. * ppc4xx_init arch/ppc/syslib/ppc4xx_setup.c
  33. * parse_bootinfo
  34. * find_bootinfo
  35. * "setup some default ppc_md pointers"
  36. * MMU_init arch/ppc/mm/init.c
  37. * *ppc_md.setup_io_mappings == ml300_map_io this file
  38. * ppc4xx_map_io arch/ppc/syslib/ppc4xx_setup.c
  39. * start_kernel init/main.c
  40. * setup_arch arch/ppc/kernel/setup.c
  41. * #if defined(CONFIG_KGDB)
  42. * *ppc_md.kgdb_map_scc() == gen550_kgdb_map_scc
  43. * #endif
  44. * *ppc_md.setup_arch == ml300_setup_arch this file
  45. * ppc4xx_setup_arch arch/ppc/syslib/ppc4xx_setup.c
  46. * ppc4xx_find_bridges arch/ppc/syslib/ppc405_pci.c
  47. * init_IRQ arch/ppc/kernel/irq.c
  48. * *ppc_md.init_IRQ == ml300_init_IRQ this file
  49. * ppc4xx_init_IRQ arch/ppc/syslib/ppc4xx_setup.c
  50. * ppc4xx_pic_init arch/ppc/syslib/xilinx_pic.c
  51. */
  52. const char* virtex_machine_name = "ML300 Reference Design";
  53. #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
  54. static volatile unsigned *powerdown_base =
  55. (volatile unsigned *) XPAR_POWER_0_POWERDOWN_BASEADDR;
  56. static void
  57. xilinx_power_off(void)
  58. {
  59. local_irq_disable();
  60. out_be32(powerdown_base, XPAR_POWER_0_POWERDOWN_VALUE);
  61. while (1) ;
  62. }
  63. #endif
  64. void __init
  65. ml300_map_io(void)
  66. {
  67. ppc4xx_map_io();
  68. #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
  69. powerdown_base = ioremap((unsigned long) powerdown_base,
  70. XPAR_POWER_0_POWERDOWN_HIGHADDR -
  71. XPAR_POWER_0_POWERDOWN_BASEADDR + 1);
  72. #endif
  73. }
  74. void __init
  75. ml300_setup_arch(void)
  76. {
  77. virtex_early_serial_map();
  78. ppc4xx_setup_arch(); /* calls ppc4xx_find_bridges() */
  79. /* Identify the system */
  80. printk(KERN_INFO "Xilinx ML300 Reference System (Virtex-II Pro)\n");
  81. }
  82. /* Called after board_setup_irq from ppc4xx_init_IRQ(). */
  83. void __init
  84. ml300_init_irq(void)
  85. {
  86. ppc4xx_init_IRQ();
  87. }
  88. void __init
  89. platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
  90. unsigned long r6, unsigned long r7)
  91. {
  92. ppc4xx_init(r3, r4, r5, r6, r7);
  93. ppc_md.setup_arch = ml300_setup_arch;
  94. ppc_md.setup_io_mappings = ml300_map_io;
  95. ppc_md.init_IRQ = ml300_init_irq;
  96. #if defined(XPAR_POWER_0_POWERDOWN_BASEADDR)
  97. ppc_md.power_off = xilinx_power_off;
  98. #endif
  99. #ifdef CONFIG_KGDB
  100. ppc_md.early_serial_map = virtex_early_serial_map;
  101. #endif
  102. }