sim_setup.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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/init.h>
  19. #include <linux/string.h>
  20. #include <linux/kernel.h>
  21. #include <linux/io.h>
  22. #include <linux/irq.h>
  23. #include <linux/ioport.h>
  24. #include <linux/tty.h>
  25. #include <linux/serial.h>
  26. #include <linux/serial_core.h>
  27. #include <linux/serial_8250.h>
  28. #include <asm/cpu.h>
  29. #include <asm/bootinfo.h>
  30. #include <asm/mips-boards/generic.h>
  31. #include <asm/mips-boards/prom.h>
  32. #include <asm/time.h>
  33. #include <asm/mips-boards/sim.h>
  34. #include <asm/mips-boards/simint.h>
  35. #include <asm/smp-ops.h>
  36. static void __init serial_init(void);
  37. unsigned int _isbonito;
  38. const char *get_system_type(void)
  39. {
  40. return "MIPSsim";
  41. }
  42. void __init plat_mem_setup(void)
  43. {
  44. set_io_port_base(0xbfd00000);
  45. serial_init();
  46. }
  47. extern struct plat_smp_ops ssmtc_smp_ops;
  48. void __init prom_init(void)
  49. {
  50. set_io_port_base(0xbfd00000);
  51. prom_meminit();
  52. if (cpu_has_mipsmt) {
  53. if (!register_vsmp_smp_ops())
  54. return;
  55. #ifdef CONFIG_MIPS_MT_SMTC
  56. register_smp_ops(&ssmtc_smp_ops);
  57. return;
  58. #endif
  59. }
  60. register_up_smp_ops();
  61. }
  62. static void __init serial_init(void)
  63. {
  64. #ifdef CONFIG_SERIAL_8250
  65. struct uart_port s;
  66. memset(&s, 0, sizeof(s));
  67. s.iobase = 0x3f8;
  68. /* hardware int 4 - the serial int, is CPU int 6
  69. but poll for now */
  70. s.irq = 0;
  71. s.uartclk = 1843200;
  72. s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
  73. s.iotype = UPIO_PORT;
  74. s.regshift = 0;
  75. s.timeout = 4;
  76. if (early_serial_setup(&s) != 0) {
  77. printk(KERN_ERR "Serial setup failed!\n");
  78. }
  79. #endif
  80. }