xilinx_ml403.c 3.3 KB

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