diff options
Diffstat (limited to 'drivers/net/ethernet/cadence/macb.h')
-rw-r--r-- | drivers/net/ethernet/cadence/macb.h | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 335e288f5314..864e38042b2d 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h | |||
@@ -10,10 +10,15 @@ | |||
10 | #ifndef _MACB_H | 10 | #ifndef _MACB_H |
11 | #define _MACB_H | 11 | #define _MACB_H |
12 | 12 | ||
13 | #define MACB_GREGS_NBR 16 | ||
14 | #define MACB_GREGS_VERSION 1 | ||
15 | |||
13 | /* MACB register offsets */ | 16 | /* MACB register offsets */ |
14 | #define MACB_NCR 0x0000 | 17 | #define MACB_NCR 0x0000 |
15 | #define MACB_NCFGR 0x0004 | 18 | #define MACB_NCFGR 0x0004 |
16 | #define MACB_NSR 0x0008 | 19 | #define MACB_NSR 0x0008 |
20 | #define MACB_TAR 0x000c /* AT91RM9200 only */ | ||
21 | #define MACB_TCR 0x0010 /* AT91RM9200 only */ | ||
17 | #define MACB_TSR 0x0014 | 22 | #define MACB_TSR 0x0014 |
18 | #define MACB_RBQP 0x0018 | 23 | #define MACB_RBQP 0x0018 |
19 | #define MACB_TBQP 0x001c | 24 | #define MACB_TBQP 0x001c |
@@ -133,6 +138,8 @@ | |||
133 | #define MACB_RTY_SIZE 1 | 138 | #define MACB_RTY_SIZE 1 |
134 | #define MACB_PAE_OFFSET 13 | 139 | #define MACB_PAE_OFFSET 13 |
135 | #define MACB_PAE_SIZE 1 | 140 | #define MACB_PAE_SIZE 1 |
141 | #define MACB_RM9200_RMII_OFFSET 13 /* AT91RM9200 only */ | ||
142 | #define MACB_RM9200_RMII_SIZE 1 /* AT91RM9200 only */ | ||
136 | #define MACB_RBOF_OFFSET 14 | 143 | #define MACB_RBOF_OFFSET 14 |
137 | #define MACB_RBOF_SIZE 2 | 144 | #define MACB_RBOF_SIZE 2 |
138 | #define MACB_RLCE_OFFSET 16 | 145 | #define MACB_RLCE_OFFSET 16 |
@@ -145,6 +152,8 @@ | |||
145 | #define MACB_IRXFCS_SIZE 1 | 152 | #define MACB_IRXFCS_SIZE 1 |
146 | 153 | ||
147 | /* GEM specific NCFGR bitfields. */ | 154 | /* GEM specific NCFGR bitfields. */ |
155 | #define GEM_GBE_OFFSET 10 | ||
156 | #define GEM_GBE_SIZE 1 | ||
148 | #define GEM_CLK_OFFSET 18 | 157 | #define GEM_CLK_OFFSET 18 |
149 | #define GEM_CLK_SIZE 3 | 158 | #define GEM_CLK_SIZE 3 |
150 | #define GEM_DBW_OFFSET 21 | 159 | #define GEM_DBW_OFFSET 21 |
@@ -178,6 +187,8 @@ | |||
178 | #define MACB_TGO_SIZE 1 | 187 | #define MACB_TGO_SIZE 1 |
179 | #define MACB_BEX_OFFSET 4 | 188 | #define MACB_BEX_OFFSET 4 |
180 | #define MACB_BEX_SIZE 1 | 189 | #define MACB_BEX_SIZE 1 |
190 | #define MACB_RM9200_BNQ_OFFSET 4 /* AT91RM9200 only */ | ||
191 | #define MACB_RM9200_BNQ_SIZE 1 /* AT91RM9200 only */ | ||
181 | #define MACB_COMP_OFFSET 5 | 192 | #define MACB_COMP_OFFSET 5 |
182 | #define MACB_COMP_SIZE 1 | 193 | #define MACB_COMP_SIZE 1 |
183 | #define MACB_UND_OFFSET 6 | 194 | #define MACB_UND_OFFSET 6 |
@@ -246,6 +257,8 @@ | |||
246 | /* Bitfields in USRIO (AT91) */ | 257 | /* Bitfields in USRIO (AT91) */ |
247 | #define MACB_RMII_OFFSET 0 | 258 | #define MACB_RMII_OFFSET 0 |
248 | #define MACB_RMII_SIZE 1 | 259 | #define MACB_RMII_SIZE 1 |
260 | #define GEM_RGMII_OFFSET 0 /* GEM gigabit mode */ | ||
261 | #define GEM_RGMII_SIZE 1 | ||
249 | #define MACB_CLKEN_OFFSET 1 | 262 | #define MACB_CLKEN_OFFSET 1 |
250 | #define MACB_CLKEN_SIZE 1 | 263 | #define MACB_CLKEN_SIZE 1 |
251 | 264 | ||
@@ -352,7 +365,12 @@ | |||
352 | __v; \ | 365 | __v; \ |
353 | }) | 366 | }) |
354 | 367 | ||
355 | struct dma_desc { | 368 | /** |
369 | * struct macb_dma_desc - Hardware DMA descriptor | ||
370 | * @addr: DMA address of data buffer | ||
371 | * @ctrl: Control and status bits | ||
372 | */ | ||
373 | struct macb_dma_desc { | ||
356 | u32 addr; | 374 | u32 addr; |
357 | u32 ctrl; | 375 | u32 ctrl; |
358 | }; | 376 | }; |
@@ -417,7 +435,12 @@ struct dma_desc { | |||
417 | #define MACB_TX_USED_OFFSET 31 | 435 | #define MACB_TX_USED_OFFSET 31 |
418 | #define MACB_TX_USED_SIZE 1 | 436 | #define MACB_TX_USED_SIZE 1 |
419 | 437 | ||
420 | struct ring_info { | 438 | /** |
439 | * struct macb_tx_skb - data about an skb which is being transmitted | ||
440 | * @skb: skb currently being transmitted | ||
441 | * @mapping: DMA address of the skb's data buffer | ||
442 | */ | ||
443 | struct macb_tx_skb { | ||
421 | struct sk_buff *skb; | 444 | struct sk_buff *skb; |
422 | dma_addr_t mapping; | 445 | dma_addr_t mapping; |
423 | }; | 446 | }; |
@@ -502,12 +525,12 @@ struct macb { | |||
502 | void __iomem *regs; | 525 | void __iomem *regs; |
503 | 526 | ||
504 | unsigned int rx_tail; | 527 | unsigned int rx_tail; |
505 | struct dma_desc *rx_ring; | 528 | struct macb_dma_desc *rx_ring; |
506 | void *rx_buffers; | 529 | void *rx_buffers; |
507 | 530 | ||
508 | unsigned int tx_head, tx_tail; | 531 | unsigned int tx_head, tx_tail; |
509 | struct dma_desc *tx_ring; | 532 | struct macb_dma_desc *tx_ring; |
510 | struct ring_info *tx_skb; | 533 | struct macb_tx_skb *tx_skb; |
511 | 534 | ||
512 | spinlock_t lock; | 535 | spinlock_t lock; |
513 | struct platform_device *pdev; | 536 | struct platform_device *pdev; |
@@ -515,6 +538,7 @@ struct macb { | |||
515 | struct clk *hclk; | 538 | struct clk *hclk; |
516 | struct net_device *dev; | 539 | struct net_device *dev; |
517 | struct napi_struct napi; | 540 | struct napi_struct napi; |
541 | struct work_struct tx_error_task; | ||
518 | struct net_device_stats stats; | 542 | struct net_device_stats stats; |
519 | union { | 543 | union { |
520 | struct macb_stats macb; | 544 | struct macb_stats macb; |
@@ -525,8 +549,6 @@ struct macb { | |||
525 | dma_addr_t tx_ring_dma; | 549 | dma_addr_t tx_ring_dma; |
526 | dma_addr_t rx_buffers_dma; | 550 | dma_addr_t rx_buffers_dma; |
527 | 551 | ||
528 | unsigned int rx_pending, tx_pending; | ||
529 | |||
530 | struct mii_bus *mii_bus; | 552 | struct mii_bus *mii_bus; |
531 | struct phy_device *phy_dev; | 553 | struct phy_device *phy_dev; |
532 | unsigned int link; | 554 | unsigned int link; |
@@ -534,8 +556,22 @@ struct macb { | |||
534 | unsigned int duplex; | 556 | unsigned int duplex; |
535 | 557 | ||
536 | phy_interface_t phy_interface; | 558 | phy_interface_t phy_interface; |
559 | |||
560 | /* AT91RM9200 transmit */ | ||
561 | struct sk_buff *skb; /* holds skb until xmit interrupt completes */ | ||
562 | dma_addr_t skb_physaddr; /* phys addr from pci_map_single */ | ||
563 | int skb_length; /* saved skb length for pci_unmap_single */ | ||
537 | }; | 564 | }; |
538 | 565 | ||
566 | extern const struct ethtool_ops macb_ethtool_ops; | ||
567 | |||
568 | int macb_mii_init(struct macb *bp); | ||
569 | int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | ||
570 | struct net_device_stats *macb_get_stats(struct net_device *dev); | ||
571 | void macb_set_rx_mode(struct net_device *dev); | ||
572 | void macb_set_hwaddr(struct macb *bp); | ||
573 | void macb_get_hwaddr(struct macb *bp); | ||
574 | |||
539 | static inline bool macb_is_gem(struct macb *bp) | 575 | static inline bool macb_is_gem(struct macb *bp) |
540 | { | 576 | { |
541 | return MACB_BFEXT(IDNUM, macb_readl(bp, MID)) == 0x2; | 577 | return MACB_BFEXT(IDNUM, macb_readl(bp, MID)) == 0x2; |