2 Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
3 <http://rt2x00.serialmonkey.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>.
21 Abstract: Data structures for the rt2x00mmio module.
32 static inline void rt2x00mmio_register_read(struct rt2x00_dev
*rt2x00dev
,
33 const unsigned int offset
,
36 *value
= readl(rt2x00dev
->csr
.base
+ offset
);
39 static inline void rt2x00mmio_register_multiread(struct rt2x00_dev
*rt2x00dev
,
40 const unsigned int offset
,
41 void *value
, const u32 length
)
43 memcpy_fromio(value
, rt2x00dev
->csr
.base
+ offset
, length
);
46 static inline void rt2x00mmio_register_write(struct rt2x00_dev
*rt2x00dev
,
47 const unsigned int offset
,
50 writel(value
, rt2x00dev
->csr
.base
+ offset
);
53 static inline void rt2x00mmio_register_multiwrite(struct rt2x00_dev
*rt2x00dev
,
54 const unsigned int offset
,
58 __iowrite32_copy(rt2x00dev
->csr
.base
+ offset
, value
, length
>> 2);
62 * rt2x00mmio_regbusy_read - Read from register with busy check
63 * @rt2x00dev: Device pointer, see &struct rt2x00_dev.
64 * @offset: Register offset
65 * @field: Field to check if register is busy
66 * @reg: Pointer to where register contents should be stored
68 * This function will read the given register, and checks if the
69 * register is busy. If it is, it will sleep for a couple of
70 * microseconds before reading the register again. If the register
71 * is not read after a certain timeout, this function will return
74 int rt2x00mmio_regbusy_read(struct rt2x00_dev
*rt2x00dev
,
75 const unsigned int offset
,
76 const struct rt2x00_field32 field
,
80 * struct queue_entry_priv_mmio: Per entry PCI specific information
82 * @desc: Pointer to device descriptor
83 * @desc_dma: DMA pointer to &desc.
84 * @data: Pointer to device's entry memory.
85 * @data_dma: DMA pointer to &data.
87 struct queue_entry_priv_mmio
{
93 * rt2x00mmio_rxdone - Handle RX done events
94 * @rt2x00dev: Device pointer, see &struct rt2x00_dev.
96 * Returns true if there are still rx frames pending and false if all
97 * pending rx frames were processed.
99 bool rt2x00mmio_rxdone(struct rt2x00_dev
*rt2x00dev
);
102 * rt2x00mmio_flush_queue - Flush data queue
103 * @queue: Data queue to stop
104 * @drop: True to drop all pending frames.
106 * This will wait for a maximum of 100ms, waiting for the queues
109 void rt2x00mmio_flush_queue(struct data_queue
*queue
, bool drop
);
112 * Device initialization handlers.
114 int rt2x00mmio_initialize(struct rt2x00_dev
*rt2x00dev
);
115 void rt2x00mmio_uninitialize(struct rt2x00_dev
*rt2x00dev
);
117 #endif /* RT2X00MMIO_H */