2 * linux/arch/sh/boards/hp6xx/setup.c
4 * Copyright (C) 2002 Andriy Skulysh
7 * May be copied or modified under the terms of the GNU General Public
8 * License. See linux/COPYING for more information.
10 * Setup code for HP620/HP660/HP680/HP690 (internal peripherials only)
12 #include <linux/types.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/irq.h>
16 #include <linux/sh_intc.h>
17 #include <sound/sh_dac_audio.h>
18 #include <asm/hd64461.h>
20 #include <mach/hp6xx.h>
23 #define SCPCR 0xa4000116
24 #define SCPDR 0xa4000136
27 static struct resource cf_ide_resources[] = {
29 .start = 0x15000000 + 0x1f0,
30 .end = 0x15000000 + 0x1f0 + 0x08 - 0x01,
31 .flags = IORESOURCE_MEM,
34 .start = 0x15000000 + 0x1fe,
35 .end = 0x15000000 + 0x1fe + 0x01,
36 .flags = IORESOURCE_MEM,
39 .start = evt2irq(0xba0),
40 .flags = IORESOURCE_IRQ,
44 static struct platform_device cf_ide_device = {
45 .name = "pata_platform",
47 .num_resources = ARRAY_SIZE(cf_ide_resources),
48 .resource = cf_ide_resources,
51 static struct platform_device jornadakbd_device = {
52 .name = "jornada680_kbd",
56 static void dac_audio_start(struct dac_audio_pdata *pdata)
61 /* HP Jornada 680/690 speaker on */
62 v = inw(HD64461_GPADR);
63 v &= ~HD64461_GPADR_SPEAKER;
64 outw(v, HD64461_GPADR);
66 /* HP Palmtop 620lx/660lx speaker on */
71 sh_dac_enable(pdata->channel);
74 static void dac_audio_stop(struct dac_audio_pdata *pdata)
79 /* HP Jornada 680/690 speaker off */
80 v = inw(HD64461_GPADR);
81 v |= HD64461_GPADR_SPEAKER;
82 outw(v, HD64461_GPADR);
84 /* HP Palmtop 620lx/660lx speaker off */
89 sh_dac_output(0, pdata->channel);
90 sh_dac_disable(pdata->channel);
93 static struct dac_audio_pdata dac_audio_platform_data = {
96 .start = dac_audio_start,
97 .stop = dac_audio_stop,
100 static struct platform_device dac_audio_device = {
104 .platform_data = &dac_audio_platform_data,
109 static struct platform_device *hp6xx_devices[] __initdata = {
115 static void __init hp6xx_init_irq(void)
117 /* Gets touchscreen and powerbutton IRQ working */
118 plat_irq_setup_pins(IRQ_MODE_IRQ);
121 static int __init hp6xx_devices_setup(void)
123 return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices));
126 static void __init hp6xx_setup(char **cmdline_p)
131 v = inw(HD64461_STBCR);
132 v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
133 HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
134 HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
135 HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST|
136 HD64461_STBCR_SAFECKE_IST;
137 #ifndef CONFIG_HD64461_ENABLER
138 v |= HD64461_STBCR_SPC1ST;
140 outw(v, HD64461_STBCR);
141 v = inw(HD64461_GPADR);
142 v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
143 outw(v, HD64461_GPADR);
145 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR);
147 #ifndef CONFIG_HD64461_ENABLER
148 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR);
151 sh_dac_output(0, DAC_SPEAKER_VOLUME);
152 sh_dac_disable(DAC_SPEAKER_VOLUME);
153 v8 = __raw_readb(DACR);
155 __raw_writeb(v8,DACR);
157 v8 = __raw_readb(SCPDR);
158 v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y;
159 v8 &= ~SCPDR_TS_SCAN_ENABLE;
160 __raw_writeb(v8, SCPDR);
162 v = __raw_readw(SCPCR);
164 v |= SCPCR_TS_ENABLE;
165 __raw_writew(v, SCPCR);
167 device_initcall(hp6xx_devices_setup);
169 static struct sh_machine_vector mv_hp6xx __initmv = {
171 .mv_setup = hp6xx_setup,
172 /* Enable IRQ0 -> IRQ3 in IRQ_MODE */
173 .mv_init_irq = hp6xx_init_irq,