setup.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Setup pointers to hardware dependent routines.
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org)
  9. * Copyright (C) 2001, 2002, 2003 by Liam Davies (ldavies@agile.tv)
  10. *
  11. */
  12. #include <linux/config.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/pci.h>
  15. #include <linux/init.h>
  16. #include <asm/bootinfo.h>
  17. #include <asm/time.h>
  18. #include <asm/io.h>
  19. #include <asm/irq.h>
  20. #include <asm/processor.h>
  21. #include <asm/reboot.h>
  22. #include <asm/gt64120.h>
  23. #include <asm/cobalt/cobalt.h>
  24. extern void cobalt_machine_restart(char *command);
  25. extern void cobalt_machine_halt(void);
  26. extern void cobalt_machine_power_off(void);
  27. int cobalt_board_id;
  28. static char my_cmdline[CL_SIZE] = {
  29. "console=ttyS0,115200 "
  30. #ifdef CONFIG_IP_PNP
  31. "ip=on "
  32. #endif
  33. #ifdef CONFIG_ROOT_NFS
  34. "root=/dev/nfs "
  35. #else
  36. "root=/dev/hda1 "
  37. #endif
  38. };
  39. const char *get_system_type(void)
  40. {
  41. return "MIPS Cobalt";
  42. }
  43. static void __init cobalt_timer_setup(struct irqaction *irq)
  44. {
  45. /* Load timer value for 150 Hz */
  46. GALILEO_OUTL(500000, GT_TC0_OFS);
  47. /* Register our timer interrupt */
  48. setup_irq(COBALT_TIMER_IRQ, irq);
  49. /* Enable timer ints */
  50. GALILEO_OUTL((GALILEO_ENTC0 | GALILEO_SELTC0), GT_TC_CONTROL_OFS);
  51. /* Unmask timer int */
  52. GALILEO_OUTL(0x100, GT_INTRMASK_OFS);
  53. }
  54. extern struct pci_ops gt64111_pci_ops;
  55. static struct resource cobalt_mem_resource = {
  56. "GT64111 PCI MEM", GT64111_IO_BASE, 0xffffffffUL, IORESOURCE_MEM
  57. };
  58. static struct resource cobalt_io_resource = {
  59. "GT64111 IO MEM", 0x00001000UL, 0x0fffffffUL, IORESOURCE_IO
  60. };
  61. static struct resource cobalt_io_resources[] = {
  62. { "dma1", 0x00, 0x1f, IORESOURCE_BUSY },
  63. { "timer", 0x40, 0x5f, IORESOURCE_BUSY },
  64. { "keyboard", 0x60, 0x6f, IORESOURCE_BUSY },
  65. { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY },
  66. { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
  67. };
  68. #define COBALT_IO_RESOURCES (sizeof(cobalt_io_resources)/sizeof(struct resource))
  69. static struct pci_controller cobalt_pci_controller = {
  70. .pci_ops = &gt64111_pci_ops,
  71. .mem_resource = &cobalt_mem_resource,
  72. .mem_offset = 0,
  73. .io_resource = &cobalt_io_resource,
  74. .io_offset = 0x00001000UL - GT64111_IO_BASE
  75. };
  76. static void __init cobalt_setup(void)
  77. {
  78. unsigned int devfn = PCI_DEVFN(COBALT_PCICONF_VIA, 0);
  79. int i;
  80. _machine_restart = cobalt_machine_restart;
  81. _machine_halt = cobalt_machine_halt;
  82. _machine_power_off = cobalt_machine_power_off;
  83. board_timer_setup = cobalt_timer_setup;
  84. set_io_port_base(KSEG1ADDR(GT64111_IO_BASE));
  85. /*
  86. * This is a prom style console. We just poke at the
  87. * UART to make it talk.
  88. * Only use this console if you really screw up and can't
  89. * get to the stage of setting up a real serial console.
  90. */
  91. /*ns16550_setup_console();*/
  92. /* request I/O space for devices used on all i[345]86 PCs */
  93. for (i = 0; i < COBALT_IO_RESOURCES; i++)
  94. request_resource(&ioport_resource, cobalt_io_resources + i);
  95. /* Read the cobalt id register out of the PCI config space */
  96. PCI_CFG_SET(devfn, (VIA_COBALT_BRD_ID_REG & ~0x3));
  97. cobalt_board_id = GALILEO_INL(GT_PCI0_CFGDATA_OFS);
  98. cobalt_board_id >>= ((VIA_COBALT_BRD_ID_REG & 3) * 8);
  99. cobalt_board_id = VIA_COBALT_BRD_REG_to_ID(cobalt_board_id);
  100. #ifdef CONFIG_PCI
  101. register_pci_controller(&cobalt_pci_controller);
  102. #endif
  103. }
  104. early_initcall(cobalt_setup);
  105. /*
  106. * Prom init. We read our one and only communication with the firmware.
  107. * Grab the amount of installed memory
  108. */
  109. void __init prom_init(void)
  110. {
  111. int argc = fw_arg0;
  112. strcpy(arcs_cmdline, my_cmdline);
  113. mips_machgroup = MACH_GROUP_COBALT;
  114. add_memory_region(0x0, argc & 0x7fffffff, BOOT_MEM_RAM);
  115. }
  116. unsigned long __init prom_free_prom_memory(void)
  117. {
  118. /* Nothing to do! */
  119. return 0;
  120. }