Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
f30c2269 | 2 | * linux/arch/sh/boards/hp6xx/setup.c |
1da177e4 LT |
3 | * |
4 | * Copyright (C) 2002 Andriy Skulysh | |
34a780a0 | 5 | * Copyright (C) 2007 Kristoffer Ericson <Kristoffer_e1@hotmail.com> |
1da177e4 LT |
6 | * |
7 | * May be copied or modified under the terms of the GNU General Public | |
8 | * License. See linux/COPYING for more information. | |
9 | * | |
aedb5986 | 10 | * Setup code for HP620/HP660/HP680/HP690 (internal peripherials only) |
1da177e4 | 11 | */ |
e5723e0e | 12 | #include <linux/types.h> |
1da177e4 | 13 | #include <linux/init.h> |
34a780a0 | 14 | #include <linux/platform_device.h> |
0025835c | 15 | #include <asm/hd64461.h> |
e5723e0e PM |
16 | #include <asm/io.h> |
17 | #include <asm/irq.h> | |
082c44d2 | 18 | #include <asm/hp6xx.h> |
1da177e4 LT |
19 | #include <asm/cpu/dac.h> |
20 | ||
3aa770e7 | 21 | #define SCPCR 0xa4000116 |
aedb5986 | 22 | #define SCPDR 0xa4000136 |
3aa770e7 | 23 | |
34a780a0 KE |
24 | /* CF Slot */ |
25 | static struct resource cf_ide_resources[] = { | |
26 | [0] = { | |
27 | .start = 0x15000000 + 0x1f0, | |
28 | .end = 0x15000000 + 0x1f0 + 0x08 - 0x01, | |
29 | .flags = IORESOURCE_MEM, | |
30 | }, | |
31 | [1] = { | |
32 | .start = 0x15000000 + 0x1fe, | |
33 | .end = 0x15000000 + 0x1fe + 0x01, | |
34 | .flags = IORESOURCE_MEM, | |
35 | }, | |
36 | [2] = { | |
c9eaaa97 | 37 | .start = 77, |
34a780a0 KE |
38 | .flags = IORESOURCE_IRQ, |
39 | }, | |
40 | }; | |
41 | ||
42 | static struct platform_device cf_ide_device = { | |
43 | .name = "pata_platform", | |
44 | .id = -1, | |
45 | .num_resources = ARRAY_SIZE(cf_ide_resources), | |
46 | .resource = cf_ide_resources, | |
47 | }; | |
48 | ||
aedb5986 KE |
49 | static struct platform_device jornadakbd_device = { |
50 | .name = "jornada680_kbd", | |
51 | .id = -1, | |
52 | }; | |
53 | ||
34a780a0 | 54 | static struct platform_device *hp6xx_devices[] __initdata = { |
aedb5986 KE |
55 | &cf_ide_device, |
56 | &jornadakbd_device, | |
34a780a0 KE |
57 | }; |
58 | ||
aedb5986 KE |
59 | static void __init hp6xx_init_irq(void) |
60 | { | |
61 | /* Gets touchscreen and powerbutton IRQ working */ | |
2f0ae55f | 62 | plat_irq_setup_pins(IRQ_MODE_IRQ); |
aedb5986 KE |
63 | } |
64 | ||
34a780a0 KE |
65 | static int __init hp6xx_devices_setup(void) |
66 | { | |
67 | return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices)); | |
68 | } | |
69 | ||
2c7834a6 | 70 | static void __init hp6xx_setup(char **cmdline_p) |
1da177e4 | 71 | { |
0025835c | 72 | u8 v8; |
1da177e4 | 73 | u16 v; |
3aa770e7 | 74 | |
1da177e4 | 75 | v = inw(HD64461_STBCR); |
aedb5986 KE |
76 | v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST | |
77 | HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST | | |
78 | HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST | | |
79 | HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST| | |
80 | HD64461_STBCR_SAFECKE_IST; | |
0025835c PM |
81 | #ifndef CONFIG_HD64461_ENABLER |
82 | v |= HD64461_STBCR_SPC1ST; | |
83 | #endif | |
1da177e4 LT |
84 | outw(v, HD64461_STBCR); |
85 | v = inw(HD64461_GPADR); | |
86 | v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0; | |
87 | outw(v, HD64461_GPADR); | |
88 | ||
0025835c PM |
89 | outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR); |
90 | ||
91 | #ifndef CONFIG_HD64461_ENABLER | |
92 | outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR); | |
93 | #endif | |
94 | ||
95 | sh_dac_output(0, DAC_SPEAKER_VOLUME); | |
1da177e4 | 96 | sh_dac_disable(DAC_SPEAKER_VOLUME); |
0025835c PM |
97 | v8 = ctrl_inb(DACR); |
98 | v8 &= ~DACR_DAE; | |
99 | ctrl_outb(v8,DACR); | |
1da177e4 | 100 | |
3aa770e7 AS |
101 | v8 = ctrl_inb(SCPDR); |
102 | v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y; | |
103 | v8 &= ~SCPDR_TS_SCAN_ENABLE; | |
104 | ctrl_outb(v8, SCPDR); | |
105 | ||
106 | v = ctrl_inw(SCPCR); | |
107 | v &= ~SCPCR_TS_MASK; | |
108 | v |= SCPCR_TS_ENABLE; | |
109 | ctrl_outw(v, SCPCR); | |
1da177e4 | 110 | } |
34a780a0 | 111 | device_initcall(hp6xx_devices_setup); |
2c7834a6 | 112 | |
82f81f47 | 113 | static struct sh_machine_vector mv_hp6xx __initmv = { |
2c7834a6 PM |
114 | .mv_name = "hp6xx", |
115 | .mv_setup = hp6xx_setup, | |
aedb5986 KE |
116 | /* IRQ's : CPU(64) + CCHIP(16) + FREE_TO_USE(6) */ |
117 | .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM + 6, | |
2c7834a6 | 118 | .mv_irq_demux = hd64461_irq_demux, |
aedb5986 KE |
119 | /* Enable IRQ0 -> IRQ3 in IRQ_MODE */ |
120 | .mv_init_irq = hp6xx_init_irq, | |
2c7834a6 | 121 | }; |