setup.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * linux/arch/sh/boards/hp6xx/setup.c
  3. *
  4. * Copyright (C) 2002 Andriy Skulysh
  5. *
  6. * May be copied or modified under the terms of the GNU General Public
  7. * License. See linux/COPYING for more information.
  8. *
  9. * Setup code for an HP680 (internal peripherials only)
  10. */
  11. #include <linux/types.h>
  12. #include <linux/init.h>
  13. #include <asm/hd64461.h>
  14. #include <asm/io.h>
  15. #include <asm/irq.h>
  16. #include <asm/hp6xx.h>
  17. #include <asm/cpu/dac.h>
  18. #define SCPCR 0xa4000116
  19. #define SCPDR 0xa4000136
  20. static void __init hp6xx_setup(char **cmdline_p)
  21. {
  22. u8 v8;
  23. u16 v;
  24. v = inw(HD64461_STBCR);
  25. v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
  26. HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
  27. HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
  28. HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST |
  29. HD64461_STBCR_SAFECKE_IST;
  30. #ifndef CONFIG_HD64461_ENABLER
  31. v |= HD64461_STBCR_SPC1ST;
  32. #endif
  33. outw(v, HD64461_STBCR);
  34. v = inw(HD64461_GPADR);
  35. v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
  36. outw(v, HD64461_GPADR);
  37. outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR);
  38. #ifndef CONFIG_HD64461_ENABLER
  39. outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR);
  40. #endif
  41. sh_dac_output(0, DAC_SPEAKER_VOLUME);
  42. sh_dac_disable(DAC_SPEAKER_VOLUME);
  43. v8 = ctrl_inb(DACR);
  44. v8 &= ~DACR_DAE;
  45. ctrl_outb(v8,DACR);
  46. v8 = ctrl_inb(SCPDR);
  47. v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y;
  48. v8 &= ~SCPDR_TS_SCAN_ENABLE;
  49. ctrl_outb(v8, SCPDR);
  50. v = ctrl_inw(SCPCR);
  51. v &= ~SCPCR_TS_MASK;
  52. v |= SCPCR_TS_ENABLE;
  53. ctrl_outw(v, SCPCR);
  54. }
  55. /*
  56. * XXX: This is stupid, we should have a generic machine vector for the cchips
  57. * and just wrap the platform setup code in to this, as it's the only thing
  58. * that ends up being different.
  59. */
  60. struct sh_machine_vector mv_hp6xx __initmv = {
  61. .mv_name = "hp6xx",
  62. .mv_setup = hp6xx_setup,
  63. .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM,
  64. .mv_inb = hd64461_inb,
  65. .mv_inw = hd64461_inw,
  66. .mv_inl = hd64461_inl,
  67. .mv_outb = hd64461_outb,
  68. .mv_outw = hd64461_outw,
  69. .mv_outl = hd64461_outl,
  70. .mv_inb_p = hd64461_inb_p,
  71. .mv_inw_p = hd64461_inw,
  72. .mv_inl_p = hd64461_inl,
  73. .mv_outb_p = hd64461_outb_p,
  74. .mv_outw_p = hd64461_outw,
  75. .mv_outl_p = hd64461_outl,
  76. .mv_insb = hd64461_insb,
  77. .mv_insw = hd64461_insw,
  78. .mv_insl = hd64461_insl,
  79. .mv_outsb = hd64461_outsb,
  80. .mv_outsw = hd64461_outsw,
  81. .mv_outsl = hd64461_outsl,
  82. .mv_readw = hd64461_readw,
  83. .mv_writew = hd64461_writew,
  84. .mv_irq_demux = hd64461_irq_demux,
  85. };
  86. ALIAS_MV(hp6xx)