]>
Commit | Line | Data |
---|---|---|
17d559af IPG |
1 | /* |
2 | * Intel Wireless WiMAX Connection 2400m | |
3 | * SDIO-specific i2400m driver definitions | |
4 | * | |
5 | * | |
6 | * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. | |
7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | |
11 | * | |
12 | * * Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | |
14 | * * Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in | |
16 | * the documentation and/or other materials provided with the | |
17 | * distribution. | |
18 | * * Neither the name of Intel Corporation nor the names of its | |
19 | * contributors may be used to endorse or promote products derived | |
20 | * from this software without specific prior written permission. | |
21 | * | |
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
23 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
24 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
25 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
26 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | * | |
34 | * | |
35 | * Intel Corporation <linux-wimax@intel.com> | |
36 | * Brian Bian <brian.bian@intel.com> | |
37 | * Dirk Brandewie <dirk.j.brandewie@intel.com> | |
38 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | |
39 | * Yanir Lubetkin <yanirx.lubetkin@intel.com> | |
40 | * - Initial implementation | |
41 | * | |
42 | * | |
43 | * This driver implements the bus-specific part of the i2400m for | |
44 | * SDIO. Check i2400m.h for a generic driver description. | |
45 | * | |
46 | * ARCHITECTURE | |
47 | * | |
48 | * This driver sits under the bus-generic i2400m driver, providing the | |
49 | * connection to the device. | |
50 | * | |
51 | * When probed, all the function pointers are setup and then the | |
52 | * bus-generic code called. The generic driver will then use the | |
53 | * provided pointers for uploading firmware (i2400ms_bus_bm*() in | |
54 | * sdio-fw.c) and then setting up the device (i2400ms_dev_*() in | |
55 | * sdio.c). | |
56 | * | |
57 | * Once firmware is uploaded, TX functions (sdio-tx.c) are called when | |
58 | * data is ready for transmission in the TX fifo; then the SDIO IRQ is | |
59 | * fired and data is available (sdio-rx.c), it is sent to the generic | |
60 | * driver for processing with i2400m_rx. | |
61 | */ | |
62 | ||
63 | #ifndef __I2400M_SDIO_H__ | |
64 | #define __I2400M_SDIO_H__ | |
65 | ||
66 | #include "i2400m.h" | |
67 | ||
68 | /* Host-Device interface for SDIO */ | |
69 | enum { | |
c3083658 | 70 | I2400M_SDIO_BOOT_RETRIES = 3, |
17d559af IPG |
71 | I2400MS_BLK_SIZE = 256, |
72 | I2400MS_PL_SIZE_MAX = 0x3E00, | |
73 | ||
74 | I2400MS_DATA_ADDR = 0x0, | |
75 | I2400MS_INTR_STATUS_ADDR = 0x13, | |
76 | I2400MS_INTR_CLEAR_ADDR = 0x13, | |
77 | I2400MS_INTR_ENABLE_ADDR = 0x14, | |
78 | I2400MS_INTR_GET_SIZE_ADDR = 0x2C, | |
79 | /* The number of ticks to wait for the device to signal that | |
80 | * it is ready */ | |
8bec9a5e | 81 | I2400MS_INIT_SLEEP_INTERVAL = 100, |
10b1de6b DB |
82 | /* How long to wait for the device to settle after reset */ |
83 | I2400MS_SETTLE_TIME = 40, | |
f2696fbd CK |
84 | /* The number of msec to wait for IOR after sending IOE */ |
85 | IWMC3200_IOR_TIMEOUT = 10, | |
17d559af IPG |
86 | }; |
87 | ||
88 | ||
89 | /** | |
90 | * struct i2400ms - descriptor for a SDIO connected i2400m | |
91 | * | |
92 | * @i2400m: bus-generic i2400m implementation; has to be first (see | |
93 | * it's documentation in i2400m.h). | |
94 | * | |
95 | * @func: pointer to our SDIO function | |
96 | * | |
97 | * @tx_worker: workqueue struct used to TX data when the bus-generic | |
98 | * code signals packets are pending for transmission to the device. | |
99 | * | |
100 | * @tx_workqueue: workqeueue used for data TX; we don't use the | |
101 | * system's workqueue as that might cause deadlocks with code in | |
f22cf689 CK |
102 | * the bus-generic driver. The read/write operation to the queue |
103 | * is protected with spinlock (tx_lock in struct i2400m) to avoid | |
104 | * the queue being destroyed in the middle of a the queue read/write | |
105 | * operation. | |
fae92216 IPG |
106 | * |
107 | * @debugfs_dentry: dentry for the SDIO specific debugfs files | |
108 | * | |
109 | * Note this value is set to NULL upon destruction; this is | |
110 | * because some routinges use it to determine if we are inside the | |
111 | * probe() path or some other path. When debugfs is disabled, | |
112 | * creation sets the dentry to '(void*) -ENODEV', which is valid | |
113 | * for the test. | |
17d559af IPG |
114 | */ |
115 | struct i2400ms { | |
116 | struct i2400m i2400m; /* FIRST! See doc */ | |
117 | struct sdio_func *func; | |
118 | ||
119 | struct work_struct tx_worker; | |
120 | struct workqueue_struct *tx_workqueue; | |
121 | char tx_wq_name[32]; | |
122 | ||
123 | struct dentry *debugfs_dentry; | |
16820c16 IPG |
124 | |
125 | wait_queue_head_t bm_wfa_wq; | |
126 | int bm_wait_result; | |
127 | size_t bm_ack_size; | |
02eb41ef IPG |
128 | |
129 | /* Device is any of the iwmc3200 SKUs */ | |
130 | unsigned iwmc3200:1; | |
17d559af IPG |
131 | }; |
132 | ||
133 | ||
134 | static inline | |
135 | void i2400ms_init(struct i2400ms *i2400ms) | |
136 | { | |
137 | i2400m_init(&i2400ms->i2400m); | |
138 | } | |
139 | ||
140 | ||
141 | extern int i2400ms_rx_setup(struct i2400ms *); | |
142 | extern void i2400ms_rx_release(struct i2400ms *); | |
17d559af IPG |
143 | |
144 | extern int i2400ms_tx_setup(struct i2400ms *); | |
145 | extern void i2400ms_tx_release(struct i2400ms *); | |
146 | extern void i2400ms_bus_tx_kick(struct i2400m *); | |
147 | ||
148 | extern ssize_t i2400ms_bus_bm_cmd_send(struct i2400m *, | |
149 | const struct i2400m_bootrom_header *, | |
150 | size_t, int); | |
151 | extern ssize_t i2400ms_bus_bm_wait_for_ack(struct i2400m *, | |
152 | struct i2400m_bootrom_header *, | |
153 | size_t); | |
16820c16 IPG |
154 | extern void i2400ms_bus_bm_release(struct i2400m *); |
155 | extern int i2400ms_bus_bm_setup(struct i2400m *); | |
156 | ||
17d559af | 157 | #endif /* #ifndef __I2400M_SDIO_H__ */ |