📄 hx4700_bt.c
字号:
/* Bluetooth interface driver for TI BRF6150 on HX4700 * * Copyright (c) 2005 SDG Systems, LLC * * 2005-04-21 Todd Blumer Created. */#include <linux/module.h>#include <linux/kernel.h>#include <linux/delay.h>#include <linux/platform_device.h>#include <asm/hardware.h>#include <asm/arch/serial.h>#include <asm/arch/hx4700-gpio.h>#include <asm/arch/hx4700-core.h>#include "hx4700_bt.h"static uint use_led=1;static voidhx4700_bt_configure( int state ){ int tries; // printk( KERN_NOTICE "hx4700 configure bluetooth: %d\n", state ); switch (state) { case PXA_UART_CFG_PRE_STARTUP: break; case PXA_UART_CFG_POST_STARTUP: /* pre-serial-up hardware configuration */ hx4700_egpio_enable( EGPIO5_BT_3V3_ON ); SET_HX4700_GPIO( CPU_BT_RESET_N, 0 ); mdelay(1); SET_HX4700_GPIO( CPU_BT_RESET_N, 1 ); /* * BRF6150's RTS goes low when firmware is ready * so check for CTS=1 (nCTS=0 -> CTS=1). Typical 150ms */ tries = 0; do { mdelay(10); } while ((BTMSR & MSR_CTS) == 0 && tries++ < 50); if (use_led) { hx4700_set_led(2, 16, 16); } break; case PXA_UART_CFG_PRE_SHUTDOWN: hx4700_egpio_disable( EGPIO5_BT_3V3_ON ); mdelay(1); hx4700_clear_led(2); break; default: break; }}static inthx4700_bt_probe( struct device *dev ){ struct hx4700_bt_funcs *funcs = (struct hx4700_bt_funcs *) dev->platform_data; /* configure bluetooth UART */ pxa_gpio_mode( GPIO_NR_HX4700_BT_RXD_MD ); pxa_gpio_mode( GPIO_NR_HX4700_BT_TXD_MD ); pxa_gpio_mode( GPIO_NR_HX4700_BT_UART_CTS_MD ); pxa_gpio_mode( GPIO_NR_HX4700_BT_UART_RTS_MD ); funcs->configure = hx4700_bt_configure; /* Make sure the LED is off */ hx4700_clear_led(2); return 0;}static inthx4700_bt_remove( struct device *dev ){ struct hx4700_bt_funcs *funcs = (struct hx4700_bt_funcs *) dev->platform_data; funcs->configure = NULL; /* Make sure the LED is off */ hx4700_clear_led(2); return 0;}static struct device_driver bt_driver = { .name = "hx4700-bt", .bus = &platform_bus_type, .probe = hx4700_bt_probe, .remove = hx4700_bt_remove,};module_param(use_led, uint, 0);static int __inithx4700_bt_init( void ){ printk(KERN_NOTICE "hx4700 Bluetooth Driver\n"); return driver_register( &bt_driver );}static void __exithx4700_bt_exit( void ){ driver_unregister( &bt_driver );}module_init( hx4700_bt_init );module_exit( hx4700_bt_exit );MODULE_AUTHOR("Todd Blumer, SDG Systems, LLC");MODULE_DESCRIPTION("hx4700 Bluetooth Support Driver");MODULE_LICENSE("GPL");/* vim600: set noexpandtab sw=8 ts=8 :*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -