setup.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * linux/arch/sh/boards/hp6xx/setup.c
  3. *
  4. * Copyright (C) 2002 Andriy Skulysh
  5. * Copyright (C) 2007 Kristoffer Ericson <Kristoffer_e1@hotmail.com>
  6. *
  7. * May be copied or modified under the terms of the GNU General Public
  8. * License. See linux/COPYING for more information.
  9. *
  10. * Setup code for an HP680 (internal peripherials only)
  11. */
  12. #include <linux/types.h>
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <asm/hd64461.h>
  16. #include <asm/io.h>
  17. #include <asm/irq.h>
  18. #include <asm/hp6xx.h>
  19. #include <asm/cpu/dac.h>
  20. #define SCPCR 0xa4000116
  21. #define SCPDR 0xa4000136
  22. /* CF Slot */
  23. static struct resource cf_ide_resources[] = {
  24. [0] = {
  25. .start = 0x15000000 + 0x1f0,
  26. .end = 0x15000000 + 0x1f0 + 0x08 - 0x01,
  27. .flags = IORESOURCE_MEM,
  28. },
  29. [1] = {
  30. .start = 0x15000000 + 0x1fe,
  31. .end = 0x15000000 + 0x1fe + 0x01,
  32. .flags = IORESOURCE_MEM,
  33. },
  34. [2] = {
  35. .start = 93,
  36. .flags = IORESOURCE_IRQ,
  37. },
  38. };
  39. static struct platform_device cf_ide_device = {
  40. .name = "pata_platform",
  41. .id = -1,
  42. .num_resources = ARRAY_SIZE(cf_ide_resources),
  43. .resource = cf_ide_resources,
  44. };
  45. static struct platform_device *hp6xx_devices[] __initdata = {
  46. &cf_ide_device,
  47. };
  48. static int __init hp6xx_devices_setup(void)
  49. {
  50. return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices));
  51. }
  52. static void __init hp6xx_setup(char **cmdline_p)
  53. {
  54. u8 v8;
  55. u16 v;
  56. v = inw(HD64461_STBCR);
  57. v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
  58. HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
  59. HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
  60. HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST |
  61. HD64461_STBCR_SAFECKE_IST;
  62. #ifndef CONFIG_HD64461_ENABLER
  63. v |= HD64461_STBCR_SPC1ST;
  64. #endif
  65. outw(v, HD64461_STBCR);
  66. v = inw(HD64461_GPADR);
  67. v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
  68. outw(v, HD64461_GPADR);
  69. outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR);
  70. #ifndef CONFIG_HD64461_ENABLER
  71. outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR);
  72. #endif
  73. sh_dac_output(0, DAC_SPEAKER_VOLUME);
  74. sh_dac_disable(DAC_SPEAKER_VOLUME);
  75. v8 = ctrl_inb(DACR);
  76. v8 &= ~DACR_DAE;
  77. ctrl_outb(v8,DACR);
  78. v8 = ctrl_inb(SCPDR);
  79. v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y;
  80. v8 &= ~SCPDR_TS_SCAN_ENABLE;
  81. ctrl_outb(v8, SCPDR);
  82. v = ctrl_inw(SCPCR);
  83. v &= ~SCPCR_TS_MASK;
  84. v |= SCPCR_TS_ENABLE;
  85. ctrl_outw(v, SCPCR);
  86. }
  87. device_initcall(hp6xx_devices_setup);
  88. struct sh_machine_vector mv_hp6xx __initmv = {
  89. .mv_name = "hp6xx",
  90. .mv_setup = hp6xx_setup,
  91. .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM,
  92. .mv_irq_demux = hd64461_irq_demux,
  93. };
  94. ALIAS_MV(hp6xx)