ARM: mm: Recreate kernel mappings in early_paging_init()
[linux/fpc-iii.git] / drivers / net / wireless / rt2x00 / rt2x00mmio.h
blobcda3dbcf7eadf2f395e2ea6833615a0484c801f3
1 /*
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, write to the
17 Free Software Foundation, Inc.,
18 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 Module: rt2x00mmio
23 Abstract: Data structures for the rt2x00mmio module.
26 #ifndef RT2X00MMIO_H
27 #define RT2X00MMIO_H
29 #include <linux/io.h>
32 * Register access.
34 static inline void rt2x00mmio_register_read(struct rt2x00_dev *rt2x00dev,
35 const unsigned int offset,
36 u32 *value)
38 *value = readl(rt2x00dev->csr.base + offset);
41 static inline void rt2x00mmio_register_multiread(struct rt2x00_dev *rt2x00dev,
42 const unsigned int offset,
43 void *value, const u32 length)
45 memcpy_fromio(value, rt2x00dev->csr.base + offset, length);
48 static inline void rt2x00mmio_register_write(struct rt2x00_dev *rt2x00dev,
49 const unsigned int offset,
50 u32 value)
52 writel(value, rt2x00dev->csr.base + offset);
55 static inline void rt2x00mmio_register_multiwrite(struct rt2x00_dev *rt2x00dev,
56 const unsigned int offset,
57 const void *value,
58 const u32 length)
60 __iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2);
63 /**
64 * rt2x00mmio_regbusy_read - Read from register with busy check
65 * @rt2x00dev: Device pointer, see &struct rt2x00_dev.
66 * @offset: Register offset
67 * @field: Field to check if register is busy
68 * @reg: Pointer to where register contents should be stored
70 * This function will read the given register, and checks if the
71 * register is busy. If it is, it will sleep for a couple of
72 * microseconds before reading the register again. If the register
73 * is not read after a certain timeout, this function will return
74 * FALSE.
76 int rt2x00mmio_regbusy_read(struct rt2x00_dev *rt2x00dev,
77 const unsigned int offset,
78 const struct rt2x00_field32 field,
79 u32 *reg);
81 /**
82 * struct queue_entry_priv_mmio: Per entry PCI specific information
84 * @desc: Pointer to device descriptor
85 * @desc_dma: DMA pointer to &desc.
86 * @data: Pointer to device's entry memory.
87 * @data_dma: DMA pointer to &data.
89 struct queue_entry_priv_mmio {
90 __le32 *desc;
91 dma_addr_t desc_dma;
94 /**
95 * rt2x00mmio_rxdone - Handle RX done events
96 * @rt2x00dev: Device pointer, see &struct rt2x00_dev.
98 * Returns true if there are still rx frames pending and false if all
99 * pending rx frames were processed.
101 bool rt2x00mmio_rxdone(struct rt2x00_dev *rt2x00dev);
104 * rt2x00mmio_flush_queue - Flush data queue
105 * @queue: Data queue to stop
106 * @drop: True to drop all pending frames.
108 * This will wait for a maximum of 100ms, waiting for the queues
109 * to become empty.
111 void rt2x00mmio_flush_queue(struct data_queue *queue, bool drop);
114 * Device initialization handlers.
116 int rt2x00mmio_initialize(struct rt2x00_dev *rt2x00dev);
117 void rt2x00mmio_uninitialize(struct rt2x00_dev *rt2x00dev);
119 #endif /* RT2X00MMIO_H */