diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:50:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:50:49 -0400 |
commit | 9a64388d83f6ef08dfff405a9d122e3dbcb6bf38 (patch) | |
tree | a77532ce4d6d56be6c6c7f405cd901a0184250fb /drivers/net/pasemi_mac.h | |
parent | e80ab411e589e00550e2e6e5a6a02d59cc730357 (diff) | |
parent | 14b3ca4022f050f8622ed282b734ddf445464583 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (202 commits)
[POWERPC] Fix compile breakage for 64-bit UP configs
[POWERPC] Define copy_siginfo_from_user32
[POWERPC] Add compat handler for PTRACE_GETSIGINFO
[POWERPC] i2c: Fix build breakage introduced by OF helpers
[POWERPC] Optimize fls64() on 64-bit processors
[POWERPC] irqtrace support for 64-bit powerpc
[POWERPC] Stacktrace support for lockdep
[POWERPC] Move stackframe definitions to common header
[POWERPC] Fix device-tree locking vs. interrupts
[POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const
[POWERPC] Remove unused __max_memory variable
[POWERPC] Simplify xics direct/lpar irq_host setup
[POWERPC] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ()
[POWERPC] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade()
[POWERPC] Move xics_setup_8259_cascade() into platforms/pseries/setup.c
[POWERPC] Use asm-generic/bitops/find.h in bitops.h
[POWERPC] 83xx: mpc8315 - fix USB UTMI Host setup
[POWERPC] 85xx: Fix the size of qe muram for MPC8568E
[POWERPC] 86xx: mpc86xx_hpcn - Temporarily accept old dts node identifier.
[POWERPC] 86xx: mark functions static, other minor cleanups
...
Diffstat (limited to 'drivers/net/pasemi_mac.h')
-rw-r--r-- | drivers/net/pasemi_mac.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h index 99e7b9329a6f..1a115ec60b53 100644 --- a/drivers/net/pasemi_mac.h +++ b/drivers/net/pasemi_mac.h | |||
@@ -26,7 +26,14 @@ | |||
26 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
27 | #include <linux/phy.h> | 27 | #include <linux/phy.h> |
28 | 28 | ||
29 | /* Must be a power of two */ | ||
30 | #define RX_RING_SIZE 2048 | ||
31 | #define TX_RING_SIZE 4096 | ||
32 | #define CS_RING_SIZE (TX_RING_SIZE*2) | ||
33 | |||
34 | |||
29 | #define MAX_LRO_DESCRIPTORS 8 | 35 | #define MAX_LRO_DESCRIPTORS 8 |
36 | #define MAX_CS 2 | ||
30 | 37 | ||
31 | struct pasemi_mac_txring { | 38 | struct pasemi_mac_txring { |
32 | struct pasemi_dmachan chan; /* Must be first */ | 39 | struct pasemi_dmachan chan; /* Must be first */ |
@@ -51,6 +58,15 @@ struct pasemi_mac_rxring { | |||
51 | struct pasemi_mac *mac; /* Needed in intr handler */ | 58 | struct pasemi_mac *mac; /* Needed in intr handler */ |
52 | }; | 59 | }; |
53 | 60 | ||
61 | struct pasemi_mac_csring { | ||
62 | struct pasemi_dmachan chan; | ||
63 | unsigned int size; | ||
64 | unsigned int next_to_fill; | ||
65 | int events[2]; | ||
66 | int last_event; | ||
67 | int fun; | ||
68 | }; | ||
69 | |||
54 | struct pasemi_mac { | 70 | struct pasemi_mac { |
55 | struct net_device *netdev; | 71 | struct net_device *netdev; |
56 | struct pci_dev *pdev; | 72 | struct pci_dev *pdev; |
@@ -60,10 +76,12 @@ struct pasemi_mac { | |||
60 | struct napi_struct napi; | 76 | struct napi_struct napi; |
61 | 77 | ||
62 | int bufsz; /* RX ring buffer size */ | 78 | int bufsz; /* RX ring buffer size */ |
79 | int last_cs; | ||
80 | int num_cs; | ||
81 | u32 dma_if; | ||
63 | u8 type; | 82 | u8 type; |
64 | #define MAC_TYPE_GMAC 1 | 83 | #define MAC_TYPE_GMAC 1 |
65 | #define MAC_TYPE_XAUI 2 | 84 | #define MAC_TYPE_XAUI 2 |
66 | u32 dma_if; | ||
67 | 85 | ||
68 | u8 mac_addr[6]; | 86 | u8 mac_addr[6]; |
69 | 87 | ||
@@ -74,6 +92,7 @@ struct pasemi_mac { | |||
74 | 92 | ||
75 | struct pasemi_mac_txring *tx; | 93 | struct pasemi_mac_txring *tx; |
76 | struct pasemi_mac_rxring *rx; | 94 | struct pasemi_mac_rxring *rx; |
95 | struct pasemi_mac_csring *cs[MAX_CS]; | ||
77 | char tx_irq_name[10]; /* "eth%d tx" */ | 96 | char tx_irq_name[10]; /* "eth%d tx" */ |
78 | char rx_irq_name[10]; /* "eth%d rx" */ | 97 | char rx_irq_name[10]; /* "eth%d rx" */ |
79 | int link; | 98 | int link; |
@@ -90,6 +109,16 @@ struct pasemi_mac_buffer { | |||
90 | dma_addr_t dma; | 109 | dma_addr_t dma; |
91 | }; | 110 | }; |
92 | 111 | ||
112 | #define TX_DESC(tx, num) ((tx)->chan.ring_virt[(num) & (TX_RING_SIZE-1)]) | ||
113 | #define TX_DESC_INFO(tx, num) ((tx)->ring_info[(num) & (TX_RING_SIZE-1)]) | ||
114 | #define RX_DESC(rx, num) ((rx)->chan.ring_virt[(num) & (RX_RING_SIZE-1)]) | ||
115 | #define RX_DESC_INFO(rx, num) ((rx)->ring_info[(num) & (RX_RING_SIZE-1)]) | ||
116 | #define RX_BUFF(rx, num) ((rx)->buffers[(num) & (RX_RING_SIZE-1)]) | ||
117 | #define CS_DESC(cs, num) ((cs)->chan.ring_virt[(num) & (CS_RING_SIZE-1)]) | ||
118 | |||
119 | #define RING_USED(ring) (((ring)->next_to_fill - (ring)->next_to_clean) \ | ||
120 | & ((ring)->size - 1)) | ||
121 | #define RING_AVAIL(ring) ((ring->size) - RING_USED(ring)) | ||
93 | 122 | ||
94 | /* PCI register offsets and formats */ | 123 | /* PCI register offsets and formats */ |
95 | 124 | ||
@@ -101,6 +130,7 @@ enum { | |||
101 | PAS_MAC_CFG_ADR0 = 0x8c, | 130 | PAS_MAC_CFG_ADR0 = 0x8c, |
102 | PAS_MAC_CFG_ADR1 = 0x90, | 131 | PAS_MAC_CFG_ADR1 = 0x90, |
103 | PAS_MAC_CFG_TXP = 0x98, | 132 | PAS_MAC_CFG_TXP = 0x98, |
133 | PAS_MAC_CFG_RMON = 0x100, | ||
104 | PAS_MAC_IPC_CHNL = 0x208, | 134 | PAS_MAC_IPC_CHNL = 0x208, |
105 | }; | 135 | }; |
106 | 136 | ||
@@ -172,6 +202,8 @@ enum { | |||
172 | #define PAS_MAC_CFG_TXP_TIFG(x) (((x) << PAS_MAC_CFG_TXP_TIFG_S) & \ | 202 | #define PAS_MAC_CFG_TXP_TIFG(x) (((x) << PAS_MAC_CFG_TXP_TIFG_S) & \ |
173 | PAS_MAC_CFG_TXP_TIFG_M) | 203 | PAS_MAC_CFG_TXP_TIFG_M) |
174 | 204 | ||
205 | #define PAS_MAC_RMON(r) (0x100+(r)*4) | ||
206 | |||
175 | #define PAS_MAC_IPC_CHNL_DCHNO_M 0x003f0000 | 207 | #define PAS_MAC_IPC_CHNL_DCHNO_M 0x003f0000 |
176 | #define PAS_MAC_IPC_CHNL_DCHNO_S 16 | 208 | #define PAS_MAC_IPC_CHNL_DCHNO_S 16 |
177 | #define PAS_MAC_IPC_CHNL_DCHNO(x) (((x) << PAS_MAC_IPC_CHNL_DCHNO_S) & \ | 209 | #define PAS_MAC_IPC_CHNL_DCHNO(x) (((x) << PAS_MAC_IPC_CHNL_DCHNO_S) & \ |
@@ -181,4 +213,5 @@ enum { | |||
181 | #define PAS_MAC_IPC_CHNL_BCH(x) (((x) << PAS_MAC_IPC_CHNL_BCH_S) & \ | 213 | #define PAS_MAC_IPC_CHNL_BCH(x) (((x) << PAS_MAC_IPC_CHNL_BCH_S) & \ |
182 | PAS_MAC_IPC_CHNL_BCH_M) | 214 | PAS_MAC_IPC_CHNL_BCH_M) |
183 | 215 | ||
216 | |||
184 | #endif /* PASEMI_MAC_H */ | 217 | #endif /* PASEMI_MAC_H */ |