mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
mv643xx_eth: kill superfluous comments
Half of the functions in the mv643xx_eth driver are prefixed by useless and baroque comment blocks on _what_ those functions do (which is obvious from the code itself) rather than why, and there's no point in keeping those comments around. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Dale Farnsworth <dale@farnsworth.org>
This commit is contained in:
parent
e53714933c
commit
5dc4d174e2
1 changed files with 0 additions and 552 deletions
|
@ -445,26 +445,6 @@ static unsigned int mv643xx_eth_port_disable_tx(struct mv643xx_eth_private *mp)
|
|||
/* rx ***********************************************************************/
|
||||
static void mv643xx_eth_free_completed_tx_descs(struct net_device *dev);
|
||||
|
||||
/*
|
||||
* rx_return_buff - Returns a Rx buffer back to the Rx ring.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This routine returns a Rx buffer back to the Rx ring. It retrieves the
|
||||
* next 'used' descriptor and attached the returned buffer to it.
|
||||
* In case the Rx ring was in "resource error" condition, where there are
|
||||
* no available Rx resources, the function resets the resource error flag.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port Control srtuct.
|
||||
* struct pkt_info *p_pkt_info Information on returned buffer.
|
||||
*
|
||||
* OUTPUT:
|
||||
* New available Rx resource in Rx descriptor ring.
|
||||
*
|
||||
* RETURN:
|
||||
* ETH_ERROR in case the routine can not access Rx desc ring.
|
||||
* ETH_OK otherwise.
|
||||
*/
|
||||
static FUNC_RET_STATUS rx_return_buff(struct mv643xx_eth_private *mp,
|
||||
struct pkt_info *p_pkt_info)
|
||||
{
|
||||
|
@ -500,14 +480,6 @@ static FUNC_RET_STATUS rx_return_buff(struct mv643xx_eth_private *mp,
|
|||
return ETH_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_rx_refill_descs
|
||||
*
|
||||
* Fills / refills RX queue on a certain gigabit ethernet port
|
||||
*
|
||||
* Input : pointer to ethernet interface network device structure
|
||||
* Output : N/A
|
||||
*/
|
||||
static void mv643xx_eth_rx_refill_descs(struct net_device *dev)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
@ -546,44 +518,11 @@ static void mv643xx_eth_rx_refill_descs(struct net_device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_rx_refill_descs_timer_wrapper
|
||||
*
|
||||
* Timer routine to wake up RX queue filling task. This function is
|
||||
* used only in case the RX queue is empty, and all alloc_skb has
|
||||
* failed (due to out of memory event).
|
||||
*
|
||||
* Input : pointer to ethernet interface network device structure
|
||||
* Output : N/A
|
||||
*/
|
||||
static inline void mv643xx_eth_rx_refill_descs_timer_wrapper(unsigned long data)
|
||||
{
|
||||
mv643xx_eth_rx_refill_descs((struct net_device *)data);
|
||||
}
|
||||
|
||||
/*
|
||||
* port_receive - Get received information from Rx ring.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This routine returns the received data to the caller. There is no
|
||||
* data copying during routine operation. All information is returned
|
||||
* using pointer to packet information struct passed from the caller.
|
||||
* If the routine exhausts Rx ring resources then the resource error flag
|
||||
* is set.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port Control srtuct.
|
||||
* struct pkt_info *p_pkt_info User packet buffer.
|
||||
*
|
||||
* OUTPUT:
|
||||
* Rx ring current and used indexes are updated.
|
||||
*
|
||||
* RETURN:
|
||||
* ETH_ERROR in case the routine can not access Rx desc ring.
|
||||
* ETH_QUEUE_FULL if Rx ring resources are exhausted.
|
||||
* ETH_END_OF_JOB if there is no received data.
|
||||
* ETH_OK otherwise.
|
||||
*/
|
||||
static FUNC_RET_STATUS port_receive(struct mv643xx_eth_private *mp,
|
||||
struct pkt_info *p_pkt_info)
|
||||
{
|
||||
|
@ -639,17 +578,6 @@ static FUNC_RET_STATUS port_receive(struct mv643xx_eth_private *mp,
|
|||
return ETH_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_receive
|
||||
*
|
||||
* This function is forward packets that are received from the port's
|
||||
* queues toward kernel core or FastRoute them to another interface.
|
||||
*
|
||||
* Input : dev - a pointer to the required interface
|
||||
* max - maximum number to receive (0 means unlimted)
|
||||
*
|
||||
* Output : number of served packets
|
||||
*/
|
||||
static int mv643xx_eth_receive_queue(struct net_device *dev, int budget)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
@ -719,11 +647,6 @@ static int mv643xx_eth_receive_queue(struct net_device *dev, int budget)
|
|||
}
|
||||
|
||||
#ifdef MV643XX_ETH_NAPI
|
||||
/*
|
||||
* mv643xx_eth_poll
|
||||
*
|
||||
* This function is used in case of NAPI
|
||||
*/
|
||||
static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = container_of(napi, struct mv643xx_eth_private, napi);
|
||||
|
@ -756,13 +679,6 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
|
|||
|
||||
|
||||
/* tx ***********************************************************************/
|
||||
/**
|
||||
* has_tiny_unaligned_frags - check if skb has any small, unaligned fragments
|
||||
*
|
||||
* Hardware can't handle unaligned fragments smaller than 9 bytes.
|
||||
* This helper function detects that case.
|
||||
*/
|
||||
|
||||
static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb)
|
||||
{
|
||||
unsigned int frag;
|
||||
|
@ -776,9 +692,6 @@ static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* alloc_tx_desc_index - return the index of the next available tx desc
|
||||
*/
|
||||
static int alloc_tx_desc_index(struct mv643xx_eth_private *mp)
|
||||
{
|
||||
int tx_desc_curr;
|
||||
|
@ -793,12 +706,6 @@ static int alloc_tx_desc_index(struct mv643xx_eth_private *mp)
|
|||
return tx_desc_curr;
|
||||
}
|
||||
|
||||
/**
|
||||
* tx_fill_frag_descs - fill tx hw descriptors for an skb's fragments.
|
||||
*
|
||||
* Ensure the data for each fragment to be transmitted is mapped properly,
|
||||
* then fill in descriptors in the tx hw queue.
|
||||
*/
|
||||
static void tx_fill_frag_descs(struct mv643xx_eth_private *mp,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
|
@ -837,12 +744,6 @@ static inline __be16 sum16_as_be(__sum16 sum)
|
|||
return (__force __be16)sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* tx_submit_descs_for_skb - submit data from an skb to the tx hw
|
||||
*
|
||||
* Ensure the data for an skb to be transmitted is mapped properly,
|
||||
* then fill in descriptors in the tx hw queue and start the hardware.
|
||||
*/
|
||||
static void tx_submit_descs_for_skb(struct mv643xx_eth_private *mp,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
|
@ -906,10 +807,6 @@ static void tx_submit_descs_for_skb(struct mv643xx_eth_private *mp,
|
|||
mp->tx_desc_count += nr_frags + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* mv643xx_eth_start_xmit - queue an skb to the hardware for transmission
|
||||
*
|
||||
*/
|
||||
static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
@ -951,26 +848,6 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||
/* mii management interface *************************************************/
|
||||
static int phy_addr_get(struct mv643xx_eth_private *mp);
|
||||
|
||||
/*
|
||||
* read_smi_reg - Read PHY registers
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This routine utilize the SMI interface to interact with the PHY in
|
||||
* order to perform PHY register read.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port.
|
||||
* unsigned int phy_reg PHY register address offset.
|
||||
* unsigned int *value Register value buffer.
|
||||
*
|
||||
* OUTPUT:
|
||||
* Write the value of a specified PHY register into given buffer.
|
||||
*
|
||||
* RETURN:
|
||||
* false if the PHY is busy or read data is not in valid state.
|
||||
* true otherwise.
|
||||
*
|
||||
*/
|
||||
static void read_smi_reg(struct mv643xx_eth_private *mp,
|
||||
unsigned int phy_reg, unsigned int *value)
|
||||
{
|
||||
|
@ -1007,26 +884,6 @@ out:
|
|||
spin_unlock_irqrestore(&mp->shared_smi->phy_lock, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* write_smi_reg - Write to PHY registers
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This routine utilize the SMI interface to interact with the PHY in
|
||||
* order to perform writes to PHY registers.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port.
|
||||
* unsigned int phy_reg PHY register address offset.
|
||||
* unsigned int value Register value.
|
||||
*
|
||||
* OUTPUT:
|
||||
* Write the given value to the specified PHY register.
|
||||
*
|
||||
* RETURN:
|
||||
* false if the PHY is busy.
|
||||
* true otherwise.
|
||||
*
|
||||
*/
|
||||
static void write_smi_reg(struct mv643xx_eth_private *mp,
|
||||
unsigned int phy_reg, unsigned int value)
|
||||
{
|
||||
|
@ -1055,23 +912,6 @@ out:
|
|||
|
||||
|
||||
/* mib counters *************************************************************/
|
||||
/*
|
||||
* clear_mib_counters - Clear all MIB counters
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This function clears all MIB counters of a specific ethernet port.
|
||||
* A read from the MIB counter will reset the counter.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port.
|
||||
*
|
||||
* OUTPUT:
|
||||
* After reading all MIB counters, the counters resets.
|
||||
*
|
||||
* RETURN:
|
||||
* MIB counter value.
|
||||
*
|
||||
*/
|
||||
static void clear_mib_counters(struct mv643xx_eth_private *mp)
|
||||
{
|
||||
unsigned int port_num = mp->port_num;
|
||||
|
@ -1286,9 +1126,6 @@ static const struct ethtool_ops mv643xx_eth_ethtool_ops = {
|
|||
|
||||
|
||||
/* address handling *********************************************************/
|
||||
/*
|
||||
* uc_addr_get - Read the MAC address from the port's hw registers
|
||||
*/
|
||||
static void uc_addr_get(struct mv643xx_eth_private *mp, unsigned char *p_addr)
|
||||
{
|
||||
unsigned int port_num = mp->port_num;
|
||||
|
@ -1306,22 +1143,6 @@ static void uc_addr_get(struct mv643xx_eth_private *mp, unsigned char *p_addr)
|
|||
p_addr[5] = mac_l & 0xff;
|
||||
}
|
||||
|
||||
/*
|
||||
* init_mac_tables - Clear all entrance in the UC, SMC and OMC tables
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Go through all the DA filter tables (Unicast, Special Multicast &
|
||||
* Other Multicast) and set each entry to 0.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port.
|
||||
*
|
||||
* OUTPUT:
|
||||
* Multicast and Unicast packets are rejected.
|
||||
*
|
||||
* RETURN:
|
||||
* None.
|
||||
*/
|
||||
static void init_mac_tables(struct mv643xx_eth_private *mp)
|
||||
{
|
||||
unsigned int port_num = mp->port_num;
|
||||
|
@ -1339,15 +1160,6 @@ static void init_mac_tables(struct mv643xx_eth_private *mp)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The entries in each table are indexed by a hash of a packet's MAC
|
||||
* address. One bit in each entry determines whether the packet is
|
||||
* accepted. There are 4 entries (each 8 bits wide) in each register
|
||||
* of the table. The bits in each entry are defined as follows:
|
||||
* 0 Accept=1, Drop=0
|
||||
* 3-1 Queue (ETH_Q0=0)
|
||||
* 7-4 Reserved = 0;
|
||||
*/
|
||||
static void set_filter_table_entry(struct mv643xx_eth_private *mp,
|
||||
int table, unsigned char entry)
|
||||
{
|
||||
|
@ -1364,9 +1176,6 @@ static void set_filter_table_entry(struct mv643xx_eth_private *mp,
|
|||
wrl(mp, table + tbl_offset, table_reg);
|
||||
}
|
||||
|
||||
/*
|
||||
* uc_addr_set - Write a MAC address into the port's hw registers
|
||||
*/
|
||||
static void uc_addr_set(struct mv643xx_eth_private *mp, unsigned char *p_addr)
|
||||
{
|
||||
unsigned int port_num = mp->port_num;
|
||||
|
@ -1386,14 +1195,6 @@ static void uc_addr_set(struct mv643xx_eth_private *mp, unsigned char *p_addr)
|
|||
set_filter_table_entry(mp, table, p_addr[5] & 0x0f);
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_update_mac_address
|
||||
*
|
||||
* Update the MAC address of the port in the address table
|
||||
*
|
||||
* Input : pointer to ethernet interface network device structure
|
||||
* Output : N/A
|
||||
*/
|
||||
static void mv643xx_eth_update_mac_address(struct net_device *dev)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
@ -1402,17 +1203,6 @@ static void mv643xx_eth_update_mac_address(struct net_device *dev)
|
|||
uc_addr_set(mp, dev->dev_addr);
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_set_mac_address
|
||||
*
|
||||
* Change the interface's mac address.
|
||||
* No special hardware thing should be done because interface is always
|
||||
* put in promiscuous mode.
|
||||
*
|
||||
* Input : pointer to ethernet interface network device structure and
|
||||
* a pointer to the designated entry to be added to the cache.
|
||||
* Output : zero upon success, negative upon failure
|
||||
*/
|
||||
static int mv643xx_eth_set_mac_address(struct net_device *dev, void *addr)
|
||||
{
|
||||
int i;
|
||||
|
@ -1424,20 +1214,6 @@ static int mv643xx_eth_set_mac_address(struct net_device *dev, void *addr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mc_addr - Multicast address settings.
|
||||
*
|
||||
* The MV device supports multicast using two tables:
|
||||
* 1) Special Multicast Table for MAC addresses of the form
|
||||
* 0x01-00-5E-00-00-XX (where XX is between 0x00 and 0x_FF).
|
||||
* The MAC DA[7:0] bits are used as a pointer to the Special Multicast
|
||||
* Table entries in the DA-Filter table.
|
||||
* 2) Other Multicast Table for multicast of another type. A CRC-8bit
|
||||
* is used as an index to the Other Multicast Table entries in the
|
||||
* DA-Filter table. This function calculates the CRC-8bit value.
|
||||
* In either case, set_filter_table_entry() is then called
|
||||
* to set to set the actual table entry.
|
||||
*/
|
||||
static void mc_addr(struct mv643xx_eth_private *mp, unsigned char *p_addr)
|
||||
{
|
||||
unsigned int port_num = mp->port_num;
|
||||
|
@ -1528,9 +1304,6 @@ static void mc_addr(struct mv643xx_eth_private *mp, unsigned char *p_addr)
|
|||
set_filter_table_entry(mp, table, crc_result);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the entire multicast list based on dev->mc_list.
|
||||
*/
|
||||
static void set_multicast_list(struct net_device *dev)
|
||||
{
|
||||
|
||||
|
@ -1588,14 +1361,6 @@ static void set_multicast_list(struct net_device *dev)
|
|||
mc_addr(mp, mc_list->dmi_addr);
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_set_rx_mode
|
||||
*
|
||||
* Change from promiscuos to regular rx mode
|
||||
*
|
||||
* Input : pointer to ethernet interface network device structure
|
||||
* Output : N/A
|
||||
*/
|
||||
static void mv643xx_eth_set_rx_mode(struct net_device *dev)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
@ -1613,28 +1378,6 @@ static void mv643xx_eth_set_rx_mode(struct net_device *dev)
|
|||
|
||||
|
||||
/* rx/tx queue initialisation ***********************************************/
|
||||
/*
|
||||
* ether_init_rx_desc_ring - Curve a Rx chain desc list and buffer in memory.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This function prepares a Rx chained list of descriptors and packet
|
||||
* buffers in a form of a ring. The routine must be called after port
|
||||
* initialization routine and before port start routine.
|
||||
* The Ethernet SDMA engine uses CPU bus addresses to access the various
|
||||
* devices in the system (i.e. DRAM). This function uses the ethernet
|
||||
* struct 'virtual to physical' routine (set by the user) to set the ring
|
||||
* with physical addresses.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port Control srtuct.
|
||||
*
|
||||
* OUTPUT:
|
||||
* The routine updates the Ethernet port control struct with information
|
||||
* regarding the Rx descriptors and buffers.
|
||||
*
|
||||
* RETURN:
|
||||
* None.
|
||||
*/
|
||||
static void ether_init_rx_desc_ring(struct mv643xx_eth_private *mp)
|
||||
{
|
||||
volatile struct rx_desc *p_rx_desc;
|
||||
|
@ -1684,28 +1427,6 @@ static void mv643xx_eth_free_rx_rings(struct net_device *dev)
|
|||
mp->p_rx_desc_area, mp->rx_desc_dma);
|
||||
}
|
||||
|
||||
/*
|
||||
* ether_init_tx_desc_ring - Curve a Tx chain desc list and buffer in memory.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This function prepares a Tx chained list of descriptors and packet
|
||||
* buffers in a form of a ring. The routine must be called after port
|
||||
* initialization routine and before port start routine.
|
||||
* The Ethernet SDMA engine uses CPU bus addresses to access the various
|
||||
* devices in the system (i.e. DRAM). This function uses the ethernet
|
||||
* struct 'virtual to physical' routine (set by the user) to set the ring
|
||||
* with physical addresses.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port Control srtuct.
|
||||
*
|
||||
* OUTPUT:
|
||||
* The routine updates the Ethernet port control struct with information
|
||||
* regarding the Tx descriptors and buffers.
|
||||
*
|
||||
* RETURN:
|
||||
* None.
|
||||
*/
|
||||
static void ether_init_tx_desc_ring(struct mv643xx_eth_private *mp)
|
||||
{
|
||||
int tx_desc_num = mp->tx_ring_size;
|
||||
|
@ -1725,11 +1446,6 @@ static void ether_init_tx_desc_ring(struct mv643xx_eth_private *mp)
|
|||
mp->tx_desc_area_size = tx_desc_num * sizeof(struct tx_desc);
|
||||
}
|
||||
|
||||
/**
|
||||
* mv643xx_eth_free_tx_descs - Free the tx desc data for completed descriptors
|
||||
*
|
||||
* If force is non-zero, frees uncompleted descriptors as well
|
||||
*/
|
||||
static int mv643xx_eth_free_tx_descs(struct net_device *dev, int force)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
@ -1828,7 +1544,6 @@ static void mv643xx_eth_free_tx_rings(struct net_device *dev)
|
|||
/* netdev ops and related ***************************************************/
|
||||
static void port_reset(struct mv643xx_eth_private *mp);
|
||||
|
||||
/* Set the mv643xx port configuration register for the speed/duplex mode. */
|
||||
static void mv643xx_eth_update_pscr(struct net_device *dev,
|
||||
struct ethtool_cmd *ecmd)
|
||||
{
|
||||
|
@ -1874,17 +1589,6 @@ static void mv643xx_eth_update_pscr(struct net_device *dev,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_int_handler
|
||||
*
|
||||
* Main interrupt handler for the gigbit ethernet ports
|
||||
*
|
||||
* Input : irq - irq number (not used)
|
||||
* dev_id - a pointer to the required interface's data structure
|
||||
* regs - not used
|
||||
* Output : N/A
|
||||
*/
|
||||
|
||||
static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id)
|
||||
{
|
||||
struct net_device *dev = (struct net_device *)dev_id;
|
||||
|
@ -1947,22 +1651,6 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id)
|
|||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
/*
|
||||
* phy_reset - Reset Ethernet port PHY.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This routine utilizes the SMI interface to reset the ethernet port PHY.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port.
|
||||
*
|
||||
* OUTPUT:
|
||||
* The PHY is reset.
|
||||
*
|
||||
* RETURN:
|
||||
* None.
|
||||
*
|
||||
*/
|
||||
static void phy_reset(struct mv643xx_eth_private *mp)
|
||||
{
|
||||
unsigned int phy_reg_data;
|
||||
|
@ -1979,33 +1667,6 @@ static void phy_reset(struct mv643xx_eth_private *mp)
|
|||
} while (phy_reg_data & 0x8000);
|
||||
}
|
||||
|
||||
/*
|
||||
* port_start - Start the Ethernet port activity.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This routine prepares the Ethernet port for Rx and Tx activity:
|
||||
* 1. Initialize Tx and Rx Current Descriptor Pointer for each queue that
|
||||
* has been initialized a descriptor's ring (using
|
||||
* ether_init_tx_desc_ring for Tx and ether_init_rx_desc_ring for Rx)
|
||||
* 2. Initialize and enable the Ethernet configuration port by writing to
|
||||
* the port's configuration and command registers.
|
||||
* 3. Initialize and enable the SDMA by writing to the SDMA's
|
||||
* configuration and command registers. After completing these steps,
|
||||
* the ethernet port SDMA can starts to perform Rx and Tx activities.
|
||||
*
|
||||
* Note: Each Rx and Tx queue descriptor's list must be initialized prior
|
||||
* to calling this function (use ether_init_tx_desc_ring for Tx queues
|
||||
* and ether_init_rx_desc_ring for Rx queues).
|
||||
*
|
||||
* INPUT:
|
||||
* dev - a pointer to the required interface
|
||||
*
|
||||
* OUTPUT:
|
||||
* Ethernet port is ready to receive and transmit.
|
||||
*
|
||||
* RETURN:
|
||||
* None.
|
||||
*/
|
||||
static void port_start(struct net_device *dev)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
@ -2070,29 +1731,6 @@ static void port_start(struct net_device *dev)
|
|||
}
|
||||
|
||||
#ifdef MV643XX_ETH_COAL
|
||||
|
||||
/*
|
||||
* set_rx_coal - Sets coalescing interrupt mechanism on RX path
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This routine sets the RX coalescing interrupt mechanism parameter.
|
||||
* This parameter is a timeout counter, that counts in 64 t_clk
|
||||
* chunks ; that when timeout event occurs a maskable interrupt
|
||||
* occurs.
|
||||
* The parameter is calculated using the tClk of the MV-643xx chip
|
||||
* , and the required delay of the interrupt in usec.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet port
|
||||
* unsigned int delay Delay in usec
|
||||
*
|
||||
* OUTPUT:
|
||||
* Interrupt coalescing mechanism value is set in MV-643xx chip.
|
||||
*
|
||||
* RETURN:
|
||||
* The interrupt coalescing value set in the gigE port.
|
||||
*
|
||||
*/
|
||||
static unsigned int set_rx_coal(struct mv643xx_eth_private *mp,
|
||||
unsigned int delay)
|
||||
{
|
||||
|
@ -2109,28 +1747,6 @@ static unsigned int set_rx_coal(struct mv643xx_eth_private *mp,
|
|||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* set_tx_coal - Sets coalescing interrupt mechanism on TX path
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This routine sets the TX coalescing interrupt mechanism parameter.
|
||||
* This parameter is a timeout counter, that counts in 64 t_clk
|
||||
* chunks ; that when timeout event occurs a maskable interrupt
|
||||
* occurs.
|
||||
* The parameter is calculated using the t_cLK frequency of the
|
||||
* MV-643xx chip and the required delay in the interrupt in uSec
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet port
|
||||
* unsigned int delay Delay in uSeconds
|
||||
*
|
||||
* OUTPUT:
|
||||
* Interrupt coalescing mechanism value is set in MV-643xx chip.
|
||||
*
|
||||
* RETURN:
|
||||
* The interrupt coalescing value set in the gigE port.
|
||||
*
|
||||
*/
|
||||
static unsigned int set_tx_coal(struct mv643xx_eth_private *mp,
|
||||
unsigned int delay)
|
||||
{
|
||||
|
@ -2142,30 +1758,6 @@ static unsigned int set_tx_coal(struct mv643xx_eth_private *mp,
|
|||
return coal;
|
||||
}
|
||||
|
||||
/*
|
||||
* port_init - Initialize the Ethernet port driver
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This function prepares the ethernet port to start its activity:
|
||||
* 1) Completes the ethernet port driver struct initialization toward port
|
||||
* start routine.
|
||||
* 2) Resets the device to a quiescent state in case of warm reboot.
|
||||
* 3) Enable SDMA access to all four DRAM banks as well as internal SRAM.
|
||||
* 4) Clean MAC tables. The reset status of those tables is unknown.
|
||||
* 5) Set PHY address.
|
||||
* Note: Call this routine prior to port_start routine and after
|
||||
* setting user values in the user fields of Ethernet port control
|
||||
* struct.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet port control struct
|
||||
*
|
||||
* OUTPUT:
|
||||
* See description.
|
||||
*
|
||||
* RETURN:
|
||||
* None.
|
||||
*/
|
||||
static void port_init(struct mv643xx_eth_private *mp)
|
||||
{
|
||||
mp->rx_resource_err = 0;
|
||||
|
@ -2175,19 +1767,6 @@ static void port_init(struct mv643xx_eth_private *mp)
|
|||
init_mac_tables(mp);
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_open
|
||||
*
|
||||
* This function is called when openning the network device. The function
|
||||
* should initialize all the hardware, initialize cyclic Rx/Tx
|
||||
* descriptors chain and buffers and allocate an IRQ to the network
|
||||
* device.
|
||||
*
|
||||
* Input : a pointer to the network device structure
|
||||
*
|
||||
* Output : zero of success , nonzero if fails.
|
||||
*/
|
||||
|
||||
static int mv643xx_eth_open(struct net_device *dev)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
@ -2320,24 +1899,6 @@ out_free_irq:
|
|||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* port_reset - Reset Ethernet port
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This routine resets the chip by aborting any SDMA engine activity and
|
||||
* clearing the MIB counters. The Receiver and the Transmit unit are in
|
||||
* idle state after this command is performed and the port is disabled.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port.
|
||||
*
|
||||
* OUTPUT:
|
||||
* Channel activity is halted.
|
||||
*
|
||||
* RETURN:
|
||||
* None.
|
||||
*
|
||||
*/
|
||||
static void port_reset(struct mv643xx_eth_private *mp)
|
||||
{
|
||||
unsigned int port_num = mp->port_num;
|
||||
|
@ -2357,16 +1918,6 @@ static void port_reset(struct mv643xx_eth_private *mp)
|
|||
wrl(mp, PORT_SERIAL_CONTROL(port_num), reg_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_stop
|
||||
*
|
||||
* This function is used when closing the network device.
|
||||
* It updates the hardware,
|
||||
* release all memory that holds buffers and descriptors and release the IRQ.
|
||||
* Input : a pointer to the device structure
|
||||
* Output : zero if success , nonzero if fails
|
||||
*/
|
||||
|
||||
static int mv643xx_eth_stop(struct net_device *dev)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
@ -2400,13 +1951,6 @@ static int mv643xx_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, int c
|
|||
return generic_mii_ioctl(&mp->mii, if_mii(ifr), cmd, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Changes MTU (maximum transfer unit) of the gigabit ethenret port
|
||||
*
|
||||
* Input : pointer to ethernet interface network device structure
|
||||
* new mtu size
|
||||
* Output : 0 upon success, -EINVAL upon failure
|
||||
*/
|
||||
static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu)
|
||||
{
|
||||
if ((new_mtu > 9500) || (new_mtu < 64))
|
||||
|
@ -2431,11 +1975,6 @@ static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_tx_timeout_task
|
||||
*
|
||||
* Actual routine to reset the adapter when a timeout on Tx has occurred
|
||||
*/
|
||||
static void mv643xx_eth_tx_timeout_task(struct work_struct *ugly)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = container_of(ugly, struct mv643xx_eth_private,
|
||||
|
@ -2454,14 +1993,6 @@ static void mv643xx_eth_tx_timeout_task(struct work_struct *ugly)
|
|||
netif_wake_queue(dev);
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_tx_timeout
|
||||
*
|
||||
* Called upon a timeout on transmitting a packet
|
||||
*
|
||||
* Input : pointer to ethernet interface network device structure.
|
||||
* Output : N/A
|
||||
*/
|
||||
static void mv643xx_eth_tx_timeout(struct net_device *dev)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
@ -2488,9 +2019,6 @@ static void mv643xx_eth_netpoll(struct net_device *netdev)
|
|||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Wrappers for MII support library.
|
||||
*/
|
||||
static int mv643xx_eth_mdio_read(struct net_device *dev, int phy_id, int location)
|
||||
{
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
@ -2607,23 +2135,6 @@ static struct platform_driver mv643xx_eth_shared_driver = {
|
|||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* phy_addr_set - Set the ethernet port PHY address.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This routine sets the given ethernet port PHY address.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port.
|
||||
* int phy_addr PHY address.
|
||||
*
|
||||
* OUTPUT:
|
||||
* None.
|
||||
*
|
||||
* RETURN:
|
||||
* None.
|
||||
*
|
||||
*/
|
||||
static void phy_addr_set(struct mv643xx_eth_private *mp, int phy_addr)
|
||||
{
|
||||
u32 reg_data;
|
||||
|
@ -2635,22 +2146,6 @@ static void phy_addr_set(struct mv643xx_eth_private *mp, int phy_addr)
|
|||
wrl(mp, PHY_ADDR, reg_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* phy_addr_get - Get the ethernet port PHY address.
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This routine returns the given ethernet port PHY address.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port.
|
||||
*
|
||||
* OUTPUT:
|
||||
* None.
|
||||
*
|
||||
* RETURN:
|
||||
* PHY address.
|
||||
*
|
||||
*/
|
||||
static int phy_addr_get(struct mv643xx_eth_private *mp)
|
||||
{
|
||||
unsigned int reg_data;
|
||||
|
@ -2660,24 +2155,6 @@ static int phy_addr_get(struct mv643xx_eth_private *mp)
|
|||
return ((reg_data >> (5 * mp->port_num)) & 0x1f);
|
||||
}
|
||||
|
||||
/*
|
||||
* phy_detect - Detect whether a phy is present
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* This function tests whether there is a PHY present on
|
||||
* the specified port.
|
||||
*
|
||||
* INPUT:
|
||||
* struct mv643xx_eth_private *mp Ethernet Port.
|
||||
*
|
||||
* OUTPUT:
|
||||
* None
|
||||
*
|
||||
* RETURN:
|
||||
* 0 on success
|
||||
* -ENODEV on failure
|
||||
*
|
||||
*/
|
||||
static int phy_detect(struct mv643xx_eth_private *mp)
|
||||
{
|
||||
unsigned int phy_reg_data0;
|
||||
|
@ -2726,17 +2203,6 @@ static void mv643xx_init_ethtool_cmd(struct net_device *dev, int phy_address,
|
|||
}
|
||||
}
|
||||
|
||||
/*/
|
||||
* mv643xx_eth_probe
|
||||
*
|
||||
* First function called after registering the network device.
|
||||
* It's purpose is to initialize the device as an ethernet device,
|
||||
* fill the ethernet device structure with pointers * to functions,
|
||||
* and set the MAC address of the interface
|
||||
*
|
||||
* Input : struct device *
|
||||
* Output : -ENOMEM if failed , 0 if success
|
||||
*/
|
||||
static int mv643xx_eth_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct mv643xx_eth_platform_data *pd;
|
||||
|
@ -2949,15 +2415,6 @@ static struct platform_driver mv643xx_eth_driver = {
|
|||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* mv643xx_eth_init_module
|
||||
*
|
||||
* Registers the network drivers into the Linux kernel
|
||||
*
|
||||
* Input : N/A
|
||||
*
|
||||
* Output : N/A
|
||||
*/
|
||||
static int __init mv643xx_eth_init_module(void)
|
||||
{
|
||||
int rc;
|
||||
|
@ -2971,15 +2428,6 @@ static int __init mv643xx_eth_init_module(void)
|
|||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* mv643xx_eth_cleanup_module
|
||||
*
|
||||
* Registers the network drivers into the Linux kernel
|
||||
*
|
||||
* Input : N/A
|
||||
*
|
||||
* Output : N/A
|
||||
*/
|
||||
static void __exit mv643xx_eth_cleanup_module(void)
|
||||
{
|
||||
platform_driver_unregister(&mv643xx_eth_driver);
|
||||
|
|
Loading…
Reference in a new issue