aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixp2000/ixpdev_priv.h
blob: 86aa08ea0c3381becada48babbd21b1b7442d105 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * IXP2000 MSF network device driver
 * Copyright (C) 2004, 2005 Lennert Buytenhek <buytenh@wantstofly.org>
 * Dedicated to Marija Kulikova.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef __IXPDEV_PRIV_H
#define __IXPDEV_PRIV_H

#define RX_BUF_DESC_BASE	0x00001000
#define RX_BUF_COUNT		((3 * PAGE_SIZE) / (4 * sizeof(struct ixpdev_rx_desc)))
#define TX_BUF_DESC_BASE	0x00002000
#define TX_BUF_COUNT		((3 * PAGE_SIZE) / (4 * sizeof(struct ixpdev_tx_desc)))
#define TX_BUF_COUNT_PER_CHAN	(TX_BUF_COUNT / 4)

#define RING_RX_PENDING		((u32 *)IXP2000_SCRATCH_RING_VIRT_BASE)
#define RING_RX_DONE		((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 4))
#define RING_TX_PENDING		((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 8))
#define RING_TX_DONE		((u32 *)(IXP2000_SCRATCH_RING_VIRT_BASE + 12))

#define SCRATCH_REG(x)		((u32 *)(IXP2000_GLOBAL_REG_VIRT_BASE | 0x0800 | (x)))
#define RING_RX_PENDING_BASE	SCRATCH_REG(0x00)
#define RING_RX_PENDING_HEAD	SCRATCH_REG(0x04)
#define RING_RX_PENDING_TAIL	SCRATCH_REG(0x08)
#define RING_RX_DONE_BASE	SCRATCH_REG(0x10)
#define RING_RX_DONE_HEAD	SCRATCH_REG(0x14)
#define RING_RX_DONE_TAIL	SCRATCH_REG(0x18)
#define RING_TX_PENDING_BASE	SCRATCH_REG(0x20)
#define RING_TX_PENDING_HEAD	SCRATCH_REG(0x24)
#define RING_TX_PENDING_TAIL	SCRATCH_REG(0x28)
#define RING_TX_DONE_BASE	SCRATCH_REG(0x30)
#define RING_TX_DONE_HEAD	SCRATCH_REG(0x34)
#define RING_TX_DONE_TAIL	SCRATCH_REG(0x38)

struct ixpdev_rx_desc
{
	u32	buf_addr;
	u32	buf_length;
	u32	channel;
	u32	pkt_length;
};

struct ixpdev_tx_desc
{
	u32	buf_addr;
	u32	pkt_length;
	u32	channel;
	u32	unused;
};


#endif