rsi: add vendor Kconfig entry
[deliverable/linux.git] / drivers / net / wireless / rt2x00 / rt2x00mmio.h
CommitLineData
69a2bac8
GJ
1/*
2 Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
3 <http://rt2x00.serialmonkey.com>
4
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.
9
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.
14
15 You should have received a copy of the GNU General Public License
a05b8c58 16 along with this program; if not, see <http://www.gnu.org/licenses/>.
69a2bac8
GJ
17 */
18
19/*
20 Module: rt2x00mmio
21 Abstract: Data structures for the rt2x00mmio module.
22 */
23
24#ifndef RT2X00MMIO_H
25#define RT2X00MMIO_H
26
27#include <linux/io.h>
28
29/*
30 * Register access.
31 */
58959bdc
GJ
32static inline void rt2x00mmio_register_read(struct rt2x00_dev *rt2x00dev,
33 const unsigned int offset,
34 u32 *value)
69a2bac8
GJ
35{
36 *value = readl(rt2x00dev->csr.base + offset);
37}
38
58959bdc
GJ
39static inline void rt2x00mmio_register_multiread(struct rt2x00_dev *rt2x00dev,
40 const unsigned int offset,
41 void *value, const u32 length)
69a2bac8
GJ
42{
43 memcpy_fromio(value, rt2x00dev->csr.base + offset, length);
44}
45
58959bdc
GJ
46static inline void rt2x00mmio_register_write(struct rt2x00_dev *rt2x00dev,
47 const unsigned int offset,
48 u32 value)
69a2bac8
GJ
49{
50 writel(value, rt2x00dev->csr.base + offset);
51}
52
58959bdc
GJ
53static inline void rt2x00mmio_register_multiwrite(struct rt2x00_dev *rt2x00dev,
54 const unsigned int offset,
55 const void *value,
56 const u32 length)
69a2bac8
GJ
57{
58 __iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2);
59}
60
61/**
58959bdc 62 * rt2x00mmio_regbusy_read - Read from register with busy check
69a2bac8
GJ
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
67 *
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
72 * FALSE.
73 */
58959bdc
GJ
74int rt2x00mmio_regbusy_read(struct rt2x00_dev *rt2x00dev,
75 const unsigned int offset,
76 const struct rt2x00_field32 field,
77 u32 *reg);
69a2bac8
GJ
78
79/**
58959bdc 80 * struct queue_entry_priv_mmio: Per entry PCI specific information
69a2bac8
GJ
81 *
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.
86 */
58959bdc 87struct queue_entry_priv_mmio {
69a2bac8
GJ
88 __le32 *desc;
89 dma_addr_t desc_dma;
90};
91
92/**
58959bdc 93 * rt2x00mmio_rxdone - Handle RX done events
69a2bac8
GJ
94 * @rt2x00dev: Device pointer, see &struct rt2x00_dev.
95 *
96 * Returns true if there are still rx frames pending and false if all
97 * pending rx frames were processed.
98 */
58959bdc 99bool rt2x00mmio_rxdone(struct rt2x00_dev *rt2x00dev);
69a2bac8
GJ
100
101/**
58959bdc 102 * rt2x00mmio_flush_queue - Flush data queue
69a2bac8
GJ
103 * @queue: Data queue to stop
104 * @drop: True to drop all pending frames.
105 *
106 * This will wait for a maximum of 100ms, waiting for the queues
107 * to become empty.
108 */
58959bdc 109void rt2x00mmio_flush_queue(struct data_queue *queue, bool drop);
69a2bac8
GJ
110
111/*
112 * Device initialization handlers.
113 */
58959bdc 114int rt2x00mmio_initialize(struct rt2x00_dev *rt2x00dev);
58959bdc 115void rt2x00mmio_uninitialize(struct rt2x00_dev *rt2x00dev);
69a2bac8
GJ
116
117#endif /* RT2X00MMIO_H */
This page took 0.182434 seconds and 5 git commands to generate.