sim_setup.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
  3. *
  4. * This program is free software; you can distribute it and/or modify it
  5. * under the terms of the GNU General Public License (Version 2) as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  11. * for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along
  14. * with this program; if not, write to the Free Software Foundation, Inc.,
  15. * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  16. *
  17. */
  18. #include <linux/config.h>
  19. #include <linux/init.h>
  20. #include <linux/string.h>
  21. #include <linux/kernel.h>
  22. #include <linux/ioport.h>
  23. #include <linux/tty.h>
  24. #include <linux/serial.h>
  25. #include <linux/serial_core.h>
  26. #include <asm/cpu.h>
  27. #include <asm/bootinfo.h>
  28. #include <asm/irq.h>
  29. #include <asm/mips-boards/generic.h>
  30. #include <asm/mips-boards/prom.h>
  31. #include <asm/serial.h>
  32. #include <asm/io.h>
  33. #include <asm/time.h>
  34. #include <asm/mips-boards/sim.h>
  35. #include <asm/mips-boards/simint.h>
  36. extern void sim_time_init(void);
  37. extern void sim_timer_setup(struct irqaction *irq);
  38. static void __init serial_init(void);
  39. unsigned int _isbonito = 0;
  40. extern void __init sanitize_tlb_entries(void);
  41. const char *get_system_type(void)
  42. {
  43. return "MIPSsim";
  44. }
  45. void __init plat_setup(void)
  46. {
  47. set_io_port_base(0xbfd00000);
  48. serial_init();
  49. board_time_init = sim_time_init;
  50. board_timer_setup = sim_timer_setup;
  51. prom_printf("Linux started...\n");
  52. #ifdef CONFIG_MT_SMP
  53. sanitize_tlb_entries();
  54. #endif
  55. }
  56. void prom_init(void)
  57. {
  58. set_io_port_base(0xbfd00000);
  59. prom_printf("\nLINUX started...\n");
  60. prom_init_cmdline();
  61. prom_meminit();
  62. }
  63. static void __init serial_init(void)
  64. {
  65. #ifdef CONFIG_SERIAL_8250
  66. struct uart_port s;
  67. memset(&s, 0, sizeof(s));
  68. s.iobase = 0x3f8;
  69. /* hardware int 4 - the serial int, is CPU int 6
  70. but poll for now */
  71. s.irq = 0;
  72. s.uartclk = BASE_BAUD * 16;
  73. s.flags = ASYNC_BOOT_AUTOCONF | UPF_SKIP_TEST;
  74. s.iotype = SERIAL_IO_PORT | ASYNC_SKIP_TEST;
  75. s.regshift = 0;
  76. s.timeout = 4;
  77. if (early_serial_setup(&s) != 0) {
  78. prom_printf(KERN_ERR "Serial setup failed!\n");
  79. }
  80. #endif
  81. }