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>
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).
44 static struct htcsable_bt_funcs bt_funcs
;
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
;
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!
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,*/
86 #ifdef CONFIG_HTCSABLE_BACKLIGHT
88 extern struct platform_device htcsable_bl
;
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", };
99 static struct platform_device htcsable_bt
= {
100 .name
= "htcsable_bt",
103 .platform_data
= &bt_funcs
,
107 static struct platform_device htcsable_phone
= {
108 .name
= "htcsable_phone",
111 .platform_data
= &phone_funcs
,
116 static struct platform_device
*htcsable_asic3_devices
[] __initdata
= {
122 #ifdef CONFIG_HTCSABLE_BACKLIGHT
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.
143 .batt_fault_out
= 0x0000,
144 .alt_function
= 0x6000, //
145 .sleep_conf
= 0x000c,
151 .batt_fault_out
= 0x0000,
152 .alt_function
= 0x0000, //
153 .sleep_conf
= 0x000c,
159 .batt_fault_out
= 0x0000,
160 .alt_function
= 0x0038, // GPIOC_LED_RED | GPIOC_LED_GREEN | GPIOC_LED_BLUE
161 .sleep_conf
= 0x000c,
167 .batt_fault_out
= 0x0000,
168 .alt_function
= 0x0000, //
169 .sleep_conf
= 0x0008,
173 .child_platform_devs
= htcsable_asic3_devices
,
174 .num_child_platform_devs
= ARRAY_SIZE(htcsable_asic3_devices
),
177 static struct resource htcsable_asic3_resources
[] = {
179 .start
= HTCSABLE_ASIC3_GPIO_PHYS
,
180 .end
= HTCSABLE_ASIC3_GPIO_PHYS
+ IPAQ_ASIC3_MAP_SIZE
,
181 .flags
= IORESOURCE_MEM
,
184 .start
= HTCSABLE_IRQ(ASIC3_EXT_INT
),
185 .end
= HTCSABLE_IRQ(ASIC3_EXT_INT
),
186 .flags
= IORESOURCE_IRQ
,
189 .start
= HTCSABLE_ASIC3_MMC_PHYS
,
190 .end
= HTCSABLE_ASIC3_MMC_PHYS
+ IPAQ_ASIC3_MAP_SIZE
,
191 .flags
= IORESOURCE_MEM
,
194 .start
= HTCSABLE_IRQ(ASIC3_SDIO_INT_N
),
195 .flags
= IORESOURCE_IRQ
,
199 struct platform_device htcsable_asic3
= {
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",
214 .platform_data
= NULL
,
218 static struct platform_device
*devices
[] __initdata
= {
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
,
228 .ioctl
= htcsable_phone_ioctl
,
232 static void __init
htcsable_map_io(void)
234 struct ffuart_pxa_port
*sport
;
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
,
269 .init_machine
= htcsable_init
,