setup.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* $Id: setup.c,v 1.5 2003/08/04 01:51:58 lethal Exp $
  2. *
  3. * arch/sh/kernel/setup_cqreek.c
  4. *
  5. * Copyright (C) 2000 Niibe Yutaka
  6. *
  7. * CqREEK IDE/ISA Bridge Support.
  8. *
  9. */
  10. #include <linux/config.h>
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/irq.h>
  14. #include <asm/mach/cqreek.h>
  15. #include <asm/machvec.h>
  16. #include <asm/io.h>
  17. #include <asm/io_generic.h>
  18. #include <asm/irq.h>
  19. #include <asm/rtc.h>
  20. #define IDE_OFFSET 0xA4000000UL
  21. #define ISA_OFFSET 0xA4A00000UL
  22. const char *get_system_type(void)
  23. {
  24. return "CqREEK";
  25. }
  26. static unsigned long cqreek_port2addr(unsigned long port)
  27. {
  28. if (0x0000<=port && port<=0x0040)
  29. return IDE_OFFSET + port;
  30. if ((0x01f0<=port && port<=0x01f7) || port == 0x03f6)
  31. return IDE_OFFSET + port;
  32. return ISA_OFFSET + port;
  33. }
  34. /*
  35. * The Machine Vector
  36. */
  37. struct sh_machine_vector mv_cqreek __initmv = {
  38. #if defined(CONFIG_CPU_SH4)
  39. .mv_nr_irqs = 48,
  40. #elif defined(CONFIG_CPU_SUBTYPE_SH7708)
  41. .mv_nr_irqs = 32,
  42. #elif defined(CONFIG_CPU_SUBTYPE_SH7709)
  43. .mv_nr_irqs = 61,
  44. #endif
  45. .mv_init_irq = init_cqreek_IRQ,
  46. .mv_isa_port2addr = cqreek_port2addr,
  47. };
  48. ALIAS_MV(cqreek)
  49. /*
  50. * Initialize the board
  51. */
  52. void __init platform_setup(void)
  53. {
  54. int i;
  55. /* udelay is not available at setup time yet... */
  56. #define DELAY() do {for (i=0; i<10000; i++) ctrl_inw(0xa0000000);} while(0)
  57. if ((inw (BRIDGE_FEATURE) & 1)) { /* We have IDE interface */
  58. outw_p(0, BRIDGE_IDE_INTR_LVL);
  59. outw_p(0, BRIDGE_IDE_INTR_MASK);
  60. outw_p(0, BRIDGE_IDE_CTRL);
  61. DELAY();
  62. outw_p(0x8000, BRIDGE_IDE_CTRL);
  63. DELAY();
  64. outw_p(0xffff, BRIDGE_IDE_INTR_STAT); /* Clear interrupt status */
  65. outw_p(0x0f-14, BRIDGE_IDE_INTR_LVL); /* Use 14 IPR */
  66. outw_p(1, BRIDGE_IDE_INTR_MASK); /* Enable interrupt */
  67. cqreek_has_ide=1;
  68. }
  69. if ((inw (BRIDGE_FEATURE) & 2)) { /* We have ISA interface */
  70. outw_p(0, BRIDGE_ISA_INTR_LVL);
  71. outw_p(0, BRIDGE_ISA_INTR_MASK);
  72. outw_p(0, BRIDGE_ISA_CTRL);
  73. DELAY();
  74. outw_p(0x8000, BRIDGE_ISA_CTRL);
  75. DELAY();
  76. outw_p(0xffff, BRIDGE_ISA_INTR_STAT); /* Clear interrupt status */
  77. outw_p(0x0f-10, BRIDGE_ISA_INTR_LVL); /* Use 10 IPR */
  78. outw_p(0xfff8, BRIDGE_ISA_INTR_MASK); /* Enable interrupt */
  79. cqreek_has_isa=1;
  80. }
  81. printk(KERN_INFO "CqREEK Setup (IDE=%d, ISA=%d)...done\n", cqreek_has_ide, cqreek_has_isa);
  82. }