setup.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 HP620/HP660/HP680/HP690 (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 = 77,
  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 jornadakbd_device = {
  46. .name = "jornada680_kbd",
  47. .id = -1,
  48. };
  49. static struct platform_device *hp6xx_devices[] __initdata = {
  50. &cf_ide_device,
  51. &jornadakbd_device,
  52. };
  53. static void __init hp6xx_init_irq(void)
  54. {
  55. /* Gets touchscreen and powerbutton IRQ working */
  56. plat_irq_setup_pins(IRQ_MODE_IRQ);
  57. }
  58. static int __init hp6xx_devices_setup(void)
  59. {
  60. return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices));
  61. }
  62. static void __init hp6xx_setup(char **cmdline_p)
  63. {
  64. u8 v8;
  65. u16 v;
  66. v = inw(HD64461_STBCR);
  67. v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
  68. HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
  69. HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
  70. HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST|
  71. HD64461_STBCR_SAFECKE_IST;
  72. #ifndef CONFIG_HD64461_ENABLER
  73. v |= HD64461_STBCR_SPC1ST;
  74. #endif
  75. outw(v, HD64461_STBCR);
  76. v = inw(HD64461_GPADR);
  77. v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
  78. outw(v, HD64461_GPADR);
  79. outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR);
  80. #ifndef CONFIG_HD64461_ENABLER
  81. outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR);
  82. #endif
  83. sh_dac_output(0, DAC_SPEAKER_VOLUME);
  84. sh_dac_disable(DAC_SPEAKER_VOLUME);
  85. v8 = ctrl_inb(DACR);
  86. v8 &= ~DACR_DAE;
  87. ctrl_outb(v8,DACR);
  88. v8 = ctrl_inb(SCPDR);
  89. v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y;
  90. v8 &= ~SCPDR_TS_SCAN_ENABLE;
  91. ctrl_outb(v8, SCPDR);
  92. v = ctrl_inw(SCPCR);
  93. v &= ~SCPCR_TS_MASK;
  94. v |= SCPCR_TS_ENABLE;
  95. ctrl_outw(v, SCPCR);
  96. }
  97. device_initcall(hp6xx_devices_setup);
  98. static struct sh_machine_vector mv_hp6xx __initmv = {
  99. .mv_name = "hp6xx",
  100. .mv_setup = hp6xx_setup,
  101. /* IRQ's : CPU(64) + CCHIP(16) + FREE_TO_USE(6) */
  102. .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM + 6,
  103. .mv_irq_demux = hd64461_irq_demux,
  104. /* Enable IRQ0 -> IRQ3 in IRQ_MODE */
  105. .mv_init_irq = hp6xx_init_irq,
  106. };