aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro/stmmac/common.h
diff options
context:
space:
mode:
authorGiuseppe CAVALLARO <peppe.cavallaro@st.com>2013-03-26 00:43:05 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-26 12:53:36 -0400
commit4a7d666a7202744af32d4da31fb52857b7d86850 (patch)
tree37aaa3fc4b8aba60ff1d9557a9662e7d30a96c4d /drivers/net/ethernet/stmicro/stmmac/common.h
parentad999eee669d6a0439f5b9734e87eed50e776e32 (diff)
stmmac: reorganize chain/ring modes removing Koptions
Previously we had two Koptions to decide if the stmmac had to use either a ring or a chain to manage its descriptors. This patch removes the Kernel configuration options and it allow us to use the chain mode by passing a module option. Ring mode continues to be the default. Also with this patch, it will be easier to validate the driver built and guarantee that all the two modes always compile fine. Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/common.h')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/common.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 186d14806122..a29553211dee 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -255,23 +255,27 @@ struct dma_features {
255#define STMMAC_DEFAULT_LIT_LS_TIMER 0x3E8 255#define STMMAC_DEFAULT_LIT_LS_TIMER 0x3E8
256#define STMMAC_DEFAULT_TWT_LS_TIMER 0x0 256#define STMMAC_DEFAULT_TWT_LS_TIMER 0x0
257 257
258#define STMMAC_CHAIN_MODE 0x1
259#define STMMAC_RING_MODE 0x2
260
258struct stmmac_desc_ops { 261struct stmmac_desc_ops {
259 /* DMA RX descriptor ring initialization */ 262 /* DMA RX descriptor ring initialization */
260 void (*init_rx_desc) (struct dma_desc *p, unsigned int ring_size, 263 void (*init_rx_desc) (struct dma_desc *p, unsigned int ring_size,
261 int disable_rx_ic); 264 int disable_rx_ic, int mode);
262 /* DMA TX descriptor ring initialization */ 265 /* DMA TX descriptor ring initialization */
263 void (*init_tx_desc) (struct dma_desc *p, unsigned int ring_size); 266 void (*init_tx_desc) (struct dma_desc *p, unsigned int ring_size,
267 int mode);
264 268
265 /* Invoked by the xmit function to prepare the tx descriptor */ 269 /* Invoked by the xmit function to prepare the tx descriptor */
266 void (*prepare_tx_desc) (struct dma_desc *p, int is_fs, int len, 270 void (*prepare_tx_desc) (struct dma_desc *p, int is_fs, int len,
267 int csum_flag); 271 int csum_flag, int mode);
268 /* Set/get the owner of the descriptor */ 272 /* Set/get the owner of the descriptor */
269 void (*set_tx_owner) (struct dma_desc *p); 273 void (*set_tx_owner) (struct dma_desc *p);
270 int (*get_tx_owner) (struct dma_desc *p); 274 int (*get_tx_owner) (struct dma_desc *p);
271 /* Invoked by the xmit function to close the tx descriptor */ 275 /* Invoked by the xmit function to close the tx descriptor */
272 void (*close_tx_desc) (struct dma_desc *p); 276 void (*close_tx_desc) (struct dma_desc *p);
273 /* Clean the tx descriptor as soon as the tx irq is received */ 277 /* Clean the tx descriptor as soon as the tx irq is received */
274 void (*release_tx_desc) (struct dma_desc *p); 278 void (*release_tx_desc) (struct dma_desc *p, int mode);
275 /* Clear interrupt on tx frame completion. When this bit is 279 /* Clear interrupt on tx frame completion. When this bit is
276 * set an interrupt happens as soon as the frame is transmitted */ 280 * set an interrupt happens as soon as the frame is transmitted */
277 void (*clear_tx_ic) (struct dma_desc *p); 281 void (*clear_tx_ic) (struct dma_desc *p);
@@ -361,18 +365,24 @@ struct stmmac_ring_mode_ops {
361 unsigned int (*is_jumbo_frm) (int len, int ehn_desc); 365 unsigned int (*is_jumbo_frm) (int len, int ehn_desc);
362 unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum); 366 unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum);
363 void (*refill_desc3) (int bfsize, struct dma_desc *p); 367 void (*refill_desc3) (int bfsize, struct dma_desc *p);
364 void (*init_desc3) (int des3_as_data_buf, struct dma_desc *p); 368 void (*init_desc3) (struct dma_desc *p);
365 void (*init_dma_chain) (struct dma_desc *des, dma_addr_t phy_addr,
366 unsigned int size);
367 void (*clean_desc3) (struct dma_desc *p); 369 void (*clean_desc3) (struct dma_desc *p);
368 int (*set_16kib_bfsize) (int mtu); 370 int (*set_16kib_bfsize) (int mtu);
369}; 371};
370 372
373struct stmmac_chain_mode_ops {
374 unsigned int (*is_jumbo_frm) (int len, int ehn_desc);
375 unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum);
376 void (*init_dma_chain) (struct dma_desc *des, dma_addr_t phy_addr,
377 unsigned int size);
378};
379
371struct mac_device_info { 380struct mac_device_info {
372 const struct stmmac_ops *mac; 381 const struct stmmac_ops *mac;
373 const struct stmmac_desc_ops *desc; 382 const struct stmmac_desc_ops *desc;
374 const struct stmmac_dma_ops *dma; 383 const struct stmmac_dma_ops *dma;
375 const struct stmmac_ring_mode_ops *ring; 384 const struct stmmac_ring_mode_ops *ring;
385 const struct stmmac_chain_mode_ops *chain;
376 struct mii_regs mii; /* MII register Addresses */ 386 struct mii_regs mii; /* MII register Addresses */
377 struct mac_link link; 387 struct mac_link link;
378 unsigned int synopsys_uid; 388 unsigned int synopsys_uid;
@@ -390,5 +400,6 @@ extern void stmmac_set_mac(void __iomem *ioaddr, bool enable);
390 400
391extern void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr); 401extern void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr);
392extern const struct stmmac_ring_mode_ops ring_mode_ops; 402extern const struct stmmac_ring_mode_ops ring_mode_ops;
403extern const struct stmmac_chain_mode_ops chain_mode_ops;
393 404
394#endif /* __COMMON_H__ */ 405#endif /* __COMMON_H__ */