diff options
author | Giuseppe CAVALLARO <peppe.cavallaro@st.com> | 2010-01-06 18:07:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-01-07 20:06:08 -0500 |
commit | db98a0b001df79ffcdd4f231c3516411786a1113 (patch) | |
tree | 0a21ac92a40c2c6cefc3e442b1dfa40982da446a /drivers/net | |
parent | 65818fa744e70a58d230083dda1f1cd8e5c5e2ee (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')
-rw-r--r-- | drivers/net/stmmac/common.h | 64 | ||||
-rw-r--r-- | drivers/net/stmmac/gmac.c | 43 | ||||
-rw-r--r-- | drivers/net/stmmac/mac100.c | 43 | ||||
-rw-r--r-- | drivers/net/stmmac/stmmac.h | 2 | ||||
-rw-r--r-- | drivers/net/stmmac/stmmac_ethtool.c | 8 | ||||
-rw-r--r-- | drivers/net/stmmac/stmmac_main.c | 138 | ||||
-rw-r--r-- | drivers/net/stmmac/stmmac_mdio.c | 10 |
7 files changed, 162 insertions, 146 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 | ||
242 | struct stmmac_ops { | 242 | struct 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 | |||
279 | struct 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 | |||
292 | struct 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 | ||
306 | struct mac_link { | 313 | struct 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 | ||
317 | struct 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 | |||
324 | struct mac_device_info { | 324 | struct 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 | ||
329 | struct mac_device_info *gmac_setup(unsigned long addr); | 333 | struct mac_device_info *gmac_setup(unsigned long addr); |
diff --git a/drivers/net/stmmac/gmac.c b/drivers/net/stmmac/gmac.c index c1278876ef25..cf199d969227 100644 --- a/drivers/net/stmmac/gmac.c +++ b/drivers/net/stmmac/gmac.c | |||
@@ -630,19 +630,28 @@ static int gmac_get_rx_frame_len(struct dma_desc *p) | |||
630 | return p->des01.erx.frame_length; | 630 | return p->des01.erx.frame_length; |
631 | } | 631 | } |
632 | 632 | ||
633 | struct stmmac_ops gmac_driver = { | 633 | struct stmmac_ops gmac_ops = { |
634 | .core_init = gmac_core_init, | 634 | .core_init = gmac_core_init, |
635 | .dump_mac_regs = gmac_dump_regs, | 635 | .dump_regs = gmac_dump_regs, |
636 | .dma_init = gmac_dma_init, | 636 | .host_irq_status = gmac_irq_status, |
637 | .dump_dma_regs = gmac_dump_dma_regs, | 637 | .set_filter = gmac_set_filter, |
638 | .flow_ctrl = gmac_flow_ctrl, | ||
639 | .pmt = gmac_pmt, | ||
640 | .set_umac_addr = gmac_set_umac_addr, | ||
641 | .get_umac_addr = gmac_get_umac_addr, | ||
642 | }; | ||
643 | |||
644 | struct stmmac_dma_ops gmac_dma_ops = { | ||
645 | .init = gmac_dma_init, | ||
646 | .dump_regs = gmac_dump_dma_regs, | ||
638 | .dma_mode = gmac_dma_operation_mode, | 647 | .dma_mode = gmac_dma_operation_mode, |
639 | .dma_diagnostic_fr = gmac_dma_diagnostic_fr, | 648 | .dma_diagnostic_fr = gmac_dma_diagnostic_fr, |
649 | }; | ||
650 | |||
651 | struct stmmac_desc_ops gmac_desc_ops = { | ||
640 | .tx_status = gmac_get_tx_frame_status, | 652 | .tx_status = gmac_get_tx_frame_status, |
641 | .rx_status = gmac_get_rx_frame_status, | 653 | .rx_status = gmac_get_rx_frame_status, |
642 | .get_tx_len = gmac_get_tx_len, | 654 | .get_tx_len = gmac_get_tx_len, |
643 | .set_filter = gmac_set_filter, | ||
644 | .flow_ctrl = gmac_flow_ctrl, | ||
645 | .pmt = gmac_pmt, | ||
646 | .init_rx_desc = gmac_init_rx_desc, | 655 | .init_rx_desc = gmac_init_rx_desc, |
647 | .init_tx_desc = gmac_init_tx_desc, | 656 | .init_tx_desc = gmac_init_tx_desc, |
648 | .get_tx_owner = gmac_get_tx_owner, | 657 | .get_tx_owner = gmac_get_tx_owner, |
@@ -655,9 +664,6 @@ struct stmmac_ops gmac_driver = { | |||
655 | .set_tx_owner = gmac_set_tx_owner, | 664 | .set_tx_owner = gmac_set_tx_owner, |
656 | .set_rx_owner = gmac_set_rx_owner, | 665 | .set_rx_owner = gmac_set_rx_owner, |
657 | .get_rx_frame_len = gmac_get_rx_frame_len, | 666 | .get_rx_frame_len = gmac_get_rx_frame_len, |
658 | .host_irq_status = gmac_irq_status, | ||
659 | .set_umac_addr = gmac_set_umac_addr, | ||
660 | .get_umac_addr = gmac_get_umac_addr, | ||
661 | }; | 667 | }; |
662 | 668 | ||
663 | struct mac_device_info *gmac_setup(unsigned long ioaddr) | 669 | struct mac_device_info *gmac_setup(unsigned long ioaddr) |
@@ -670,13 +676,16 @@ struct mac_device_info *gmac_setup(unsigned long ioaddr) | |||
670 | 676 | ||
671 | mac = kzalloc(sizeof(const struct mac_device_info), GFP_KERNEL); | 677 | mac = kzalloc(sizeof(const struct mac_device_info), GFP_KERNEL); |
672 | 678 | ||
673 | mac->ops = &gmac_driver; | 679 | mac->mac = &gmac_ops; |
674 | mac->hw.pmt = PMT_SUPPORTED; | 680 | mac->desc = &gmac_desc_ops; |
675 | mac->hw.link.port = GMAC_CONTROL_PS; | 681 | mac->dma = &gmac_dma_ops; |
676 | mac->hw.link.duplex = GMAC_CONTROL_DM; | 682 | |
677 | mac->hw.link.speed = GMAC_CONTROL_FES; | 683 | mac->pmt = PMT_SUPPORTED; |
678 | mac->hw.mii.addr = GMAC_MII_ADDR; | 684 | mac->link.port = GMAC_CONTROL_PS; |
679 | mac->hw.mii.data = GMAC_MII_DATA; | 685 | mac->link.duplex = GMAC_CONTROL_DM; |
686 | mac->link.speed = GMAC_CONTROL_FES; | ||
687 | mac->mii.addr = GMAC_MII_ADDR; | ||
688 | mac->mii.data = GMAC_MII_DATA; | ||
680 | 689 | ||
681 | return mac; | 690 | return mac; |
682 | } | 691 | } |
diff --git a/drivers/net/stmmac/mac100.c b/drivers/net/stmmac/mac100.c index 625171b6062b..45d0457ddb6e 100644 --- a/drivers/net/stmmac/mac100.c +++ b/drivers/net/stmmac/mac100.c | |||
@@ -467,19 +467,28 @@ static int mac100_get_rx_frame_len(struct dma_desc *p) | |||
467 | return p->des01.rx.frame_length; | 467 | return p->des01.rx.frame_length; |
468 | } | 468 | } |
469 | 469 | ||
470 | struct stmmac_ops mac100_driver = { | 470 | struct stmmac_ops mac100_ops = { |
471 | .core_init = mac100_core_init, | 471 | .core_init = mac100_core_init, |
472 | .dump_mac_regs = mac100_dump_mac_regs, | 472 | .dump_regs = mac100_dump_mac_regs, |
473 | .dma_init = mac100_dma_init, | 473 | .host_irq_status = mac100_irq_status, |
474 | .dump_dma_regs = mac100_dump_dma_regs, | 474 | .set_filter = mac100_set_filter, |
475 | .flow_ctrl = mac100_flow_ctrl, | ||
476 | .pmt = mac100_pmt, | ||
477 | .set_umac_addr = mac100_set_umac_addr, | ||
478 | .get_umac_addr = mac100_get_umac_addr, | ||
479 | }; | ||
480 | |||
481 | struct stmmac_dma_ops mac100_dma_ops = { | ||
482 | .init = mac100_dma_init, | ||
483 | .dump_regs = mac100_dump_dma_regs, | ||
475 | .dma_mode = mac100_dma_operation_mode, | 484 | .dma_mode = mac100_dma_operation_mode, |
476 | .dma_diagnostic_fr = mac100_dma_diagnostic_fr, | 485 | .dma_diagnostic_fr = mac100_dma_diagnostic_fr, |
486 | }; | ||
487 | |||
488 | struct stmmac_desc_ops mac100_desc_ops = { | ||
477 | .tx_status = mac100_get_tx_frame_status, | 489 | .tx_status = mac100_get_tx_frame_status, |
478 | .rx_status = mac100_get_rx_frame_status, | 490 | .rx_status = mac100_get_rx_frame_status, |
479 | .get_tx_len = mac100_get_tx_len, | 491 | .get_tx_len = mac100_get_tx_len, |
480 | .set_filter = mac100_set_filter, | ||
481 | .flow_ctrl = mac100_flow_ctrl, | ||
482 | .pmt = mac100_pmt, | ||
483 | .init_rx_desc = mac100_init_rx_desc, | 492 | .init_rx_desc = mac100_init_rx_desc, |
484 | .init_tx_desc = mac100_init_tx_desc, | 493 | .init_tx_desc = mac100_init_tx_desc, |
485 | .get_tx_owner = mac100_get_tx_owner, | 494 | .get_tx_owner = mac100_get_tx_owner, |
@@ -492,9 +501,6 @@ struct stmmac_ops mac100_driver = { | |||
492 | .set_tx_owner = mac100_set_tx_owner, | 501 | .set_tx_owner = mac100_set_tx_owner, |
493 | .set_rx_owner = mac100_set_rx_owner, | 502 | .set_rx_owner = mac100_set_rx_owner, |
494 | .get_rx_frame_len = mac100_get_rx_frame_len, | 503 | .get_rx_frame_len = mac100_get_rx_frame_len, |
495 | .host_irq_status = mac100_irq_status, | ||
496 | .set_umac_addr = mac100_set_umac_addr, | ||
497 | .get_umac_addr = mac100_get_umac_addr, | ||
498 | }; | 504 | }; |
499 | 505 | ||
500 | struct mac_device_info *mac100_setup(unsigned long ioaddr) | 506 | struct mac_device_info *mac100_setup(unsigned long ioaddr) |
@@ -505,13 +511,16 @@ struct mac_device_info *mac100_setup(unsigned long ioaddr) | |||
505 | 511 | ||
506 | pr_info("\tMAC 10/100\n"); | 512 | pr_info("\tMAC 10/100\n"); |
507 | 513 | ||
508 | mac->ops = &mac100_driver; | 514 | mac->mac = &mac100_ops; |
509 | mac->hw.pmt = PMT_NOT_SUPPORTED; | 515 | mac->desc = &mac100_desc_ops; |
510 | mac->hw.link.port = MAC_CONTROL_PS; | 516 | mac->dma = &mac100_dma_ops; |
511 | mac->hw.link.duplex = MAC_CONTROL_F; | 517 | |
512 | mac->hw.link.speed = 0; | 518 | mac->pmt = PMT_NOT_SUPPORTED; |
513 | mac->hw.mii.addr = MAC_MII_ADDR; | 519 | mac->link.port = MAC_CONTROL_PS; |
514 | mac->hw.mii.data = MAC_MII_DATA; | 520 | mac->link.duplex = MAC_CONTROL_F; |
521 | mac->link.speed = 0; | ||
522 | mac->mii.addr = MAC_MII_ADDR; | ||
523 | mac->mii.data = MAC_MII_DATA; | ||
515 | 524 | ||
516 | return mac; | 525 | return mac; |
517 | } | 526 | } |
diff --git a/drivers/net/stmmac/stmmac.h b/drivers/net/stmmac/stmmac.h index 0d5529fa579a..44421d9667a8 100644 --- a/drivers/net/stmmac/stmmac.h +++ b/drivers/net/stmmac/stmmac.h | |||
@@ -58,7 +58,7 @@ struct stmmac_priv { | |||
58 | int rx_csum; | 58 | int rx_csum; |
59 | unsigned int dma_buf_sz; | 59 | unsigned int dma_buf_sz; |
60 | struct device *device; | 60 | struct device *device; |
61 | struct mac_device_info *mac_type; | 61 | struct mac_device_info *hw; |
62 | 62 | ||
63 | struct stmmac_extra_stats xstats; | 63 | struct stmmac_extra_stats xstats; |
64 | struct napi_struct napi; | 64 | struct napi_struct napi; |
diff --git a/drivers/net/stmmac/stmmac_ethtool.c b/drivers/net/stmmac/stmmac_ethtool.c index 694ebe6a0758..9c7ce1ea3aea 100644 --- a/drivers/net/stmmac/stmmac_ethtool.c +++ b/drivers/net/stmmac/stmmac_ethtool.c | |||
@@ -268,8 +268,8 @@ stmmac_set_pauseparam(struct net_device *netdev, | |||
268 | } | 268 | } |
269 | } else { | 269 | } else { |
270 | unsigned long ioaddr = netdev->base_addr; | 270 | unsigned long ioaddr = netdev->base_addr; |
271 | priv->mac_type->ops->flow_ctrl(ioaddr, phy->duplex, | 271 | priv->hw->mac->flow_ctrl(ioaddr, phy->duplex, |
272 | priv->flow_ctrl, priv->pause); | 272 | priv->flow_ctrl, priv->pause); |
273 | } | 273 | } |
274 | spin_unlock(&priv->lock); | 274 | spin_unlock(&priv->lock); |
275 | return ret; | 275 | return ret; |
@@ -283,8 +283,8 @@ static void stmmac_get_ethtool_stats(struct net_device *dev, | |||
283 | int i; | 283 | int i; |
284 | 284 | ||
285 | /* Update HW stats if supported */ | 285 | /* Update HW stats if supported */ |
286 | priv->mac_type->ops->dma_diagnostic_fr(&dev->stats, &priv->xstats, | 286 | priv->hw->dma->dma_diagnostic_fr(&dev->stats, (void *) &priv->xstats, |
287 | ioaddr); | 287 | ioaddr); |
288 | 288 | ||
289 | for (i = 0; i < STMMAC_STATS_LEN; i++) { | 289 | for (i = 0; i < STMMAC_STATS_LEN; i++) { |
290 | char *p = (char *)priv + stmmac_gstrings_stats[i].stat_offset; | 290 | char *p = (char *)priv + stmmac_gstrings_stats[i].stat_offset; |
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c index 82ebbc0c8839..86e910300969 100644 --- a/drivers/net/stmmac/stmmac_main.c +++ b/drivers/net/stmmac/stmmac_main.c | |||
@@ -225,38 +225,34 @@ static void stmmac_adjust_link(struct net_device *dev) | |||
225 | if (phydev->duplex != priv->oldduplex) { | 225 | if (phydev->duplex != priv->oldduplex) { |
226 | new_state = 1; | 226 | new_state = 1; |
227 | if (!(phydev->duplex)) | 227 | if (!(phydev->duplex)) |
228 | ctrl &= ~priv->mac_type->hw.link.duplex; | 228 | ctrl &= ~priv->hw->link.duplex; |
229 | else | 229 | else |
230 | ctrl |= priv->mac_type->hw.link.duplex; | 230 | ctrl |= priv->hw->link.duplex; |
231 | priv->oldduplex = phydev->duplex; | 231 | priv->oldduplex = phydev->duplex; |
232 | } | 232 | } |
233 | /* Flow Control operation */ | 233 | /* Flow Control operation */ |
234 | if (phydev->pause) | 234 | if (phydev->pause) |
235 | priv->mac_type->ops->flow_ctrl(ioaddr, phydev->duplex, | 235 | priv->hw->mac->flow_ctrl(ioaddr, phydev->duplex, |
236 | fc, pause_time); | 236 | fc, pause_time); |
237 | 237 | ||
238 | if (phydev->speed != priv->speed) { | 238 | if (phydev->speed != priv->speed) { |
239 | new_state = 1; | 239 | new_state = 1; |
240 | switch (phydev->speed) { | 240 | switch (phydev->speed) { |
241 | case 1000: | 241 | case 1000: |
242 | if (likely(priv->is_gmac)) | 242 | if (likely(priv->is_gmac)) |
243 | ctrl &= ~priv->mac_type->hw.link.port; | 243 | ctrl &= ~priv->hw->link.port; |
244 | break; | 244 | break; |
245 | case 100: | 245 | case 100: |
246 | case 10: | 246 | case 10: |
247 | if (priv->is_gmac) { | 247 | if (priv->is_gmac) { |
248 | ctrl |= priv->mac_type->hw.link.port; | 248 | ctrl |= priv->hw->link.port; |
249 | if (phydev->speed == SPEED_100) { | 249 | if (phydev->speed == SPEED_100) { |
250 | ctrl |= | 250 | ctrl |= priv->hw->link.speed; |
251 | priv->mac_type->hw.link. | ||
252 | speed; | ||
253 | } else { | 251 | } else { |
254 | ctrl &= | 252 | ctrl &= ~(priv->hw->link.speed); |
255 | ~(priv->mac_type->hw. | ||
256 | link.speed); | ||
257 | } | 253 | } |
258 | } else { | 254 | } else { |
259 | ctrl &= ~priv->mac_type->hw.link.port; | 255 | ctrl &= ~priv->hw->link.port; |
260 | } | 256 | } |
261 | if (likely(priv->fix_mac_speed)) | 257 | if (likely(priv->fix_mac_speed)) |
262 | priv->fix_mac_speed(priv->bsp_priv, | 258 | priv->fix_mac_speed(priv->bsp_priv, |
@@ -509,8 +505,8 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
509 | priv->cur_tx = 0; | 505 | priv->cur_tx = 0; |
510 | 506 | ||
511 | /* Clear the Rx/Tx descriptors */ | 507 | /* Clear the Rx/Tx descriptors */ |
512 | priv->mac_type->ops->init_rx_desc(priv->dma_rx, rxsize, dis_ic); | 508 | priv->hw->desc->init_rx_desc(priv->dma_rx, rxsize, dis_ic); |
513 | priv->mac_type->ops->init_tx_desc(priv->dma_tx, txsize); | 509 | priv->hw->desc->init_tx_desc(priv->dma_tx, txsize); |
514 | 510 | ||
515 | if (netif_msg_hw(priv)) { | 511 | if (netif_msg_hw(priv)) { |
516 | pr_info("RX descriptor ring:\n"); | 512 | pr_info("RX descriptor ring:\n"); |
@@ -545,8 +541,8 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv) | |||
545 | struct dma_desc *p = priv->dma_tx + i; | 541 | struct dma_desc *p = priv->dma_tx + i; |
546 | if (p->des2) | 542 | if (p->des2) |
547 | dma_unmap_single(priv->device, p->des2, | 543 | dma_unmap_single(priv->device, p->des2, |
548 | priv->mac_type->ops->get_tx_len(p), | 544 | priv->hw->desc->get_tx_len(p), |
549 | DMA_TO_DEVICE); | 545 | DMA_TO_DEVICE); |
550 | dev_kfree_skb_any(priv->tx_skbuff[i]); | 546 | dev_kfree_skb_any(priv->tx_skbuff[i]); |
551 | priv->tx_skbuff[i] = NULL; | 547 | priv->tx_skbuff[i] = NULL; |
552 | } | 548 | } |
@@ -630,18 +626,18 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv) | |||
630 | { | 626 | { |
631 | if (!priv->is_gmac) { | 627 | if (!priv->is_gmac) { |
632 | /* MAC 10/100 */ | 628 | /* MAC 10/100 */ |
633 | priv->mac_type->ops->dma_mode(priv->dev->base_addr, tc, 0); | 629 | priv->hw->dma->dma_mode(priv->dev->base_addr, tc, 0); |
634 | priv->tx_coe = NO_HW_CSUM; | 630 | priv->tx_coe = NO_HW_CSUM; |
635 | } else { | 631 | } else { |
636 | if ((priv->dev->mtu <= ETH_DATA_LEN) && (tx_coe)) { | 632 | if ((priv->dev->mtu <= ETH_DATA_LEN) && (tx_coe)) { |
637 | priv->mac_type->ops->dma_mode(priv->dev->base_addr, | 633 | priv->hw->dma->dma_mode(priv->dev->base_addr, |
638 | SF_DMA_MODE, SF_DMA_MODE); | 634 | SF_DMA_MODE, SF_DMA_MODE); |
639 | tc = SF_DMA_MODE; | 635 | tc = SF_DMA_MODE; |
640 | priv->tx_coe = HW_CSUM; | 636 | priv->tx_coe = HW_CSUM; |
641 | } else { | 637 | } else { |
642 | /* Checksum computation is performed in software. */ | 638 | /* Checksum computation is performed in software. */ |
643 | priv->mac_type->ops->dma_mode(priv->dev->base_addr, tc, | 639 | priv->hw->dma->dma_mode(priv->dev->base_addr, tc, |
644 | SF_DMA_MODE); | 640 | SF_DMA_MODE); |
645 | priv->tx_coe = NO_HW_CSUM; | 641 | priv->tx_coe = NO_HW_CSUM; |
646 | } | 642 | } |
647 | } | 643 | } |
@@ -749,16 +745,16 @@ static void stmmac_tx(struct stmmac_priv *priv) | |||
749 | struct dma_desc *p = priv->dma_tx + entry; | 745 | struct dma_desc *p = priv->dma_tx + entry; |
750 | 746 | ||
751 | /* Check if the descriptor is owned by the DMA. */ | 747 | /* Check if the descriptor is owned by the DMA. */ |
752 | if (priv->mac_type->ops->get_tx_owner(p)) | 748 | if (priv->hw->desc->get_tx_owner(p)) |
753 | break; | 749 | break; |
754 | 750 | ||
755 | /* Verify tx error by looking at the last segment */ | 751 | /* Verify tx error by looking at the last segment */ |
756 | last = priv->mac_type->ops->get_tx_ls(p); | 752 | last = priv->hw->desc->get_tx_ls(p); |
757 | if (likely(last)) { | 753 | if (likely(last)) { |
758 | int tx_error = | 754 | int tx_error = |
759 | priv->mac_type->ops->tx_status(&priv->dev->stats, | 755 | priv->hw->desc->tx_status(&priv->dev->stats, |
760 | &priv->xstats, | 756 | &priv->xstats, p, |
761 | p, ioaddr); | 757 | ioaddr); |
762 | if (likely(tx_error == 0)) { | 758 | if (likely(tx_error == 0)) { |
763 | priv->dev->stats.tx_packets++; | 759 | priv->dev->stats.tx_packets++; |
764 | priv->xstats.tx_pkt_n++; | 760 | priv->xstats.tx_pkt_n++; |
@@ -770,7 +766,7 @@ static void stmmac_tx(struct stmmac_priv *priv) | |||
770 | 766 | ||
771 | if (likely(p->des2)) | 767 | if (likely(p->des2)) |
772 | dma_unmap_single(priv->device, p->des2, | 768 | dma_unmap_single(priv->device, p->des2, |
773 | priv->mac_type->ops->get_tx_len(p), | 769 | priv->hw->desc->get_tx_len(p), |
774 | DMA_TO_DEVICE); | 770 | DMA_TO_DEVICE); |
775 | if (unlikely(p->des3)) | 771 | if (unlikely(p->des3)) |
776 | p->des3 = 0; | 772 | p->des3 = 0; |
@@ -791,7 +787,7 @@ static void stmmac_tx(struct stmmac_priv *priv) | |||
791 | priv->tx_skbuff[entry] = NULL; | 787 | priv->tx_skbuff[entry] = NULL; |
792 | } | 788 | } |
793 | 789 | ||
794 | priv->mac_type->ops->release_tx_desc(p); | 790 | priv->hw->desc->release_tx_desc(p); |
795 | 791 | ||
796 | entry = (++priv->dirty_tx) % txsize; | 792 | entry = (++priv->dirty_tx) % txsize; |
797 | } | 793 | } |
@@ -833,7 +829,7 @@ static int stmmac_has_work(struct stmmac_priv *priv) | |||
833 | unsigned int has_work = 0; | 829 | unsigned int has_work = 0; |
834 | int rxret, tx_work = 0; | 830 | int rxret, tx_work = 0; |
835 | 831 | ||
836 | rxret = priv->mac_type->ops->get_rx_owner(priv->dma_rx + | 832 | rxret = priv->hw->desc->get_rx_owner(priv->dma_rx + |
837 | (priv->cur_rx % priv->dma_rx_size)); | 833 | (priv->cur_rx % priv->dma_rx_size)); |
838 | 834 | ||
839 | if (priv->dirty_tx != priv->cur_tx) | 835 | if (priv->dirty_tx != priv->cur_tx) |
@@ -886,7 +882,7 @@ static void stmmac_tx_err(struct stmmac_priv *priv) | |||
886 | 882 | ||
887 | stmmac_dma_stop_tx(priv->dev->base_addr); | 883 | stmmac_dma_stop_tx(priv->dev->base_addr); |
888 | dma_free_tx_skbufs(priv); | 884 | dma_free_tx_skbufs(priv); |
889 | priv->mac_type->ops->init_tx_desc(priv->dma_tx, priv->dma_tx_size); | 885 | priv->hw->desc->init_tx_desc(priv->dma_tx, priv->dma_tx_size); |
890 | priv->dirty_tx = 0; | 886 | priv->dirty_tx = 0; |
891 | priv->cur_tx = 0; | 887 | priv->cur_tx = 0; |
892 | stmmac_dma_start_tx(priv->dev->base_addr); | 888 | stmmac_dma_start_tx(priv->dev->base_addr); |
@@ -926,8 +922,8 @@ static void stmmac_dma_interrupt(struct net_device *dev) | |||
926 | if (unlikely(tc != SF_DMA_MODE) && (tc <= 256)) { | 922 | if (unlikely(tc != SF_DMA_MODE) && (tc <= 256)) { |
927 | /* Try to bump up the threshold */ | 923 | /* Try to bump up the threshold */ |
928 | tc += 64; | 924 | tc += 64; |
929 | priv->mac_type->ops->dma_mode(ioaddr, tc, | 925 | priv->hw->dma->dma_mode(ioaddr, tc, |
930 | SF_DMA_MODE); | 926 | SF_DMA_MODE); |
931 | priv->xstats.threshold = tc; | 927 | priv->xstats.threshold = tc; |
932 | } | 928 | } |
933 | stmmac_tx_err(priv); | 929 | stmmac_tx_err(priv); |
@@ -1059,20 +1055,20 @@ static int stmmac_open(struct net_device *dev) | |||
1059 | init_dma_desc_rings(dev); | 1055 | init_dma_desc_rings(dev); |
1060 | 1056 | ||
1061 | /* DMA initialization and SW reset */ | 1057 | /* DMA initialization and SW reset */ |
1062 | if (unlikely(priv->mac_type->ops->dma_init(ioaddr, | 1058 | if (unlikely(priv->hw->dma->init(ioaddr, priv->pbl, priv->dma_tx_phy, |
1063 | priv->pbl, priv->dma_tx_phy, priv->dma_rx_phy) < 0)) { | 1059 | priv->dma_rx_phy) < 0)) { |
1064 | 1060 | ||
1065 | pr_err("%s: DMA initialization failed\n", __func__); | 1061 | pr_err("%s: DMA initialization failed\n", __func__); |
1066 | return -1; | 1062 | return -1; |
1067 | } | 1063 | } |
1068 | 1064 | ||
1069 | /* Copy the MAC addr into the HW */ | 1065 | /* Copy the MAC addr into the HW */ |
1070 | priv->mac_type->ops->set_umac_addr(ioaddr, dev->dev_addr, 0); | 1066 | priv->hw->mac->set_umac_addr(ioaddr, dev->dev_addr, 0); |
1071 | /* If required, perform hw setup of the bus. */ | 1067 | /* If required, perform hw setup of the bus. */ |
1072 | if (priv->bus_setup) | 1068 | if (priv->bus_setup) |
1073 | priv->bus_setup(ioaddr); | 1069 | priv->bus_setup(ioaddr); |
1074 | /* Initialize the MAC Core */ | 1070 | /* Initialize the MAC Core */ |
1075 | priv->mac_type->ops->core_init(ioaddr); | 1071 | priv->hw->mac->core_init(ioaddr); |
1076 | 1072 | ||
1077 | priv->shutdown = 0; | 1073 | priv->shutdown = 0; |
1078 | 1074 | ||
@@ -1101,8 +1097,8 @@ static int stmmac_open(struct net_device *dev) | |||
1101 | #endif | 1097 | #endif |
1102 | /* Dump DMA/MAC registers */ | 1098 | /* Dump DMA/MAC registers */ |
1103 | if (netif_msg_hw(priv)) { | 1099 | if (netif_msg_hw(priv)) { |
1104 | priv->mac_type->ops->dump_mac_regs(ioaddr); | 1100 | priv->hw->mac->dump_regs(ioaddr); |
1105 | priv->mac_type->ops->dump_dma_regs(ioaddr); | 1101 | priv->hw->dma->dump_regs(ioaddr); |
1106 | } | 1102 | } |
1107 | 1103 | ||
1108 | if (priv->phydev) | 1104 | if (priv->phydev) |
@@ -1218,8 +1214,8 @@ static unsigned int stmmac_handle_jumbo_frames(struct sk_buff *skb, | |||
1218 | desc->des2 = dma_map_single(priv->device, skb->data, | 1214 | desc->des2 = dma_map_single(priv->device, skb->data, |
1219 | BUF_SIZE_8KiB, DMA_TO_DEVICE); | 1215 | BUF_SIZE_8KiB, DMA_TO_DEVICE); |
1220 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 1216 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
1221 | priv->mac_type->ops->prepare_tx_desc(desc, 1, BUF_SIZE_8KiB, | 1217 | priv->hw->desc->prepare_tx_desc(desc, 1, BUF_SIZE_8KiB, |
1222 | csum_insertion); | 1218 | csum_insertion); |
1223 | 1219 | ||
1224 | entry = (++priv->cur_tx) % txsize; | 1220 | entry = (++priv->cur_tx) % txsize; |
1225 | desc = priv->dma_tx + entry; | 1221 | desc = priv->dma_tx + entry; |
@@ -1228,16 +1224,17 @@ static unsigned int stmmac_handle_jumbo_frames(struct sk_buff *skb, | |||
1228 | skb->data + BUF_SIZE_8KiB, | 1224 | skb->data + BUF_SIZE_8KiB, |
1229 | buf2_size, DMA_TO_DEVICE); | 1225 | buf2_size, DMA_TO_DEVICE); |
1230 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 1226 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
1231 | priv->mac_type->ops->prepare_tx_desc(desc, 0, | 1227 | priv->hw->desc->prepare_tx_desc(desc, 0, buf2_size, |
1232 | buf2_size, csum_insertion); | 1228 | csum_insertion); |
1233 | priv->mac_type->ops->set_tx_owner(desc); | 1229 | priv->hw->desc->set_tx_owner(desc); |
1230 | |||
1234 | priv->tx_skbuff[entry] = NULL; | 1231 | priv->tx_skbuff[entry] = NULL; |
1235 | } else { | 1232 | } else { |
1236 | desc->des2 = dma_map_single(priv->device, skb->data, | 1233 | desc->des2 = dma_map_single(priv->device, skb->data, |
1237 | nopaged_len, DMA_TO_DEVICE); | 1234 | nopaged_len, DMA_TO_DEVICE); |
1238 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 1235 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
1239 | priv->mac_type->ops->prepare_tx_desc(desc, 1, nopaged_len, | 1236 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, |
1240 | csum_insertion); | 1237 | csum_insertion); |
1241 | } | 1238 | } |
1242 | return entry; | 1239 | return entry; |
1243 | } | 1240 | } |
@@ -1305,8 +1302,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1305 | unsigned int nopaged_len = skb_headlen(skb); | 1302 | unsigned int nopaged_len = skb_headlen(skb); |
1306 | desc->des2 = dma_map_single(priv->device, skb->data, | 1303 | desc->des2 = dma_map_single(priv->device, skb->data, |
1307 | nopaged_len, DMA_TO_DEVICE); | 1304 | nopaged_len, DMA_TO_DEVICE); |
1308 | priv->mac_type->ops->prepare_tx_desc(desc, 1, nopaged_len, | 1305 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, |
1309 | csum_insertion); | 1306 | csum_insertion); |
1310 | } | 1307 | } |
1311 | 1308 | ||
1312 | for (i = 0; i < nfrags; i++) { | 1309 | for (i = 0; i < nfrags; i++) { |
@@ -1321,21 +1318,20 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1321 | frag->page_offset, | 1318 | frag->page_offset, |
1322 | len, DMA_TO_DEVICE); | 1319 | len, DMA_TO_DEVICE); |
1323 | priv->tx_skbuff[entry] = NULL; | 1320 | priv->tx_skbuff[entry] = NULL; |
1324 | priv->mac_type->ops->prepare_tx_desc(desc, 0, len, | 1321 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion); |
1325 | csum_insertion); | 1322 | priv->hw->desc->set_tx_owner(desc); |
1326 | priv->mac_type->ops->set_tx_owner(desc); | ||
1327 | } | 1323 | } |
1328 | 1324 | ||
1329 | /* Interrupt on completition only for the latest segment */ | 1325 | /* Interrupt on completition only for the latest segment */ |
1330 | priv->mac_type->ops->close_tx_desc(desc); | 1326 | priv->hw->desc->close_tx_desc(desc); |
1331 | 1327 | ||
1332 | #ifdef CONFIG_STMMAC_TIMER | 1328 | #ifdef CONFIG_STMMAC_TIMER |
1333 | /* Clean IC while using timer */ | 1329 | /* Clean IC while using timer */ |
1334 | if (likely(priv->tm->enable)) | 1330 | if (likely(priv->tm->enable)) |
1335 | priv->mac_type->ops->clear_tx_ic(desc); | 1331 | priv->hw->desc->clear_tx_ic(desc); |
1336 | #endif | 1332 | #endif |
1337 | /* To avoid raise condition */ | 1333 | /* To avoid raise condition */ |
1338 | priv->mac_type->ops->set_tx_owner(first); | 1334 | priv->hw->desc->set_tx_owner(first); |
1339 | 1335 | ||
1340 | priv->cur_tx++; | 1336 | priv->cur_tx++; |
1341 | 1337 | ||
@@ -1395,7 +1391,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv) | |||
1395 | } | 1391 | } |
1396 | RX_DBG(KERN_INFO "\trefill entry #%d\n", entry); | 1392 | RX_DBG(KERN_INFO "\trefill entry #%d\n", entry); |
1397 | } | 1393 | } |
1398 | priv->mac_type->ops->set_rx_owner(p + entry); | 1394 | priv->hw->desc->set_rx_owner(p + entry); |
1399 | } | 1395 | } |
1400 | return; | 1396 | return; |
1401 | } | 1397 | } |
@@ -1416,7 +1412,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit) | |||
1416 | } | 1412 | } |
1417 | #endif | 1413 | #endif |
1418 | count = 0; | 1414 | count = 0; |
1419 | while (!priv->mac_type->ops->get_rx_owner(p)) { | 1415 | while (!priv->hw->desc->get_rx_owner(p)) { |
1420 | int status; | 1416 | int status; |
1421 | 1417 | ||
1422 | if (count >= limit) | 1418 | if (count >= limit) |
@@ -1429,15 +1425,14 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit) | |||
1429 | prefetch(p_next); | 1425 | prefetch(p_next); |
1430 | 1426 | ||
1431 | /* read the status of the incoming frame */ | 1427 | /* read the status of the incoming frame */ |
1432 | status = (priv->mac_type->ops->rx_status(&priv->dev->stats, | 1428 | status = (priv->hw->desc->rx_status(&priv->dev->stats, |
1433 | &priv->xstats, p)); | 1429 | &priv->xstats, p)); |
1434 | if (unlikely(status == discard_frame)) | 1430 | if (unlikely(status == discard_frame)) |
1435 | priv->dev->stats.rx_errors++; | 1431 | priv->dev->stats.rx_errors++; |
1436 | else { | 1432 | else { |
1437 | struct sk_buff *skb; | 1433 | struct sk_buff *skb; |
1438 | /* Length should omit the CRC */ | 1434 | /* Length should omit the CRC */ |
1439 | int frame_len = | 1435 | int frame_len = priv->hw->desc->get_rx_frame_len(p) - 4; |
1440 | priv->mac_type->ops->get_rx_frame_len(p) - 4; | ||
1441 | 1436 | ||
1442 | #ifdef STMMAC_RX_DEBUG | 1437 | #ifdef STMMAC_RX_DEBUG |
1443 | if (frame_len > ETH_FRAME_LEN) | 1438 | if (frame_len > ETH_FRAME_LEN) |
@@ -1573,7 +1568,7 @@ static void stmmac_multicast_list(struct net_device *dev) | |||
1573 | struct stmmac_priv *priv = netdev_priv(dev); | 1568 | struct stmmac_priv *priv = netdev_priv(dev); |
1574 | 1569 | ||
1575 | spin_lock(&priv->lock); | 1570 | spin_lock(&priv->lock); |
1576 | priv->mac_type->ops->set_filter(dev); | 1571 | priv->hw->mac->set_filter(dev); |
1577 | spin_unlock(&priv->lock); | 1572 | spin_unlock(&priv->lock); |
1578 | return; | 1573 | return; |
1579 | } | 1574 | } |
@@ -1627,7 +1622,7 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id) | |||
1627 | if (priv->is_gmac) { | 1622 | if (priv->is_gmac) { |
1628 | unsigned long ioaddr = dev->base_addr; | 1623 | unsigned long ioaddr = dev->base_addr; |
1629 | /* To handle GMAC own interrupts */ | 1624 | /* To handle GMAC own interrupts */ |
1630 | priv->mac_type->ops->host_irq_status(ioaddr); | 1625 | priv->hw->mac->host_irq_status(ioaddr); |
1631 | } | 1626 | } |
1632 | stmmac_dma_interrupt(dev); | 1627 | stmmac_dma_interrupt(dev); |
1633 | 1628 | ||
@@ -1748,7 +1743,7 @@ static int stmmac_probe(struct net_device *dev) | |||
1748 | netif_napi_add(dev, &priv->napi, stmmac_poll, 64); | 1743 | netif_napi_add(dev, &priv->napi, stmmac_poll, 64); |
1749 | 1744 | ||
1750 | /* Get the MAC address */ | 1745 | /* Get the MAC address */ |
1751 | priv->mac_type->ops->get_umac_addr(dev->base_addr, dev->dev_addr, 0); | 1746 | priv->hw->mac->get_umac_addr(dev->base_addr, dev->dev_addr, 0); |
1752 | 1747 | ||
1753 | if (!is_valid_ether_addr(dev->dev_addr)) | 1748 | if (!is_valid_ether_addr(dev->dev_addr)) |
1754 | pr_warning("\tno valid MAC address;" | 1749 | pr_warning("\tno valid MAC address;" |
@@ -1790,9 +1785,9 @@ static int stmmac_mac_device_setup(struct net_device *dev) | |||
1790 | if (!device) | 1785 | if (!device) |
1791 | return -ENOMEM; | 1786 | return -ENOMEM; |
1792 | 1787 | ||
1793 | priv->mac_type = device; | 1788 | priv->hw = device; |
1794 | 1789 | ||
1795 | priv->wolenabled = priv->mac_type->hw.pmt; /* PMT supported */ | 1790 | priv->wolenabled = priv->hw->pmt; /* PMT supported */ |
1796 | if (priv->wolenabled == PMT_SUPPORTED) | 1791 | if (priv->wolenabled == PMT_SUPPORTED) |
1797 | priv->wolopts = WAKE_MAGIC; /* Magic Frame */ | 1792 | priv->wolopts = WAKE_MAGIC; /* Magic Frame */ |
1798 | 1793 | ||
@@ -2048,18 +2043,17 @@ static int stmmac_suspend(struct platform_device *pdev, pm_message_t state) | |||
2048 | stmmac_dma_stop_tx(dev->base_addr); | 2043 | stmmac_dma_stop_tx(dev->base_addr); |
2049 | stmmac_dma_stop_rx(dev->base_addr); | 2044 | stmmac_dma_stop_rx(dev->base_addr); |
2050 | /* Clear the Rx/Tx descriptors */ | 2045 | /* Clear the Rx/Tx descriptors */ |
2051 | priv->mac_type->ops->init_rx_desc(priv->dma_rx, | 2046 | priv->hw->desc->init_rx_desc(priv->dma_rx, priv->dma_rx_size, |
2052 | priv->dma_rx_size, dis_ic); | 2047 | dis_ic); |
2053 | priv->mac_type->ops->init_tx_desc(priv->dma_tx, | 2048 | priv->hw->desc->init_tx_desc(priv->dma_tx, priv->dma_tx_size); |
2054 | priv->dma_tx_size); | ||
2055 | 2049 | ||
2056 | stmmac_mac_disable_tx(dev->base_addr); | 2050 | stmmac_mac_disable_tx(dev->base_addr); |
2057 | 2051 | ||
2058 | if (device_may_wakeup(&(pdev->dev))) { | 2052 | if (device_may_wakeup(&(pdev->dev))) { |
2059 | /* Enable Power down mode by programming the PMT regs */ | 2053 | /* Enable Power down mode by programming the PMT regs */ |
2060 | if (priv->wolenabled == PMT_SUPPORTED) | 2054 | if (priv->wolenabled == PMT_SUPPORTED) |
2061 | priv->mac_type->ops->pmt(dev->base_addr, | 2055 | priv->hw->mac->pmt(dev->base_addr, |
2062 | priv->wolopts); | 2056 | priv->wolopts); |
2063 | } else { | 2057 | } else { |
2064 | stmmac_mac_disable_rx(dev->base_addr); | 2058 | stmmac_mac_disable_rx(dev->base_addr); |
2065 | } | 2059 | } |
@@ -2100,7 +2094,7 @@ static int stmmac_resume(struct platform_device *pdev) | |||
2100 | * from another devices (e.g. serial console). */ | 2094 | * from another devices (e.g. serial console). */ |
2101 | if (device_may_wakeup(&(pdev->dev))) | 2095 | if (device_may_wakeup(&(pdev->dev))) |
2102 | if (priv->wolenabled == PMT_SUPPORTED) | 2096 | if (priv->wolenabled == PMT_SUPPORTED) |
2103 | priv->mac_type->ops->pmt(dev->base_addr, 0); | 2097 | priv->hw->mac->pmt(dev->base_addr, 0); |
2104 | 2098 | ||
2105 | netif_device_attach(dev); | 2099 | netif_device_attach(dev); |
2106 | 2100 | ||
diff --git a/drivers/net/stmmac/stmmac_mdio.c b/drivers/net/stmmac/stmmac_mdio.c index 8498552a22fc..131e0a603711 100644 --- a/drivers/net/stmmac/stmmac_mdio.c +++ b/drivers/net/stmmac/stmmac_mdio.c | |||
@@ -48,8 +48,8 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg) | |||
48 | struct net_device *ndev = bus->priv; | 48 | struct net_device *ndev = bus->priv; |
49 | struct stmmac_priv *priv = netdev_priv(ndev); | 49 | struct stmmac_priv *priv = netdev_priv(ndev); |
50 | unsigned long ioaddr = ndev->base_addr; | 50 | unsigned long ioaddr = ndev->base_addr; |
51 | unsigned int mii_address = priv->mac_type->hw.mii.addr; | 51 | unsigned int mii_address = priv->hw->mii.addr; |
52 | unsigned int mii_data = priv->mac_type->hw.mii.data; | 52 | unsigned int mii_data = priv->hw->mii.data; |
53 | 53 | ||
54 | int data; | 54 | int data; |
55 | u16 regValue = (((phyaddr << 11) & (0x0000F800)) | | 55 | u16 regValue = (((phyaddr << 11) & (0x0000F800)) | |
@@ -80,8 +80,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg, | |||
80 | struct net_device *ndev = bus->priv; | 80 | struct net_device *ndev = bus->priv; |
81 | struct stmmac_priv *priv = netdev_priv(ndev); | 81 | struct stmmac_priv *priv = netdev_priv(ndev); |
82 | unsigned long ioaddr = ndev->base_addr; | 82 | unsigned long ioaddr = ndev->base_addr; |
83 | unsigned int mii_address = priv->mac_type->hw.mii.addr; | 83 | unsigned int mii_address = priv->hw->mii.addr; |
84 | unsigned int mii_data = priv->mac_type->hw.mii.data; | 84 | unsigned int mii_data = priv->hw->mii.data; |
85 | 85 | ||
86 | u16 value = | 86 | u16 value = |
87 | (((phyaddr << 11) & (0x0000F800)) | ((phyreg << 6) & (0x000007C0))) | 87 | (((phyaddr << 11) & (0x0000F800)) | ((phyreg << 6) & (0x000007C0))) |
@@ -112,7 +112,7 @@ static int stmmac_mdio_reset(struct mii_bus *bus) | |||
112 | struct net_device *ndev = bus->priv; | 112 | struct net_device *ndev = bus->priv; |
113 | struct stmmac_priv *priv = netdev_priv(ndev); | 113 | struct stmmac_priv *priv = netdev_priv(ndev); |
114 | unsigned long ioaddr = ndev->base_addr; | 114 | unsigned long ioaddr = ndev->base_addr; |
115 | unsigned int mii_address = priv->mac_type->hw.mii.addr; | 115 | unsigned int mii_address = priv->hw->mii.addr; |
116 | 116 | ||
117 | if (priv->phy_reset) { | 117 | if (priv->phy_reset) { |
118 | pr_debug("stmmac_mdio_reset: calling phy_reset\n"); | 118 | pr_debug("stmmac_mdio_reset: calling phy_reset\n"); |