dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / drivers / net / wireless / ralink / rt2x00 / rt2x00mmio.h
blob184a4148b2f8ff619915557bff928e17d93539e3
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, see <http://www.gnu.org/licenses/>.
20 Module: rt2x00mmio
21 Abstract: Data structures for the rt2x00mmio module.
24 #ifndef RT2X00MMIO_H
25 #define RT2X00MMIO_H
27 #include <linux/io.h>
30 * Register access.
32 static inline u32 rt2x00mmio_register_read(struct rt2x00_dev *rt2x00dev,
33 const unsigned int offset)
35 return readl(rt2x00dev->csr.base + offset);
38 static inline void rt2x00mmio_register_multiread(struct rt2x00_dev *rt2x00dev,
39 const unsigned int offset,
40 void *value, const u32 length)
42 memcpy_fromio(value, rt2x00dev->csr.base + offset, length);
45 static inline void rt2x00mmio_register_write(struct rt2x00_dev *rt2x00dev,
46 const unsigned int offset,
47 u32 value)
49 writel(value, rt2x00dev->csr.base + offset);
52 static inline void rt2x00mmio_register_multiwrite(struct rt2x00_dev *rt2x00dev,
53 const unsigned int offset,
54 const void *value,
55 const u32 length)
57 __iowrite32_copy(rt2x00dev->csr.base + offset, value, length >> 2);
60 /**
61 * rt2x00mmio_regbusy_read - Read from register with busy check
62 * @rt2x00dev: Device pointer, see &struct rt2x00_dev.
63 * @offset: Register offset
64 * @field: Field to check if register is busy
65 * @reg: Pointer to where register contents should be stored
67 * This function will read the given register, and checks if the
68 * register is busy. If it is, it will sleep for a couple of
69 * microseconds before reading the register again. If the register
70 * is not read after a certain timeout, this function will return
71 * FALSE.
73 int rt2x00mmio_regbusy_read(struct rt2x00_dev *rt2x00dev,
74 const unsigned int offset,
75 const struct rt2x00_field32 field,
76 u32 *reg);
78 /**
79 * struct queue_entry_priv_mmio: Per entry PCI specific information
81 * @desc: Pointer to device descriptor
82 * @desc_dma: DMA pointer to &desc.
83 * @data: Pointer to device's entry memory.
84 * @data_dma: DMA pointer to &data.
86 struct queue_entry_priv_mmio {
87 __le32 *desc;
88 dma_addr_t desc_dma;
91 /**
92 * rt2x00mmio_rxdone - Handle RX done events
93 * @rt2x00dev: Device pointer, see &struct rt2x00_dev.
95 * Returns true if there are still rx frames pending and false if all
96 * pending rx frames were processed.
98 bool rt2x00mmio_rxdone(struct rt2x00_dev *rt2x00dev);
101 * rt2x00mmio_flush_queue - Flush data queue
102 * @queue: Data queue to stop
103 * @drop: True to drop all pending frames.
105 * This will wait for a maximum of 100ms, waiting for the queues
106 * to become empty.
108 void rt2x00mmio_flush_queue(struct data_queue *queue, bool drop);
111 * Device initialization handlers.
113 int rt2x00mmio_initialize(struct rt2x00_dev *rt2x00dev);
114 void rt2x00mmio_uninitialize(struct rt2x00_dev *rt2x00dev);
116 #endif /* RT2X00MMIO_H */