aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Einon <mark.einon@gmail.com>2011-10-23 05:22:50 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-23 05:35:13 -0400
commita4d444bdef709d37838f83f92cab33b6c4475627 (patch)
tree37db8c4cd77fea2b245dc0deaab9d7889f5a8973
parent5da2b1581a24af6a50d40737c44a9ae13d3097b3 (diff)
staging: et131x: Remove yet more forward declarations
Moved functions in et131x.c file to remove the forward declarations of: et1310_setup_device_for_multicast et1310_setup_device_for_unicast et131x_up et131x_down et131x_enable_txrx et131x_disable_txrx Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/et131x/et131x.c434
1 files changed, 214 insertions, 220 deletions
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 44fff21ae50d..208c69fcb76e 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -576,12 +576,6 @@ struct et131x_adapter {
576 struct net_device_stats net_stats; 576 struct net_device_stats net_stats;
577}; 577};
578 578
579void et1310_setup_device_for_multicast(struct et131x_adapter *adapter);
580void et1310_setup_device_for_unicast(struct et131x_adapter *adapter);
581void et131x_up(struct net_device *netdev);
582void et131x_down(struct net_device *netdev);
583void et131x_enable_txrx(struct net_device *netdev);
584void et131x_disable_txrx(struct net_device *netdev);
585int et1310_in_phy_coma(struct et131x_adapter *adapter); 579int et1310_in_phy_coma(struct et131x_adapter *adapter);
586void et1310_phy_access_mii_bit(struct et131x_adapter *adapter, 580void et1310_phy_access_mii_bit(struct et131x_adapter *adapter,
587 u16 action, 581 u16 action,
@@ -1025,6 +1019,95 @@ void et1310_config_mac_regs2(struct et131x_adapter *adapter)
1025 } 1019 }
1026} 1020}
1027 1021
1022void et1310_setup_device_for_multicast(struct et131x_adapter *adapter)
1023{
1024 struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac;
1025 uint32_t nIndex;
1026 uint32_t result;
1027 uint32_t hash1 = 0;
1028 uint32_t hash2 = 0;
1029 uint32_t hash3 = 0;
1030 uint32_t hash4 = 0;
1031 u32 pm_csr;
1032
1033 /* If ET131X_PACKET_TYPE_MULTICAST is specified, then we provision
1034 * the multi-cast LIST. If it is NOT specified, (and "ALL" is not
1035 * specified) then we should pass NO multi-cast addresses to the
1036 * driver.
1037 */
1038 if (adapter->packet_filter & ET131X_PACKET_TYPE_MULTICAST) {
1039 /* Loop through our multicast array and set up the device */
1040 for (nIndex = 0; nIndex < adapter->multicast_addr_count;
1041 nIndex++) {
1042 result = ether_crc(6, adapter->multicast_list[nIndex]);
1043
1044 result = (result & 0x3F800000) >> 23;
1045
1046 if (result < 32) {
1047 hash1 |= (1 << result);
1048 } else if ((31 < result) && (result < 64)) {
1049 result -= 32;
1050 hash2 |= (1 << result);
1051 } else if ((63 < result) && (result < 96)) {
1052 result -= 64;
1053 hash3 |= (1 << result);
1054 } else {
1055 result -= 96;
1056 hash4 |= (1 << result);
1057 }
1058 }
1059 }
1060
1061 /* Write out the new hash to the device */
1062 pm_csr = readl(&adapter->regs->global.pm_csr);
1063 if (!et1310_in_phy_coma(adapter)) {
1064 writel(hash1, &rxmac->multi_hash1);
1065 writel(hash2, &rxmac->multi_hash2);
1066 writel(hash3, &rxmac->multi_hash3);
1067 writel(hash4, &rxmac->multi_hash4);
1068 }
1069}
1070
1071void et1310_setup_device_for_unicast(struct et131x_adapter *adapter)
1072{
1073 struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac;
1074 u32 uni_pf1;
1075 u32 uni_pf2;
1076 u32 uni_pf3;
1077 u32 pm_csr;
1078
1079 /* Set up unicast packet filter reg 3 to be the first two octets of
1080 * the MAC address for both address
1081 *
1082 * Set up unicast packet filter reg 2 to be the octets 2 - 5 of the
1083 * MAC address for second address
1084 *
1085 * Set up unicast packet filter reg 3 to be the octets 2 - 5 of the
1086 * MAC address for first address
1087 */
1088 uni_pf3 = (adapter->addr[0] << ET_UNI_PF_ADDR2_1_SHIFT) |
1089 (adapter->addr[1] << ET_UNI_PF_ADDR2_2_SHIFT) |
1090 (adapter->addr[0] << ET_UNI_PF_ADDR1_1_SHIFT) |
1091 adapter->addr[1];
1092
1093 uni_pf2 = (adapter->addr[2] << ET_UNI_PF_ADDR2_3_SHIFT) |
1094 (adapter->addr[3] << ET_UNI_PF_ADDR2_4_SHIFT) |
1095 (adapter->addr[4] << ET_UNI_PF_ADDR2_5_SHIFT) |
1096 adapter->addr[5];
1097
1098 uni_pf1 = (adapter->addr[2] << ET_UNI_PF_ADDR1_3_SHIFT) |
1099 (adapter->addr[3] << ET_UNI_PF_ADDR1_4_SHIFT) |
1100 (adapter->addr[4] << ET_UNI_PF_ADDR1_5_SHIFT) |
1101 adapter->addr[5];
1102
1103 pm_csr = readl(&adapter->regs->global.pm_csr);
1104 if (!et1310_in_phy_coma(adapter)) {
1105 writel(uni_pf1, &rxmac->uni_pf_addr1);
1106 writel(uni_pf2, &rxmac->uni_pf_addr2);
1107 writel(uni_pf3, &rxmac->uni_pf_addr3);
1108 }
1109}
1110
1028void et1310_config_rxmac_regs(struct et131x_adapter *adapter) 1111void et1310_config_rxmac_regs(struct et131x_adapter *adapter)
1029{ 1112{
1030 struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac; 1113 struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac;
@@ -1358,95 +1441,6 @@ void et1310_handle_macstat_interrupt(struct et131x_adapter *adapter)
1358 adapter->stats.tx_collisions += COUNTER_WRAP_12_BIT; 1441 adapter->stats.tx_collisions += COUNTER_WRAP_12_BIT;
1359} 1442}
1360 1443
1361void et1310_setup_device_for_multicast(struct et131x_adapter *adapter)
1362{
1363 struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac;
1364 uint32_t nIndex;
1365 uint32_t result;
1366 uint32_t hash1 = 0;
1367 uint32_t hash2 = 0;
1368 uint32_t hash3 = 0;
1369 uint32_t hash4 = 0;
1370 u32 pm_csr;
1371
1372 /* If ET131X_PACKET_TYPE_MULTICAST is specified, then we provision
1373 * the multi-cast LIST. If it is NOT specified, (and "ALL" is not
1374 * specified) then we should pass NO multi-cast addresses to the
1375 * driver.
1376 */
1377 if (adapter->packet_filter & ET131X_PACKET_TYPE_MULTICAST) {
1378 /* Loop through our multicast array and set up the device */
1379 for (nIndex = 0; nIndex < adapter->multicast_addr_count;
1380 nIndex++) {
1381 result = ether_crc(6, adapter->multicast_list[nIndex]);
1382
1383 result = (result & 0x3F800000) >> 23;
1384
1385 if (result < 32) {
1386 hash1 |= (1 << result);
1387 } else if ((31 < result) && (result < 64)) {
1388 result -= 32;
1389 hash2 |= (1 << result);
1390 } else if ((63 < result) && (result < 96)) {
1391 result -= 64;
1392 hash3 |= (1 << result);
1393 } else {
1394 result -= 96;
1395 hash4 |= (1 << result);
1396 }
1397 }
1398 }
1399
1400 /* Write out the new hash to the device */
1401 pm_csr = readl(&adapter->regs->global.pm_csr);
1402 if (!et1310_in_phy_coma(adapter)) {
1403 writel(hash1, &rxmac->multi_hash1);
1404 writel(hash2, &rxmac->multi_hash2);
1405 writel(hash3, &rxmac->multi_hash3);
1406 writel(hash4, &rxmac->multi_hash4);
1407 }
1408}
1409
1410void et1310_setup_device_for_unicast(struct et131x_adapter *adapter)
1411{
1412 struct rxmac_regs __iomem *rxmac = &adapter->regs->rxmac;
1413 u32 uni_pf1;
1414 u32 uni_pf2;
1415 u32 uni_pf3;
1416 u32 pm_csr;
1417
1418 /* Set up unicast packet filter reg 3 to be the first two octets of
1419 * the MAC address for both address
1420 *
1421 * Set up unicast packet filter reg 2 to be the octets 2 - 5 of the
1422 * MAC address for second address
1423 *
1424 * Set up unicast packet filter reg 3 to be the octets 2 - 5 of the
1425 * MAC address for first address
1426 */
1427 uni_pf3 = (adapter->addr[0] << ET_UNI_PF_ADDR2_1_SHIFT) |
1428 (adapter->addr[1] << ET_UNI_PF_ADDR2_2_SHIFT) |
1429 (adapter->addr[0] << ET_UNI_PF_ADDR1_1_SHIFT) |
1430 adapter->addr[1];
1431
1432 uni_pf2 = (adapter->addr[2] << ET_UNI_PF_ADDR2_3_SHIFT) |
1433 (adapter->addr[3] << ET_UNI_PF_ADDR2_4_SHIFT) |
1434 (adapter->addr[4] << ET_UNI_PF_ADDR2_5_SHIFT) |
1435 adapter->addr[5];
1436
1437 uni_pf1 = (adapter->addr[2] << ET_UNI_PF_ADDR1_3_SHIFT) |
1438 (adapter->addr[3] << ET_UNI_PF_ADDR1_4_SHIFT) |
1439 (adapter->addr[4] << ET_UNI_PF_ADDR1_5_SHIFT) |
1440 adapter->addr[5];
1441
1442 pm_csr = readl(&adapter->regs->global.pm_csr);
1443 if (!et1310_in_phy_coma(adapter)) {
1444 writel(uni_pf1, &rxmac->uni_pf_addr1);
1445 writel(uni_pf2, &rxmac->uni_pf_addr2);
1446 writel(uni_pf3, &rxmac->uni_pf_addr3);
1447 }
1448}
1449
1450/* PHY functions */ 1444/* PHY functions */
1451 1445
1452int et131x_mdio_read(struct mii_bus *bus, int phy_addr, int reg) 1446int et131x_mdio_read(struct mii_bus *bus, int phy_addr, int reg)
@@ -1982,6 +1976,104 @@ void et131x_soft_reset(struct et131x_adapter *adapter)
1982} 1976}
1983 1977
1984/** 1978/**
1979 * et131x_enable_interrupts - enable interrupt
1980 * @adapter: et131x device
1981 *
1982 * Enable the appropriate interrupts on the ET131x according to our
1983 * configuration
1984 */
1985void et131x_enable_interrupts(struct et131x_adapter *adapter)
1986{
1987 u32 mask;
1988
1989 /* Enable all global interrupts */
1990 if (adapter->flowcontrol == FLOW_TXONLY ||
1991 adapter->flowcontrol == FLOW_BOTH)
1992 mask = INT_MASK_ENABLE;
1993 else
1994 mask = INT_MASK_ENABLE_NO_FLOW;
1995
1996 writel(mask, &adapter->regs->global.int_mask);
1997}
1998
1999/**
2000 * et131x_disable_interrupts - interrupt disable
2001 * @adapter: et131x device
2002 *
2003 * Block all interrupts from the et131x device at the device itself
2004 */
2005void et131x_disable_interrupts(struct et131x_adapter *adapter)
2006{
2007 /* Disable all global interrupts */
2008 writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask);
2009}
2010
2011/**
2012 * et131x_tx_dma_disable - Stop of Tx_DMA on the ET1310
2013 * @adapter: pointer to our adapter structure
2014 */
2015void et131x_tx_dma_disable(struct et131x_adapter *adapter)
2016{
2017 /* Setup the tramsmit dma configuration register */
2018 writel(ET_TXDMA_CSR_HALT|ET_TXDMA_SNGL_EPKT,
2019 &adapter->regs->txdma.csr);
2020}
2021
2022/**
2023 * et131x_tx_dma_enable - re-start of Tx_DMA on the ET1310.
2024 * @adapter: pointer to our adapter structure
2025 *
2026 * Mainly used after a return to the D0 (full-power) state from a lower state.
2027 */
2028void et131x_tx_dma_enable(struct et131x_adapter *adapter)
2029{
2030 /* Setup the transmit dma configuration register for normal
2031 * operation
2032 */
2033 writel(ET_TXDMA_SNGL_EPKT|(PARM_DMA_CACHE_DEF << ET_TXDMA_CACHE_SHIFT),
2034 &adapter->regs->txdma.csr);
2035}
2036
2037/**
2038 * et131x_enable_txrx - Enable tx/rx queues
2039 * @netdev: device to be enabled
2040 */
2041void et131x_enable_txrx(struct net_device *netdev)
2042{
2043 struct et131x_adapter *adapter = netdev_priv(netdev);
2044
2045 /* Enable the Tx and Rx DMA engines (if not already enabled) */
2046 et131x_rx_dma_enable(adapter);
2047 et131x_tx_dma_enable(adapter);
2048
2049 /* Enable device interrupts */
2050 if (adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)
2051 et131x_enable_interrupts(adapter);
2052
2053 /* We're ready to move some data, so start the queue */
2054 netif_start_queue(netdev);
2055}
2056
2057/**
2058 * et131x_disable_txrx - Disable tx/rx queues
2059 * @netdev: device to be disabled
2060 */
2061void et131x_disable_txrx(struct net_device *netdev)
2062{
2063 struct et131x_adapter *adapter = netdev_priv(netdev);
2064
2065 /* First thing is to stop the queue */
2066 netif_stop_queue(netdev);
2067
2068 /* Stop the Tx and Rx DMA engines */
2069 et131x_rx_dma_disable(adapter);
2070 et131x_tx_dma_disable(adapter);
2071
2072 /* Disable device interrupts */
2073 et131x_disable_interrupts(adapter);
2074}
2075
2076/**
1985 * et1310_enable_phy_coma - called when network cable is unplugged 2077 * et1310_enable_phy_coma - called when network cable is unplugged
1986 * @adapter: pointer to our adapter structure 2078 * @adapter: pointer to our adapter structure
1987 * 2079 *
@@ -3164,32 +3256,6 @@ void et131x_tx_dma_memory_free(struct et131x_adapter *adapter)
3164} 3256}
3165 3257
3166/** 3258/**
3167 * et131x_tx_dma_disable - Stop of Tx_DMA on the ET1310
3168 * @adapter: pointer to our adapter structure
3169 */
3170void et131x_tx_dma_disable(struct et131x_adapter *adapter)
3171{
3172 /* Setup the tramsmit dma configuration register */
3173 writel(ET_TXDMA_CSR_HALT|ET_TXDMA_SNGL_EPKT,
3174 &adapter->regs->txdma.csr);
3175}
3176
3177/**
3178 * et131x_tx_dma_enable - re-start of Tx_DMA on the ET1310.
3179 * @adapter: pointer to our adapter structure
3180 *
3181 * Mainly used after a return to the D0 (full-power) state from a lower state.
3182 */
3183void et131x_tx_dma_enable(struct et131x_adapter *adapter)
3184{
3185 /* Setup the transmit dma configuration register for normal
3186 * operation
3187 */
3188 writel(ET_TXDMA_SNGL_EPKT|(PARM_DMA_CACHE_DEF << ET_TXDMA_CACHE_SHIFT),
3189 &adapter->regs->txdma.csr);
3190}
3191
3192/**
3193 * et131x_init_send - Initialize send data structures 3259 * et131x_init_send - Initialize send data structures
3194 * @adapter: pointer to our private adapter structure 3260 * @adapter: pointer to our private adapter structure
3195 */ 3261 */
@@ -4046,27 +4112,6 @@ static int et131x_pci_init(struct et131x_adapter *adapter,
4046} 4112}
4047 4113
4048/** 4114/**
4049 * et131x_enable_interrupts - enable interrupt
4050 * @adapter: et131x device
4051 *
4052 * Enable the appropriate interrupts on the ET131x according to our
4053 * configuration
4054 */
4055void et131x_enable_interrupts(struct et131x_adapter *adapter)
4056{
4057 u32 mask;
4058
4059 /* Enable all global interrupts */
4060 if (adapter->flowcontrol == FLOW_TXONLY ||
4061 adapter->flowcontrol == FLOW_BOTH)
4062 mask = INT_MASK_ENABLE;
4063 else
4064 mask = INT_MASK_ENABLE_NO_FLOW;
4065
4066 writel(mask, &adapter->regs->global.int_mask);
4067}
4068
4069/**
4070 * et131x_error_timer_handler 4115 * et131x_error_timer_handler
4071 * @data: timer-specific variable; here a pointer to our adapter structure 4116 * @data: timer-specific variable; here a pointer to our adapter structure
4072 * 4117 *
@@ -4350,18 +4395,6 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev,
4350} 4395}
4351 4396
4352/** 4397/**
4353 * et131x_disable_interrupts - interrupt disable
4354 * @adapter: et131x device
4355 *
4356 * Block all interrupts from the et131x device at the device itself
4357 */
4358void et131x_disable_interrupts(struct et131x_adapter *adapter)
4359{
4360 /* Disable all global interrupts */
4361 writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask);
4362}
4363
4364/**
4365 * et131x_pci_remove 4398 * et131x_pci_remove
4366 * @pdev: a pointer to the device's pci_dev structure 4399 * @pdev: a pointer to the device's pci_dev structure
4367 * 4400 *
@@ -4388,6 +4421,33 @@ static void __devexit et131x_pci_remove(struct pci_dev *pdev)
4388 pci_disable_device(pdev); 4421 pci_disable_device(pdev);
4389} 4422}
4390 4423
4424/**
4425 * et131x_up - Bring up a device for use.
4426 * @netdev: device to be opened
4427 */
4428void et131x_up(struct net_device *netdev)
4429{
4430 struct et131x_adapter *adapter = netdev_priv(netdev);
4431
4432 et131x_enable_txrx(netdev);
4433 phy_start(adapter->phydev);
4434}
4435
4436/**
4437 * et131x_down - Bring down the device
4438 * @netdev: device to be broght down
4439 */
4440void et131x_down(struct net_device *netdev)
4441{
4442 struct et131x_adapter *adapter = netdev_priv(netdev);
4443
4444 /* Save the timestamp for the TX watchdog, prevent a timeout */
4445 netdev->trans_start = jiffies;
4446
4447 phy_stop(adapter->phydev);
4448 et131x_disable_txrx(netdev);
4449}
4450
4391#ifdef CONFIG_PM_SLEEP 4451#ifdef CONFIG_PM_SLEEP
4392static int et131x_suspend(struct device *dev) 4452static int et131x_suspend(struct device *dev)
4393{ 4453{
@@ -4766,57 +4826,6 @@ static struct net_device_stats *et131x_stats(struct net_device *netdev)
4766} 4826}
4767 4827
4768/** 4828/**
4769 * et131x_enable_txrx - Enable tx/rx queues
4770 * @netdev: device to be enabled
4771 */
4772void et131x_enable_txrx(struct net_device *netdev)
4773{
4774 struct et131x_adapter *adapter = netdev_priv(netdev);
4775
4776 /* Enable the Tx and Rx DMA engines (if not already enabled) */
4777 et131x_rx_dma_enable(adapter);
4778 et131x_tx_dma_enable(adapter);
4779
4780 /* Enable device interrupts */
4781 if (adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)
4782 et131x_enable_interrupts(adapter);
4783
4784 /* We're ready to move some data, so start the queue */
4785 netif_start_queue(netdev);
4786}
4787
4788/**
4789 * et131x_disable_txrx - Disable tx/rx queues
4790 * @netdev: device to be disabled
4791 */
4792void et131x_disable_txrx(struct net_device *netdev)
4793{
4794 struct et131x_adapter *adapter = netdev_priv(netdev);
4795
4796 /* First thing is to stop the queue */
4797 netif_stop_queue(netdev);
4798
4799 /* Stop the Tx and Rx DMA engines */
4800 et131x_rx_dma_disable(adapter);
4801 et131x_tx_dma_disable(adapter);
4802
4803 /* Disable device interrupts */
4804 et131x_disable_interrupts(adapter);
4805}
4806
4807/**
4808 * et131x_up - Bring up a device for use.
4809 * @netdev: device to be opened
4810 */
4811void et131x_up(struct net_device *netdev)
4812{
4813 struct et131x_adapter *adapter = netdev_priv(netdev);
4814
4815 et131x_enable_txrx(netdev);
4816 phy_start(adapter->phydev);
4817}
4818
4819/**
4820 * et131x_open - Open the device for use. 4829 * et131x_open - Open the device for use.
4821 * @netdev: device to be opened 4830 * @netdev: device to be opened
4822 * 4831 *
@@ -4851,21 +4860,6 @@ int et131x_open(struct net_device *netdev)
4851} 4860}
4852 4861
4853/** 4862/**
4854 * et131x_down - Bring down the device
4855 * @netdev: device to be broght down
4856 */
4857void et131x_down(struct net_device *netdev)
4858{
4859 struct et131x_adapter *adapter = netdev_priv(netdev);
4860
4861 /* Save the timestamp for the TX watchdog, prevent a timeout */
4862 netdev->trans_start = jiffies;
4863
4864 phy_stop(adapter->phydev);
4865 et131x_disable_txrx(netdev);
4866}
4867
4868/**
4869 * et131x_close - Close the device 4863 * et131x_close - Close the device
4870 * @netdev: device to be closed 4864 * @netdev: device to be closed
4871 * 4865 *