Merge current mainline tree into linux-omap tree
[pandora-kernel.git] / drivers / bluetooth / brf6150.h
1 /*
2  *  linux/drivers/bluetooth/brf6150/brf6150.h
3  *
4  *  Copyright (C) 2005 Nokia Corporation
5  *  Written by Ville Tervo <ville.tervo@nokia.com>
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version. 
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include <mach/board.h>
23
24 #ifndef __DRIVERS_BLUETOOTH_BRF6150_H
25 #define __DRIVERS_BLUETOOTH_BRF6150_H
26
27 #define UART_SYSC_OMAP_RESET    0x02
28 #define UART_SYSS_RESETDONE     0x01
29 #define UART_OMAP_SCR_EMPTY_THR 0x08
30 #define UART_OMAP_SCR_WAKEUP    0x10
31 #define UART_OMAP_SSR_WAKEUP    0x02
32 #define UART_OMAP_SSR_TXFULL    0x01
33
34 struct brf6150_info {
35         struct hci_dev *hdev;
36         spinlock_t lock;
37
38         struct clk *uart_ck;
39         unsigned long uart_base;
40         unsigned int irq;
41
42         struct sk_buff_head txq;
43         struct sk_buff *rx_skb;
44         const struct omap_bluetooth_config *btinfo;
45         const struct firmware *fw_entry;
46         int fw_pos;
47         int fw_error;
48         struct completion fw_completion;
49         struct completion init_completion;
50         struct tasklet_struct tx_task;
51         long rx_count;
52         unsigned long garbage_bytes;
53         unsigned long rx_state;
54         int pm_enabled;
55         int rx_pm_enabled;
56         int tx_pm_enabled;
57         struct timer_list pm_timer;
58 };
59
60 #define BT_DEVICE "nokia_btuart"
61 #define BT_DRIVER "nokia_btuart"
62
63 #define MAX_BAUD_RATE           921600
64 #define UART_CLOCK              48000000
65 #define BT_INIT_DIVIDER         320
66 #define BT_BAUDRATE_DIVIDER     384000000
67 #define BT_SYSCLK_DIV           1000
68 #define INIT_SPEED              120000
69
70 #define H4_TYPE_SIZE            1
71
72 /* H4+ packet types */
73 #define H4_CMD_PKT              0x01
74 #define H4_ACL_PKT              0x02
75 #define H4_SCO_PKT              0x03
76 #define H4_EVT_PKT              0x04
77 #define H4_NEG_PKT              0x06
78 #define H4_ALIVE_PKT            0x07
79
80 /* TX states */
81 #define WAIT_FOR_PKT_TYPE       1
82 #define WAIT_FOR_HEADER         2
83 #define WAIT_FOR_DATA           3
84
85 struct hci_fw_event {
86         struct hci_event_hdr hev;
87         struct hci_ev_cmd_complete cmd;
88         __u8 status;
89 } __attribute__ ((packed));
90
91 #endif /* __DRIVERS_BLUETOOTH_BRF6150_H */