aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/stmmac/common.h
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>2010-01-06 18:07:17 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-07 20:06:08 -0500
commitdb98a0b001df79ffcdd4f231c3516411786a1113 (patch)
tree0a21ac92a40c2c6cefc3e442b1dfa40982da446a /drivers/net/stmmac/common.h
parent65818fa744e70a58d230083dda1f1cd8e5c5e2ee (diff)
stmmac: reorganise class operations.
This patch reorganises the internal stmmac ops structure. The stmmac_ops has been splitted into other three structures named: stmmac_ops stmmac_dma_ops stmmac_desc_ops This makes the code more clear and also helps the next work to make the driver more generic. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/stmmac/common.h')
-rw-r--r--drivers/net/stmmac/common.h64
1 files changed, 34 insertions, 30 deletions
diff --git a/drivers/net/stmmac/common.h b/drivers/net/stmmac/common.h
index e49e5188e887..95782ccf44b4 100644
--- a/drivers/net/stmmac/common.h
+++ b/drivers/net/stmmac/common.h
@@ -239,25 +239,11 @@ static inline void stmmac_get_mac_addr(unsigned long ioaddr,
239 return; 239 return;
240} 240}
241 241
242struct stmmac_ops { 242struct stmmac_desc_ops {
243 /* MAC core initialization */ 243 /* DMA RX descriptor ring initialization */
244 void (*core_init) (unsigned long ioaddr) ____cacheline_aligned;
245 /* DMA core initialization */
246 int (*dma_init) (unsigned long ioaddr, int pbl, u32 dma_tx, u32 dma_rx);
247 /* Dump MAC registers */
248 void (*dump_mac_regs) (unsigned long ioaddr);
249 /* Dump DMA registers */
250 void (*dump_dma_regs) (unsigned long ioaddr);
251 /* Set tx/rx threshold in the csr6 register
252 * An invalid value enables the store-and-forward mode */
253 void (*dma_mode) (unsigned long ioaddr, int txmode, int rxmode);
254 /* To track extra statistic (if supported) */
255 void (*dma_diagnostic_fr) (void *data, struct stmmac_extra_stats *x,
256 unsigned long ioaddr);
257 /* RX descriptor ring initialization */
258 void (*init_rx_desc) (struct dma_desc *p, unsigned int ring_size, 244 void (*init_rx_desc) (struct dma_desc *p, unsigned int ring_size,
259 int disable_rx_ic); 245 int disable_rx_ic);
260 /* TX descriptor ring initialization */ 246 /* DMA TX descriptor ring initialization */
261 void (*init_tx_desc) (struct dma_desc *p, unsigned int ring_size); 247 void (*init_tx_desc) (struct dma_desc *p, unsigned int ring_size);
262 248
263 /* Invoked by the xmit function to prepare the tx descriptor */ 249 /* Invoked by the xmit function to prepare the tx descriptor */
@@ -281,7 +267,6 @@ struct stmmac_ops {
281 /* Get the buffer size from the descriptor */ 267 /* Get the buffer size from the descriptor */
282 int (*get_tx_len) (struct dma_desc *p); 268 int (*get_tx_len) (struct dma_desc *p);
283 /* Handle extra events on specific interrupts hw dependent */ 269 /* Handle extra events on specific interrupts hw dependent */
284 void (*host_irq_status) (unsigned long ioaddr);
285 int (*get_rx_owner) (struct dma_desc *p); 270 int (*get_rx_owner) (struct dma_desc *p);
286 void (*set_rx_owner) (struct dma_desc *p); 271 void (*set_rx_owner) (struct dma_desc *p);
287 /* Get the receive frame size */ 272 /* Get the receive frame size */
@@ -289,6 +274,28 @@ struct stmmac_ops {
289 /* Return the reception status looking at the RDES1 */ 274 /* Return the reception status looking at the RDES1 */
290 int (*rx_status) (void *data, struct stmmac_extra_stats *x, 275 int (*rx_status) (void *data, struct stmmac_extra_stats *x,
291 struct dma_desc *p); 276 struct dma_desc *p);
277};
278
279struct stmmac_dma_ops {
280 /* DMA core initialization */
281 int (*init) (unsigned long ioaddr, int pbl, u32 dma_tx, u32 dma_rx);
282 /* Dump DMA registers */
283 void (*dump_regs) (unsigned long ioaddr);
284 /* Set tx/rx threshold in the csr6 register
285 * An invalid value enables the store-and-forward mode */
286 void (*dma_mode) (unsigned long ioaddr, int txmode, int rxmode);
287 /* To track extra statistic (if supported) */
288 void (*dma_diagnostic_fr) (void *data, struct stmmac_extra_stats *x,
289 unsigned long ioaddr);
290};
291
292struct stmmac_ops {
293 /* MAC core initialization */
294 void (*core_init) (unsigned long ioaddr) ____cacheline_aligned;
295 /* Dump MAC registers */
296 void (*dump_regs) (unsigned long ioaddr);
297 /* Handle extra events on specific interrupts hw dependent */
298 void (*host_irq_status) (unsigned long ioaddr);
292 /* Multicast filter setting */ 299 /* Multicast filter setting */
293 void (*set_filter) (struct net_device *dev); 300 void (*set_filter) (struct net_device *dev);
294 /* Flow control setting */ 301 /* Flow control setting */
@@ -298,9 +305,9 @@ struct stmmac_ops {
298 void (*pmt) (unsigned long ioaddr, unsigned long mode); 305 void (*pmt) (unsigned long ioaddr, unsigned long mode);
299 /* Set/Get Unicast MAC addresses */ 306 /* Set/Get Unicast MAC addresses */
300 void (*set_umac_addr) (unsigned long ioaddr, unsigned char *addr, 307 void (*set_umac_addr) (unsigned long ioaddr, unsigned char *addr,
301 unsigned int reg_n); 308 unsigned int reg_n);
302 void (*get_umac_addr) (unsigned long ioaddr, unsigned char *addr, 309 void (*get_umac_addr) (unsigned long ioaddr, unsigned char *addr,
303 unsigned int reg_n); 310 unsigned int reg_n);
304}; 311};
305 312
306struct mac_link { 313struct mac_link {
@@ -314,16 +321,13 @@ struct mii_regs {
314 unsigned int data; /* MII Data */ 321 unsigned int data; /* MII Data */
315}; 322};
316 323
317struct hw_cap {
318 unsigned int version; /* Core Version register (GMAC) */
319 unsigned int pmt; /* Power-Down mode (GMAC) */
320 struct mac_link link;
321 struct mii_regs mii;
322};
323
324struct mac_device_info { 324struct mac_device_info {
325 struct hw_cap hw; 325 struct stmmac_ops *mac;
326 struct stmmac_ops *ops; 326 struct stmmac_desc_ops *desc;
327 struct stmmac_dma_ops *dma;
328 unsigned int pmt; /* support Power-Down */
329 struct mii_regs mii; /* MII register Addresses */
330 struct mac_link link;
327}; 331};
328 332
329struct mac_device_info *gmac_setup(unsigned long addr); 333struct mac_device_info *gmac_setup(unsigned long addr);