sync hh.org
[hh.org.git] / arch / arm / mach-pxa / asus620 / asus620.c
blob5b55afad1ef66db11ab444e79a998a74259829c0
1 /*
2 * linux/arch/arm/mach-pxa/asus620.c
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * Copyright (c) 2004 Vitaliy Sardyko
9 * Copyright (c) 2003,2004 Adam Turowski
10 * Copyright (c) 2001 Cliff Brake, Accelent Systems Inc.
13 * 2001-09-13: Cliff Brake <cbrake@accelent.com>
14 * Initial code for IDP
15 * 2003-12-03: Adam Turowski
16 * code adaptation for Asus 620
17 * 2004-07-23: Vitaliy Sardyko
18 * updated to 2.6.7 format,
19 * split functions between modules.
21 #include <linux/kernel.h>
22 #include <linux/init.h>
23 #include <linux/major.h>
24 #include <linux/fs.h>
25 #include <linux/interrupt.h>
27 #include <asm/setup.h>
28 #include <asm/memory.h>
29 #include <asm/mach-types.h>
30 #include <asm/hardware.h>
31 #include <asm/irq.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
36 #include <asm/arch/udc.h>
37 #include <asm/arch/pxa-regs.h>
38 #include <../drivers/pcmcia/soc_common.h>
40 #include <asm/arch/asus620-init.h>
41 #include <asm/arch/asus620-gpio.h>
43 #include "../generic.h"
45 #define DEBUG 1
47 #if DEBUG
48 # define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args)
49 #else
50 # define DPRINTK(fmt, args...)
51 #endif
54 static u64 fb_dma_mask = ~(u64)0;
56 static void __init asus620_init_irq(void)
58 pxa_init_irq();
61 static int asus620_udc_is_connected(void) {
62 DPRINTK("asus620_udc_is_connected\n");
63 return GET_A620_GPIO(USB_DETECT);
66 static void asus620_udc_command(int cmd) {
68 DPRINTK("asus620_udc_command: %d\n", cmd);
70 switch(cmd){
71 case PXA2XX_UDC_CMD_DISCONNECT:
72 pxa_gpio_mode (GPIO_NR_A620_USBP_PULLUP | GPIO_IN);
73 break;
74 case PXA2XX_UDC_CMD_CONNECT:
75 pxa_gpio_mode (GPIO_NR_A620_USBP_PULLUP | GPIO_OUT);
76 SET_A620_GPIO(USBP_PULLUP, 1);
77 break;
78 default:
79 DPRINTK("asus620_udc_control: unknown command!\n");
80 break;
85 static struct map_desc asus620_io_desc[] __initdata = {
86 // virtual physical length type
87 {ASUS_IDE_VIRTUAL, ASUS_IDE_BASE, ASUS_IDE_SIZE, MT_DEVICE}
90 static struct resource pxafb_resources[]=
92 [0] = {
93 .start = 0x44000000,
94 .end = 0x44000010,
95 .flags = IORESOURCE_MEM,
97 [1] = {
98 .start = IRQ_LCD,
99 .end = IRQ_LCD,
100 .flags = IORESOURCE_IRQ,
104 static struct resource ad7873_resources[]=
106 [0] = {
107 .start = 0x41000000,
108 .end = 0x41000100,
109 .flags = IORESOURCE_MEM,
114 static struct platform_device pxafb_device = {
115 .name = "pxafb",
116 .id = 0,
117 .dev = {
118 .dma_mask = &fb_dma_mask,
119 .coherent_dma_mask = 0xFFFFFFFF,
121 .num_resources = ARRAY_SIZE(pxafb_resources),
122 .resource = pxafb_resources,
125 static struct platform_device ad7873_device =
127 .name = "pxa-ad7873",
128 .id = 0,
129 .num_resources = ARRAY_SIZE(ad7873_resources),
130 .resource = ad7873_resources,
135 static void __init asus620_map_io(void)
137 pxa_map_io();
138 iotable_init( asus620_io_desc, ARRAY_SIZE(asus620_io_desc) );
140 /* Wake up on CF/SD card insertion, Power and Record buttons,
141 USB plug/unplug */
142 PWER =
143 PWER_GPIO0 | PWER_GPIO2 | PWER_GPIO3 | PWER_GPIO4 |
144 PWER_GPIO5 | PWER_GPIO11 | /* Buttons */
145 PWER_GPIO9 | /* CF */
146 PWER_GPIO10 | /* USB */
147 PWER_RTC;
148 PFER =
149 PWER_GPIO0 | PWER_GPIO2 | PWER_GPIO3 | PWER_GPIO4 |
150 PWER_GPIO5 | PWER_GPIO11 | /* Buttons */
151 PWER_GPIO9 | /* CF */
152 PWER_RTC;
153 PRER = PWER_GPIO10; /* USB */
154 PCFR = PCFR_OPDE;
156 DPRINTK("asus620_map_io\n");
160 static struct pxa2xx_udc_mach_info asus620_udc_mach_info = {
161 .udc_is_connected = asus620_udc_is_connected,
162 .udc_command = asus620_udc_command,
166 static struct platform_device pxa2xx_pcmcia_device = {
167 .name = "pxa2xx-pcmcia",
168 .id = 0,
171 static struct platform_device pxa2xx_udc_device =
173 .name = "pxa2xx_udc",
174 .id = 0,
177 static struct platform_device *devices[] __initdata = {
178 &pxa2xx_pcmcia_device,
179 // &pxa2xx_udc_device,
180 &pxafb_device,
181 &ad7873_device
184 static void __init asus620_init(void)
186 DPRINTK("asus620_init()\n");
188 pxa_set_udc_info(&asus620_udc_mach_info);
189 platform_add_devices(devices, ARRAY_SIZE(devices));
192 MACHINE_START(A620, "Asus 620")
193 /* Maintainer: Adam Turowski,Vitaliy Sardyko */
194 .phys_ram = 0xa0000000,
195 .phys_io = 0x40000000,
196 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
197 .map_io = asus620_map_io,
198 .boot_params = 0xa0000100,
199 .init_irq = asus620_init_irq,
200 .init_machine = asus620_init,
201 MACHINE_END