malta_setup.c
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:4k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * Carsten Langgaard, carstenl@mips.com
  3.  * Copyright (C) 2000 MIPS Technologies, Inc.  All rights reserved.
  4.  *
  5.  *  This program is free software; you can distribute it and/or modify it
  6.  *  under the terms of the GNU General Public License (Version 2) as
  7.  *  published by the Free Software Foundation.
  8.  *
  9.  *  This program is distributed in the hope it will be useful, but WITHOUT
  10.  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11.  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12.  *  for more details.
  13.  *
  14.  *  You should have received a copy of the GNU General Public License along
  15.  *  with this program; if not, write to the Free Software Foundation, Inc.,
  16.  *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  17.  */
  18. #include <linux/config.h>
  19. #include <linux/init.h>
  20. #include <linux/sched.h>
  21. #include <linux/mc146818rtc.h>
  22. #include <linux/ioport.h>
  23. #include <linux/pci.h>
  24. #ifdef CONFIG_BLK_DEV_IDE
  25. #include <linux/ide.h>
  26. #endif
  27. #include <asm/cpu.h>
  28. #include <asm/bootinfo.h>
  29. #include <asm/irq.h>
  30. #include <asm/mips-boards/generic.h>
  31. #include <asm/mips-boards/prom.h>
  32. #include <asm/mips-boards/malta.h>
  33. #include <asm/mips-boards/maltaint.h>
  34. #ifdef CONFIG_BLK_DEV_FD
  35. #include <asm/floppy.h>
  36. #endif
  37. #include <asm/dma.h>
  38. #if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_PROM_CONSOLE)
  39. extern void console_setup(char *, int *);
  40. char serial_console[20];
  41. #endif
  42. #ifdef CONFIG_REMOTE_DEBUG
  43. extern void set_debug_traps(void);
  44. extern void rs_kgdb_hook(int);
  45. extern void breakpoint(void);
  46. static int remote_debug = 0;
  47. #endif
  48. extern struct ide_ops std_ide_ops;
  49. extern struct fd_ops std_fd_ops;
  50. extern struct rtc_ops malta_rtc_ops;
  51. extern struct kbd_ops std_kbd_ops;
  52. extern void mips_reboot_setup(void);
  53. struct resource standard_io_resources[] = {
  54. { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
  55. { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
  56. { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
  57. { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
  58. };
  59. #define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource))
  60. void __init malta_setup(void)
  61. {
  62. #ifdef CONFIG_REMOTE_DEBUG
  63. int rs_putDebugChar(char);
  64. char rs_getDebugChar(void);
  65. extern int (*generic_putDebugChar)(char);
  66. extern char (*generic_getDebugChar)(void);
  67. #endif
  68. char *argptr;
  69. int i;
  70. /* Request I/O space for devices used on the Malta board. */
  71. for (i = 0; i < STANDARD_IO_RESOURCES; i++)
  72. request_resource(&ioport_resource, standard_io_resources+i);
  73. /* 
  74.  * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge.
  75.  */
  76. enable_dma(4);
  77. #ifdef CONFIG_SERIAL_CONSOLE
  78. argptr = prom_getcmdline();
  79. if ((argptr = strstr(argptr, "console=")) == NULL) {
  80. argptr = prom_getcmdline();
  81. strcat(argptr, " console=ttyS0,38400");
  82. }
  83. #endif
  84. #ifdef CONFIG_REMOTE_DEBUG
  85. argptr = prom_getcmdline();
  86. if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
  87. int line;
  88. argptr += strlen("kgdb=ttyS");
  89. if (*argptr != '0' && *argptr != '1')
  90. printk("KGDB: Uknown serial line /dev/ttyS%c, "
  91.        "falling back to /dev/ttyS1n", *argptr);
  92. line = *argptr == '0' ? 0 : 1;
  93. printk("KGDB: Using serial line /dev/ttyS%d for sessionn",
  94.        line ? 1 : 0);
  95. rs_kgdb_hook(line);
  96. generic_putDebugChar = rs_putDebugChar;
  97. generic_getDebugChar = rs_getDebugChar;
  98. prom_printf("KGDB: Using serial line /dev/ttyS%d for session, "
  99.     "please connect your debuggern", line ? 1 : 0);
  100. remote_debug = 1;
  101. /* Breakpoints are in init_IRQ() */
  102. }
  103. #endif
  104. argptr = prom_getcmdline();
  105. if ((argptr = strstr(argptr, "nofpu")) != NULL)
  106. mips_cpu.options &= ~MIPS_CPU_FPU;
  107. rtc_ops = &malta_rtc_ops;
  108. #ifdef CONFIG_BLK_DEV_IDE
  109.         ide_ops = &std_ide_ops;
  110. #endif
  111. #ifdef CONFIG_BLK_DEV_FD
  112.         fd_ops = &std_fd_ops;
  113. #endif
  114. #ifdef CONFIG_PC_KEYB
  115. kbd_ops = &std_kbd_ops;
  116. #endif
  117. mips_reboot_setup();
  118. }