setup.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. *
  3. * By Dustin McIntire (dustin@sensoria.com) (c)2001
  4. *
  5. * Setup and IRQ handling code for the HD64465 companion chip.
  6. * by Greg Banks <gbanks@pocketpenguins.com>
  7. * Copyright (c) 2000 PocketPenguins Inc
  8. *
  9. * Derived from setup_hd64465.c which bore the message:
  10. * Greg Banks <gbanks@pocketpenguins.com>
  11. * Copyright (c) 2000 PocketPenguins Inc and
  12. * Copyright (C) 2000 YAEGASHI Takeshi
  13. * and setup_cqreek.c which bore message:
  14. * Copyright (C) 2000 Niibe Yutaka
  15. *
  16. * May be copied or modified under the terms of the GNU General Public
  17. * License. See linux/COPYING for more information.
  18. *
  19. * Setup functions for a Hitachi Big Sur Evaluation Board.
  20. *
  21. */
  22. #include <linux/sched.h>
  23. #include <linux/module.h>
  24. #include <linux/kernel.h>
  25. #include <linux/param.h>
  26. #include <linux/ioport.h>
  27. #include <linux/interrupt.h>
  28. #include <linux/init.h>
  29. #include <linux/irq.h>
  30. #include <linux/bitops.h>
  31. #include <asm/io.h>
  32. #include <asm/irq.h>
  33. #include <asm/machvec.h>
  34. #include <asm/bigsur/io.h>
  35. #include <asm/hd64465/hd64465.h>
  36. #include <asm/bigsur/bigsur.h>
  37. /*===========================================================*/
  38. // Big Sur Init Routines
  39. /*===========================================================*/
  40. const char *get_system_type(void)
  41. {
  42. return "Big Sur";
  43. }
  44. /*
  45. * The Machine Vector
  46. */
  47. extern void heartbeat_bigsur(void);
  48. extern void init_bigsur_IRQ(void);
  49. struct sh_machine_vector mv_bigsur __initmv = {
  50. .mv_nr_irqs = NR_IRQS, // Defined in <asm/irq.h>
  51. .mv_isa_port2addr = bigsur_isa_port2addr,
  52. .mv_irq_demux = bigsur_irq_demux,
  53. .mv_init_irq = init_bigsur_IRQ,
  54. #ifdef CONFIG_HEARTBEAT
  55. .mv_heartbeat = heartbeat_bigsur,
  56. #endif
  57. };
  58. ALIAS_MV(bigsur)
  59. int __init platform_setup(void)
  60. {
  61. /* Mask all 2nd level IRQ's */
  62. outb(-1,BIGSUR_IMR0);
  63. outb(-1,BIGSUR_IMR1);
  64. outb(-1,BIGSUR_IMR2);
  65. outb(-1,BIGSUR_IMR3);
  66. /* Mask 1st level interrupts */
  67. outb(-1,BIGSUR_IRLMR0);
  68. outb(-1,BIGSUR_IRLMR1);
  69. #if defined (CONFIG_HD64465) && defined (CONFIG_SERIAL)
  70. /* remap IO ports for first ISA serial port to HD64465 UART */
  71. bigsur_port_map(0x3f8, 8, CONFIG_HD64465_IOBASE + 0x8000, 1);
  72. #endif /* CONFIG_HD64465 && CONFIG_SERIAL */
  73. /* TODO: setup IDE registers */
  74. bigsur_port_map(BIGSUR_IDECTL_IOPORT, 2, BIGSUR_ICTL, 8);
  75. /* Setup the Ethernet port to BIGSUR_ETHER_IOPORT */
  76. bigsur_port_map(BIGSUR_ETHER_IOPORT, 16, BIGSUR_ETHR+BIGSUR_ETHER_IOPORT, 0);
  77. /* set page to 1 */
  78. outw(1, BIGSUR_ETHR+0xe);
  79. /* set the IO port to BIGSUR_ETHER_IOPORT */
  80. outw(BIGSUR_ETHER_IOPORT<<3, BIGSUR_ETHR+0x2);
  81. return 0;
  82. }