1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
4 <http://rt2x00.serialmonkey.com>
10 Abstract: Data structures for the rt2x00mmio module.
21 static inline u32
rt2x00mmio_register_read(struct rt2x00_dev
*rt2x00dev
,
22 const unsigned int offset
)
24 return readl(rt2x00dev
->csr
.base
+ offset
);
27 static inline void rt2x00mmio_register_multiread(struct rt2x00_dev
*rt2x00dev
,
28 const unsigned int offset
,
29 void *value
, const u32 length
)
31 memcpy_fromio(value
, rt2x00dev
->csr
.base
+ offset
, length
);
34 static inline void rt2x00mmio_register_write(struct rt2x00_dev
*rt2x00dev
,
35 const unsigned int offset
,
38 writel(value
, rt2x00dev
->csr
.base
+ offset
);
41 static inline void rt2x00mmio_register_multiwrite(struct rt2x00_dev
*rt2x00dev
,
42 const unsigned int offset
,
46 __iowrite32_copy(rt2x00dev
->csr
.base
+ offset
, value
, length
>> 2);
50 * rt2x00mmio_regbusy_read - Read from register with busy check
51 * @rt2x00dev: Device pointer, see &struct rt2x00_dev.
52 * @offset: Register offset
53 * @field: Field to check if register is busy
54 * @reg: Pointer to where register contents should be stored
56 * This function will read the given register, and checks if the
57 * register is busy. If it is, it will sleep for a couple of
58 * microseconds before reading the register again. If the register
59 * is not read after a certain timeout, this function will return
62 int rt2x00mmio_regbusy_read(struct rt2x00_dev
*rt2x00dev
,
63 const unsigned int offset
,
64 const struct rt2x00_field32 field
,
68 * struct queue_entry_priv_mmio: Per entry PCI specific information
70 * @desc: Pointer to device descriptor
71 * @desc_dma: DMA pointer to &desc.
73 struct queue_entry_priv_mmio
{
79 * rt2x00mmio_rxdone - Handle RX done events
80 * @rt2x00dev: Device pointer, see &struct rt2x00_dev.
82 * Returns true if there are still rx frames pending and false if all
83 * pending rx frames were processed.
85 bool rt2x00mmio_rxdone(struct rt2x00_dev
*rt2x00dev
);
88 * rt2x00mmio_flush_queue - Flush data queue
89 * @queue: Data queue to stop
90 * @drop: True to drop all pending frames.
92 * This will wait for a maximum of 100ms, waiting for the queues
95 void rt2x00mmio_flush_queue(struct data_queue
*queue
, bool drop
);
98 * Device initialization handlers.
100 int rt2x00mmio_initialize(struct rt2x00_dev
*rt2x00dev
);
101 void rt2x00mmio_uninitialize(struct rt2x00_dev
*rt2x00dev
);
103 #endif /* RT2X00MMIO_H */