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/stmmac/gmac.c | |
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/stmmac/gmac.c')
-rw-r--r-- | drivers/net/stmmac/gmac.c | 43 |
1 files changed, 26 insertions, 17 deletions
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 | } |