hh.org updates
[hh.org.git] / arch / arm / mach-pxa / htcsable / htcsable_core.c
blob6f3a03a46f422ac56c79e940e24816733e5cabd9
1 /* Core Hardware driver for HTC Sable (Serial, ASIC3, EGPIOs)
3 * Copyright (c) 2005 SDG Systems, LLC
5 * 2005-03-29 Todd Blumer Converted basic structure to support hx4700
6 * 2005-04-30 Todd Blumer Add IRDA code from H2200
7 */
9 #include <linux/kernel.h>
10 #include <linux/module.h>
11 #include <linux/device.h>
12 #include <linux/version.h>
13 #include <linux/config.h>
14 #include <linux/interrupt.h>
15 #include <linux/platform_device.h>
16 #include <linux/delay.h>
17 #include <linux/pm.h>
19 #include <asm/mach-types.h>
20 #include <asm/hardware.h>
21 #include <asm/irq.h>
22 #include <asm/io.h>
23 #include <asm/mach/irq.h>
24 #include <asm/arch/pxa-regs.h>
25 #include <asm/arch/pxa-pm_ll.h>
26 #include <asm/arch/htcsable-gpio.h>
27 #include <asm/arch/htcsable-asic.h>
29 #include <linux/soc/asic3_base.h>
30 #include <asm/hardware/ipaq-asic3.h>
35 #ifdef CONFIG_PM
37 void htcsable_ll_pm_init(void);
39 static int htcsable_suspend(struct device *dev, pm_message_t state)
41 /* Turn off external clocks here, because htcsable_power and asic3_mmc
42 * scared to do so to not hurt each other. (-5 mA) */
43 #if 0
44 asic3_set_clock_cdex(&htcsable_asic3.dev,
45 CLOCK_CDEX_EX0 | CLOCK_CDEX_EX1, 0 | 0);
46 #endif
47 /* 0x20c2 is HTC clock value
48 * CLOCK_CDEX_SOURCE 2
49 * CLOCK_CDEX_SPI 0
50 * CLOCK_CDEX_OWM 0
52 * CLOCK_CDEX_PWM0 0
53 * CLOCK_CDEX_PWM1 0
54 * CLOCK_CDEX_LED0 1
55 * CLOCK_CDEX_LED1 1
57 * CLOCK_CDEX_LED2 0
58 * CLOCK_CDEX_SD_HOST 0
59 * CLOCK_CDEX_SD_BUS 0
60 * CLOCK_CDEX_SMBUS 0
62 * CLOCK_CDEX_CONTROL_CX 0
63 * CLOCK_CDEX_EX0 1
64 * CLOCK_CDEX_EX1 0
65 * */
66 asic3_set_clock_cdex(&htcsable_asic3.dev, 0xffff, 0x73cc);
68 /* Wake up enable. */
69 PWER = PWER_GPIO0
70 | PWER_GPIO1 /* reset */
71 | PWER_GPIO9 /* */
72 | PWER_RTC;
73 /* Wake up on falling edge. */
74 PFER = PWER_GPIO0 ;
76 /* Wake up on rising edge. */
77 PRER = PWER_GPIO0
78 | PWER_GPIO9;
80 /* 3.6864 MHz oscillator power-down enable */
81 PCFR = PCFR_OPDE | PCFR_PI2CEN | (1<<5);
83 PGSR0 = 0x00004018;
84 PGSR1 = 0x00020802;
85 PGSR2 = 0x0001c000;
86 PGSR3 = 0x00100080;
88 PSLR = 0xcc000000;
90 asic3_set_extcf_select(&htcsable_asic3.dev, ASIC3_EXTCF_OWM_EN, 0);
92 return 0;
95 static int htcsable_resume(struct device *dev)
97 return 0;
99 #else
100 # define htcsable_suspend NULL
101 # define htcsable_resume NULL
102 #endif
104 static int
105 htcsable_core_probe( struct device *dev )
107 printk( KERN_NOTICE "HTC Sable Core Hardware Driver\n" );
109 htcsable_ll_pm_init();
111 return 0;
114 static int
115 htcsable_core_remove( struct device *dev )
118 return 0;
121 struct device_driver htcsable_core_driver = {
122 .name = "htcsable_core",
123 .bus = &platform_bus_type,
124 .probe = htcsable_core_probe,
125 .remove = htcsable_core_remove,
126 .suspend = htcsable_suspend,
127 .resume = htcsable_resume,
130 static int __init
131 htcsable_core_init( void )
133 return driver_register( &htcsable_core_driver );
137 static void __exit
138 htcsable_core_exit( void )
140 driver_unregister( &htcsable_core_driver );
143 module_init( htcsable_core_init );
144 module_exit( htcsable_core_exit );
146 MODULE_AUTHOR("Todd Blumer, SDG Systems, LLC");
147 MODULE_DESCRIPTION("HTC Sable Core Hardware Driver");
148 MODULE_LICENSE("GPL");
150 /* vim600: set noexpandtab sw=8 ts=8 :*/