hh.org updates
[hh.org.git] / arch / arm / mach-pxa / htcsable / htcsable.c
blob6cb10b1e04180020e47c393280d24ead0560b59c
1 /*
2 * linux/arch/arm/mach-pxa/htcsable/htcsable.c
4 * Support for the Intel XScale based Palm PDAs. Only the LifeDrive is
5 * supported at the moment.
7 * Author: Alex Osborne <bobofdoom@gmail.com>
9 * USB stubs based on aximx30.c (Michael Opdenacker)
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/fb.h>
16 #include <linux/platform_device.h>
18 #include <asm/mach-types.h>
19 #include <asm/mach/arch.h>
21 #include <asm/arch/hardware.h>
22 #include <asm/arch/pxafb.h>
23 #include <asm/arch/pxa-regs.h>
24 #include <asm/arch/serial.h>
26 #include <asm/arch/htcsable-gpio.h>
27 #include <asm/arch/htcsable-asic.h>
29 #include <asm/hardware/ipaq-asic3.h>
30 #include <linux/soc/asic3_base.h>
32 #include "../generic.h"
34 #include "htcsable_bt.h"
35 #include "htcsable_phone.h"
38 * * Bluetooth - Relies on other loadable modules, like ASIC3 and Core,
39 * * so make the calls indirectly through pointers. Requires that the
40 * * hx4700 bluetooth module be loaded before any attempt to use
41 * * bluetooth (obviously).
42 * */
44 static struct htcsable_bt_funcs bt_funcs;
46 static void
47 htcsable_bt_configure( int state )
49 if (bt_funcs.configure != NULL)
50 bt_funcs.configure( state );
53 static struct htcsable_phone_funcs phone_funcs;
55 static void
56 htcsable_phone_configure( int state )
58 if (phone_funcs.configure != NULL)
59 phone_funcs.configure( state );
64 static struct pxafb_mach_info htcsable_lcd_screen __initdata = {
65 .pixclock = 480769, // LCCR4 bit is set!
66 .xres = 240,
67 .yres = 240,
68 .bpp = 16,
69 .hsync_len = 4,
70 .vsync_len = 2,
71 .left_margin = 12,
72 .right_margin = 8,
73 .upper_margin = 3,
74 .lower_margin = 3,
76 // .sync = FB_SYNC_HOR_LOW_ACT|FB_SYNC_VERT_LOW_ACT,
78 /* fixme: this is a hack, use constants instead. */
79 /*.lccr0 = 0x05b008b9,
80 .lccr3 = 0x04700019,*/
81 .lccr0 = 0x042000b1,
82 .lccr3 = 0x04700019,
86 #ifdef CONFIG_HTCSABLE_BACKLIGHT
87 /* Backlight */
88 extern struct platform_device htcsable_bl;
89 #endif
90 extern struct platform_device htcsable_keyboard;
91 static struct platform_device htcsable_udc = { .name = "htcsable_udc", };
92 static struct platform_device htcsable_ts = { .name = "htcsable_ts", };
93 static struct platform_device htcsable_kbd = { .name = "htcsable_kbd", };
94 static struct platform_device htcsable_buttons = { .name = "htcsable_buttons", };
95 static struct platform_device htcsable_lcd = { .name = "htcsable_lcd", };
97 /* Bluetooth */
99 static struct platform_device htcsable_bt = {
100 .name = "htcsable_bt",
101 .id = -1,
102 .dev = {
103 .platform_data = &bt_funcs,
107 static struct platform_device htcsable_phone = {
108 .name = "htcsable_phone",
109 .id = -1,
110 .dev = {
111 .platform_data = &phone_funcs,
116 static struct platform_device *htcsable_asic3_devices[] __initdata = {
117 &htcsable_ts,
118 &htcsable_kbd,
119 &htcsable_lcd,
120 &htcsable_keyboard,
121 &htcsable_buttons,
122 #ifdef CONFIG_HTCSABLE_BACKLIGHT
123 &htcsable_bl,
124 #endif
125 &htcsable_bt,
126 &htcsable_phone,
127 &htcsable_udc,
130 static struct asic3_platform_data htcsable_asic3_platform_data = {
133 * These registers are configured as they are on Wince.
135 * A0 is set high by default as we think it's the i2c initialisation
136 * pin. that means less worry about having to have a pxa-i2s module
137 * init function on a per-device basis. nasty hack, really.
139 .gpio_a = {
140 .dir = 0xbffb,
141 .init = 0xc084,
142 .sleep_out = 0x0000,
143 .batt_fault_out = 0x0000,
144 .alt_function = 0x6000, //
145 .sleep_conf = 0x000c,
147 .gpio_b = {
148 .dir = 0xe408,
149 .init = 0x1762,
150 .sleep_out = 0x0000,
151 .batt_fault_out = 0x0000,
152 .alt_function = 0x0000, //
153 .sleep_conf = 0x000c,
155 .gpio_c = {
156 .dir = 0xfff7,
157 .init = 0x8640,
158 .sleep_out = 0x0000,
159 .batt_fault_out = 0x0000,
160 .alt_function = 0x0038, // GPIOC_LED_RED | GPIOC_LED_GREEN | GPIOC_LED_BLUE
161 .sleep_conf = 0x000c,
163 .gpio_d = {
164 .dir = 0xffff,
165 .init = 0xd000,
166 .sleep_out = 0x0000,
167 .batt_fault_out = 0x0000,
168 .alt_function = 0x0000, //
169 .sleep_conf = 0x0008,
171 .bus_shift = 1,
173 .child_platform_devs = htcsable_asic3_devices,
174 .num_child_platform_devs = ARRAY_SIZE(htcsable_asic3_devices),
177 static struct resource htcsable_asic3_resources[] = {
178 [0] = {
179 .start = HTCSABLE_ASIC3_GPIO_PHYS,
180 .end = HTCSABLE_ASIC3_GPIO_PHYS + IPAQ_ASIC3_MAP_SIZE,
181 .flags = IORESOURCE_MEM,
183 [1] = {
184 .start = HTCSABLE_IRQ(ASIC3_EXT_INT),
185 .end = HTCSABLE_IRQ(ASIC3_EXT_INT),
186 .flags = IORESOURCE_IRQ,
188 [2] = {
189 .start = HTCSABLE_ASIC3_MMC_PHYS,
190 .end = HTCSABLE_ASIC3_MMC_PHYS + IPAQ_ASIC3_MAP_SIZE,
191 .flags = IORESOURCE_MEM,
193 [3] = {
194 .start = HTCSABLE_IRQ(ASIC3_SDIO_INT_N),
195 .flags = IORESOURCE_IRQ,
199 struct platform_device htcsable_asic3 = {
200 .name = "asic3",
201 .id = 0,
202 .num_resources = ARRAY_SIZE(htcsable_asic3_resources),
203 .resource = htcsable_asic3_resources,
204 .dev = { .platform_data = &htcsable_asic3_platform_data, },
206 EXPORT_SYMBOL(htcsable_asic3);
208 /* Core Hardware Functions */
210 struct platform_device htcsable_core = {
211 .name = "htcsable_core",
212 .id = 0,
213 .dev = {
214 .platform_data = NULL,
218 static struct platform_device *devices[] __initdata = {
219 &htcsable_core,
222 static struct platform_pxa_serial_funcs htcsable_pxa_bt_funcs = {
223 .configure = htcsable_bt_configure,
225 static struct platform_pxa_serial_funcs htcsable_pxa_phone_funcs = {
226 .configure = htcsable_phone_configure,
227 #if 0
228 .ioctl = htcsable_phone_ioctl,
229 #endif
232 static void __init htcsable_map_io(void)
234 struct ffuart_pxa_port *sport;
236 pxa_map_io();
238 ffuart_device.dev.platform_data = &htcsable_pxa_bt_funcs;
239 btuart_device.dev.platform_data = &htcsable_pxa_phone_funcs;
241 sport = platform_get_drvdata(&ffuart_device);
242 printk("sport=0x%x\n", (unsigned int)sport);
244 pxa_set_cken(CKEN8_I2S, 0);
245 printk("CKEN=0x%x CKEN11_USB=0x%x\n", CKEN, CKEN11_USB);
246 pxa_set_cken(CKEN11_USB, 1);
247 printk("CKEN=0x%x\n", CKEN);
251 static void __init htcsable_init(void)
253 set_pxa_fb_info( &htcsable_lcd_screen );
255 pxa_gpio_mode( GPIO_NR_HTCSABLE_I2C_SCL_MD );
256 pxa_gpio_mode( GPIO_NR_HTCSABLE_I2C_SDA_MD );
258 platform_device_register(&htcsable_asic3);
259 platform_add_devices( devices, ARRAY_SIZE(devices) );
262 MACHINE_START(HW6900, "HTC Sable")
263 .phys_io = 0x40000000,
264 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
265 .boot_params = 0xa0000100,
266 .map_io = htcsable_map_io,
267 .init_irq = pxa_init_irq,
268 .timer = &pxa_timer,
269 .init_machine = htcsable_init,
270 MACHINE_END