1 /* Bluetooth interface driver for TI BRF6150 on HX4700
3 * Copyright (c) 2005 SDG Systems, LLC
5 * 2005-04-21 Todd Blumer Created.
8 #include <linux/module.h>
9 #include <linux/kernel.h>
10 #include <linux/delay.h>
11 #include <linux/platform_device.h>
12 #include <linux/soc/asic3_base.h>
14 #include <asm/hardware.h>
15 #include <asm/arch/serial.h>
16 #include <asm/hardware/ipaq-asic3.h>
17 #include <asm/arch/htcuniversal-gpio.h>
18 #include <asm/arch/htcuniversal-asic.h>
20 #include "htcuniversal_bt.h"
22 static uint use_led
=1;
25 htcuniversal_bt_configure( int state
)
29 printk( KERN_NOTICE
"htcuniversal configure bluetooth: %d\n", state
);
32 case PXA_UART_CFG_PRE_STARTUP
:
35 case PXA_UART_CFG_POST_STARTUP
:
36 /* pre-serial-up hardware configuration */
37 htcuniversal_egpio_enable(EGPIO5_BT_3V3_ON
);
39 asic3_set_gpio_out_c(&htcuniversal_asic3
.dev
, 1<<GPIOC_BT_PWR_ON
, 1<<GPIOC_BT_PWR_ON
);
41 asic3_set_gpio_out_c(&htcuniversal_asic3
.dev
, 1<<GPIOC_BT_RESET
, 0);
43 asic3_set_gpio_out_c(&htcuniversal_asic3
.dev
, 1<<GPIOC_BT_RESET
, 1<<GPIOC_BT_RESET
);
47 * BRF6150's RTS goes low when firmware is ready
48 * so check for CTS=1 (nCTS=0 -> CTS=1). Typical 150ms
53 } while ((BTMSR
& MSR_CTS
) == 0 && tries
++ < 50);
55 // htcuniversal_set_led(2, 16, 16);
59 case PXA_UART_CFG_PRE_SHUTDOWN
:
60 htcuniversal_egpio_disable(EGPIO5_BT_3V3_ON
);
62 // htcuniversal_clear_led(2);
63 asic3_set_gpio_out_c(&htcuniversal_asic3
.dev
, 1<<GPIOC_BT_PWR_ON
, 0);
73 htcuniversal_bt_probe( struct platform_device
*dev
)
75 struct htcuniversal_bt_funcs
*funcs
= dev
->dev
.platform_data
;
77 /* configure bluetooth UART */
78 pxa_gpio_mode( GPIO_NR_HTCUNIVERSAL_BT_RXD_MD
);
79 pxa_gpio_mode( GPIO_NR_HTCUNIVERSAL_BT_TXD_MD
);
80 pxa_gpio_mode( GPIO_NR_HTCUNIVERSAL_BT_UART_CTS_MD
);
81 pxa_gpio_mode( GPIO_NR_HTCUNIVERSAL_BT_UART_RTS_MD
);
83 funcs
->configure
= htcuniversal_bt_configure
;
85 /* Make sure the LED is off */
86 // htcuniversal_clear_led(2);
92 htcuniversal_bt_remove( struct platform_device
*dev
)
94 struct htcuniversal_bt_funcs
*funcs
= dev
->dev
.platform_data
;
96 funcs
->configure
= NULL
;
98 /* Make sure the LED is off */
99 // htcuniversal_clear_led(2);
104 static struct platform_driver bt_driver
= {
106 .name
= "htcuniversal_bt",
108 .probe
= htcuniversal_bt_probe
,
109 .remove
= htcuniversal_bt_remove
,
112 module_param(use_led
, uint
, 0);
115 htcuniversal_bt_init( void )
117 printk(KERN_NOTICE
"htcuniversal Bluetooth Driver\n");
118 return platform_driver_register( &bt_driver
);
122 htcuniversal_bt_exit( void )
124 platform_driver_unregister( &bt_driver
);
127 module_init( htcuniversal_bt_init
);
128 module_exit( htcuniversal_bt_exit
);
130 MODULE_AUTHOR("Todd Blumer, SDG Systems, LLC");
131 MODULE_DESCRIPTION("HTC Universal Bluetooth Support Driver");
132 MODULE_LICENSE("GPL");
134 /* vim600: set noexpandtab sw=8 ts=8 :*/