2 /* Phone interface driver for Qualcomm MSM6250 on HTC Universal
4 * Copyright (c) 2005 SDG Systems, LLC
6 * 2005-04-21 Todd Blumer Created.
9 #include <linux/module.h>
10 #include <linux/kernel.h>
11 #include <linux/delay.h>
12 #include <linux/platform_device.h>
13 #include <linux/soc/asic3_base.h>
15 #include <asm/hardware.h>
16 #include <asm/arch/serial.h>
17 #include <asm/hardware/ipaq-asic3.h>
18 #include <asm/arch/htcuniversal-gpio.h>
19 #include <asm/arch/htcuniversal-asic.h>
21 #include "htcuniversal_phone.h"
23 static void phone_reset(void)
25 asic3_set_gpio_out_b(&htcuniversal_asic3
.dev
, 1<<GPIOB_BB_RESET2
, 0);
27 SET_HTCUNIVERSAL_GPIO(PHONE_RESET
,0);
28 asic3_set_gpio_out_d(&htcuniversal_asic3
.dev
, 1<<GPIOD_BB_RESET1
, 0);
30 asic3_set_gpio_out_d(&htcuniversal_asic3
.dev
, 1<<GPIOD_BB_RESET1
, 1<<GPIOD_BB_RESET1
);
32 SET_HTCUNIVERSAL_GPIO(PHONE_RESET
,1);
34 asic3_set_gpio_out_d(&htcuniversal_asic3
.dev
, 1<<GPIOD_BB_RESET1
, 0);
37 static void phone_off(void)
39 asic3_set_gpio_out_d(&htcuniversal_asic3
.dev
, 1<<GPIOD_BB_RESET1
, 1<<GPIOD_BB_RESET1
);
41 asic3_set_gpio_out_d(&htcuniversal_asic3
.dev
, 1<<GPIOD_BB_RESET1
, 0);
43 asic3_set_gpio_out_b(&htcuniversal_asic3
.dev
, 1<<GPIOB_BB_RESET2
, 1<<GPIOB_BB_RESET2
);
44 SET_HTCUNIVERSAL_GPIO(PHONE_OFF
,0);
48 htcuniversal_phone_configure( int state
)
51 unsigned short statusb
;
53 printk( KERN_NOTICE
"htcuniversal configure phone: %d\n", state
);
56 case PXA_UART_CFG_PRE_STARTUP
:
59 case PXA_UART_CFG_POST_STARTUP
:
60 /* pre-serial-up hardware configuration */
62 SET_HTCUNIVERSAL_GPIO(PHONE_START
,0); /* "bootloader" */
63 SET_HTCUNIVERSAL_GPIO(PHONE_UNKNOWN
,0); /* not used */
64 SET_HTCUNIVERSAL_GPIO(PHONE_OFF
,0); // /* PHONE_OFF */
68 SET_HTCUNIVERSAL_GPIO(PHONE_START
,1); /* phone */
77 statusb
= asic3_get_gpio_status_b( &htcuniversal_asic3
.dev
);
78 } while ( (statusb
& (1<<GPIOB_UMTS_DCD
)) == 0 && tries
++ < 200);
80 printk("UMTS_DCD tries=%d of 200\n",tries
);
84 SET_HTCUNIVERSAL_GPIO(PHONE_OFF
,1);
86 SET_HTCUNIVERSAL_GPIO(PHONE_OFF
,0);
88 statusb
= asic3_get_gpio_status_b( &htcuniversal_asic3
.dev
);
89 } while ( (statusb
& (1<<GPIOB_BB_READY
)) == 0 && tries
++ < 200);
91 printk("BB_READY tries=%d of 200\n",tries
);
95 case PXA_UART_CFG_PRE_SHUTDOWN
:
108 htcuniversal_phone_probe( struct platform_device
*dev
)
110 struct htcuniversal_phone_funcs
*funcs
= dev
->dev
.platform_data
;
112 /* configure phone UART */
113 pxa_gpio_mode( GPIO_NR_HTCUNIVERSAL_PHONE_RXD_MD
);
114 pxa_gpio_mode( GPIO_NR_HTCUNIVERSAL_PHONE_TXD_MD
);
115 pxa_gpio_mode( GPIO_NR_HTCUNIVERSAL_PHONE_UART_CTS_MD
);
116 pxa_gpio_mode( GPIO_NR_HTCUNIVERSAL_PHONE_UART_RTS_MD
);
118 funcs
->configure
= htcuniversal_phone_configure
;
124 htcuniversal_phone_remove( struct platform_device
*dev
)
126 struct htcuniversal_phone_funcs
*funcs
= dev
->dev
.platform_data
;
128 funcs
->configure
= NULL
;
133 static struct platform_driver phone_driver
= {
135 .name
= "htcuniversal_phone",
137 .probe
= htcuniversal_phone_probe
,
138 .remove
= htcuniversal_phone_remove
,
142 htcuniversal_phone_init( void )
144 printk(KERN_NOTICE
"htcuniversal Phone Driver\n");
145 return platform_driver_register( &phone_driver
);
149 htcuniversal_phone_exit( void )
151 platform_driver_unregister( &phone_driver
);
154 module_init( htcuniversal_phone_init
);
155 module_exit( htcuniversal_phone_exit
);
157 MODULE_AUTHOR("Todd Blumer, SDG Systems, LLC");
158 MODULE_DESCRIPTION("HTC Universal Phone Support Driver");
159 MODULE_LICENSE("GPL");
161 /* vim600: set noexpandtab sw=8 ts=8 :*/