2006-01-23 21:59:58 +00:00
|
|
|
#ifndef BCM43xx_PIO_H_
|
|
|
|
#define BCM43xx_PIO_H_
|
|
|
|
|
|
|
|
#include "bcm43xx.h"
|
|
|
|
|
2006-02-12 15:47:44 +00:00
|
|
|
#include <linux/interrupt.h>
|
2006-01-23 21:59:58 +00:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
|
|
|
|
|
|
|
|
#define BCM43xx_PIO_TXCTL 0x00
|
|
|
|
#define BCM43xx_PIO_TXDATA 0x02
|
|
|
|
#define BCM43xx_PIO_TXQBUFSIZE 0x04
|
|
|
|
#define BCM43xx_PIO_RXCTL 0x08
|
|
|
|
#define BCM43xx_PIO_RXDATA 0x0A
|
|
|
|
|
2006-04-23 11:23:10 +00:00
|
|
|
#define BCM43xx_PIO_TXCTL_WRITELO (1 << 0)
|
|
|
|
#define BCM43xx_PIO_TXCTL_WRITEHI (1 << 1)
|
2006-01-23 21:59:58 +00:00
|
|
|
#define BCM43xx_PIO_TXCTL_COMPLETE (1 << 2)
|
|
|
|
#define BCM43xx_PIO_TXCTL_INIT (1 << 3)
|
|
|
|
#define BCM43xx_PIO_TXCTL_SUSPEND (1 << 7)
|
|
|
|
|
|
|
|
#define BCM43xx_PIO_RXCTL_DATAAVAILABLE (1 << 0)
|
|
|
|
#define BCM43xx_PIO_RXCTL_READY (1 << 1)
|
|
|
|
|
|
|
|
/* PIO constants */
|
|
|
|
#define BCM43xx_PIO_MAXTXDEVQPACKETS 31
|
|
|
|
#define BCM43xx_PIO_TXQADJUST 80
|
|
|
|
|
|
|
|
/* PIO tuning knobs */
|
|
|
|
#define BCM43xx_PIO_MAXTXPACKETS 256
|
|
|
|
|
|
|
|
|
2006-02-12 15:47:44 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_BCM43XX_PIO
|
|
|
|
|
|
|
|
|
2006-01-23 21:59:58 +00:00
|
|
|
struct bcm43xx_pioqueue;
|
|
|
|
struct bcm43xx_xmitstatus;
|
|
|
|
|
|
|
|
struct bcm43xx_pio_txpacket {
|
|
|
|
struct bcm43xx_pioqueue *queue;
|
|
|
|
struct ieee80211_txb *txb;
|
|
|
|
struct list_head list;
|
|
|
|
|
|
|
|
u8 xmitted_frags;
|
|
|
|
u16 xmitted_octets;
|
|
|
|
};
|
|
|
|
|
2006-02-12 15:47:44 +00:00
|
|
|
#define pio_txpacket_getindex(packet) ((int)((packet) - (packet)->queue->tx_packets_cache))
|
2006-01-23 21:59:58 +00:00
|
|
|
|
|
|
|
struct bcm43xx_pioqueue {
|
|
|
|
struct bcm43xx_private *bcm;
|
|
|
|
u16 mmio_base;
|
|
|
|
|
2006-02-12 15:47:44 +00:00
|
|
|
u8 tx_suspended:1,
|
|
|
|
need_workarounds:1; /* Workarounds needed for core.rev < 3 */
|
2006-01-23 21:59:58 +00:00
|
|
|
|
|
|
|
/* Adjusted size of the device internal TX buffer. */
|
|
|
|
u16 tx_devq_size;
|
|
|
|
/* Used octets of the device internal TX buffer. */
|
|
|
|
u16 tx_devq_used;
|
|
|
|
/* Used packet slots in the device internal TX buffer. */
|
|
|
|
u8 tx_devq_packets;
|
|
|
|
/* Packets from the txfree list can
|
|
|
|
* be taken on incoming TX requests.
|
|
|
|
*/
|
|
|
|
struct list_head txfree;
|
2006-02-12 15:47:44 +00:00
|
|
|
unsigned int nr_txfree;
|
2006-01-23 21:59:58 +00:00
|
|
|
/* Packets on the txqueue are queued,
|
|
|
|
* but not completely written to the chip, yet.
|
|
|
|
*/
|
|
|
|
struct list_head txqueue;
|
|
|
|
/* Packets on the txrunning queue are completely
|
|
|
|
* posted to the device. We are waiting for the txstatus.
|
|
|
|
*/
|
|
|
|
struct list_head txrunning;
|
2006-02-12 15:47:44 +00:00
|
|
|
/* Total number or packets sent.
|
|
|
|
* (This counter can obviously wrap).
|
|
|
|
*/
|
|
|
|
unsigned int nr_tx_packets;
|
|
|
|
struct tasklet_struct txtask;
|
|
|
|
struct bcm43xx_pio_txpacket tx_packets_cache[BCM43xx_PIO_MAXTXPACKETS];
|
2006-01-23 21:59:58 +00:00
|
|
|
};
|
|
|
|
|
2006-02-12 15:47:44 +00:00
|
|
|
static inline
|
|
|
|
u16 bcm43xx_pio_read(struct bcm43xx_pioqueue *queue,
|
|
|
|
u16 offset)
|
|
|
|
{
|
|
|
|
return bcm43xx_read16(queue->bcm, queue->mmio_base + offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
void bcm43xx_pio_write(struct bcm43xx_pioqueue *queue,
|
|
|
|
u16 offset, u16 value)
|
|
|
|
{
|
|
|
|
bcm43xx_write16(queue->bcm, queue->mmio_base + offset, value);
|
2006-04-23 11:23:10 +00:00
|
|
|
mmiowb();
|
2006-02-12 15:47:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-23 21:59:58 +00:00
|
|
|
int bcm43xx_pio_init(struct bcm43xx_private *bcm);
|
|
|
|
void bcm43xx_pio_free(struct bcm43xx_private *bcm);
|
|
|
|
|
2006-02-12 15:47:44 +00:00
|
|
|
int bcm43xx_pio_tx(struct bcm43xx_private *bcm,
|
|
|
|
struct ieee80211_txb *txb);
|
|
|
|
void bcm43xx_pio_handle_xmitstatus(struct bcm43xx_private *bcm,
|
|
|
|
struct bcm43xx_xmitstatus *status);
|
|
|
|
void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue);
|
|
|
|
|
2006-04-23 11:23:10 +00:00
|
|
|
void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue);
|
|
|
|
void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue);
|
|
|
|
|
2006-02-12 15:47:44 +00:00
|
|
|
#else /* CONFIG_BCM43XX_PIO */
|
|
|
|
|
|
|
|
static inline
|
|
|
|
int bcm43xx_pio_init(struct bcm43xx_private *bcm)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static inline
|
|
|
|
void bcm43xx_pio_free(struct bcm43xx_private *bcm)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline
|
|
|
|
int bcm43xx_pio_tx(struct bcm43xx_private *bcm,
|
|
|
|
struct ieee80211_txb *txb)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static inline
|
|
|
|
void bcm43xx_pio_handle_xmitstatus(struct bcm43xx_private *bcm,
|
|
|
|
struct bcm43xx_xmitstatus *status)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline
|
|
|
|
void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue)
|
|
|
|
{
|
|
|
|
}
|
2006-04-23 11:23:10 +00:00
|
|
|
static inline
|
|
|
|
void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline
|
|
|
|
void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue)
|
|
|
|
{
|
|
|
|
}
|
2006-02-12 15:47:44 +00:00
|
|
|
|
|
|
|
#endif /* CONFIG_BCM43XX_PIO */
|
2006-01-23 21:59:58 +00:00
|
|
|
#endif /* BCM43xx_PIO_H_ */
|