diff options
Diffstat (limited to 'drivers/net/ethernet/stmicro')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/common.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac.h | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 205 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 23 |
8 files changed, 131 insertions, 120 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index d0b814ef0675..0319d640f728 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h | |||
@@ -67,6 +67,7 @@ struct stmmac_extra_stats { | |||
67 | unsigned long ipc_csum_error; | 67 | unsigned long ipc_csum_error; |
68 | unsigned long rx_collision; | 68 | unsigned long rx_collision; |
69 | unsigned long rx_crc; | 69 | unsigned long rx_crc; |
70 | unsigned long dribbling_bit; | ||
70 | unsigned long rx_length; | 71 | unsigned long rx_length; |
71 | unsigned long rx_mii; | 72 | unsigned long rx_mii; |
72 | unsigned long rx_multicast; | 73 | unsigned long rx_multicast; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c index d87976364ec5..ad1b627f8ec2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c | |||
@@ -201,7 +201,7 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, | |||
201 | 201 | ||
202 | if (unlikely(p->des01.erx.dribbling)) { | 202 | if (unlikely(p->des01.erx.dribbling)) { |
203 | CHIP_DBG(KERN_ERR "GMAC RX: dribbling error\n"); | 203 | CHIP_DBG(KERN_ERR "GMAC RX: dribbling error\n"); |
204 | ret = discard_frame; | 204 | x->dribbling_bit++; |
205 | } | 205 | } |
206 | if (unlikely(p->des01.erx.sa_filter_fail)) { | 206 | if (unlikely(p->des01.erx.sa_filter_fail)) { |
207 | CHIP_DBG(KERN_ERR "GMAC RX : Source Address filter fail\n"); | 207 | CHIP_DBG(KERN_ERR "GMAC RX : Source Address filter fail\n"); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c index fda5d2b31d3a..25953bb45a73 100644 --- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c +++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c | |||
@@ -104,7 +104,7 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, | |||
104 | ret = discard_frame; | 104 | ret = discard_frame; |
105 | } | 105 | } |
106 | if (unlikely(p->des01.rx.dribbling)) | 106 | if (unlikely(p->des01.rx.dribbling)) |
107 | ret = discard_frame; | 107 | x->dribbling_bit++; |
108 | 108 | ||
109 | if (unlikely(p->des01.rx.length_error)) { | 109 | if (unlikely(p->des01.rx.length_error)) { |
110 | x->rx_length++; | 110 | x->rx_length++; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 120740020e2c..b4b095fdcf29 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h | |||
@@ -21,7 +21,7 @@ | |||
21 | *******************************************************************************/ | 21 | *******************************************************************************/ |
22 | 22 | ||
23 | #define STMMAC_RESOURCE_NAME "stmmaceth" | 23 | #define STMMAC_RESOURCE_NAME "stmmaceth" |
24 | #define DRV_MODULE_VERSION "Dec_2011" | 24 | #define DRV_MODULE_VERSION "Feb_2012" |
25 | #include <linux/stmmac.h> | 25 | #include <linux/stmmac.h> |
26 | #include <linux/phy.h> | 26 | #include <linux/phy.h> |
27 | #include "common.h" | 27 | #include "common.h" |
@@ -97,4 +97,5 @@ int stmmac_resume(struct net_device *ndev); | |||
97 | int stmmac_suspend(struct net_device *ndev); | 97 | int stmmac_suspend(struct net_device *ndev); |
98 | int stmmac_dvr_remove(struct net_device *ndev); | 98 | int stmmac_dvr_remove(struct net_device *ndev); |
99 | struct stmmac_priv *stmmac_dvr_probe(struct device *device, | 99 | struct stmmac_priv *stmmac_dvr_probe(struct device *device, |
100 | struct plat_stmmacenet_data *plat_dat); | 100 | struct plat_stmmacenet_data *plat_dat, |
101 | void __iomem *addr); | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 9573303a706b..f98e1511660f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | |||
@@ -47,23 +47,25 @@ struct stmmac_stats { | |||
47 | offsetof(struct stmmac_priv, xstats.m)} | 47 | offsetof(struct stmmac_priv, xstats.m)} |
48 | 48 | ||
49 | static const struct stmmac_stats stmmac_gstrings_stats[] = { | 49 | static const struct stmmac_stats stmmac_gstrings_stats[] = { |
50 | /* Transmit errors */ | ||
50 | STMMAC_STAT(tx_underflow), | 51 | STMMAC_STAT(tx_underflow), |
51 | STMMAC_STAT(tx_carrier), | 52 | STMMAC_STAT(tx_carrier), |
52 | STMMAC_STAT(tx_losscarrier), | 53 | STMMAC_STAT(tx_losscarrier), |
53 | STMMAC_STAT(vlan_tag), | 54 | STMMAC_STAT(vlan_tag), |
54 | STMMAC_STAT(tx_deferred), | 55 | STMMAC_STAT(tx_deferred), |
55 | STMMAC_STAT(tx_vlan), | 56 | STMMAC_STAT(tx_vlan), |
56 | STMMAC_STAT(rx_vlan), | ||
57 | STMMAC_STAT(tx_jabber), | 57 | STMMAC_STAT(tx_jabber), |
58 | STMMAC_STAT(tx_frame_flushed), | 58 | STMMAC_STAT(tx_frame_flushed), |
59 | STMMAC_STAT(tx_payload_error), | 59 | STMMAC_STAT(tx_payload_error), |
60 | STMMAC_STAT(tx_ip_header_error), | 60 | STMMAC_STAT(tx_ip_header_error), |
61 | /* Receive errors */ | ||
61 | STMMAC_STAT(rx_desc), | 62 | STMMAC_STAT(rx_desc), |
62 | STMMAC_STAT(sa_filter_fail), | 63 | STMMAC_STAT(sa_filter_fail), |
63 | STMMAC_STAT(overflow_error), | 64 | STMMAC_STAT(overflow_error), |
64 | STMMAC_STAT(ipc_csum_error), | 65 | STMMAC_STAT(ipc_csum_error), |
65 | STMMAC_STAT(rx_collision), | 66 | STMMAC_STAT(rx_collision), |
66 | STMMAC_STAT(rx_crc), | 67 | STMMAC_STAT(rx_crc), |
68 | STMMAC_STAT(dribbling_bit), | ||
67 | STMMAC_STAT(rx_length), | 69 | STMMAC_STAT(rx_length), |
68 | STMMAC_STAT(rx_mii), | 70 | STMMAC_STAT(rx_mii), |
69 | STMMAC_STAT(rx_multicast), | 71 | STMMAC_STAT(rx_multicast), |
@@ -73,6 +75,8 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = { | |||
73 | STMMAC_STAT(sa_rx_filter_fail), | 75 | STMMAC_STAT(sa_rx_filter_fail), |
74 | STMMAC_STAT(rx_missed_cntr), | 76 | STMMAC_STAT(rx_missed_cntr), |
75 | STMMAC_STAT(rx_overflow_cntr), | 77 | STMMAC_STAT(rx_overflow_cntr), |
78 | STMMAC_STAT(rx_vlan), | ||
79 | /* Tx/Rx IRQ errors */ | ||
76 | STMMAC_STAT(tx_undeflow_irq), | 80 | STMMAC_STAT(tx_undeflow_irq), |
77 | STMMAC_STAT(tx_process_stopped_irq), | 81 | STMMAC_STAT(tx_process_stopped_irq), |
78 | STMMAC_STAT(tx_jabber_irq), | 82 | STMMAC_STAT(tx_jabber_irq), |
@@ -82,6 +86,7 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = { | |||
82 | STMMAC_STAT(rx_watchdog_irq), | 86 | STMMAC_STAT(rx_watchdog_irq), |
83 | STMMAC_STAT(tx_early_irq), | 87 | STMMAC_STAT(tx_early_irq), |
84 | STMMAC_STAT(fatal_bus_error_irq), | 88 | STMMAC_STAT(fatal_bus_error_irq), |
89 | /* Extra info */ | ||
85 | STMMAC_STAT(threshold), | 90 | STMMAC_STAT(threshold), |
86 | STMMAC_STAT(tx_pkt_n), | 91 | STMMAC_STAT(tx_pkt_n), |
87 | STMMAC_STAT(rx_pkt_n), | 92 | STMMAC_STAT(rx_pkt_n), |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 96fa2da30763..6ee593a55a64 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -241,7 +241,7 @@ static void stmmac_adjust_link(struct net_device *dev) | |||
241 | case 1000: | 241 | case 1000: |
242 | if (likely(priv->plat->has_gmac)) | 242 | if (likely(priv->plat->has_gmac)) |
243 | ctrl &= ~priv->hw->link.port; | 243 | ctrl &= ~priv->hw->link.port; |
244 | stmmac_hw_fix_mac_speed(priv); | 244 | stmmac_hw_fix_mac_speed(priv); |
245 | break; | 245 | break; |
246 | case 100: | 246 | case 100: |
247 | case 10: | 247 | case 10: |
@@ -785,7 +785,7 @@ static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv) | |||
785 | u32 uid = ((hwid & 0x0000ff00) >> 8); | 785 | u32 uid = ((hwid & 0x0000ff00) >> 8); |
786 | u32 synid = (hwid & 0x000000ff); | 786 | u32 synid = (hwid & 0x000000ff); |
787 | 787 | ||
788 | pr_info("STMMAC - user ID: 0x%x, Synopsys ID: 0x%x\n", | 788 | pr_info("stmmac - user ID: 0x%x, Synopsys ID: 0x%x\n", |
789 | uid, synid); | 789 | uid, synid); |
790 | 790 | ||
791 | return synid; | 791 | return synid; |
@@ -869,38 +869,6 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv) | |||
869 | return hw_cap; | 869 | return hw_cap; |
870 | } | 870 | } |
871 | 871 | ||
872 | /** | ||
873 | * stmmac_mac_device_setup | ||
874 | * @dev : device pointer | ||
875 | * Description: this is to attach the GMAC or MAC 10/100 | ||
876 | * main core structures that will be completed during the | ||
877 | * open step. | ||
878 | */ | ||
879 | static int stmmac_mac_device_setup(struct net_device *dev) | ||
880 | { | ||
881 | struct stmmac_priv *priv = netdev_priv(dev); | ||
882 | |||
883 | struct mac_device_info *device; | ||
884 | |||
885 | if (priv->plat->has_gmac) | ||
886 | device = dwmac1000_setup(priv->ioaddr); | ||
887 | else | ||
888 | device = dwmac100_setup(priv->ioaddr); | ||
889 | |||
890 | if (!device) | ||
891 | return -ENOMEM; | ||
892 | |||
893 | priv->hw = device; | ||
894 | priv->hw->ring = &ring_mode_ops; | ||
895 | |||
896 | if (device_can_wakeup(priv->device)) { | ||
897 | priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */ | ||
898 | enable_irq_wake(priv->wol_irq); | ||
899 | } | ||
900 | |||
901 | return 0; | ||
902 | } | ||
903 | |||
904 | static void stmmac_check_ether_addr(struct stmmac_priv *priv) | 872 | static void stmmac_check_ether_addr(struct stmmac_priv *priv) |
905 | { | 873 | { |
906 | /* verify if the MAC address is valid, in case of failures it | 874 | /* verify if the MAC address is valid, in case of failures it |
@@ -930,20 +898,8 @@ static int stmmac_open(struct net_device *dev) | |||
930 | struct stmmac_priv *priv = netdev_priv(dev); | 898 | struct stmmac_priv *priv = netdev_priv(dev); |
931 | int ret; | 899 | int ret; |
932 | 900 | ||
933 | /* MAC HW device setup */ | ||
934 | ret = stmmac_mac_device_setup(dev); | ||
935 | if (ret < 0) | ||
936 | return ret; | ||
937 | |||
938 | stmmac_check_ether_addr(priv); | 901 | stmmac_check_ether_addr(priv); |
939 | 902 | ||
940 | stmmac_verify_args(); | ||
941 | |||
942 | /* Override with kernel parameters if supplied XXX CRS XXX | ||
943 | * this needs to have multiple instances */ | ||
944 | if ((phyaddr >= 0) && (phyaddr <= 31)) | ||
945 | priv->plat->phy_addr = phyaddr; | ||
946 | |||
947 | /* MDIO bus Registration */ | 903 | /* MDIO bus Registration */ |
948 | ret = stmmac_mdio_register(dev); | 904 | ret = stmmac_mdio_register(dev); |
949 | if (ret < 0) { | 905 | if (ret < 0) { |
@@ -976,44 +932,6 @@ static int stmmac_open(struct net_device *dev) | |||
976 | goto open_error; | 932 | goto open_error; |
977 | } | 933 | } |
978 | 934 | ||
979 | stmmac_get_synopsys_id(priv); | ||
980 | |||
981 | priv->hw_cap_support = stmmac_get_hw_features(priv); | ||
982 | |||
983 | if (priv->hw_cap_support) { | ||
984 | pr_info(" Support DMA HW capability register"); | ||
985 | |||
986 | /* We can override some gmac/dma configuration fields: e.g. | ||
987 | * enh_desc, tx_coe (e.g. that are passed through the | ||
988 | * platform) with the values from the HW capability | ||
989 | * register (if supported). | ||
990 | */ | ||
991 | priv->plat->enh_desc = priv->dma_cap.enh_desc; | ||
992 | priv->plat->tx_coe = priv->dma_cap.tx_coe; | ||
993 | priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up; | ||
994 | |||
995 | /* By default disable wol on magic frame if not supported */ | ||
996 | if (!priv->dma_cap.pmt_magic_frame) | ||
997 | priv->wolopts &= ~WAKE_MAGIC; | ||
998 | |||
999 | } else | ||
1000 | pr_info(" No HW DMA feature register supported"); | ||
1001 | |||
1002 | /* Select the enhnaced/normal descriptor structures */ | ||
1003 | stmmac_selec_desc_mode(priv); | ||
1004 | |||
1005 | /* PMT module is not integrated in all the MAC devices. */ | ||
1006 | if (priv->plat->pmt) { | ||
1007 | pr_info(" Remote wake-up capable\n"); | ||
1008 | device_set_wakeup_capable(priv->device, 1); | ||
1009 | } | ||
1010 | |||
1011 | priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr); | ||
1012 | if (priv->rx_coe) | ||
1013 | pr_info(" Checksum Offload Engine supported\n"); | ||
1014 | if (priv->plat->tx_coe) | ||
1015 | pr_info(" Checksum insertion supported\n"); | ||
1016 | |||
1017 | /* Create and initialize the TX/RX descriptors chains. */ | 935 | /* Create and initialize the TX/RX descriptors chains. */ |
1018 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); | 936 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); |
1019 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); | 937 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); |
@@ -1030,14 +948,14 @@ static int stmmac_open(struct net_device *dev) | |||
1030 | 948 | ||
1031 | /* Copy the MAC addr into the HW */ | 949 | /* Copy the MAC addr into the HW */ |
1032 | priv->hw->mac->set_umac_addr(priv->ioaddr, dev->dev_addr, 0); | 950 | priv->hw->mac->set_umac_addr(priv->ioaddr, dev->dev_addr, 0); |
951 | |||
1033 | /* If required, perform hw setup of the bus. */ | 952 | /* If required, perform hw setup of the bus. */ |
1034 | if (priv->plat->bus_setup) | 953 | if (priv->plat->bus_setup) |
1035 | priv->plat->bus_setup(priv->ioaddr); | 954 | priv->plat->bus_setup(priv->ioaddr); |
955 | |||
1036 | /* Initialize the MAC Core */ | 956 | /* Initialize the MAC Core */ |
1037 | priv->hw->mac->core_init(priv->ioaddr); | 957 | priv->hw->mac->core_init(priv->ioaddr); |
1038 | 958 | ||
1039 | netdev_update_features(dev); | ||
1040 | |||
1041 | /* Request the IRQ lines */ | 959 | /* Request the IRQ lines */ |
1042 | ret = request_irq(dev->irq, stmmac_interrupt, | 960 | ret = request_irq(dev->irq, stmmac_interrupt, |
1043 | IRQF_SHARED, dev->name, dev); | 961 | IRQF_SHARED, dev->name, dev); |
@@ -1047,6 +965,17 @@ static int stmmac_open(struct net_device *dev) | |||
1047 | goto open_error; | 965 | goto open_error; |
1048 | } | 966 | } |
1049 | 967 | ||
968 | /* Request the Wake IRQ in case of another line is used for WoL */ | ||
969 | if (priv->wol_irq != dev->irq) { | ||
970 | ret = request_irq(priv->wol_irq, stmmac_interrupt, | ||
971 | IRQF_SHARED, dev->name, dev); | ||
972 | if (unlikely(ret < 0)) { | ||
973 | pr_err("%s: ERROR: allocating the ext WoL IRQ %d " | ||
974 | "(error: %d)\n", __func__, priv->wol_irq, ret); | ||
975 | goto open_error_wolirq; | ||
976 | } | ||
977 | } | ||
978 | |||
1050 | /* Enable the MAC Rx/Tx */ | 979 | /* Enable the MAC Rx/Tx */ |
1051 | stmmac_set_mac(priv->ioaddr, true); | 980 | stmmac_set_mac(priv->ioaddr, true); |
1052 | 981 | ||
@@ -1062,7 +991,7 @@ static int stmmac_open(struct net_device *dev) | |||
1062 | #ifdef CONFIG_STMMAC_DEBUG_FS | 991 | #ifdef CONFIG_STMMAC_DEBUG_FS |
1063 | ret = stmmac_init_fs(dev); | 992 | ret = stmmac_init_fs(dev); |
1064 | if (ret < 0) | 993 | if (ret < 0) |
1065 | pr_warning("\tFailed debugFS registration"); | 994 | pr_warning("%s: failed debugFS registration\n", __func__); |
1066 | #endif | 995 | #endif |
1067 | /* Start the ball rolling... */ | 996 | /* Start the ball rolling... */ |
1068 | DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name); | 997 | DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name); |
@@ -1072,6 +1001,7 @@ static int stmmac_open(struct net_device *dev) | |||
1072 | #ifdef CONFIG_STMMAC_TIMER | 1001 | #ifdef CONFIG_STMMAC_TIMER |
1073 | priv->tm->timer_start(tmrate); | 1002 | priv->tm->timer_start(tmrate); |
1074 | #endif | 1003 | #endif |
1004 | |||
1075 | /* Dump DMA/MAC registers */ | 1005 | /* Dump DMA/MAC registers */ |
1076 | if (netif_msg_hw(priv)) { | 1006 | if (netif_msg_hw(priv)) { |
1077 | priv->hw->mac->dump_regs(priv->ioaddr); | 1007 | priv->hw->mac->dump_regs(priv->ioaddr); |
@@ -1087,6 +1017,9 @@ static int stmmac_open(struct net_device *dev) | |||
1087 | 1017 | ||
1088 | return 0; | 1018 | return 0; |
1089 | 1019 | ||
1020 | open_error_wolirq: | ||
1021 | free_irq(dev->irq, dev); | ||
1022 | |||
1090 | open_error: | 1023 | open_error: |
1091 | #ifdef CONFIG_STMMAC_TIMER | 1024 | #ifdef CONFIG_STMMAC_TIMER |
1092 | kfree(priv->tm); | 1025 | kfree(priv->tm); |
@@ -1127,6 +1060,8 @@ static int stmmac_release(struct net_device *dev) | |||
1127 | 1060 | ||
1128 | /* Free the IRQ lines */ | 1061 | /* Free the IRQ lines */ |
1129 | free_irq(dev->irq, dev); | 1062 | free_irq(dev->irq, dev); |
1063 | if (priv->wol_irq != dev->irq) | ||
1064 | free_irq(priv->wol_irq, dev); | ||
1130 | 1065 | ||
1131 | /* Stop TX/RX DMA and clear the descriptors */ | 1066 | /* Stop TX/RX DMA and clear the descriptors */ |
1132 | priv->hw->dma->stop_tx(priv->ioaddr); | 1067 | priv->hw->dma->stop_tx(priv->ioaddr); |
@@ -1789,13 +1724,77 @@ static const struct net_device_ops stmmac_netdev_ops = { | |||
1789 | }; | 1724 | }; |
1790 | 1725 | ||
1791 | /** | 1726 | /** |
1727 | * stmmac_hw_init - Init the MAC device | ||
1728 | * @priv : pointer to the private device structure. | ||
1729 | * Description: this function detects which MAC device | ||
1730 | * (GMAC/MAC10-100) has to attached, checks the HW capability | ||
1731 | * (if supported) and sets the driver's features (for example | ||
1732 | * to use the ring or chaine mode or support the normal/enh | ||
1733 | * descriptor structure). | ||
1734 | */ | ||
1735 | static int stmmac_hw_init(struct stmmac_priv *priv) | ||
1736 | { | ||
1737 | int ret = 0; | ||
1738 | struct mac_device_info *mac; | ||
1739 | |||
1740 | /* Identify the MAC HW device */ | ||
1741 | if (priv->plat->has_gmac) | ||
1742 | mac = dwmac1000_setup(priv->ioaddr); | ||
1743 | else | ||
1744 | mac = dwmac100_setup(priv->ioaddr); | ||
1745 | if (!mac) | ||
1746 | return -ENOMEM; | ||
1747 | |||
1748 | priv->hw = mac; | ||
1749 | |||
1750 | /* To use the chained or ring mode */ | ||
1751 | priv->hw->ring = &ring_mode_ops; | ||
1752 | |||
1753 | /* Get and dump the chip ID */ | ||
1754 | stmmac_get_synopsys_id(priv); | ||
1755 | |||
1756 | /* Get the HW capability (new GMAC newer than 3.50a) */ | ||
1757 | priv->hw_cap_support = stmmac_get_hw_features(priv); | ||
1758 | if (priv->hw_cap_support) { | ||
1759 | pr_info(" DMA HW capability register supported"); | ||
1760 | |||
1761 | /* We can override some gmac/dma configuration fields: e.g. | ||
1762 | * enh_desc, tx_coe (e.g. that are passed through the | ||
1763 | * platform) with the values from the HW capability | ||
1764 | * register (if supported). | ||
1765 | */ | ||
1766 | priv->plat->enh_desc = priv->dma_cap.enh_desc; | ||
1767 | priv->plat->tx_coe = priv->dma_cap.tx_coe; | ||
1768 | priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up; | ||
1769 | } else | ||
1770 | pr_info(" No HW DMA feature register supported"); | ||
1771 | |||
1772 | /* Select the enhnaced/normal descriptor structures */ | ||
1773 | stmmac_selec_desc_mode(priv); | ||
1774 | |||
1775 | priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr); | ||
1776 | if (priv->rx_coe) | ||
1777 | pr_info(" RX Checksum Offload Engine supported\n"); | ||
1778 | if (priv->plat->tx_coe) | ||
1779 | pr_info(" TX Checksum insertion supported\n"); | ||
1780 | |||
1781 | if (priv->plat->pmt) { | ||
1782 | pr_info(" Wake-Up On Lan supported\n"); | ||
1783 | device_set_wakeup_capable(priv->device, 1); | ||
1784 | } | ||
1785 | |||
1786 | return ret; | ||
1787 | } | ||
1788 | |||
1789 | /** | ||
1792 | * stmmac_dvr_probe | 1790 | * stmmac_dvr_probe |
1793 | * @device: device pointer | 1791 | * @device: device pointer |
1794 | * Description: this is the main probe function used to | 1792 | * Description: this is the main probe function used to |
1795 | * call the alloc_etherdev, allocate the priv structure. | 1793 | * call the alloc_etherdev, allocate the priv structure. |
1796 | */ | 1794 | */ |
1797 | struct stmmac_priv *stmmac_dvr_probe(struct device *device, | 1795 | struct stmmac_priv *stmmac_dvr_probe(struct device *device, |
1798 | struct plat_stmmacenet_data *plat_dat) | 1796 | struct plat_stmmacenet_data *plat_dat, |
1797 | void __iomem *addr) | ||
1799 | { | 1798 | { |
1800 | int ret = 0; | 1799 | int ret = 0; |
1801 | struct net_device *ndev = NULL; | 1800 | struct net_device *ndev = NULL; |
@@ -1815,10 +1814,27 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, | |||
1815 | 1814 | ||
1816 | ether_setup(ndev); | 1815 | ether_setup(ndev); |
1817 | 1816 | ||
1818 | ndev->netdev_ops = &stmmac_netdev_ops; | ||
1819 | stmmac_set_ethtool_ops(ndev); | 1817 | stmmac_set_ethtool_ops(ndev); |
1818 | priv->pause = pause; | ||
1819 | priv->plat = plat_dat; | ||
1820 | priv->ioaddr = addr; | ||
1821 | priv->dev->base_addr = (unsigned long)addr; | ||
1822 | |||
1823 | /* Verify driver arguments */ | ||
1824 | stmmac_verify_args(); | ||
1825 | |||
1826 | /* Override with kernel parameters if supplied XXX CRS XXX | ||
1827 | * this needs to have multiple instances */ | ||
1828 | if ((phyaddr >= 0) && (phyaddr <= 31)) | ||
1829 | priv->plat->phy_addr = phyaddr; | ||
1830 | |||
1831 | /* Init MAC and get the capabilities */ | ||
1832 | stmmac_hw_init(priv); | ||
1833 | |||
1834 | ndev->netdev_ops = &stmmac_netdev_ops; | ||
1820 | 1835 | ||
1821 | ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | 1836 | ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1837 | NETIF_F_RXCSUM; | ||
1822 | ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA; | 1838 | ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA; |
1823 | ndev->watchdog_timeo = msecs_to_jiffies(watchdog); | 1839 | ndev->watchdog_timeo = msecs_to_jiffies(watchdog); |
1824 | #ifdef STMMAC_VLAN_TAG_USED | 1840 | #ifdef STMMAC_VLAN_TAG_USED |
@@ -1830,8 +1846,6 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, | |||
1830 | if (flow_ctrl) | 1846 | if (flow_ctrl) |
1831 | priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */ | 1847 | priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */ |
1832 | 1848 | ||
1833 | priv->pause = pause; | ||
1834 | priv->plat = plat_dat; | ||
1835 | netif_napi_add(ndev, &priv->napi, stmmac_poll, 64); | 1849 | netif_napi_add(ndev, &priv->napi, stmmac_poll, 64); |
1836 | 1850 | ||
1837 | spin_lock_init(&priv->lock); | 1851 | spin_lock_init(&priv->lock); |
@@ -1839,15 +1853,10 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, | |||
1839 | 1853 | ||
1840 | ret = register_netdev(ndev); | 1854 | ret = register_netdev(ndev); |
1841 | if (ret) { | 1855 | if (ret) { |
1842 | pr_err("%s: ERROR %i registering the device\n", | 1856 | pr_err("%s: ERROR %i registering the device\n", __func__, ret); |
1843 | __func__, ret); | ||
1844 | goto error; | 1857 | goto error; |
1845 | } | 1858 | } |
1846 | 1859 | ||
1847 | DBG(probe, DEBUG, "%s: Scatter/Gather: %s - HW checksums: %s\n", | ||
1848 | ndev->name, (ndev->features & NETIF_F_SG) ? "on" : "off", | ||
1849 | (ndev->features & NETIF_F_IP_CSUM) ? "on" : "off"); | ||
1850 | |||
1851 | return priv; | 1860 | return priv; |
1852 | 1861 | ||
1853 | error: | 1862 | error: |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index c796de9eed72..50ad5b80cfaf 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | |||
@@ -96,13 +96,11 @@ static int __devinit stmmac_pci_probe(struct pci_dev *pdev, | |||
96 | 96 | ||
97 | stmmac_default_data(); | 97 | stmmac_default_data(); |
98 | 98 | ||
99 | priv = stmmac_dvr_probe(&(pdev->dev), &plat_dat); | 99 | priv = stmmac_dvr_probe(&(pdev->dev), &plat_dat, addr); |
100 | if (!priv) { | 100 | if (!priv) { |
101 | pr_err("%s: main drivr probe failed", __func__); | 101 | pr_err("%s: main driver probe failed", __func__); |
102 | goto err_out; | 102 | goto err_out; |
103 | } | 103 | } |
104 | priv->ioaddr = addr; | ||
105 | priv->dev->base_addr = (unsigned long)addr; | ||
106 | priv->dev->irq = pdev->irq; | 104 | priv->dev->irq = pdev->irq; |
107 | priv->wol_irq = pdev->irq; | 105 | priv->wol_irq = pdev->irq; |
108 | 106 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 1ac83243649a..3aad9810237c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
@@ -59,16 +59,20 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) | |||
59 | goto out_release_region; | 59 | goto out_release_region; |
60 | } | 60 | } |
61 | plat_dat = pdev->dev.platform_data; | 61 | plat_dat = pdev->dev.platform_data; |
62 | priv = stmmac_dvr_probe(&(pdev->dev), plat_dat); | 62 | |
63 | /* Custom initialisation (if needed)*/ | ||
64 | if (plat_dat->init) { | ||
65 | ret = plat_dat->init(pdev); | ||
66 | if (unlikely(ret)) | ||
67 | goto out_unmap; | ||
68 | } | ||
69 | |||
70 | priv = stmmac_dvr_probe(&(pdev->dev), plat_dat, addr); | ||
63 | if (!priv) { | 71 | if (!priv) { |
64 | pr_err("%s: main drivr probe failed", __func__); | 72 | pr_err("%s: main driver probe failed", __func__); |
65 | goto out_unmap; | 73 | goto out_unmap; |
66 | } | 74 | } |
67 | 75 | ||
68 | priv->ioaddr = addr; | ||
69 | /* Set the I/O base addr */ | ||
70 | priv->dev->base_addr = (unsigned long)addr; | ||
71 | |||
72 | /* Get the MAC information */ | 76 | /* Get the MAC information */ |
73 | priv->dev->irq = platform_get_irq_byname(pdev, "macirq"); | 77 | priv->dev->irq = platform_get_irq_byname(pdev, "macirq"); |
74 | if (priv->dev->irq == -ENXIO) { | 78 | if (priv->dev->irq == -ENXIO) { |
@@ -92,13 +96,6 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) | |||
92 | 96 | ||
93 | platform_set_drvdata(pdev, priv->dev); | 97 | platform_set_drvdata(pdev, priv->dev); |
94 | 98 | ||
95 | /* Custom initialisation */ | ||
96 | if (priv->plat->init) { | ||
97 | ret = priv->plat->init(pdev); | ||
98 | if (unlikely(ret)) | ||
99 | goto out_unmap; | ||
100 | } | ||
101 | |||
102 | pr_debug("STMMAC platform driver registration completed"); | 99 | pr_debug("STMMAC platform driver registration completed"); |
103 | 100 | ||
104 | return 0; | 101 | return 0; |