2 * Bluetooth interface driver for TI BRF6100 on h6300
4 * Copyright (C) 2005 Mika Laitio <lamikr@cc.jyu.fi>
5 * Ideas taken from the brf6150 bt driver made by Todd Blumer for the pxa hx4700.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/delay.h>
15 #include <linux/platform_device.h>
17 #include <asm/hardware.h>
18 #include <asm/arch/gpio.h>
20 #include <asm/arch/h6300_uart_info.h>
21 #include "h6300_bt_led.h"
24 h6300_bt_configure(struct uart_omap_port *up, int enable)
26 printk(KERN_NOTICE "h6300_bt_brf6100.c h6300_bt_configure() started, enable = %d\n", enable);
28 // printk( KERN_NOTICE "h6300 configure bluetooth: %d\n", enable );
30 omap_set_gpio_dataout(GPIO_N_BT_RST, 1); // turn off gpio, note 1 == off for negative gpios
32 h6300_clear_led(INDEX_BT_LED);
34 else if (enable == 1) {
35 omap_set_gpio_dataout(GPIO_N_BT_RST, 1); // turn on gpio, note 0 == on for negative gpios
38 else if (enable == 2) {
40 * BRF6150's RTS goes low when firmware is ready
41 * so check for CTS=1 (nCTS=0 -> CTS=1). Typical 150ms
49 while ((BTMSR & MSR_CTS) == 0 && tries++ < 50);
51 h6300_set_led(INDEX_BT_LED, 16, 16);
53 printk(KERN_NOTICE "h6300_bt_brf6100.c h6300_bt_configure() done\n");
57 h6300_bt_set_txrx(struct uart_omap_port *up, int txrx)
59 printk(KERN_NOTICE "h6300_bt_brf6100.c h6300_bt_set_txrx(), txrx = %d done\n", txrx);
64 h6300_bt_get_txrx(struct uart_omap_port *up)
66 printk(KERN_NOTICE "h6300_bt_brf6100.c h6300_bt_get_txrx() done\n");
72 h6300_bt_probe(struct platform_device *pdev)
74 struct h6300_uart_funcs *funcs = (struct h6300_uart_funcs *)pdev->dev.platform_data;
76 omap_request_gpio(GPIO_BT_PWR_EN); // ask bt_power_en gpio, remember to release in remove_function
77 omap_set_gpio_direction(GPIO_BT_PWR_EN, 1); // set gpio direction to be output
78 omap_set_gpio_dataout(GPIO_BT_PWR_EN, 1); // turn on gpio
82 omap_request_gpio(GPIO_N_BT_RST); // ask bt_reset gpio, remember to release in remove_function
83 omap_set_gpio_direction(GPIO_N_BT_RST, 1); // set gpio direction to be output
84 omap_set_gpio_dataout(GPIO_N_BT_RST, 0); // turn on gpio, note 0 == on for negative gpios
86 /* configure bluetooth UART */
87 //h6300_gpio_mode(GPIO_NR_H6300_BT_RXD_MD);
88 //h6300_gpio_mode(GPIO_NR_H6300_BT_TXD_MD);
89 //h6300_gpio_mode(GPIO_NR_H6300_BT_UART_CTS_MD);
90 //h6300_gpio_mode(GPIO_NR_H6300_BT_UART_RTS_MD);
92 funcs->configure = h6300_bt_configure;
93 funcs->set_txrx = h6300_bt_set_txrx;
94 funcs->get_txrx = h6300_bt_get_txrx;
96 /* Make sure the LED is off */
97 h6300_clear_led(INDEX_BT_LED);
99 printk(KERN_NOTICE "h6300_bt_brf6100.c h6300_bt_probe() done\n");
105 h6300_bt_remove(struct platform_device *pdev)
107 struct h6300_uart_funcs *funcs = (struct h6300_uart_funcs *)pdev->dev.platform_data;
109 printk(KERN_NOTICE "h6300_bt_brf6100.c h6300_bt_remove() started\n");
111 omap_free_gpio(GPIO_BT_PWR_EN);
112 omap_free_gpio(GPIO_N_BT_RST);
114 funcs->configure = NULL;
115 funcs->set_txrx = NULL;
116 funcs->get_txrx = NULL;
118 /* Make sure the LED is off */
119 h6300_clear_led(INDEX_BT_LED);
121 printk(KERN_NOTICE "h6300_bt_brf6100.c, h6300_bt_remove() done\n");
126 static struct platform_driver bt_driver = {
127 .probe = h6300_bt_probe,
128 .remove = h6300_bt_remove,
137 printk(KERN_NOTICE "h6300 Bluetooth Driver init()\n");
138 return platform_driver_register(&bt_driver);
144 printk(KERN_NOTICE "h6300 Bluetooth Driver exit()\n");
145 platform_driver_unregister(&bt_driver);
148 module_init(h6300_bt_init);
149 module_exit(h6300_bt_exit);
151 MODULE_AUTHOR("Mika Laitio, <lamikr@cc.jyu.fi>");
152 MODULE_DESCRIPTION("iPAQ h6300 BRF6100 Bluetooth driver.");
153 MODULE_LICENSE("GPL");