summaryrefslogtreecommitdiff
path: root/bsp/ls1cdev/drivers/net/synopGMAC_Dev.c
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-05-28 16:20:08 +0800
committerGitHub <[email protected]>2021-05-28 16:20:08 +0800
commit92beddf3bccf6346e26aa097f82464456fb8e6bd (patch)
tree197e4a108118dda016ea02274172f0c40e7ee8ed /bsp/ls1cdev/drivers/net/synopGMAC_Dev.c
parentb18a99b44240ec3152011e159cc24a5af8dff0ce (diff)
parent03f4d40e30f3c94e1db0b3a65b3610dee695694a (diff)
Merge pull request #4737 from mysterywolf/3,1,xformatv3.1.5
[lts 3.1.x] format codes
Diffstat (limited to 'bsp/ls1cdev/drivers/net/synopGMAC_Dev.c')
-rw-r--r--bsp/ls1cdev/drivers/net/synopGMAC_Dev.c2430
1 files changed, 1215 insertions, 1215 deletions
diff --git a/bsp/ls1cdev/drivers/net/synopGMAC_Dev.c b/bsp/ls1cdev/drivers/net/synopGMAC_Dev.c
index a41038f35c..3a31c9af70 100644
--- a/bsp/ls1cdev/drivers/net/synopGMAC_Dev.c
+++ b/bsp/ls1cdev/drivers/net/synopGMAC_Dev.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -7,13 +7,13 @@
* Date Author Notes
* 2017-08-24 chinesebear first version
*/
-
+
#include "synopGMAC_Dev.h"
#include <rthw.h>
#include <rtthread.h>
-#define UNUSED 1
+#define UNUSED 1
/**
* Function to set the MDC clock for mdio transactiona
@@ -24,12 +24,12 @@
*/
s32 synopGMAC_set_mdc_clk_div(synopGMACdevice *gmacdev,u32 clk_div_val)
{
- u32 orig_data;
- orig_data = synopGMACReadReg(gmacdev->MacBase,GmacGmiiAddr); //set the mdc clock to the user defined value
- orig_data &= (~ GmiiCsrClkMask);
- orig_data |= clk_div_val;
- synopGMACWriteReg(gmacdev->MacBase, GmacGmiiAddr ,orig_data);
- return 0;
+ u32 orig_data;
+ orig_data = synopGMACReadReg(gmacdev->MacBase,GmacGmiiAddr); //set the mdc clock to the user defined value
+ orig_data &= (~ GmiiCsrClkMask);
+ orig_data |= clk_div_val;
+ synopGMACWriteReg(gmacdev->MacBase, GmacGmiiAddr ,orig_data);
+ return 0;
}
/**
@@ -41,10 +41,10 @@ s32 synopGMAC_set_mdc_clk_div(synopGMACdevice *gmacdev,u32 clk_div_val)
*/
u32 synopGMAC_get_mdc_clk_div(synopGMACdevice *gmacdev)
{
- u32 data;
- data = synopGMACReadReg(gmacdev->MacBase,GmacGmiiAddr);
- data &= GmiiCsrClkMask;
- return data;
+ u32 data;
+ data = synopGMACReadReg(gmacdev->MacBase,GmacGmiiAddr);
+ data &= GmiiCsrClkMask;
+ return data;
}
@@ -59,34 +59,34 @@ u32 synopGMAC_get_mdc_clk_div(synopGMACdevice *gmacdev)
*/
s32 synopGMAC_read_phy_reg(u32 RegBase,u32 PhyBase, u32 RegOffset, u16 * data )
{
- u32 addr;
- u32 loop_variable;
- addr = ((PhyBase << GmiiDevShift) & GmiiDevMask) | ((RegOffset << GmiiRegShift) & GmiiRegMask)
- | GmiiCsrClk3; //sw: add GmiiCsrClk
- addr = addr | GmiiBusy ; //Gmii busy bit
+ u32 addr;
+ u32 loop_variable;
+ addr = ((PhyBase << GmiiDevShift) & GmiiDevMask) | ((RegOffset << GmiiRegShift) & GmiiRegMask)
+ | GmiiCsrClk3; //sw: add GmiiCsrClk
+ addr = addr | GmiiBusy ; //Gmii busy bit
- synopGMACWriteReg(RegBase,GmacGmiiAddr,addr);
- //write the address from where the data to be read in GmiiGmiiAddr register of synopGMAC ip
+ synopGMACWriteReg(RegBase,GmacGmiiAddr,addr);
+ //write the address from where the data to be read in GmiiGmiiAddr register of synopGMAC ip
- for(loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++){
- //Wait till the busy bit gets cleared within a certain amount of time
- if (!(synopGMACReadReg(RegBase,GmacGmiiAddr) & GmiiBusy)){
- break;
- }
- plat_delay(DEFAULT_DELAY_VARIABLE);
- }
- if(loop_variable < DEFAULT_LOOP_VARIABLE)
- * data = (u16)(synopGMACReadReg(RegBase,GmacGmiiData) & 0xFFFF);
- else{
- TR("Error::: PHY not responding Busy bit didnot get cleared !!!!!!\n");
- return -ESYNOPGMACPHYERR;
- }
- //sw
+ for(loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++){
+ //Wait till the busy bit gets cleared within a certain amount of time
+ if (!(synopGMACReadReg(RegBase,GmacGmiiAddr) & GmiiBusy)){
+ break;
+ }
+ plat_delay(DEFAULT_DELAY_VARIABLE);
+ }
+ if(loop_variable < DEFAULT_LOOP_VARIABLE)
+ * data = (u16)(synopGMACReadReg(RegBase,GmacGmiiData) & 0xFFFF);
+ else{
+ TR("Error::: PHY not responding Busy bit didnot get cleared !!!!!!\n");
+ return -ESYNOPGMACPHYERR;
+ }
+ //sw
#if SYNOP_REG_DEBUG
- printf("read phy reg: offset = 0x%x\tdata = 0x%x\n",RegOffset,*data);
+ printf("read phy reg: offset = 0x%x\tdata = 0x%x\n",RegOffset,*data);
#endif
- return -ESYNOPGMACNOERR;
+ return -ESYNOPGMACNOERR;
}
/**
@@ -105,14 +105,14 @@ s32 synopGMAC_write_phy_reg(u32 RegBase, u32 PhyBase, u32 RegOffset, u16 data)
synopGMACWriteReg(RegBase,GmacGmiiData,data); // write the data in to GmacGmiiData register of synopGMAC ip
- addr = ((PhyBase << GmiiDevShift) & GmiiDevMask) | ((RegOffset << GmiiRegShift) & GmiiRegMask) | GmiiWrite | GmiiCsrClk3; //sw: add GmiiCsrclk
+ addr = ((PhyBase << GmiiDevShift) & GmiiDevMask) | ((RegOffset << GmiiRegShift) & GmiiRegMask) | GmiiWrite | GmiiCsrClk3; //sw: add GmiiCsrclk
addr = addr | GmiiBusy ; //set Gmii clk to 20-35 Mhz and Gmii busy bit
synopGMACWriteReg(RegBase,GmacGmiiAddr,addr);
for(loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++){
if (!(synopGMACReadReg(RegBase,GmacGmiiAddr) & GmiiBusy)){
- break;
+ break;
}
plat_delay(DEFAULT_DELAY_VARIABLE);
}
@@ -130,12 +130,12 @@ s32 synopGMAC_write_phy_reg(u32 RegBase, u32 PhyBase, u32 RegOffset, u16 data)
}
/**
- * Function to configure the phy in loopback mode.
+ * Function to configure the phy in loopback mode.
*
* @param[in] pointer to synopGMACdevice.
* @param[in] enable or disable the loopback.
* \return 0 on success else return the error status.
- * \note Don't get confused with mac loop-back synopGMAC_loopback_on(synopGMACdevice *)
+ * \note Don't get confused with mac loop-back synopGMAC_loopback_on(synopGMACdevice *)
* and synopGMAC_loopback_off(synopGMACdevice *) functions.
*/
#if UNUSED
@@ -143,13 +143,13 @@ s32 synopGMAC_phy_loopback(synopGMACdevice *gmacdev, bool loopback)
{
s32 status = -ESYNOPGMACNOERR;
u16 *temp;
- status = synopGMAC_read_phy_reg(gmacdev->MacBase, gmacdev->PhyBase, PHY_CONTROL_REG,temp);
+ status = synopGMAC_read_phy_reg(gmacdev->MacBase, gmacdev->PhyBase, PHY_CONTROL_REG,temp);
if(loopback)
- *temp |= 0x4000;
+ *temp |= 0x4000;
else
- *temp = *temp;
+ *temp = *temp;
- status = synopGMAC_write_phy_reg(gmacdev->MacBase, gmacdev->PhyBase, PHY_CONTROL_REG, *temp);
+ status = synopGMAC_write_phy_reg(gmacdev->MacBase, gmacdev->PhyBase, PHY_CONTROL_REG, *temp);
return status;
}
@@ -162,36 +162,36 @@ return status;
* \return Always return 0.
*/
-s32 synopGMAC_read_version (synopGMACdevice * gmacdev)
-{
- u32 data = 0;
- data = synopGMACReadReg(gmacdev->MacBase, GmacVersion );
- gmacdev->Version = data;
- return 0;
+s32 synopGMAC_read_version (synopGMACdevice * gmacdev)
+{
+ u32 data = 0;
+ data = synopGMACReadReg(gmacdev->MacBase, GmacVersion );
+ gmacdev->Version = data;
+ return 0;
}
/**
- * Function to reset the GMAC core.
+ * Function to reset the GMAC core.
* This reests the DMA and GMAC core. After reset all the registers holds their respective reset value
* @param[in] pointer to synopGMACdevice.
* \return 0 on success else return the error status.
*/
-s32 synopGMAC_reset (synopGMACdevice * gmacdev)
-{
- u32 data = 0;
- synopGMACWriteReg(gmacdev->DmaBase, DmaBusMode ,DmaResetOn);
+s32 synopGMAC_reset (synopGMACdevice * gmacdev)
+{
+ u32 data = 0;
+ synopGMACWriteReg(gmacdev->DmaBase, DmaBusMode ,DmaResetOn);
plat_delay(DEFAULT_LOOP_VARIABLE);
- data = synopGMACReadReg(gmacdev->DmaBase, DmaBusMode);
- TR("DATA after Reset = %08x\n",data);
-
- return 0;
+ data = synopGMACReadReg(gmacdev->DmaBase, DmaBusMode);
+ TR("DATA after Reset = %08x\n",data);
+
+ return 0;
}
/**
- * Function to program DMA bus mode register.
- *
+ * Function to program DMA bus mode register.
+ *
* The Bus Mode register is programmed with the value given. The bits to be set are
* bit wise or'ed and sent as the second argument to this function.
* @param[in] pointer to synopGMACdevice.
@@ -200,14 +200,14 @@ s32 synopGMAC_reset (synopGMACdevice * gmacdev)
*/
s32 synopGMAC_dma_bus_mode_init(synopGMACdevice * gmacdev, u32 init_value )
{
- synopGMACWriteReg(gmacdev->DmaBase, DmaBusMode ,init_value );
- return 0;
+ synopGMACWriteReg(gmacdev->DmaBase, DmaBusMode ,init_value );
+ return 0;
}
/**
- * Function to program DMA Control register.
- *
+ * Function to program DMA Control register.
+ *
* The Dma Control register is programmed with the value given. The bits to be set are
* bit wise or'ed and sent as the second argument to this function.
* @param[in] pointer to synopGMACdevice.
@@ -216,15 +216,15 @@ s32 synopGMAC_dma_bus_mode_init(synopGMACdevice * gmacdev, u32 init_value )
*/
s32 synopGMAC_dma_control_init(synopGMACdevice * gmacdev, u32 init_value )
{
- synopGMACWriteReg(gmacdev->DmaBase, DmaControl, init_value);
- return 0;
+ synopGMACWriteReg(gmacdev->DmaBase, DmaControl, init_value);
+ return 0;
}
/*Gmac configuration functions*/
/**
- * Enable the watchdog timer on the receiver.
+ * Enable the watchdog timer on the receiver.
* When enabled, Gmac enables Watchdog timer, and GMAC allows no more than
* 2048 bytes of data (10,240 if Jumbo frame enabled).
* @param[in] pointer to synopGMACdevice.
@@ -232,11 +232,11 @@ s32 synopGMAC_dma_control_init(synopGMACdevice * gmacdev, u32 init_value )
*/
void synopGMAC_wd_enable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacWatchdog);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacWatchdog);
+ return;
}
/**
- * Disable the watchdog timer on the receiver.
+ * Disable the watchdog timer on the receiver.
* When disabled, Gmac disabled watchdog timer, and can receive frames up to
* 16,384 bytes.
* @param[in] pointer to synopGMACdevice.
@@ -245,24 +245,24 @@ void synopGMAC_wd_enable(synopGMACdevice * gmacdev)
void synopGMAC_wd_disable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacWatchdog);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacWatchdog);
+ return;
}
/**
- * Enables the Jabber frame support.
+ * Enables the Jabber frame support.
* When enabled, GMAC disabled the jabber timer, and can transfer 16,384 byte frames.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
void synopGMAC_jab_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacJabber);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacJabber);
+ return;
}
/**
- * Disables the Jabber frame support.
- * When disabled, GMAC enables jabber timer. It cuts of transmitter if application
+ * Disables the Jabber frame support.
+ * When disabled, GMAC enables jabber timer. It cuts of transmitter if application
* sends more than 2048 bytes of data (10240 if Jumbo frame enabled).
* @param[in] pointer to synopGMACdevice.
* \return returns void.
@@ -270,13 +270,13 @@ void synopGMAC_jab_enable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_jab_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacJabber);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacJabber);
+ return;
}
#endif
/**
- * Enables Frame bursting (Only in Half Duplex Mode).
+ * Enables Frame bursting (Only in Half Duplex Mode).
* When enabled, GMAC allows frame bursting in GMII Half Duplex mode.
* Reserved in 10/100 and Full-Duplex configurations.
* @param[in] pointer to synopGMACdevice.
@@ -284,11 +284,11 @@ void synopGMAC_jab_disable(synopGMACdevice * gmacdev)
*/
void synopGMAC_frame_burst_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacFrameBurst);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacFrameBurst);
+ return;
}
/**
- * Disables Frame bursting.
+ * Disables Frame bursting.
* When Disabled, frame bursting is not supported.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
@@ -296,13 +296,13 @@ void synopGMAC_frame_burst_enable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_frame_burst_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacFrameBurst);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacFrameBurst);
+ return;
}
#endif
/**
- * Enable Jumbo frame support.
+ * Enable Jumbo frame support.
* When Enabled GMAC supports jumbo frames of 9018/9022(VLAN tagged).
* Giant frame error is not reported in receive frame status.
* @param[in] pointer to synopGMACdevice.
@@ -311,12 +311,12 @@ void synopGMAC_frame_burst_disable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_jumbo_frame_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacJumboFrame);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacJumboFrame);
+ return;
}
#endif
/**
- * Disable Jumbo frame support.
+ * Disable Jumbo frame support.
* When Disabled GMAC does not supports jumbo frames.
* Giant frame error is reported in receive frame status.
* @param[in] pointer to synopGMACdevice.
@@ -324,12 +324,12 @@ void synopGMAC_jumbo_frame_enable(synopGMACdevice * gmacdev)
*/
void synopGMAC_jumbo_frame_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacJumboFrame);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacJumboFrame);
+ return;
}
/**
- * Disable Carrier sense.
+ * Disable Carrier sense.
* When Disabled GMAC ignores CRS signal during frame transmission
* in half duplex mode.
* @param[in] pointer to synopGMACdevice.
@@ -339,49 +339,49 @@ void synopGMAC_jumbo_frame_disable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_disable_crs(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacDisableCrs);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacDisableCrs);
+ return;
}
#endif
/**
- * Selects the GMII port.
+ * Selects the GMII port.
* When called GMII (1000Mbps) port is selected (programmable only in 10/100/1000 Mbps configuration).
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
void synopGMAC_select_gmii(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacMiiGmii);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacMiiGmii);
+ return;
}
/**
- * Selects the MII port.
+ * Selects the MII port.
* When called MII (10/100Mbps) port is selected (programmable only in 10/100/1000 Mbps configuration).
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
void synopGMAC_select_mii(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacMiiGmii);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacMiiGmii);
+ return;
}
/**
- * Enables Receive Own bit (Only in Half Duplex Mode).
+ * Enables Receive Own bit (Only in Half Duplex Mode).
* When enaled GMAC receives all the packets given by phy while transmitting.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
void synopGMAC_rx_own_enable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacRxOwn);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacRxOwn);
+ return;
}
/**
- * Disables Receive Own bit (Only in Half Duplex Mode).
+ * Disables Receive Own bit (Only in Half Duplex Mode).
* When enaled GMAC disables the reception of frames when gmii_txen_o is asserted.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
@@ -389,13 +389,13 @@ void synopGMAC_rx_own_enable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_rx_own_disable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacRxOwn);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacRxOwn);
+ return;
}
#endif
/**
- * Sets the GMAC in loopback mode.
+ * Sets the GMAC in loopback mode.
* When on GMAC operates in loop-back mode at GMII/MII.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
@@ -404,66 +404,66 @@ void synopGMAC_rx_own_disable(synopGMACdevice * gmacdev)
*/
void synopGMAC_loopback_on(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacLoopback);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacLoopback);
+ return;
}
/**
- * Sets the GMAC in Normal mode.
+ * Sets the GMAC in Normal mode.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
void synopGMAC_loopback_off(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacLoopback);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacLoopback);
+ return;
}
/**
- * Sets the GMAC core in Full-Duplex mode.
+ * Sets the GMAC core in Full-Duplex mode.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
void synopGMAC_set_full_duplex(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacDuplex);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacDuplex);
+ return;
}
/**
- * Sets the GMAC core in Half-Duplex mode.
+ * Sets the GMAC core in Half-Duplex mode.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
void synopGMAC_set_half_duplex(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacDuplex);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacDuplex);
+ return;
}
/**
* GMAC tries retransmission (Only in Half Duplex mode).
- * If collision occurs on the GMII/MII, GMAC attempt retries based on the
- * back off limit configured.
+ * If collision occurs on the GMII/MII, GMAC attempt retries based on the
+ * back off limit configured.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
* \note This function is tightly coupled with synopGMAC_back_off_limit(synopGMACdev *, u32).
*/
void synopGMAC_retry_enable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacRetry);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacRetry);
+ return;
}
/**
* GMAC tries only one transmission (Only in Half Duplex mode).
* If collision occurs on the GMII/MII, GMAC will ignore the current frami
- * transmission and report a frame abort with excessive collision in tranmit frame status.
+ * transmission and report a frame abort with excessive collision in tranmit frame status.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
#if UNUSED
void synopGMAC_retry_disable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacRetry);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacRetry);
+ return;
}
#endif
@@ -471,29 +471,29 @@ void synopGMAC_retry_disable(synopGMACdevice * gmacdev)
* GMAC strips the Pad/FCS field of incoming frames.
* This is true only if the length field value is less than or equal to
* 1500 bytes. All received frames with length field greater than or equal to
- * 1501 bytes are passed to the application without stripping the Pad/FCS field.
+ * 1501 bytes are passed to the application without stripping the Pad/FCS field.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
#if UNUSED
void synopGMAC_pad_crc_strip_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacPadCrcStrip);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacPadCrcStrip);
+ return;
}
#endif
/**
* GMAC doesnot strips the Pad/FCS field of incoming frames.
- * GMAC will pass all the incoming frames to Host unmodified.
+ * GMAC will pass all the incoming frames to Host unmodified.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
void synopGMAC_pad_crc_strip_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacPadCrcStrip);
- u32 status = synopGMACReadReg(gmacdev->MacBase, GmacConfig);
- DEBUG_MES("strips status : %u\n", status & GmacPadCrcStrip);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacPadCrcStrip);
+ u32 status = synopGMACReadReg(gmacdev->MacBase, GmacConfig);
+ DEBUG_MES("strips status : %u\n", status & GmacPadCrcStrip);
+ return;
}
/**
* GMAC programmed with the back off limit value.
@@ -503,30 +503,30 @@ void synopGMAC_pad_crc_strip_disable(synopGMACdevice * gmacdev)
*/
void synopGMAC_back_off_limit(synopGMACdevice * gmacdev, u32 value)
{
- u32 data;
- data = synopGMACReadReg(gmacdev->MacBase, GmacConfig);
- data &= (~GmacBackoffLimit);
- data |= value;
- synopGMACWriteReg(gmacdev->MacBase, GmacConfig,data);
- return;
+ u32 data;
+ data = synopGMACReadReg(gmacdev->MacBase, GmacConfig);
+ data &= (~GmacBackoffLimit);
+ data |= value;
+ synopGMACWriteReg(gmacdev->MacBase, GmacConfig,data);
+ return;
}
/**
* Enables the Deferral check in GMAC (Only in Half Duplex mode)
- * GMAC issues a Frame Abort Status, along with the excessive deferral error bit set in the
+ * GMAC issues a Frame Abort Status, along with the excessive deferral error bit set in the
* transmit frame status when transmit state machine is deferred for more than
- * - 24,288 bit times in 10/100Mbps mode
- * - 155,680 bit times in 1000Mbps mode or Jumbo frame mode in 10/100Mbps operation.
+ * - 24,288 bit times in 10/100Mbps mode
+ * - 155,680 bit times in 1000Mbps mode or Jumbo frame mode in 10/100Mbps operation.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
* \note Deferral begins when transmitter is ready to transmit, but is prevented because of
- * an active CRS (carrier sense)
+ * an active CRS (carrier sense)
*/
#if UNUSED
void synopGMAC_deferral_check_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacDeferralCheck);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacDeferralCheck);
+ return;
}
#endif
/**
@@ -537,8 +537,8 @@ void synopGMAC_deferral_check_enable(synopGMACdevice * gmacdev)
*/
void synopGMAC_deferral_check_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacDeferralCheck);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacDeferralCheck);
+ return;
}
/**
* Enable the reception of frames on GMII/MII.
@@ -547,8 +547,8 @@ void synopGMAC_deferral_check_disable(synopGMACdevice * gmacdev)
*/
void synopGMAC_rx_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacRx);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacRx);
+ return;
}
/**
* Disable the reception of frames on GMII/MII.
@@ -559,8 +559,8 @@ void synopGMAC_rx_enable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_rx_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacRx);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacRx);
+ return;
}
#endif
/**
@@ -570,8 +570,8 @@ void synopGMAC_rx_disable(synopGMACdevice * gmacdev)
*/
void synopGMAC_tx_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacTx);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacTx);
+ return;
}
/**
* Disable the transmission of frames on GMII/MII.
@@ -582,8 +582,8 @@ void synopGMAC_tx_enable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_tx_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacTx);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacConfig, GmacTx);
+ return;
}
#endif
@@ -599,20 +599,20 @@ void synopGMAC_tx_disable(synopGMACdevice * gmacdev)
*/
void synopGMAC_frame_filter_enable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacFilter);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacFilter);
+ return;
}
/**
* Disables reception of all the frames to application.
- * GMAC passes only those received frames to application which
+ * GMAC passes only those received frames to application which
* pass SA/DA address filtering.
* @param[in] pointer to synopGMACdevice.
- * \return void.
+ * \return void.
*/
void synopGMAC_frame_filter_disable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacFilter);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacFilter);
+ return;
}
/**
@@ -620,13 +620,13 @@ void synopGMAC_frame_filter_disable(synopGMACdevice * gmacdev)
* This function is called when the Hash filtering is to be enabled.
* @param[in] pointer to synopGMACdevice.
* @param[in] data to be written to hash table high register.
- * \return void.
+ * \return void.
*/
#if UNUSED
void synopGMAC_write_hash_table_high(synopGMACdevice * gmacdev, u32 data)
{
- synopGMACWriteReg(gmacdev->MacBase,GmacHashHigh,data);
- return;
+ synopGMACWriteReg(gmacdev->MacBase,GmacHashHigh,data);
+ return;
}
#endif
@@ -635,71 +635,71 @@ void synopGMAC_write_hash_table_high(synopGMACdevice * gmacdev, u32 data)
* This function is called when the Hash filtering is to be enabled.
* @param[in] pointer to synopGMACdevice.
* @param[in] data to be written to hash table low register.
- * \return void.
+ * \return void.
*/
#if UNUSED
void synopGMAC_write_hash_table_low(synopGMACdevice * gmacdev, u32 data)
{
- synopGMACWriteReg(gmacdev->MacBase,GmacHashLow,data);
- return;
+ synopGMACWriteReg(gmacdev->MacBase,GmacHashLow,data);
+ return;
}
#endif
/**
* Enables Hash or Perfect filter (only if Hash filter is enabled in H/W).
- * Only frames matching either perfect filtering or Hash Filtering as per HMC and HUC
+ * Only frames matching either perfect filtering or Hash Filtering as per HMC and HUC
* configuration are sent to application.
* @param[in] pointer to synopGMACdevice.
- * \return void.
+ * \return void.
*/
#if UNUSED
void synopGMAC_hash_perfect_filter_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacHashPerfectFilter);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacHashPerfectFilter);
+ return;
}
#endif
/**
* Enables only Hash(only if Hash filter is enabled in H/W).
- * Only frames matching Hash Filtering as per HMC and HUC
+ * Only frames matching Hash Filtering as per HMC and HUC
* configuration are sent to application.
* @param[in] pointer to synopGMACdevice.
- * \return void.
+ * \return void.
*/
#if UNUSED
void synopGMAC_Hash_filter_only_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacHashPerfectFilter);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacHashPerfectFilter);
+ return;
}
#endif
/**
* Enables Source address filtering.
- * When enabled source address filtering is performed. Only frames matching SA filtering are passed to application with
- * SAMatch bit of RxStatus is set. GMAC drops failed frames.
+ * When enabled source address filtering is performed. Only frames matching SA filtering are passed to application with
+ * SAMatch bit of RxStatus is set. GMAC drops failed frames.
* @param[in] pointer to synopGMACdevice.
* \return void.
- * \note This function is overriden by synopGMAC_frame_filter_disable(synopGMACdevice *)
+ * \note This function is overriden by synopGMAC_frame_filter_disable(synopGMACdevice *)
*/
#if UNUSED
void synopGMAC_src_addr_filter_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacSrcAddrFilter);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacSrcAddrFilter);
+ return;
}
#endif
/**
* Disables Source address filtering.
- * When disabled GMAC forwards the received frames with updated SAMatch bit in RxStatus.
+ * When disabled GMAC forwards the received frames with updated SAMatch bit in RxStatus.
* @param[in] pointer to synopGMACdevice.
* \return void.
*/
void synopGMAC_src_addr_filter_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacSrcAddrFilter);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacSrcAddrFilter);
+ return;
}
/**
* Enables Inverse Destination address filtering.
@@ -709,8 +709,8 @@ void synopGMAC_src_addr_filter_disable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_dst_addr_filter_inverse(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacDestAddrFilterNor);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacDestAddrFilterNor);
+ return;
}
#endif
/**
@@ -720,8 +720,8 @@ void synopGMAC_dst_addr_filter_inverse(synopGMACdevice * gmacdev)
*/
void synopGMAC_dst_addr_filter_normal(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacDestAddrFilterNor);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacDestAddrFilterNor);
+ return;
}
/**
@@ -732,13 +732,13 @@ void synopGMAC_dst_addr_filter_normal(synopGMACdevice * gmacdev)
* \note Depends on RFE of FlowControlRegister[2]
*/
void synopGMAC_set_pass_control(synopGMACdevice * gmacdev,u32 passcontrol)
-{
- u32 data;
- data = synopGMACReadReg(gmacdev->MacBase, GmacFrameFilter);
- data &= (~GmacPassControl);
- data |= passcontrol;
- synopGMACWriteReg(gmacdev->MacBase,GmacFrameFilter,data);
- return;
+{
+ u32 data;
+ data = synopGMACReadReg(gmacdev->MacBase, GmacFrameFilter);
+ data &= (~GmacPassControl);
+ data |= passcontrol;
+ synopGMACWriteReg(gmacdev->MacBase,GmacFrameFilter,data);
+ return;
}
/**
@@ -749,8 +749,8 @@ void synopGMAC_set_pass_control(synopGMACdevice * gmacdev,u32 passcontrol)
*/
void synopGMAC_broadcast_enable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacBroadcast );
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacBroadcast );
+ return;
}
/**
* Disable Broadcast frames.
@@ -761,8 +761,8 @@ void synopGMAC_broadcast_enable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_broadcast_disable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacBroadcast);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacBroadcast);
+ return;
}
#endif
@@ -775,8 +775,8 @@ void synopGMAC_broadcast_disable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_multicast_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacMulticastFilter);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacMulticastFilter);
+ return;
}
#endif
/**
@@ -787,8 +787,8 @@ void synopGMAC_multicast_enable(synopGMACdevice * gmacdev)
*/
void synopGMAC_multicast_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacMulticastFilter);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacMulticastFilter);
+ return;
}
/**
@@ -800,21 +800,21 @@ void synopGMAC_multicast_disable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_multicast_hash_filter_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacMcastHashFilter);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacMcastHashFilter);
+ return;
}
#endif
/**
* Disables multicast hash filtering.
- * When disabled GMAC performs perfect destination address filtering for multicast frames, it compares
+ * When disabled GMAC performs perfect destination address filtering for multicast frames, it compares
* DA field with the value programmed in DA register.
* @param[in] pointer to synopGMACdevice.
* \return void.
*/
void synopGMAC_multicast_hash_filter_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacMcastHashFilter);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacMcastHashFilter);
+ return;
}
/**
@@ -827,8 +827,8 @@ void synopGMAC_multicast_hash_filter_disable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_promisc_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacPromiscuousMode);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacPromiscuousMode);
+ return;
}
#endif
/**
@@ -839,8 +839,8 @@ void synopGMAC_promisc_enable(synopGMACdevice * gmacdev)
*/
void synopGMAC_promisc_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacPromiscuousMode);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacPromiscuousMode);
+ return;
}
@@ -853,23 +853,23 @@ void synopGMAC_promisc_disable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_unicast_hash_filter_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacUcastHashFilter);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacUcastHashFilter);
+ return;
}
#endif
/**
* Disables multicast hash filtering.
- * When disabled GMAC performs perfect destination address filtering for unicast frames, it compares
+ * When disabled GMAC performs perfect destination address filtering for unicast frames, it compares
* DA field with the value programmed in DA register.
* @param[in] pointer to synopGMACdevice.
* \return void.
*/
void synopGMAC_unicast_hash_filter_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacUcastHashFilter);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacFrameFilter, GmacUcastHashFilter);
+ return;
}
-
+
/*Flow control configuration functions*/
/**
@@ -882,8 +882,8 @@ void synopGMAC_unicast_hash_filter_disable(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_unicast_pause_frame_detect_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacUnicastPauseFrame);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacUnicastPauseFrame);
+ return;
}
#endif
/**
@@ -894,8 +894,8 @@ void synopGMAC_unicast_pause_frame_detect_enable(synopGMACdevice * gmacdev)
*/
void synopGMAC_unicast_pause_frame_detect_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacFlowControl, GmacUnicastPauseFrame);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacFlowControl, GmacUnicastPauseFrame);
+ return;
}
/**
* Rx flow control enable.
@@ -905,8 +905,8 @@ void synopGMAC_unicast_pause_frame_detect_disable(synopGMACdevice * gmacdev)
*/
void synopGMAC_rx_flow_control_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacRxFlowControl);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacRxFlowControl);
+ return;
}
/**
* Rx flow control disable.
@@ -916,60 +916,60 @@ void synopGMAC_rx_flow_control_enable(synopGMACdevice * gmacdev)
*/
void synopGMAC_rx_flow_control_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacFlowControl, GmacRxFlowControl);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacFlowControl, GmacRxFlowControl);
+ return;
}
/**
* Tx flow control enable.
- * When Enabled
- * - In full duplex GMAC enables flow control operation to transmit pause frames.
- * - In Half duplex GMAC enables the back pressure operation
+ * When Enabled
+ * - In full duplex GMAC enables flow control operation to transmit pause frames.
+ * - In Half duplex GMAC enables the back pressure operation
* @param[in] pointer to synopGMACdevice.
* \return void.
*/
void synopGMAC_tx_flow_control_enable(synopGMACdevice * gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacTxFlowControl);
- return;
+ synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacTxFlowControl);
+ return;
}
/**
* Tx flow control disable.
- * When Disabled
- * - In full duplex GMAC will not transmit any pause frames.
- * - In Half duplex GMAC disables the back pressure feature.
+ * When Disabled
+ * - In full duplex GMAC will not transmit any pause frames.
+ * - In Half duplex GMAC disables the back pressure feature.
* @param[in] pointer to synopGMACdevice.
* \return void.
*/
void synopGMAC_tx_flow_control_disable(synopGMACdevice * gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase, GmacFlowControl, GmacTxFlowControl);
- return;
+ synopGMACClearBits(gmacdev->MacBase, GmacFlowControl, GmacTxFlowControl);
+ return;
}
/**
* Initiate Flowcontrol operation.
* When Set
- * - In full duplex GMAC initiates pause control frame.
- * - In Half duplex GMAC initiates back pressure function.
+ * - In full duplex GMAC initiates pause control frame.
+ * - In Half duplex GMAC initiates back pressure function.
* @param[in] pointer to synopGMACdevice.
* \return void.
*/
#if UNUSED
void synopGMAC_tx_activate_flow_control(synopGMACdevice * gmacdev)
{
- //In case of full duplex check for this bit to b'0. if it is read as b'1 indicates that
+ //In case of full duplex check for this bit to b'0. if it is read as b'1 indicates that
//control frame transmission is in progress.
- if(gmacdev->Speed == FULLDUPLEX){
- if(!synopGMACCheckBits(gmacdev->MacBase, GmacFlowControl, GmacFlowControlBackPressure))
- synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacFlowControlBackPressure);
- }
- else{ //if half duplex mode
-
- synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacFlowControlBackPressure);
- }
+ if(gmacdev->Speed == FULLDUPLEX){
+ if(!synopGMACCheckBits(gmacdev->MacBase, GmacFlowControl, GmacFlowControlBackPressure))
+ synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacFlowControlBackPressure);
+ }
+ else{ //if half duplex mode
+
+ synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacFlowControlBackPressure);
+ }
- return;
+ return;
}
#endif
@@ -981,11 +981,11 @@ void synopGMAC_tx_activate_flow_control(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_tx_deactivate_flow_control(synopGMACdevice * gmacdev)
{
- //In full duplex this bit is automatically cleared after transmitting a pause control frame.
- if(gmacdev->Speed == HALFDUPLEX){
- synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacFlowControlBackPressure);
- }
- return;
+ //In full duplex this bit is automatically cleared after transmitting a pause control frame.
+ if(gmacdev->Speed == HALFDUPLEX){
+ synopGMACSetBits(gmacdev->MacBase, GmacFlowControl, GmacFlowControlBackPressure);
+ }
+ return;
}
#endif
@@ -998,17 +998,17 @@ void synopGMAC_tx_deactivate_flow_control(synopGMACdevice * gmacdev)
*/
void synopGMAC_pause_control(synopGMACdevice *gmacdev)
{
- u32 omr_reg;
- u32 mac_flow_control_reg;
- omr_reg = synopGMACReadReg(gmacdev->DmaBase,DmaControl);
- omr_reg |= DmaRxFlowCtrlAct4K | DmaRxFlowCtrlDeact5K |DmaEnHwFlowCtrl;
- synopGMACWriteReg(gmacdev->DmaBase, DmaControl, omr_reg);
+ u32 omr_reg;
+ u32 mac_flow_control_reg;
+ omr_reg = synopGMACReadReg(gmacdev->DmaBase,DmaControl);
+ omr_reg |= DmaRxFlowCtrlAct4K | DmaRxFlowCtrlDeact5K |DmaEnHwFlowCtrl;
+ synopGMACWriteReg(gmacdev->DmaBase, DmaControl, omr_reg);
- mac_flow_control_reg = synopGMACReadReg(gmacdev->MacBase,GmacFlowControl);
- mac_flow_control_reg |= GmacRxFlowControl | GmacTxFlowControl | 0xFFFF0000;
- synopGMACWriteReg(gmacdev->MacBase,GmacFlowControl,mac_flow_control_reg);
+ mac_flow_control_reg = synopGMACReadReg(gmacdev->MacBase,GmacFlowControl);
+ mac_flow_control_reg |= GmacRxFlowControl | GmacTxFlowControl | 0xFFFF0000;
+ synopGMACWriteReg(gmacdev->MacBase,GmacFlowControl,mac_flow_control_reg);
- return;
+ return;
}
@@ -1021,126 +1021,126 @@ void synopGMAC_pause_control(synopGMACdevice *gmacdev)
*/
s32 synopGMAC_mac_init(synopGMACdevice * gmacdev)
{
- u32 PHYreg;
-
- if(gmacdev->DuplexMode == FULLDUPLEX){
- TR("\n===phy FULLDUPLEX MODE\n"); //sw: debug
- synopGMAC_wd_enable(gmacdev);
- synopGMAC_jab_enable(gmacdev);
- synopGMAC_frame_burst_enable(gmacdev);
- synopGMAC_jumbo_frame_disable(gmacdev);
- synopGMAC_rx_own_enable(gmacdev);
+ u32 PHYreg;
+
+ if(gmacdev->DuplexMode == FULLDUPLEX){
+ TR("\n===phy FULLDUPLEX MODE\n"); //sw: debug
+ synopGMAC_wd_enable(gmacdev);
+ synopGMAC_jab_enable(gmacdev);
+ synopGMAC_frame_burst_enable(gmacdev);
+ synopGMAC_jumbo_frame_disable(gmacdev);
+ synopGMAC_rx_own_enable(gmacdev);
#if SYNOP_LOOPBACK_MODE
- synopGMAC_loopback_on(gmacdev);
+ synopGMAC_loopback_on(gmacdev);
#else
- synopGMAC_loopback_off(gmacdev);
+ synopGMAC_loopback_off(gmacdev);
#endif
- synopGMAC_set_full_duplex(gmacdev); //1
- synopGMAC_retry_enable(gmacdev);
- synopGMAC_pad_crc_strip_disable(gmacdev);
- synopGMAC_back_off_limit(gmacdev,GmacBackoffLimit0);
- synopGMAC_deferral_check_disable(gmacdev);
-
- synopGMAC_tx_enable(gmacdev); //according to Tang Dan's commitment
- synopGMAC_rx_enable(gmacdev);
+ synopGMAC_set_full_duplex(gmacdev); //1
+ synopGMAC_retry_enable(gmacdev);
+ synopGMAC_pad_crc_strip_disable(gmacdev);
+ synopGMAC_back_off_limit(gmacdev,GmacBackoffLimit0);
+ synopGMAC_deferral_check_disable(gmacdev);
+
+ synopGMAC_tx_enable(gmacdev); //according to Tang Dan's commitment
+ synopGMAC_rx_enable(gmacdev);
- synopGMACSetBits(gmacdev->DmaBase,DmaControl, DmaStoreAndForward );//3
- synopGMACSetBits(gmacdev->DmaBase,DmaControl, DmaFwdErrorFrames );
- if(gmacdev->Speed == SPEED1000)
- synopGMAC_select_gmii(gmacdev);
- else{
- synopGMAC_select_mii(gmacdev);
- if(gmacdev->Speed == SPEED100)
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacFESpeed100);
- else
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacFESpeed10);
- }
-
+ synopGMACSetBits(gmacdev->DmaBase,DmaControl, DmaStoreAndForward );//3
+ synopGMACSetBits(gmacdev->DmaBase,DmaControl, DmaFwdErrorFrames );
+ if(gmacdev->Speed == SPEED1000)
+ synopGMAC_select_gmii(gmacdev);
+ else{
+ synopGMAC_select_mii(gmacdev);
+ if(gmacdev->Speed == SPEED100)
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacFESpeed100);
+ else
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacFESpeed10);
+ }
+
+
+ /*Frame Filter Configuration*/
+ synopGMAC_frame_filter_enable(gmacdev); //2
+ //synopGMAC_frame_filter_disable(gmacdev); //2
+ synopGMAC_set_pass_control(gmacdev,GmacPassControl0);
+ synopGMAC_broadcast_enable(gmacdev);
+ synopGMAC_src_addr_filter_disable(gmacdev);
+ synopGMAC_multicast_disable(gmacdev);
+ //synopGMAC_dst_addr_filter_normal(gmacdev); //scl
+ synopGMAC_dst_addr_filter_inverse(gmacdev);
+ synopGMAC_multicast_hash_filter_disable(gmacdev);
+ synopGMAC_promisc_disable(gmacdev);
+ synopGMAC_unicast_hash_filter_disable(gmacdev);
- /*Frame Filter Configuration*/
- synopGMAC_frame_filter_enable(gmacdev); //2
- //synopGMAC_frame_filter_disable(gmacdev); //2
- synopGMAC_set_pass_control(gmacdev,GmacPassControl0);
- synopGMAC_broadcast_enable(gmacdev);
- synopGMAC_src_addr_filter_disable(gmacdev);
- synopGMAC_multicast_disable(gmacdev);
- //synopGMAC_dst_addr_filter_normal(gmacdev); //scl
- synopGMAC_dst_addr_filter_inverse(gmacdev);
- synopGMAC_multicast_hash_filter_disable(gmacdev);
- synopGMAC_promisc_disable(gmacdev);
- synopGMAC_unicast_hash_filter_disable(gmacdev);
-
- /*Flow Control Configuration*/
- synopGMAC_unicast_pause_frame_detect_disable(gmacdev);
- synopGMAC_rx_flow_control_enable(gmacdev);
- synopGMAC_tx_flow_control_enable(gmacdev);
- }
- else{//for Half Duplex configuration
-
- TR("\n===phy HALFDUPLEX MODE\n"); //sw: debug
- synopGMAC_wd_enable(gmacdev );
- synopGMAC_jab_enable(gmacdev);
- synopGMAC_frame_burst_enable(gmacdev);
- synopGMAC_jumbo_frame_disable(gmacdev);
- synopGMAC_rx_own_enable(gmacdev);
+ /*Flow Control Configuration*/
+ synopGMAC_unicast_pause_frame_detect_disable(gmacdev);
+ synopGMAC_rx_flow_control_enable(gmacdev);
+ synopGMAC_tx_flow_control_enable(gmacdev);
+ }
+ else{//for Half Duplex configuration
+
+ TR("\n===phy HALFDUPLEX MODE\n"); //sw: debug
+ synopGMAC_wd_enable(gmacdev );
+ synopGMAC_jab_enable(gmacdev);
+ synopGMAC_frame_burst_enable(gmacdev);
+ synopGMAC_jumbo_frame_disable(gmacdev);
+ synopGMAC_rx_own_enable(gmacdev);
#if SYNOP_LOOPBACK_MODE
- synopGMAC_loopback_on(gmacdev);
+ synopGMAC_loopback_on(gmacdev);
#else
- synopGMAC_loopback_off(gmacdev);
+ synopGMAC_loopback_off(gmacdev);
#endif
- synopGMAC_set_half_duplex(gmacdev);
- synopGMAC_retry_enable(gmacdev);
- synopGMAC_pad_crc_strip_disable(gmacdev);
- synopGMAC_back_off_limit(gmacdev,GmacBackoffLimit0);
- synopGMAC_deferral_check_disable(gmacdev);
+ synopGMAC_set_half_duplex(gmacdev);
+ synopGMAC_retry_enable(gmacdev);
+ synopGMAC_pad_crc_strip_disable(gmacdev);
+ synopGMAC_back_off_limit(gmacdev,GmacBackoffLimit0);
+ synopGMAC_deferral_check_disable(gmacdev);
//sw: set efe & tsf
- synopGMACSetBits(gmacdev->DmaBase,DmaControl, DmaStoreAndForward );
- synopGMACSetBits(gmacdev->DmaBase,DmaControl, DmaFwdErrorFrames );
+ synopGMACSetBits(gmacdev->DmaBase,DmaControl, DmaStoreAndForward );
+ synopGMACSetBits(gmacdev->DmaBase,DmaControl, DmaFwdErrorFrames );
//sw: put it in the end
- synopGMAC_tx_enable(gmacdev);
- synopGMAC_rx_enable(gmacdev);
+ synopGMAC_tx_enable(gmacdev);
+ synopGMAC_rx_enable(gmacdev);
+
+
+ if(gmacdev->Speed == SPEED1000)
+ synopGMAC_select_gmii(gmacdev);
+ else{
+ synopGMAC_select_mii(gmacdev );
+ if(gmacdev->Speed == SPEED100)
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacFESpeed100 );
+ else
+ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacFESpeed10 );
+ }
+// synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacDisableCrs);
+// synopGMAC_select_gmii(gmacdev);
- if(gmacdev->Speed == SPEED1000)
- synopGMAC_select_gmii(gmacdev);
- else{
- synopGMAC_select_mii(gmacdev );
- if(gmacdev->Speed == SPEED100)
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacFESpeed100 );
- else
- synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacFESpeed10 );
- }
-
-// synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacDisableCrs);
-// synopGMAC_select_gmii(gmacdev);
+ /*Frame Filter Configuration*/
+ synopGMAC_frame_filter_enable(gmacdev);
+// synopGMAC_frame_filter_disable(gmacdev);
- /*Frame Filter Configuration*/
- synopGMAC_frame_filter_enable(gmacdev);
-// synopGMAC_frame_filter_disable(gmacdev);
+ synopGMAC_set_pass_control(gmacdev,GmacPassControl0);
+ synopGMAC_broadcast_enable(gmacdev);
+ synopGMAC_src_addr_filter_disable(gmacdev);
+ synopGMAC_multicast_disable(gmacdev);
+ synopGMAC_dst_addr_filter_normal(gmacdev);
+ synopGMAC_multicast_hash_filter_disable(gmacdev);
- synopGMAC_set_pass_control(gmacdev,GmacPassControl0);
- synopGMAC_broadcast_enable(gmacdev);
- synopGMAC_src_addr_filter_disable(gmacdev);
- synopGMAC_multicast_disable(gmacdev);
- synopGMAC_dst_addr_filter_normal(gmacdev);
- synopGMAC_multicast_hash_filter_disable(gmacdev);
+ synopGMAC_promisc_disable(gmacdev);
+// synopGMAC_promisc_enable(gmacdev);
+ synopGMAC_unicast_hash_filter_disable(gmacdev);
- synopGMAC_promisc_disable(gmacdev);
-// synopGMAC_promisc_enable(gmacdev);
- synopGMAC_unicast_hash_filter_disable(gmacdev);
-
//sw: loopback mode
-// synopGMAC_loopback_on(gmacdev);
-
- /*Flow Control Configuration*/
- synopGMAC_unicast_pause_frame_detect_disable(gmacdev);
- synopGMAC_rx_flow_control_disable(gmacdev);
- synopGMAC_tx_flow_control_disable(gmacdev);
+// synopGMAC_loopback_on(gmacdev);
- /*To set PHY register to enable CRS on Transmit*/
- }
- return 0;
+ /*Flow Control Configuration*/
+ synopGMAC_unicast_pause_frame_detect_disable(gmacdev);
+ synopGMAC_rx_flow_control_disable(gmacdev);
+ synopGMAC_tx_flow_control_disable(gmacdev);
+
+ /*To set PHY register to enable CRS on Transmit*/
+ }
+ return 0;
}
@@ -1155,14 +1155,14 @@ s32 synopGMAC_mac_init(synopGMACdevice * gmacdev)
*/
s32 synopGMAC_set_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8 *MacAddr)
{
- u32 data;
+ u32 data;
- data = (MacAddr[5] << 8) | MacAddr[4];
- synopGMACWriteReg(gmacdev->MacBase,MacHigh,data);
- data = (MacAddr[3] << 24) | (MacAddr[2] << 16) | (MacAddr[1] << 8) | MacAddr[0] ;
- synopGMACWriteReg(gmacdev->MacBase,MacLow,data);
+ data = (MacAddr[5] << 8) | MacAddr[4];
+ synopGMACWriteReg(gmacdev->MacBase,MacHigh,data);
+ data = (MacAddr[3] << 24) | (MacAddr[2] << 16) | (MacAddr[1] << 8) | MacAddr[0] ;
+ synopGMACWriteReg(gmacdev->MacBase,MacLow,data);
- return 0;
+ return 0;
}
@@ -1177,21 +1177,21 @@ s32 synopGMAC_set_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8
*/
s32 synopGMAC_get_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8 *MacAddr)
{
- u32 data;
-
- data = synopGMACReadReg(gmacdev->MacBase,MacHigh);
- MacAddr[5] = (data >> 8) & 0xff;
- MacAddr[4] = (data) & 0xff;
+ u32 data;
- data = synopGMACReadReg(gmacdev->MacBase,MacLow);
- MacAddr[3] = (data >> 24) & 0xff;
- MacAddr[2] = (data >> 16) & 0xff;
- MacAddr[1] = (data >> 8 ) & 0xff;
- MacAddr[0] = (data ) & 0xff;
+ data = synopGMACReadReg(gmacdev->MacBase,MacHigh);
+ MacAddr[5] = (data >> 8) & 0xff;
+ MacAddr[4] = (data) & 0xff;
-// rt_kprintf("MacAddr = 0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\n",MacAddr[0],MacAddr[1],MacAddr[2],MacAddr[3],MacAddr[4],MacAddr[5]);
+ data = synopGMACReadReg(gmacdev->MacBase,MacLow);
+ MacAddr[3] = (data >> 24) & 0xff;
+ MacAddr[2] = (data >> 16) & 0xff;
+ MacAddr[1] = (data >> 8 ) & 0xff;
+ MacAddr[0] = (data ) & 0xff;
- return 0;
+// rt_kprintf("MacAddr = 0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\n",MacAddr[0],MacAddr[1],MacAddr[2],MacAddr[3],MacAddr[4],MacAddr[5]);
+
+ return 0;
}
@@ -1203,42 +1203,42 @@ s32 synopGMAC_get_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8
* @param[in] GMAC IP dma base address.
* @param[in] GMAC IP phy base address.
* \return 0 upon success. Error code upon failure.
- * \note This is important function. No kernel api provided by Synopsys
+ * \note This is important function. No kernel api provided by Synopsys
*/
s32 synopGMAC_attach (synopGMACdevice * gmacdev, u32 macBase, u32 dmaBase, u32 phyBase,u8 *mac_addr)
{
- /*Make sure the Device data strucure is cleared before we proceed further*/
- rt_memset((void *) gmacdev,0,sizeof(synopGMACdevice));
- /*Populate the mac and dma base addresses*/
- gmacdev->MacBase = macBase;
- gmacdev->DmaBase = dmaBase;
- gmacdev->PhyBase = phyBase;
-// rt_kprintf("gmacdev->DmaBase = 0x%x\n", gmacdev->DmaBase);
-// rt_kprintf("dmaBase = 0x%x\n", dmaBase);
- {
- int i,j;
- u16 data;
- for (i = phyBase,j=0;j<32;i=(i+1)&0x1f,j++)
- {
- synopGMAC_read_phy_reg(gmacdev->MacBase,i,2,&data);
- if(data != 0 && data != 0xffff) break;
- synopGMAC_read_phy_reg(gmacdev->MacBase,i,3,&data);
- if(data != 0 && data != 0xffff) break;
- }
+ /*Make sure the Device data strucure is cleared before we proceed further*/
+ rt_memset((void *) gmacdev,0,sizeof(synopGMACdevice));
+ /*Populate the mac and dma base addresses*/
+ gmacdev->MacBase = macBase;
+ gmacdev->DmaBase = dmaBase;
+ gmacdev->PhyBase = phyBase;
+// rt_kprintf("gmacdev->DmaBase = 0x%x\n", gmacdev->DmaBase);
+// rt_kprintf("dmaBase = 0x%x\n", dmaBase);
+ {
+ int i,j;
+ u16 data;
+ for (i = phyBase,j=0;j<32;i=(i+1)&0x1f,j++)
+ {
+ synopGMAC_read_phy_reg(gmacdev->MacBase,i,2,&data);
+ if(data != 0 && data != 0xffff) break;
+ synopGMAC_read_phy_reg(gmacdev->MacBase,i,3,&data);
+ if(data != 0 && data != 0xffff) break;
+ }
- if(j==32) {
- rt_kprintf("phy_detect: can't find PHY!\n");
- }
- gmacdev->PhyBase = i;
- }
+ if(j==32) {
+ rt_kprintf("phy_detect: can't find PHY!\n");
+ }
+ gmacdev->PhyBase = i;
+ }
-// synopGMAC_get_mac_addr(gmacdev, GmacAddr0High, GmacAddr0Low, mac_addr);
+// synopGMAC_get_mac_addr(gmacdev, GmacAddr0High, GmacAddr0Low, mac_addr);
- /* Program/flash in the station/IP's Mac address */
- synopGMAC_set_mac_addr(gmacdev,GmacAddr0High,GmacAddr0Low, mac_addr);
+ /* Program/flash in the station/IP's Mac address */
+ synopGMAC_set_mac_addr(gmacdev,GmacAddr0High,GmacAddr0Low, mac_addr);
- return 0;
+ return 0;
}
@@ -1246,10 +1246,10 @@ s32 synopGMAC_attach (synopGMACdevice * gmacdev, u32 macBase, u32 dmaBase, u32 p
/**
* Initialize the rx descriptors for ring or chain mode operation.
- * - Status field is initialized to 0.
- * - EndOfRing set for the last descriptor.
- * - buffer1 and buffer2 set to 0 for ring mode of operation. (note)
- * - data1 and data2 set to 0. (note)
+ * - Status field is initialized to 0.
+ * - EndOfRing set for the last descriptor.
+ * - buffer1 and buffer2 set to 0 for ring mode of operation. (note)
+ * - data1 and data2 set to 0. (note)
* @param[in] pointer to DmaDesc structure.
* @param[in] whether end of ring
* \return void.
@@ -1258,36 +1258,36 @@ s32 synopGMAC_attach (synopGMACdevice * gmacdev, u32 macBase, u32 dmaBase, u32 p
*/
void synopGMAC_rx_desc_init_ring(DmaDesc *desc, bool last_ring_desc)
{
- desc->status = 0;
- desc->length = last_ring_desc ? RxDescEndOfRing : 0;
- desc->buffer1 = 0;
- desc->buffer2 = 0;
- desc->data1 = 0;
- desc->data2 = 0;
- desc->dummy1 = 0;
- desc->dummy2 = 0;
+ desc->status = 0;
+ desc->length = last_ring_desc ? RxDescEndOfRing : 0;
+ desc->buffer1 = 0;
+ desc->buffer2 = 0;
+ desc->data1 = 0;
+ desc->data2 = 0;
+ desc->dummy1 = 0;
+ desc->dummy2 = 0;
- return;
+ return;
}
void synopGMAC_rx_desc_recycle(DmaDesc *desc, bool last_ring_desc)
{
- desc->status = DescOwnByDma;
- desc->length = last_ring_desc ? RxDescEndOfRing : 0;
- //desc->buffer1 = 0;
- //desc->buffer2 = 0;
- //desc->data1 = 0;
- //desc->data2 = 0;
- desc->dummy1 = 0;
- desc->dummy2 = 0;
+ desc->status = DescOwnByDma;
+ desc->length = last_ring_desc ? RxDescEndOfRing : 0;
+ //desc->buffer1 = 0;
+ //desc->buffer2 = 0;
+ //desc->data1 = 0;
+ //desc->data2 = 0;
+ desc->dummy1 = 0;
+ desc->dummy2 = 0;
- return;
+ return;
}
/**
* Initialize the tx descriptors for ring or chain mode operation.
- * - Status field is initialized to 0.
- * - EndOfRing set for the last descriptor.
- * - buffer1 and buffer2 set to 0 for ring mode of operation. (note)
- * - data1 and data2 set to 0. (note)
+ * - Status field is initialized to 0.
+ * - EndOfRing set for the last descriptor.
+ * - buffer1 and buffer2 set to 0 for ring mode of operation. (note)
+ * - data1 and data2 set to 0. (note)
* @param[in] pointer to DmaDesc structure.
* @param[in] whether end of ring
* \return void.
@@ -1296,32 +1296,32 @@ void synopGMAC_rx_desc_recycle(DmaDesc *desc, bool last_ring_desc)
*/
void synopGMAC_tx_desc_init_ring(DmaDesc *desc, bool last_ring_desc)
{
- #ifdef ENH_DESC
- desc->status = last_ring_desc? TxDescEndOfRing : 0;
- desc->length = 0;
- #else
- desc->length = last_ring_desc? TxDescEndOfRing : 0;
- #endif
-//sw
- desc->status = 0;
+ #ifdef ENH_DESC
+ desc->status = last_ring_desc? TxDescEndOfRing : 0;
+ desc->length = 0;
+ #else
+ desc->length = last_ring_desc? TxDescEndOfRing : 0;
+ #endif
+//sw
+ desc->status = 0;
- desc->buffer1 = 0;
- desc->buffer2 = 0;
- desc->data1 = 0;
- desc->data2 = 0;
- desc->dummy1 = 0;
- desc->dummy2 = 0;
- return;
+ desc->buffer1 = 0;
+ desc->buffer2 = 0;
+ desc->data1 = 0;
+ desc->data2 = 0;
+ desc->dummy1 = 0;
+ desc->dummy2 = 0;
+ return;
}
/**
* Initialize the rx descriptors for chain mode of operation.
- * - Status field is initialized to 0.
- * - EndOfRing set for the last descriptor.
- * - buffer1 and buffer2 set to 0.
- * - data1 and data2 set to 0.
+ * - Status field is initialized to 0.
+ * - EndOfRing set for the last descriptor.
+ * - buffer1 and buffer2 set to 0.
+ * - data1 and data2 set to 0.
* @param[in] pointer to DmaDesc structure.
* @param[in] whether end of ring
* \return void.
@@ -1329,86 +1329,86 @@ void synopGMAC_tx_desc_init_ring(DmaDesc *desc, bool last_ring_desc)
void synopGMAC_rx_desc_init_chain(DmaDesc * desc)
{
- desc->status = 0;
- desc->length = RxDescChain;
- desc->buffer1 = 0;
- desc->data1 = 0;
- return;
+ desc->status = 0;
+ desc->length = RxDescChain;
+ desc->buffer1 = 0;
+ desc->data1 = 0;
+ return;
}
/**
* Initialize the rx descriptors for chain mode of operation.
- * - Status field is initialized to 0.
- * - EndOfRing set for the last descriptor.
- * - buffer1 and buffer2 set to 0.
- * - data1 and data2 set to 0.
+ * - Status field is initialized to 0.
+ * - EndOfRing set for the last descriptor.
+ * - buffer1 and buffer2 set to 0.
+ * - data1 and data2 set to 0.
* @param[in] pointer to DmaDesc structure.
* @param[in] whether end of ring
* \return void.
*/
void synopGMAC_tx_desc_init_chain(DmaDesc * desc)
{
- #ifdef ENH_DESC
- desc->status = TxDescChain;
- desc->length = 0;
- #else
- desc->length = TxDescChain;
- #endif
- desc->buffer1 = 0;
- desc->data1 = 0;
- return;
+ #ifdef ENH_DESC
+ desc->status = TxDescChain;
+ desc->length = 0;
+ #else
+ desc->length = TxDescChain;
+ #endif
+ desc->buffer1 = 0;
+ desc->data1 = 0;
+ return;
}
s32 synopGMAC_init_tx_rx_desc_queue(synopGMACdevice *gmacdev)
{
- s32 i;
- for(i =0; i < gmacdev -> TxDescCount; i++){
- synopGMAC_tx_desc_init_ring(gmacdev->TxDesc + i, i == gmacdev->TxDescCount-1);
- }
- TR("At line %d\n",__LINE__);
- for(i =0; i < gmacdev -> RxDescCount; i++){
- synopGMAC_rx_desc_init_ring(gmacdev->RxDesc + i, i == gmacdev->RxDescCount-1);
- }
-
- gmacdev->TxNext = 0;
- gmacdev->TxBusy = 0;
- gmacdev->RxNext = 0;
- gmacdev->RxBusy = 0;
-
- return -ESYNOPGMACNOERR;
+ s32 i;
+ for(i =0; i < gmacdev -> TxDescCount; i++){
+ synopGMAC_tx_desc_init_ring(gmacdev->TxDesc + i, i == gmacdev->TxDescCount-1);
+ }
+ TR("At line %d\n",__LINE__);
+ for(i =0; i < gmacdev -> RxDescCount; i++){
+ synopGMAC_rx_desc_init_ring(gmacdev->RxDesc + i, i == gmacdev->RxDescCount-1);
+ }
+
+ gmacdev->TxNext = 0;
+ gmacdev->TxBusy = 0;
+ gmacdev->RxNext = 0;
+ gmacdev->RxBusy = 0;
+
+ return -ESYNOPGMACNOERR;
}
/**
* Programs the DmaRxBaseAddress with the Rx descriptor base address.
- * Rx Descriptor's base address is available in the gmacdev structure. This function progrms the
+ * Rx Descriptor's base address is available in the gmacdev structure. This function progrms the
* Dma Rx Base address with the starting address of the descriptor ring or chain.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
void synopGMAC_init_rx_desc_base(synopGMACdevice *gmacdev)
{
- DEBUG_MES("gmacdev->RxDescDma = %08x\n", gmacdev->RxDescDma);
- synopGMACWriteReg(gmacdev->DmaBase,DmaRxBaseAddr,(u32)gmacdev->RxDescDma );
- return;
+ DEBUG_MES("gmacdev->RxDescDma = %08x\n", gmacdev->RxDescDma);
+ synopGMACWriteReg(gmacdev->DmaBase,DmaRxBaseAddr,(u32)gmacdev->RxDescDma );
+ return;
}
/**
* Programs the DmaTxBaseAddress with the Tx descriptor base address.
- * Tx Descriptor's base address is available in the gmacdev structure. This function progrms the
+ * Tx Descriptor's base address is available in the gmacdev structure. This function progrms the
* Dma Tx Base address with the starting address of the descriptor ring or chain.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
void synopGMAC_init_tx_desc_base(synopGMACdevice *gmacdev)
{
- synopGMACWriteReg(gmacdev->DmaBase,DmaTxBaseAddr,(u32)gmacdev->TxDescDma);
- return;
+ synopGMACWriteReg(gmacdev->DmaBase,DmaTxBaseAddr,(u32)gmacdev->TxDescDma);
+ return;
}
-/**
+/**
* Makes the Dma as owner for this descriptor.
* This function sets the own bit of status field of the DMA descriptor,
- * indicating the DMA is the owner for this descriptor.
+ * indicating the DMA is the owner for this descriptor.
* @param[in] pointer to DmaDesc structure.
* \return returns void.
*/
@@ -1417,7 +1417,7 @@ void synopGMAC_set_owner_dma(DmaDesc *desc)
desc->status |= DescOwnByDma;
}
-/**
+/**
* set tx descriptor to indicate SOF.
* This Descriptor contains the start of ethernet frame.
* @param[in] pointer to DmaDesc structure.
@@ -1433,7 +1433,7 @@ desc->length |= DescTxFirst;
}
-/**
+/**
* set tx descriptor to indicate EOF.
* This descriptor contains the End of ethernet frame.
* @param[in] pointer to DmaDesc structure.
@@ -1449,51 +1449,51 @@ desc->length |= DescTxLast;
}
-/**
+/**
* checks whether this descriptor contains start of frame.
- * This function is to check whether the descriptor's data buffer
+ * This function is to check whether the descriptor's data buffer
* contains a fresh ethernet frame?
* @param[in] pointer to DmaDesc structure.
* \return returns true if SOF in current descriptor, else returns fail.
*/
bool synopGMAC_is_sof_in_rx_desc(DmaDesc *desc)
{
-return ((desc->status & DescRxFirst) == DescRxFirst);
+return ((desc->status & DescRxFirst) == DescRxFirst);
}
-/**
+/**
* checks whether this descriptor contains end of frame.
- * This function is to check whether the descriptor's data buffer
+ * This function is to check whether the descriptor's data buffer
* contains end of ethernet frame?
* @param[in] pointer to DmaDesc structure.
* \return returns true if SOF in current descriptor, else returns fail.
*/
bool synopGMAC_is_eof_in_rx_desc(DmaDesc *desc)
{
-return ((desc->status & DescRxLast) == DescRxLast);
+return ((desc->status & DescRxLast) == DescRxLast);
}
-/**
+/**
* checks whether destination address filter failed in the rx frame.
* @param[in] pointer to DmaDesc structure.
* \return returns true if Failed, false if not.
*/
bool synopGMAC_is_da_filter_failed(DmaDesc *desc)
{
-return ((desc->status & DescDAFilterFail) == DescDAFilterFail);
+return ((desc->status & DescDAFilterFail) == DescDAFilterFail);
}
-/**
+/**
* checks whether source address filter failed in the rx frame.
* @param[in] pointer to DmaDesc structure.
* \return returns true if Failed, false if not.
*/
bool synopGMAC_is_sa_filter_failed(DmaDesc *desc)
{
-return ((desc->status & DescSAFilterFail) == DescSAFilterFail);
+return ((desc->status & DescSAFilterFail) == DescSAFilterFail);
}
-/**
+/**
* Checks whether the descriptor is owned by DMA.
* If descriptor is owned by DMA then the OWN bit is set to 1. This API is same for both ring and chain mode.
* @param[in] pointer to DmaDesc structure.
@@ -1512,7 +1512,7 @@ return ((desc->status & DescOwnByDma) == DescOwnByDma );
*/
u32 synopGMAC_get_rx_desc_frame_length(u32 status)
{
- return ((status & DescFrameLengthMask) >> DescFrameLengthShift);
+ return ((status & DescFrameLengthMask) >> DescFrameLengthShift);
}
/**
@@ -1524,7 +1524,7 @@ u32 synopGMAC_get_rx_desc_frame_length(u32 status)
*/
bool synopGMAC_is_desc_valid(u32 status)
{
- return ((status & DescError) == 0);
+ return ((status & DescError) == 0);
}
/**
@@ -1536,8 +1536,8 @@ bool synopGMAC_is_desc_valid(u32 status)
*/
bool synopGMAC_is_desc_empty(DmaDesc *desc)
{
- //if both the buffer1 length and buffer2 length are zero desc is empty
- return(((desc->length & DescSize1Mask) == 0) && ((desc->length & DescSize2Mask) == 0) );
+ //if both the buffer1 length and buffer2 length are zero desc is empty
+ return(((desc->length & DescSize1Mask) == 0) && ((desc->length & DescSize2Mask) == 0) );
}
@@ -1549,7 +1549,7 @@ bool synopGMAC_is_desc_empty(DmaDesc *desc)
*/
bool synopGMAC_is_rx_desc_valid(u32 status)
{
- return ((status & DescError) == 0) && ((status & DescRxFirst) == DescRxFirst) && ((status & DescRxLast) == DescRxLast);
+ return ((status & DescError) == 0) && ((status & DescRxFirst) == DescRxFirst) && ((status & DescRxLast) == DescRxLast);
}
/**
@@ -1559,7 +1559,7 @@ bool synopGMAC_is_rx_desc_valid(u32 status)
*/
bool synopGMAC_is_tx_aborted(u32 status)
{
- return (((status & DescTxLateCollision) == DescTxLateCollision) | ((status & DescTxExcCollisions) == DescTxExcCollisions));
+ return (((status & DescTxLateCollision) == DescTxLateCollision) | ((status & DescTxExcCollisions) == DescTxExcCollisions));
}
@@ -1570,7 +1570,7 @@ bool synopGMAC_is_tx_aborted(u32 status)
*/
bool synopGMAC_is_tx_carrier_error(u32 status)
{
- return (((status & DescTxLostCarrier) == DescTxLostCarrier) | ((status & DescTxNoCarrier) == DescTxNoCarrier));
+ return (((status & DescTxLostCarrier) == DescTxLostCarrier) | ((status & DescTxNoCarrier) == DescTxNoCarrier));
}
@@ -1583,11 +1583,11 @@ bool synopGMAC_is_tx_carrier_error(u32 status)
*/
u32 synopGMAC_get_tx_collision_count(u32 status)
{
- return ((status & DescTxCollMask) >> DescTxCollShift);
+ return ((status & DescTxCollMask) >> DescTxCollShift);
}
u32 synopGMAC_is_exc_tx_collisions(u32 status)
{
- return ((status & DescTxExcCollisions) == DescTxExcCollisions);
+ return ((status & DescTxExcCollisions) == DescTxExcCollisions);
}
@@ -1600,7 +1600,7 @@ u32 synopGMAC_is_exc_tx_collisions(u32 status)
bool synopGMAC_is_rx_frame_damaged(u32 status)
{
//bool synopGMAC_dma_rx_collisions(u32 status)
- return (((status & DescRxDamaged) == DescRxDamaged) | ((status & DescRxCollision) == DescRxCollision));
+ return (((status & DescRxDamaged) == DescRxDamaged) | ((status & DescRxCollision) == DescRxCollision));
}
/**
@@ -1612,7 +1612,7 @@ bool synopGMAC_is_rx_frame_damaged(u32 status)
bool synopGMAC_is_rx_frame_collision(u32 status)
{
//bool synopGMAC_dma_rx_collisions(u32 status)
- return ((status & DescRxCollision) == DescRxCollision);
+ return ((status & DescRxCollision) == DescRxCollision);
}
/**
@@ -1624,7 +1624,7 @@ bool synopGMAC_is_rx_frame_collision(u32 status)
bool synopGMAC_is_rx_crc(u32 status)
{
//u32 synopGMAC_dma_rx_crc(u32 status)
- return ((status & DescRxCrc) == DescRxCrc);
+ return ((status & DescRxCrc) == DescRxCrc);
}
/**
@@ -1636,7 +1636,7 @@ bool synopGMAC_is_rx_crc(u32 status)
bool synopGMAC_is_frame_dribbling_errors(u32 status)
{
//u32 synopGMAC_dma_rx_frame_errors(u32 status)
- return ((status & DescRxDribbling) == DescRxDribbling);
+ return ((status & DescRxDribbling) == DescRxDribbling);
}
/**
@@ -1648,7 +1648,7 @@ bool synopGMAC_is_frame_dribbling_errors(u32 status)
bool synopGMAC_is_rx_frame_length_errors(u32 status)
{
//u32 synopGMAC_dma_rx_length_errors(u32 status)
- return((status & DescRxLengthError) == DescRxLengthError);
+ return((status & DescRxLengthError) == DescRxLengthError);
}
/**
@@ -1677,9 +1677,9 @@ bool synopGMAC_is_last_tx_desc(synopGMACdevice * gmacdev,DmaDesc *desc)
{
//bool synopGMAC_is_last_desc(DmaDesc *desc)
#ifdef ENH_DESC
- return (((desc->status & TxDescEndOfRing) == TxDescEndOfRing) || ((u32)gmacdev->TxDesc == desc->data2));
+ return (((desc->status & TxDescEndOfRing) == TxDescEndOfRing) || ((u32)gmacdev->TxDesc == desc->data2));
#else
- return (((desc->length & TxDescEndOfRing) == TxDescEndOfRing) || ((u32)gmacdev->TxDesc == desc->data2));
+ return (((desc->length & TxDescEndOfRing) == TxDescEndOfRing) || ((u32)gmacdev->TxDesc == desc->data2));
#endif
}
@@ -1691,7 +1691,7 @@ bool synopGMAC_is_last_tx_desc(synopGMACdevice * gmacdev,DmaDesc *desc)
*/
bool synopGMAC_is_rx_desc_chained(DmaDesc * desc)
{
- return((desc->length & RxDescChain) == RxDescChain);
+ return((desc->length & RxDescChain) == RxDescChain);
}
/**
@@ -1703,9 +1703,9 @@ bool synopGMAC_is_rx_desc_chained(DmaDesc * desc)
bool synopGMAC_is_tx_desc_chained(DmaDesc * desc)
{
#ifdef ENH_DESC
- return((desc->status & TxDescChain) == TxDescChain);
+ return((desc->status & TxDescChain) == TxDescChain);
#else
- return((desc->length & TxDescChain) == TxDescChain);
+ return((desc->length & TxDescChain) == TxDescChain);
#endif
}
@@ -1726,24 +1726,24 @@ bool synopGMAC_is_tx_desc_chained(DmaDesc * desc)
void synopGMAC_get_desc_data(DmaDesc * desc, u32 * Status, u32 * Buffer1, u32 * Length1, u32 * Data1, u32 * Buffer2, u32 * Length2, u32 * Data2)
{
- if(Status != 0)
- *Status = desc->status;
+ if(Status != 0)
+ *Status = desc->status;
- if(Buffer1 != 0)
- *Buffer1 = desc->buffer1;
- if(Length1 != 0)
- *Length1 = (desc->length & DescSize1Mask) >> DescSize1Shift;
- if(Data1 != 0)
- *Data1 = desc->data1;
+ if(Buffer1 != 0)
+ *Buffer1 = desc->buffer1;
+ if(Length1 != 0)
+ *Length1 = (desc->length & DescSize1Mask) >> DescSize1Shift;
+ if(Data1 != 0)
+ *Data1 = desc->data1;
- if(Buffer2 != 0)
- *Buffer2 = desc->buffer2;
- if(Length2 != 0)
- *Length2 = (desc->length & DescSize2Mask) >> DescSize2Shift;
- if(Data1 != 0)
- *Data2 = desc->data2;
-
- return;
+ if(Buffer2 != 0)
+ *Buffer2 = desc->buffer2;
+ if(Length2 != 0)
+ *Length2 = (desc->length & DescSize2Mask) >> DescSize2Shift;
+ if(Data1 != 0)
+ *Data2 = desc->data2;
+
+ return;
}
@@ -1752,7 +1752,7 @@ void synopGMAC_get_desc_data(DmaDesc * desc, u32 * Status, u32 * Buffer1, u32 *
* This function is defined two times. Once when the code is compiled for ENHANCED DESCRIPTOR SUPPORT and Once for Normal descriptor
* Get the index and address of Tx desc.
* This api is same for both ring mode and chain mode.
- * This function tracks the tx descriptor the DMA just closed after the transmission of data from this descriptor is
+ * This function tracks the tx descriptor the DMA just closed after the transmission of data from this descriptor is
* over. This returns the descriptor fields to the caller.
* @param[in] pointer to synopGMACdevice.
* @param[out] status field of the descriptor.
@@ -1768,60 +1768,60 @@ void synopGMAC_get_desc_data(DmaDesc * desc, u32 * Status, u32 * Buffer1, u32 *
s32 synopGMAC_get_tx_qptr(synopGMACdevice * gmacdev, u32 * Status, u32 * Buffer1, u32 * Length1, u32 * Data1, u32 * Buffer2, u32 * Length2, u32 * Data2,
u32 * Ext_Status, u32 * Time_Stamp_High, u32 * Time_Stamp_Low)
{
- u32 txover = gmacdev->TxBusy;
- DmaDesc * txdesc = gmacdev->TxBusyDesc;
-
- if(synopGMAC_is_desc_owned_by_dma(txdesc))
- return -1;
- if(synopGMAC_is_desc_empty(txdesc))
- return -1;
+ u32 txover = gmacdev->TxBusy;
+ DmaDesc * txdesc = gmacdev->TxBusyDesc;
+
+ if(synopGMAC_is_desc_owned_by_dma(txdesc))
+ return -1;
+ if(synopGMAC_is_desc_empty(txdesc))
+ return -1;
- (gmacdev->BusyTxDesc)--; //busy tx descriptor is reduced by one as it will be handed over to Processor now
+ (gmacdev->BusyTxDesc)--; //busy tx descriptor is reduced by one as it will be handed over to Processor now
- if(Status != 0)
- *Status = txdesc->status;
+ if(Status != 0)
+ *Status = txdesc->status;
- if(Ext_Status != 0)
- *Ext_Status = txdesc->extstatus;
+ if(Ext_Status != 0)
+ *Ext_Status = txdesc->extstatus;
if(Time_Stamp_High != 0)
- *Time_Stamp_High = txdesc->timestamphigh;
+ *Time_Stamp_High = txdesc->timestamphigh;
if(Time_Stamp_Low != 0)
- *Time_Stamp_High = txdesc->timestamplow;
+ *Time_Stamp_High = txdesc->timestamplow;
- if(Buffer1 != 0)
- *Buffer1 = txdesc->buffer1;
- if(Length1 != 0)
- *Length1 = (txdesc->length & DescSize1Mask) >> DescSize1Shift;
- if(Data1 != 0)
- *Data1 = txdesc->data1;
+ if(Buffer1 != 0)
+ *Buffer1 = txdesc->buffer1;
+ if(Length1 != 0)
+ *Length1 = (txdesc->length & DescSize1Mask) >> DescSize1Shift;
+ if(Data1 != 0)
+ *Data1 = txdesc->data1;
- if(Buffer2 != 0)
- *Buffer2 = txdesc->buffer2;
- if(Length2 != 0)
- *Length2 = (txdesc->length & DescSize2Mask) >> DescSize2Shift;
- if(Data1 != 0)
- *Data2 = txdesc->data2;
+ if(Buffer2 != 0)
+ *Buffer2 = txdesc->buffer2;
+ if(Length2 != 0)
+ *Length2 = (txdesc->length & DescSize2Mask) >> DescSize2Shift;
+ if(Data1 != 0)
+ *Data2 = txdesc->data2;
- gmacdev->TxBusy = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txover + 1;
+ gmacdev->TxBusy = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txover + 1;
- if(synopGMAC_is_tx_desc_chained(txdesc)){
- gmacdev->TxBusyDesc = (DmaDesc *)txdesc->data2;
- synopGMAC_tx_desc_init_chain(txdesc);
- }
- else{
- gmacdev->TxBusyDesc = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? gmacdev->TxDesc : (txdesc + 1);
- synopGMAC_tx_desc_init_ring(txdesc, synopGMAC_is_last_tx_desc(gmacdev,txdesc));
- }
- TR("%02d %08x %08x %08x %08x %08x %08x %08x\n",txover,(u32)txdesc,txdesc->status,txdesc->length,txdesc->buffer1,txdesc->buffer2,txdesc->data1,txdesc->data2);
+ if(synopGMAC_is_tx_desc_chained(txdesc)){
+ gmacdev->TxBusyDesc = (DmaDesc *)txdesc->data2;
+ synopGMAC_tx_desc_init_chain(txdesc);
+ }
+ else{
+ gmacdev->TxBusyDesc = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? gmacdev->TxDesc : (txdesc + 1);
+ synopGMAC_tx_desc_init_ring(txdesc, synopGMAC_is_last_tx_desc(gmacdev,txdesc));
+ }
+ TR("%02d %08x %08x %08x %08x %08x %08x %08x\n",txover,(u32)txdesc,txdesc->status,txdesc->length,txdesc->buffer1,txdesc->buffer2,txdesc->data1,txdesc->data2);
- return txover;
+ return txover;
}
#else
/**
* Get the index and address of Tx desc.
* This api is same for both ring mode and chain mode.
- * This function tracks the tx descriptor the DMA just closed after the transmission of data from this descriptor is
+ * This function tracks the tx descriptor the DMA just closed after the transmission of data from this descriptor is
* over. This returns the descriptor fields to the caller.
* @param[in] pointer to synopGMACdevice.
* @param[out] status field of the descriptor.
@@ -1836,74 +1836,74 @@ s32 synopGMAC_get_tx_qptr(synopGMACdevice * gmacdev, u32 * Status, u32 * Buffer1
*/
s32 synopGMAC_get_tx_qptr(synopGMACdevice * gmacdev, u32 * Status, u32 * Buffer1, u32 * Length1, u32 * Data1, u32 * Buffer2, u32 * Length2, u32 * Data2 )
{
- u32 txover = gmacdev->TxBusy;
- DmaDesc * txdesc = gmacdev->TxBusyDesc;
- int i;
-
+ u32 txover = gmacdev->TxBusy;
+ DmaDesc * txdesc = gmacdev->TxBusyDesc;
+ int i;
+
//sw: dbg
-
- //pci_sync_cache(0, (vm_offset_t)txdesc, 64, SYNC_R);
- //pci_sync_cache(0, (vm_offset_t)txdesc, 64, SYNC_W);
+
+ //pci_sync_cache(0, (vm_offset_t)txdesc, 64, SYNC_R);
+ //pci_sync_cache(0, (vm_offset_t)txdesc, 64, SYNC_W);
#if SYNOP_TX_DEBUG
- printf("Cache sync before get a used tx dma desc!\n");
- printf("\n==%02d %08x %08x %08x %08x %08x %08x %08x\n",txover,(u32)txdesc,txdesc->status,txdesc->length,txdesc->buffer1,txdesc->buffer2,txdesc->data1,txdesc->data2);
+ printf("Cache sync before get a used tx dma desc!\n");
+ printf("\n==%02d %08x %08x %08x %08x %08x %08x %08x\n",txover,(u32)txdesc,txdesc->status,txdesc->length,txdesc->buffer1,txdesc->buffer2,txdesc->data1,txdesc->data2);
#endif
- if(synopGMAC_is_desc_owned_by_dma(txdesc))
- {
- return -1;
- }
-// gmacdev->TxBusy = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txover + 1;
-// gmacdev->TxBusyDesc = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? gmacdev->TxDesc : (txdesc + 1);
- if(synopGMAC_is_desc_empty(txdesc))
- {
- return -1;
- }
- (gmacdev->BusyTxDesc)--; //busy tx descriptor is reduced by one as it will be handed over to Processor now
+ if(synopGMAC_is_desc_owned_by_dma(txdesc))
+ {
+ return -1;
+ }
+// gmacdev->TxBusy = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txover + 1;
+// gmacdev->TxBusyDesc = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? gmacdev->TxDesc : (txdesc + 1);
+ if(synopGMAC_is_desc_empty(txdesc))
+ {
+ return -1;
+ }
+ (gmacdev->BusyTxDesc)--; //busy tx descriptor is reduced by one as it will be handed over to Processor now
- if(Status != 0)
- *Status = txdesc->status;
+ if(Status != 0)
+ *Status = txdesc->status;
- if(Buffer1 != 0)
- *Buffer1 = txdesc->buffer1;
- if(Length1 != 0)
- *Length1 = (txdesc->length & DescSize1Mask) >> DescSize1Shift;
- if(Data1 != 0)
- *Data1 = txdesc->data1;
+ if(Buffer1 != 0)
+ *Buffer1 = txdesc->buffer1;
+ if(Length1 != 0)
+ *Length1 = (txdesc->length & DescSize1Mask) >> DescSize1Shift;
+ if(Data1 != 0)
+ *Data1 = txdesc->data1;
- if(Buffer2 != 0)
- *Buffer2 = txdesc->buffer2;
- if(Length2 != 0)
- *Length2 = (txdesc->length & DescSize2Mask) >> DescSize2Shift;
- if(Data1 != 0)
- *Data2 = txdesc->data2;
+ if(Buffer2 != 0)
+ *Buffer2 = txdesc->buffer2;
+ if(Length2 != 0)
+ *Length2 = (txdesc->length & DescSize2Mask) >> DescSize2Shift;
+ if(Data1 != 0)
+ *Data2 = txdesc->data2;
- gmacdev->TxBusy = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txover + 1;
+ gmacdev->TxBusy = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txover + 1;
- if(synopGMAC_is_tx_desc_chained(txdesc)){
- gmacdev->TxBusyDesc = (DmaDesc *)txdesc->data2;
- synopGMAC_tx_desc_init_chain(txdesc);
- }
- else{
- gmacdev->TxBusyDesc = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? gmacdev->TxDesc : (txdesc + 1);
- synopGMAC_tx_desc_init_ring(txdesc, synopGMAC_is_last_tx_desc(gmacdev,txdesc));
- }
- //printf("%02d %08x %08x %08x %08x %08x %08x %08x\n",txover,(u32)txdesc,txdesc->status,txdesc->length,txdesc->buffer1,txdesc->buffer2,txdesc->data1,txdesc->data2);
- //pci_sync_cache(0, (vm_offset_t)txdesc, 64, SYNC_W);
+ if(synopGMAC_is_tx_desc_chained(txdesc)){
+ gmacdev->TxBusyDesc = (DmaDesc *)txdesc->data2;
+ synopGMAC_tx_desc_init_chain(txdesc);
+ }
+ else{
+ gmacdev->TxBusyDesc = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? gmacdev->TxDesc : (txdesc + 1);
+ synopGMAC_tx_desc_init_ring(txdesc, synopGMAC_is_last_tx_desc(gmacdev,txdesc));
+ }
+ //printf("%02d %08x %08x %08x %08x %08x %08x %08x\n",txover,(u32)txdesc,txdesc->status,txdesc->length,txdesc->buffer1,txdesc->buffer2,txdesc->data1,txdesc->data2);
+ //pci_sync_cache(0, (vm_offset_t)txdesc, 64, SYNC_W);
#if SYNOP_TX_DEBUG
- printf("Cache sync after re-init a tx dma desc!\n");
+ printf("Cache sync after re-init a tx dma desc!\n");
#endif
- return txover;
+ return txover;
}
#endif
/**
* Populate the tx desc structure with the buffer address.
- * Once the driver has a packet ready to be transmitted, this function is called with the
+ * Once the driver has a packet ready to be transmitted, this function is called with the
* valid dma-able buffer addresses and their lengths. This function populates the descriptor
* and make the DMA the owner for the descriptor. This function also controls whetther Checksum
- * offloading to be done in hardware or not.
+ * offloading to be done in hardware or not.
* This api is same for both ring mode and chain mode.
* @param[in] pointer to synopGMACdevice.
* @param[in] Dma-able buffer1 pointer.
@@ -1919,98 +1919,98 @@ s32 synopGMAC_get_tx_qptr(synopGMACdevice * gmacdev, u32 * Status, u32 * Buffer1
u32 len;
s32 synopGMAC_set_tx_qptr(synopGMACdevice * gmacdev, u32 Buffer1, u32 Length1, u32 Data1, u32 Buffer2, u32 Length2, u32 Data2,u32 offload_needed,u32 * index, DmaDesc * Dpr)
{
- u32 txnext = gmacdev->TxNext;
- DmaDesc * txdesc = gmacdev->TxNextDesc;
+ u32 txnext = gmacdev->TxNext;
+ DmaDesc * txdesc = gmacdev->TxNextDesc;
+
+ *index = txnext;
+ Dpr = txdesc;
- *index = txnext;
- Dpr = txdesc;
+ if(!synopGMAC_is_desc_empty(txdesc))
+ {
+ TR("set tx qptr: desc empty!\n");
+ return -1;
+ }
- if(!synopGMAC_is_desc_empty(txdesc))
- {
- TR("set tx qptr: desc empty!\n");
- return -1;
- }
+ (gmacdev->BusyTxDesc)++; //busy tx descriptor is reduced by one as it will be handed over to Processor now
- (gmacdev->BusyTxDesc)++; //busy tx descriptor is reduced by one as it will be handed over to Processor now
-
- if(synopGMAC_is_tx_desc_chained(txdesc)){
- txdesc->length |= ((Length1 <<DescSize1Shift) & DescSize1Mask);
- #ifdef ENH_DESC
- txdesc->status |= (DescTxFirst | DescTxLast | DescTxIntEnable); //ENH_DESC
- #else
- txdesc->length |= (DescTxFirst | DescTxLast | DescTxIntEnable); //Its always assumed that complete data will fit in to one descriptor
- #endif
+ if(synopGMAC_is_tx_desc_chained(txdesc)){
+ txdesc->length |= ((Length1 <<DescSize1Shift) & DescSize1Mask);
+ #ifdef ENH_DESC
+ txdesc->status |= (DescTxFirst | DescTxLast | DescTxIntEnable); //ENH_DESC
+ #else
+ txdesc->length |= (DescTxFirst | DescTxLast | DescTxIntEnable); //Its always assumed that complete data will fit in to one descriptor
+ #endif
- txdesc->buffer1 = Buffer1;
- txdesc->data1 = Data1;
+ txdesc->buffer1 = Buffer1;
+ txdesc->data1 = Data1;
- if(offload_needed){
- /*
- Make sure that the OS you are running supports the IP and TCP checkusm offloaidng,
- before calling any of the functions given below.
- */
- synopGMAC_tx_checksum_offload_ipv4hdr(gmacdev, txdesc);
- synopGMAC_tx_checksum_offload_tcponly(gmacdev, txdesc);
-// synopGMAC_tx_checksum_offload_tcp_pseudo(gmacdev, txdesc);
- }
- #ifdef ENH_DESC
- txdesc->status |= DescOwnByDma;//ENH_DESC
- #else
- txdesc->status = DescOwnByDma;
- #endif
+ if(offload_needed){
+ /*
+ Make sure that the OS you are running supports the IP and TCP checkusm offloaidng,
+ before calling any of the functions given below.
+ */
+ synopGMAC_tx_checksum_offload_ipv4hdr(gmacdev, txdesc);
+ synopGMAC_tx_checksum_offload_tcponly(gmacdev, txdesc);
+// synopGMAC_tx_checksum_offload_tcp_pseudo(gmacdev, txdesc);
+ }
+ #ifdef ENH_DESC
+ txdesc->status |= DescOwnByDma;//ENH_DESC
+ #else
+ txdesc->status = DescOwnByDma;
+ #endif
- gmacdev->TxNext = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txnext + 1;
- gmacdev->TxNextDesc = (DmaDesc *)txdesc->data2;
- }
- else{
-// printf("synopGMAC_set_tx_qptr:in ring mode\n");
- txdesc->length |= (((Length1 <<DescSize1Shift) & DescSize1Mask) | ((Length2 <<DescSize2Shift) & DescSize2Mask));
- #ifdef ENH_DESC
- txdesc->status |= (DescTxFirst | DescTxLast | DescTxIntEnable); //ENH_DESC
- #else
- txdesc->length |= (DescTxFirst | DescTxLast | DescTxIntEnable); //Its always assumed that complete data will fit in to one descriptor
- #endif
+ gmacdev->TxNext = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txnext + 1;
+ gmacdev->TxNextDesc = (DmaDesc *)txdesc->data2;
+ }
+ else{
+// printf("synopGMAC_set_tx_qptr:in ring mode\n");
+ txdesc->length |= (((Length1 <<DescSize1Shift) & DescSize1Mask) | ((Length2 <<DescSize2Shift) & DescSize2Mask));
+ #ifdef ENH_DESC
+ txdesc->status |= (DescTxFirst | DescTxLast | DescTxIntEnable); //ENH_DESC
+ #else
+ txdesc->length |= (DescTxFirst | DescTxLast | DescTxIntEnable); //Its always assumed that complete data will fit in to one descriptor
+ #endif
- txdesc->buffer1 = Buffer1;
- txdesc->data1 = Data1;
+ txdesc->buffer1 = Buffer1;
+ txdesc->data1 = Data1;
- txdesc->buffer2 = Buffer2;
- txdesc->data2 = Data2;
+ txdesc->buffer2 = Buffer2;
+ txdesc->data2 = Data2;
- if(offload_needed){
- /*
- Make sure that the OS you are running supports the IP and TCP checkusm offloaidng,
- before calling any of the functions given below.
- */
+ if(offload_needed){
+ /*
+ Make sure that the OS you are running supports the IP and TCP checkusm offloaidng,
+ before calling any of the functions given below.
+ */
//sw: i am not sure about the checksum.so i omit it in the outside
- synopGMAC_tx_checksum_offload_ipv4hdr(gmacdev, txdesc);
- synopGMAC_tx_checksum_offload_tcponly(gmacdev, txdesc);
-// synopGMAC_tx_checksum_offload_tcp_pseudo(gmacdev, txdesc);
- }
- #ifdef ENH_DESC
- txdesc->status |= DescOwnByDma;//ENH_DESC
- #else
-// printf("synopGMAC_set_tx_qptr:give the tx descroptor to dma\n");
- txdesc->status = DescOwnByDma;
- #endif
+ synopGMAC_tx_checksum_offload_ipv4hdr(gmacdev, txdesc);
+ synopGMAC_tx_checksum_offload_tcponly(gmacdev, txdesc);
+// synopGMAC_tx_checksum_offload_tcp_pseudo(gmacdev, txdesc);
+ }
+ #ifdef ENH_DESC
+ txdesc->status |= DescOwnByDma;//ENH_DESC
+ #else
+// printf("synopGMAC_set_tx_qptr:give the tx descroptor to dma\n");
+ txdesc->status = DescOwnByDma;
+ #endif
- gmacdev->TxNext = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txnext + 1;
- gmacdev->TxNextDesc = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? gmacdev->TxDesc : (txdesc + 1);
- }
+ gmacdev->TxNext = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? 0 : txnext + 1;
+ gmacdev->TxNextDesc = synopGMAC_is_last_tx_desc(gmacdev,txdesc) ? gmacdev->TxDesc : (txdesc + 1);
+ }
#if SYNOP_TX_DEBUG
- printf("%02d %08x %08x %08x %08x %08x %08x %08x\n",txnext,(u32)txdesc,txdesc->status,txdesc->length,txdesc->buffer1,txdesc->buffer2,txdesc->data1,txdesc->data2);
+ printf("%02d %08x %08x %08x %08x %08x %08x %08x\n",txnext,(u32)txdesc,txdesc->status,txdesc->length,txdesc->buffer1,txdesc->buffer2,txdesc->data1,txdesc->data2);
#endif
- //pci_sync_cache(0, (vm_offset_t)txdesc, 64, SYNC_W);
+ //pci_sync_cache(0, (vm_offset_t)txdesc, 64, SYNC_W);
#if SYNOP_TX_DEBUG
- printf("Cache sync to set a tx desc!\n");
+ printf("Cache sync to set a tx desc!\n");
#endif
- //pci_sync_cache(0, (vm_offset_t)(txdesc->data1), 32, SYNC_W);
+ //pci_sync_cache(0, (vm_offset_t)(txdesc->data1), 32, SYNC_W);
#if SYNOP_TX_DEBUG
- //printf("Cache sync for data in the buf of the tx desc!\n");
+ //printf("Cache sync for data in the buf of the tx desc!\n");
#endif
- return txnext;
+ return txnext;
}
#ifdef ENH_DESC_8W
/**
@@ -2027,62 +2027,62 @@ s32 synopGMAC_set_tx_qptr(synopGMACdevice * gmacdev, u32 Buffer1, u32 Length1, u
* @param[in] u32 data indicating whether the descriptor is in ring mode or chain mode.
* \return returns present rx descriptor index on success. Negative value if error.
*/
-// dma_addr RX_BUF_SIZE skb
+// dma_addr RX_BUF_SIZE skb
s32 synopGMAC_set_rx_qptr(synopGMACdevice * gmacdev, u32 Buffer1, u32 Length1, u32 Data1, u32 Buffer2, u32 Length2, u32 Data2)
{
- u32 rxnext = gmacdev->RxNext;
- DmaDesc * rxdesc = gmacdev->RxNextDesc;
+ u32 rxnext = gmacdev->RxNext;
+ DmaDesc * rxdesc = gmacdev->RxNextDesc;
- if(!synopGMAC_is_desc_empty(rxdesc))
- return -1;
+ if(!synopGMAC_is_desc_empty(rxdesc))
+ return -1;
- if(synopGMAC_is_rx_desc_chained(rxdesc)){
- rxdesc->length |= ((Length1 <<DescSize1Shift) & DescSize1Mask);
+ if(synopGMAC_is_rx_desc_chained(rxdesc)){
+ rxdesc->length |= ((Length1 <<DescSize1Shift) & DescSize1Mask);
- rxdesc->buffer1 = Buffer1;
- rxdesc->data1 = Data1;
+ rxdesc->buffer1 = Buffer1;
+ rxdesc->data1 = Data1;
- rxdesc->extstatus = 0;
- rxdesc->reserved1 = 0;
- rxdesc->timestamplow = 0;
- rxdesc->timestamphigh = 0;
+ rxdesc->extstatus = 0;
+ rxdesc->reserved1 = 0;
+ rxdesc->timestamplow = 0;
+ rxdesc->timestamphigh = 0;
- if((rxnext % MODULO_INTERRUPT) !=0)
- rxdesc->length |= RxDisIntCompl;
-
- rxdesc->status = DescOwnByDma;
+ if((rxnext % MODULO_INTERRUPT) !=0)
+ rxdesc->length |= RxDisIntCompl;
- gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
- gmacdev->RxNextDesc = (DmaDesc *)rxdesc->data2;
- }
- else{
- rxdesc->length |= (((Length1 <<DescSize1Shift) & DescSize1Mask) | ((Length2 << DescSize2Shift) & DescSize2Mask));
+ rxdesc->status = DescOwnByDma;
- rxdesc->buffer1 = Buffer1;
- rxdesc->data1 = Data1;
+ gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
+ gmacdev->RxNextDesc = (DmaDesc *)rxdesc->data2;
+ }
+ else{
+ rxdesc->length |= (((Length1 <<DescSize1Shift) & DescSize1Mask) | ((Length2 << DescSize2Shift) & DescSize2Mask));
+
+ rxdesc->buffer1 = Buffer1;
+ rxdesc->data1 = Data1;
+
+ rxdesc->extstatus = 0;
+ rxdesc->reserved1 = 0;
+ rxdesc->timestamplow = 0;
+ rxdesc->timestamphigh = 0;
- rxdesc->extstatus = 0;
- rxdesc->reserved1 = 0;
- rxdesc->timestamplow = 0;
- rxdesc->timestamphigh = 0;
+ rxdesc->buffer2 = Buffer2;
+ rxdesc->data2 = Data2;
- rxdesc->buffer2 = Buffer2;
- rxdesc->data2 = Data2;
-
- if((rxnext % MODULO_INTERRUPT) !=0)
- rxdesc->length |= RxDisIntCompl;
+ if((rxnext % MODULO_INTERRUPT) !=0)
+ rxdesc->length |= RxDisIntCompl;
- rxdesc->status = DescOwnByDma;
- gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
- gmacdev->RxNextDesc = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? gmacdev->RxDesc : (rxdesc + 1);
- }
+ rxdesc->status = DescOwnByDma;
+ gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
+ gmacdev->RxNextDesc = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? gmacdev->RxDesc : (rxdesc + 1);
+ }
#if SYNOP_RX_DEBUG
- TR("%02d %08x %08x %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2,rxdesc->dummy1,rxdesc->dummy2);
+ TR("%02d %08x %08x %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2,rxdesc->dummy1,rxdesc->dummy2);
#endif
- (gmacdev->BusyRxDesc)++; //One descriptor will be given to Hardware. So busy count incremented by one
- //pci_sync_cache(0, (vm_offset_t)rxdesc,64, SYNC_W);
- return rxnext;
+ (gmacdev->BusyRxDesc)++; //One descriptor will be given to Hardware. So busy count incremented by one
+ //pci_sync_cache(0, (vm_offset_t)rxdesc,64, SYNC_W);
+ return rxnext;
}
#else
@@ -2102,100 +2102,100 @@ s32 synopGMAC_set_rx_qptr(synopGMACdevice * gmacdev, u32 Buffer1, u32 Length1, u
*/
s32 synopGMAC_set_rx_qptr(synopGMACdevice * gmacdev, u32 Buffer1, u32 Length1, u32 Data1, u32 Buffer2, u32 Length2, u32 Data2)
{
- u32 rxnext = gmacdev->RxNext;
- DmaDesc * rxdesc = gmacdev->RxNextDesc;
+ u32 rxnext = gmacdev->RxNext;
+ DmaDesc * rxdesc = gmacdev->RxNextDesc;
+
+ if(!synopGMAC_is_desc_empty(rxdesc))
+ return -1;
- if(!synopGMAC_is_desc_empty(rxdesc))
- return -1;
+ if(synopGMAC_is_rx_desc_chained(rxdesc)){
+ rxdesc->length |= ((Length1 <<DescSize1Shift) & DescSize1Mask);
- if(synopGMAC_is_rx_desc_chained(rxdesc)){
- rxdesc->length |= ((Length1 <<DescSize1Shift) & DescSize1Mask);
+ rxdesc->buffer1 = Buffer1;
+ rxdesc->data1 = Data1;
- rxdesc->buffer1 = Buffer1;
- rxdesc->data1 = Data1;
+ if((rxnext % MODULO_INTERRUPT) !=0)
+ rxdesc->length |= RxDisIntCompl;
- if((rxnext % MODULO_INTERRUPT) !=0)
- rxdesc->length |= RxDisIntCompl;
+ rxdesc->status = DescOwnByDma;
- rxdesc->status = DescOwnByDma;
+ gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
+ gmacdev->RxNextDesc = (DmaDesc *)rxdesc->data2;
+ }
+ else{
+ rxdesc->length |= (((Length1 <<DescSize1Shift) & DescSize1Mask) | ((Length2 << DescSize2Shift) & DescSize2Mask));
- gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
- gmacdev->RxNextDesc = (DmaDesc *)rxdesc->data2;
- }
- else{
- rxdesc->length |= (((Length1 <<DescSize1Shift) & DescSize1Mask) | ((Length2 << DescSize2Shift) & DescSize2Mask));
+ rxdesc->buffer1 = Buffer1;
+ rxdesc->data1 = Data1;
- rxdesc->buffer1 = Buffer1;
- rxdesc->data1 = Data1;
+ rxdesc->buffer2 = Buffer2;
+ rxdesc->data2 = Data2;
- rxdesc->buffer2 = Buffer2;
- rxdesc->data2 = Data2;
-
- if((rxnext % MODULO_INTERRUPT) !=0)
- rxdesc->length |= RxDisIntCompl;
+ if((rxnext % MODULO_INTERRUPT) !=0)
+ rxdesc->length |= RxDisIntCompl;
- rxdesc->status = DescOwnByDma;
+ rxdesc->status = DescOwnByDma;
- gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
- gmacdev->RxNextDesc = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? gmacdev->RxDesc : (rxdesc + 1);
- }
+ gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
+ gmacdev->RxNextDesc = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? gmacdev->RxDesc : (rxdesc + 1);
+ }
#if SYNOP_RX_DEBUG
- TR("%02d %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2);
+ TR("%02d %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2);
#endif
- (gmacdev->BusyRxDesc)++; //One descriptor will be given to Hardware. So busy count incremented by one
+ (gmacdev->BusyRxDesc)++; //One descriptor will be given to Hardware. So busy count incremented by one
- return rxnext;
+ return rxnext;
}
s32 synopGMAC_set_rx_qptr_init(synopGMACdevice * gmacdev, u32 Buffer1, u32 Length1, u32 Data1, u32 Buffer2, u32 Length2, u32 Data2)
{
- u32 rxnext = gmacdev->RxNext;
- DmaDesc * rxdesc = gmacdev->RxNextDesc;
+ u32 rxnext = gmacdev->RxNext;
+ DmaDesc * rxdesc = gmacdev->RxNextDesc;
-/* sw
- if(synopGMAC_is_desc_owned_by_dma(rxdesc))
- return -1;
+/* sw
+ if(synopGMAC_is_desc_owned_by_dma(rxdesc))
+ return -1;
*/
- if(!synopGMAC_is_desc_empty(rxdesc))
- return -1;
+ if(!synopGMAC_is_desc_empty(rxdesc))
+ return -1;
+
+ if(synopGMAC_is_rx_desc_chained(rxdesc)){
+ rxdesc->length |= ((Length1 <<DescSize1Shift) & DescSize1Mask);
- if(synopGMAC_is_rx_desc_chained(rxdesc)){
- rxdesc->length |= ((Length1 <<DescSize1Shift) & DescSize1Mask);
+ rxdesc->buffer1 = Buffer1;
+ rxdesc->data1 = Data1;
- rxdesc->buffer1 = Buffer1;
- rxdesc->data1 = Data1;
+ if((rxnext % MODULO_INTERRUPT) !=0)
+ rxdesc->length |= RxDisIntCompl;
- if((rxnext % MODULO_INTERRUPT) !=0)
- rxdesc->length |= RxDisIntCompl;
+ rxdesc->status = DescOwnByDma;
+ rxdesc->status = 0;
- rxdesc->status = DescOwnByDma;
- rxdesc->status = 0;
+ gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
+ gmacdev->RxNextDesc = (DmaDesc *)rxdesc->data2;
+ }
+ else{
+ rxdesc->length |= (((Length1 <<DescSize1Shift) & DescSize1Mask) | ((Length2 << DescSize2Shift) & DescSize2Mask));
- gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
- gmacdev->RxNextDesc = (DmaDesc *)rxdesc->data2;
- }
- else{
- rxdesc->length |= (((Length1 <<DescSize1Shift) & DescSize1Mask) | ((Length2 << DescSize2Shift) & DescSize2Mask));
+ rxdesc->buffer1 = Buffer1;
+ rxdesc->data1 = Data1;
- rxdesc->buffer1 = Buffer1;
- rxdesc->data1 = Data1;
+ rxdesc->buffer2 = Buffer2;
+ rxdesc->data2 = Data2;
- rxdesc->buffer2 = Buffer2;
- rxdesc->data2 = Data2;
-
- if((rxnext % MODULO_INTERRUPT) !=0)
- rxdesc->length |= RxDisIntCompl;
+ if((rxnext % MODULO_INTERRUPT) !=0)
+ rxdesc->length |= RxDisIntCompl;
- rxdesc->status = DescOwnByDma;
- rxdesc->status = 0;
+ rxdesc->status = DescOwnByDma;
+ rxdesc->status = 0;
- gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
- gmacdev->RxNextDesc = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? gmacdev->RxDesc : (rxdesc + 1);
- }
- TR("%02d %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2);
- (gmacdev->BusyRxDesc)++; //One descriptor will be given to Hardware. So busy count incremented by one
- return rxnext;
+ gmacdev->RxNext = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
+ gmacdev->RxNextDesc = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? gmacdev->RxDesc : (rxdesc + 1);
+ }
+ TR("%02d %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2);
+ (gmacdev->BusyRxDesc)++; //One descriptor will be given to Hardware. So busy count incremented by one
+ return rxnext;
}
#endif
#ifdef ENH_DESC_8W
@@ -2204,7 +2204,7 @@ s32 synopGMAC_set_rx_qptr_init(synopGMACdevice * gmacdev, u32 Buffer1, u32 Lengt
* Get back the descriptor from DMA after data has been received.
* When the DMA indicates that the data is received (interrupt is generated), this function should be
* called to get the descriptor and hence the data buffers received. With successful return from this
- * function caller gets the descriptor fields for processing. check the parameters to understand the
+ * function caller gets the descriptor fields for processing. check the parameters to understand the
* fields returned.`
* @param[in] pointer to synopGMACdevice.
* @param[out] pointer to hold the status of DMA.
@@ -2219,53 +2219,53 @@ s32 synopGMAC_set_rx_qptr_init(synopGMACdevice * gmacdev, u32 Buffer1, u32 Lengt
s32 synopGMAC_get_rx_qptr(synopGMACdevice * gmacdev, u32 * Status, u32 * Buffer1, u32 * Length1, u32 * Data1, u32 * Buffer2, u32 * Length2, u32 * Data2,
u32 * Ext_Status, u32 * Time_Stamp_High, u32 * Time_Stamp_Low)
{
- u32 rxnext = gmacdev->RxBusy; // index of descriptor the DMA just completed. May be useful when data
- //is spread over multiple buffers/descriptors
- DmaDesc * rxdesc = gmacdev->RxBusyDesc;
- if(synopGMAC_is_desc_owned_by_dma(rxdesc))
- return -1;
- if(synopGMAC_is_desc_empty(rxdesc))
- return -1;
-
+ u32 rxnext = gmacdev->RxBusy; // index of descriptor the DMA just completed. May be useful when data
+ //is spread over multiple buffers/descriptors
+ DmaDesc * rxdesc = gmacdev->RxBusyDesc;
+ if(synopGMAC_is_desc_owned_by_dma(rxdesc))
+ return -1;
+ if(synopGMAC_is_desc_empty(rxdesc))
+ return -1;
+
- if(Status != 0)
- *Status = rxdesc->status;// send the status of this descriptor
+ if(Status != 0)
+ *Status = rxdesc->status;// send the status of this descriptor
- if(Ext_Status != 0)
- *Ext_Status = rxdesc->extstatus;
+ if(Ext_Status != 0)
+ *Ext_Status = rxdesc->extstatus;
if(Time_Stamp_High != 0)
- *Time_Stamp_High = rxdesc->timestamphigh;
+ *Time_Stamp_High = rxdesc->timestamphigh;
if(Time_Stamp_Low != 0)
- *Time_Stamp_Low = rxdesc->timestamplow;
+ *Time_Stamp_Low = rxdesc->timestamplow;
- if(Length1 != 0)
- *Length1 = (rxdesc->length & DescSize1Mask) >> DescSize1Shift;
- if(Buffer1 != 0)
- *Buffer1 = rxdesc->buffer1;
- if(Data1 != 0)
- *Data1 = rxdesc->data1;
+ if(Length1 != 0)
+ *Length1 = (rxdesc->length & DescSize1Mask) >> DescSize1Shift;
+ if(Buffer1 != 0)
+ *Buffer1 = rxdesc->buffer1;
+ if(Data1 != 0)
+ *Data1 = rxdesc->data1;
- if(Length2 != 0)
- *Length2 = (rxdesc->length & DescSize2Mask) >> DescSize2Shift;
- if(Buffer2 != 0)
- *Buffer2 = rxdesc->buffer2;
- if(Data1 != 0)
- *Data2 = rxdesc->data2;
+ if(Length2 != 0)
+ *Length2 = (rxdesc->length & DescSize2Mask) >> DescSize2Shift;
+ if(Buffer2 != 0)
+ *Buffer2 = rxdesc->buffer2;
+ if(Data1 != 0)
+ *Data2 = rxdesc->data2;
- gmacdev->RxBusy = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
+ gmacdev->RxBusy = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
- if(synopGMAC_is_rx_desc_chained(rxdesc)){
- gmacdev->RxBusyDesc = (DmaDesc *)rxdesc->data2;
- synopGMAC_rx_desc_init_chain(rxdesc);
- //synopGMAC_desc_init_chain(rxdesc, synopGMAC_is_last_rx_desc(gmacdev,rxdesc),0,0);
- }
- else{
- gmacdev->RxBusyDesc = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? gmacdev->RxDesc : (rxdesc + 1);
- synopGMAC_rx_desc_init_ring(rxdesc, synopGMAC_is_last_rx_desc(gmacdev,rxdesc));
- }
- TR("%02d %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2);
- (gmacdev->BusyRxDesc)--; //busy tx descriptor is reduced by one as it will be handed over to Processor now
- return(rxnext);
+ if(synopGMAC_is_rx_desc_chained(rxdesc)){
+ gmacdev->RxBusyDesc = (DmaDesc *)rxdesc->data2;
+ synopGMAC_rx_desc_init_chain(rxdesc);
+ //synopGMAC_desc_init_chain(rxdesc, synopGMAC_is_last_rx_desc(gmacdev,rxdesc),0,0);
+ }
+ else{
+ gmacdev->RxBusyDesc = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? gmacdev->RxDesc : (rxdesc + 1);
+ synopGMAC_rx_desc_init_ring(rxdesc, synopGMAC_is_last_rx_desc(gmacdev,rxdesc));
+ }
+ TR("%02d %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2);
+ (gmacdev->BusyRxDesc)--; //busy tx descriptor is reduced by one as it will be handed over to Processor now
+ return(rxnext);
}
#else
@@ -2274,7 +2274,7 @@ s32 synopGMAC_get_rx_qptr(synopGMACdevice * gmacdev, u32 * Status, u32 * Buffer1
* Get back the descriptor from DMA after data has been received.
* When the DMA indicates that the data is received (interrupt is generated), this function should be
* called to get the descriptor and hence the data buffers received. With successful return from this
- * function caller gets the descriptor fields for processing. check the parameters to understand the
+ * function caller gets the descriptor fields for processing. check the parameters to understand the
* fields returned.`
* @param[in] pointer to synopGMACdevice.
* @param[out] pointer to hold the status of DMA.
@@ -2288,60 +2288,60 @@ s32 synopGMAC_get_rx_qptr(synopGMACdevice * gmacdev, u32 * Status, u32 * Buffer1
*/
s32 synopGMAC_get_rx_qptr(synopGMACdevice * gmacdev, u32 * Status, u32 * Buffer1, u32 * Length1, u32 * Data1, u32 * Buffer2, u32 * Length2, u32 * Data2)
{
- u32 rxnext = gmacdev->RxBusy; // index of descriptor the DMA just completed. May be useful when data
- //is spread over multiple buffers/descriptors
- DmaDesc * rxdesc = gmacdev->RxBusyDesc;
+ u32 rxnext = gmacdev->RxBusy; // index of descriptor the DMA just completed. May be useful when data
+ //is spread over multiple buffers/descriptors
+ DmaDesc * rxdesc = gmacdev->RxBusyDesc;
+
+ u32 len;
+ if(synopGMAC_is_desc_owned_by_dma(rxdesc))
+ {
+ DEBUG_MES("synopGMAC_get_rx_qptr:DMA descriptor is owned by GMAC!\n");
+ return -1;
+ }
- u32 len;
- if(synopGMAC_is_desc_owned_by_dma(rxdesc))
- {
- DEBUG_MES("synopGMAC_get_rx_qptr:DMA descriptor is owned by GMAC!\n");
- return -1;
- }
-
- if(synopGMAC_is_desc_empty(rxdesc))
- {
- DEBUG_MES("synopGMAC_get_rx_qptr:rx desc is empty!\n");
- return -1;
- }
+ if(synopGMAC_is_desc_empty(rxdesc))
+ {
+ DEBUG_MES("synopGMAC_get_rx_qptr:rx desc is empty!\n");
+ return -1;
+ }
- if(Status != 0)
- *Status = rxdesc->status;// send the status of this descriptor
+ if(Status != 0)
+ *Status = rxdesc->status;// send the status of this descriptor
- if(Length1 != 0)
- *Length1 = (rxdesc->length & DescSize1Mask) >> DescSize1Shift;
- if(Buffer1 != 0)
- *Buffer1 = rxdesc->buffer1;
- if(Data1 != 0)
- *Data1 = rxdesc->data1;
- if(Length2 != 0)
- *Length2 = (rxdesc->length & DescSize2Mask) >> DescSize2Shift;
- if(Buffer2 != 0)
- *Buffer2 = rxdesc->buffer2;
- if(Data1 != 0)
- *Data2 = rxdesc->data2;
+ if(Length1 != 0)
+ *Length1 = (rxdesc->length & DescSize1Mask) >> DescSize1Shift;
+ if(Buffer1 != 0)
+ *Buffer1 = rxdesc->buffer1;
+ if(Data1 != 0)
+ *Data1 = rxdesc->data1;
+ if(Length2 != 0)
+ *Length2 = (rxdesc->length & DescSize2Mask) >> DescSize2Shift;
+ if(Buffer2 != 0)
+ *Buffer2 = rxdesc->buffer2;
+ if(Data1 != 0)
+ *Data2 = rxdesc->data2;
- len = synopGMAC_get_rx_desc_frame_length(*Status);
- DEBUG_MES("Cache sync for data buffer in rx dma desc: length = 0x%x\n",len);
- gmacdev->RxBusy = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
- if(synopGMAC_is_rx_desc_chained(rxdesc)){
- gmacdev->RxBusyDesc = (DmaDesc *)rxdesc->data2;
- synopGMAC_rx_desc_init_chain(rxdesc);
- }
- else{
- gmacdev->RxBusyDesc = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? gmacdev->RxDesc : (rxdesc + 1);
-//sw: raw data
+ len = synopGMAC_get_rx_desc_frame_length(*Status);
+ DEBUG_MES("Cache sync for data buffer in rx dma desc: length = 0x%x\n",len);
+ gmacdev->RxBusy = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? 0 : rxnext + 1;
+ if(synopGMAC_is_rx_desc_chained(rxdesc)){
+ gmacdev->RxBusyDesc = (DmaDesc *)rxdesc->data2;
+ synopGMAC_rx_desc_init_chain(rxdesc);
+ }
+ else{
+ gmacdev->RxBusyDesc = synopGMAC_is_last_rx_desc(gmacdev,rxdesc) ? gmacdev->RxDesc : (rxdesc + 1);
+//sw: raw data
#if SYNOP_RX_DEBUG
- DEBUG_MES("%02d %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2);
+ DEBUG_MES("%02d %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2);
#endif
- synopGMAC_rx_desc_init_ring(rxdesc, synopGMAC_is_last_rx_desc(gmacdev,rxdesc));
- }
+ synopGMAC_rx_desc_init_ring(rxdesc, synopGMAC_is_last_rx_desc(gmacdev,rxdesc));
+ }
#if SYNOP_RX_DEBUG
- DEBUG_MES("%02d %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2);
+ DEBUG_MES("%02d %08x %08x %08x %08x %08x %08x %08x\n",rxnext,(u32)rxdesc,rxdesc->status,rxdesc->length,rxdesc->buffer1,rxdesc->buffer2,rxdesc->data1,rxdesc->data2);
#endif
- (gmacdev->BusyRxDesc)--; //This returns one descriptor to processor. So busy count will be decremented by one
- return(rxnext);
+ (gmacdev->BusyRxDesc)--; //This returns one descriptor to processor. So busy count will be decremented by one
+ return(rxnext);
}
@@ -2355,13 +2355,13 @@ s32 synopGMAC_get_rx_qptr(synopGMACdevice * gmacdev, u32 * Status, u32 * Buffer1
*/
void synopGMAC_clear_interrupt(synopGMACdevice *gmacdev)
{
- u32 data;
- data = synopGMACReadReg(gmacdev->DmaBase, DmaStatus);
- TR("DMA status reg = 0x%x before cleared!\n",data);
- synopGMACWriteReg(gmacdev->DmaBase, DmaStatus ,data);
+ u32 data;
+ data = synopGMACReadReg(gmacdev->DmaBase, DmaStatus);
+ TR("DMA status reg = 0x%x before cleared!\n",data);
+ synopGMACWriteReg(gmacdev->DmaBase, DmaStatus ,data);
// plat_delay(DEFAULT_LOOP_VARIABLE);
-// data = synopGMACReadReg(gmacdev->DmaBase, DmaStatus);
- TR("DMA status reg = 0x%x after cleared!\n",data);
+// data = synopGMACReadReg(gmacdev->DmaBase, DmaStatus);
+ TR("DMA status reg = 0x%x after cleared!\n",data);
}
/**
@@ -2371,22 +2371,22 @@ void synopGMAC_clear_interrupt(synopGMACdevice *gmacdev)
*/
u32 synopGMAC_get_interrupt_type(synopGMACdevice *gmacdev)
{
- u32 data;
- u32 interrupts = 0;
- data = synopGMACReadReg(gmacdev->DmaBase, DmaStatus);
-
- //data = data & ~0x84; //sw: some bits shoud not be cleaned
- synopGMACWriteReg(gmacdev->DmaBase, DmaStatus ,data); //manju: I think this is the appropriate location to clear the interrupts
+ u32 data;
+ u32 interrupts = 0;
+ data = synopGMACReadReg(gmacdev->DmaBase, DmaStatus);
+
+ //data = data & ~0x84; //sw: some bits shoud not be cleaned
+ synopGMACWriteReg(gmacdev->DmaBase, DmaStatus ,data); //manju: I think this is the appropriate location to clear the interrupts
plat_delay(DEFAULT_LOOP_VARIABLE);
- if(data & DmaIntErrorMask) interrupts |= synopGMACDmaError;
- if(data & DmaIntRxNormMask) interrupts |= synopGMACDmaRxNormal;
- if(data & DmaIntRxAbnMask) interrupts |= synopGMACDmaRxAbnormal;
- if(data & DmaIntRxStoppedMask) interrupts |= synopGMACDmaRxStopped;
- if(data & DmaIntTxNormMask) interrupts |= synopGMACDmaTxNormal;
- if(data & DmaIntTxAbnMask) interrupts |= synopGMACDmaTxAbnormal;
- if(data & DmaIntTxStoppedMask) interrupts |= synopGMACDmaTxStopped;
+ if(data & DmaIntErrorMask) interrupts |= synopGMACDmaError;
+ if(data & DmaIntRxNormMask) interrupts |= synopGMACDmaRxNormal;
+ if(data & DmaIntRxAbnMask) interrupts |= synopGMACDmaRxAbnormal;
+ if(data & DmaIntRxStoppedMask) interrupts |= synopGMACDmaRxStopped;
+ if(data & DmaIntTxNormMask) interrupts |= synopGMACDmaTxNormal;
+ if(data & DmaIntTxAbnMask) interrupts |= synopGMACDmaTxAbnormal;
+ if(data & DmaIntTxStoppedMask) interrupts |= synopGMACDmaTxStopped;
- return interrupts;
+ return interrupts;
}
/**
@@ -2397,7 +2397,7 @@ u32 synopGMAC_get_interrupt_type(synopGMACdevice *gmacdev)
#if UNUSED
u32 synopGMAC_get_interrupt_mask(synopGMACdevice *gmacdev)
{
- return(synopGMACReadReg(gmacdev->DmaBase, DmaInterrupt));
+ return(synopGMACReadReg(gmacdev->DmaBase, DmaInterrupt));
}
#endif
@@ -2411,8 +2411,8 @@ u32 synopGMAC_get_interrupt_mask(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_enable_interrupt(synopGMACdevice *gmacdev, u32 interrupts)
{
- synopGMACWriteReg(gmacdev->DmaBase, DmaInterrupt, interrupts);
- return;
+ synopGMACWriteReg(gmacdev->DmaBase, DmaInterrupt, interrupts);
+ return;
}
#endif
@@ -2427,10 +2427,10 @@ void synopGMAC_enable_interrupt(synopGMACdevice *gmacdev, u32 interrupts)
*/
void synopGMAC_disable_interrupt_all(synopGMACdevice *gmacdev)
{
-// rt_kprintf("dmabase = 0x%x\n",gmacdev->DmaBase);
- synopGMACWriteReg(gmacdev->DmaBase, DmaInterrupt, DmaIntDisable);
-// synopGMACReadReg(gmacdev->DmaBase, DmaInterrupt);
- return;
+// rt_kprintf("dmabase = 0x%x\n",gmacdev->DmaBase);
+ synopGMACWriteReg(gmacdev->DmaBase, DmaInterrupt, DmaIntDisable);
+// synopGMACReadReg(gmacdev->DmaBase, DmaInterrupt);
+ return;
}
/**
@@ -2443,8 +2443,8 @@ void synopGMAC_disable_interrupt_all(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_disable_interrupt(synopGMACdevice *gmacdev, u32 interrupts)
{
- synopGMACClearBits(gmacdev->DmaBase, DmaInterrupt, interrupts);
- return;
+ synopGMACClearBits(gmacdev->DmaBase, DmaInterrupt, interrupts);
+ return;
}
#endif
/**
@@ -2454,13 +2454,13 @@ void synopGMAC_disable_interrupt(synopGMACdevice *gmacdev, u32 interrupts)
*/
void synopGMAC_enable_dma_rx(synopGMACdevice * gmacdev)
{
-// synopGMACSetBits(gmacdev->DmaBase, DmaControl, DmaRxStart);
- u32 data;
- data = synopGMACReadReg(gmacdev->DmaBase, DmaControl);
- data |= DmaRxStart;
- TR0(" ===33334\n");
- synopGMACWriteReg(gmacdev->DmaBase, DmaControl ,data);
- TR0(" ===33344\n");
+// synopGMACSetBits(gmacdev->DmaBase, DmaControl, DmaRxStart);
+ u32 data;
+ data = synopGMACReadReg(gmacdev->DmaBase, DmaControl);
+ data |= DmaRxStart;
+ TR0(" ===33334\n");
+ synopGMACWriteReg(gmacdev->DmaBase, DmaControl ,data);
+ TR0(" ===33344\n");
}
/**
@@ -2470,11 +2470,11 @@ void synopGMAC_enable_dma_rx(synopGMACdevice * gmacdev)
*/
void synopGMAC_enable_dma_tx(synopGMACdevice * gmacdev)
{
-// synopGMACSetBits(gmacdev->DmaBase, DmaControl, DmaTxStart);
- u32 data;
- data = synopGMACReadReg(gmacdev->DmaBase, DmaControl);
- data |= DmaTxStart;
- synopGMACWriteReg(gmacdev->DmaBase, DmaControl ,data);
+// synopGMACSetBits(gmacdev->DmaBase, DmaControl, DmaTxStart);
+ u32 data;
+ data = synopGMACReadReg(gmacdev->DmaBase, DmaControl);
+ data |= DmaTxStart;
+ synopGMACWriteReg(gmacdev->DmaBase, DmaControl ,data);
}
@@ -2487,7 +2487,7 @@ void synopGMAC_enable_dma_tx(synopGMACdevice * gmacdev)
*/
void synopGMAC_resume_dma_tx(synopGMACdevice * gmacdev)
{
- synopGMACWriteReg(gmacdev->DmaBase, DmaTxPollDemand, 1);
+ synopGMACWriteReg(gmacdev->DmaBase, DmaTxPollDemand, 1);
}
/**
@@ -2499,7 +2499,7 @@ void synopGMAC_resume_dma_tx(synopGMACdevice * gmacdev)
*/
void synopGMAC_resume_dma_rx(synopGMACdevice * gmacdev)
{
- synopGMACWriteReg(gmacdev->DmaBase, DmaRxPollDemand, 0);
+ synopGMACWriteReg(gmacdev->DmaBase, DmaRxPollDemand, 0);
}
/**
@@ -2510,10 +2510,10 @@ void synopGMAC_resume_dma_rx(synopGMACdevice * gmacdev)
*/
void synopGMAC_take_desc_ownership(DmaDesc * desc)
{
- if(desc){
- desc->status &= ~DescOwnByDma; //Clear the DMA own bit
-// desc->status |= DescError; // Set the error to indicate this descriptor is bad
- }
+ if(desc){
+ desc->status &= ~DescOwnByDma; //Clear the DMA own bit
+// desc->status |= DescError; // Set the error to indicate this descriptor is bad
+ }
}
/**
@@ -2527,19 +2527,19 @@ void synopGMAC_take_desc_ownership(DmaDesc * desc)
*/
void synopGMAC_take_desc_ownership_rx(synopGMACdevice * gmacdev)
{
- s32 i;
- DmaDesc *desc;
- desc = gmacdev->RxDesc;
- for(i = 0; i < gmacdev->RxDescCount; i++){
- if(synopGMAC_is_rx_desc_chained(desc)){ //This descriptor is in chain mode
-
- synopGMAC_take_desc_ownership(desc);
- desc = (DmaDesc *)desc->data2;
- }
- else{
- synopGMAC_take_desc_ownership(desc + i);
- }
- }
+ s32 i;
+ DmaDesc *desc;
+ desc = gmacdev->RxDesc;
+ for(i = 0; i < gmacdev->RxDescCount; i++){
+ if(synopGMAC_is_rx_desc_chained(desc)){ //This descriptor is in chain mode
+
+ synopGMAC_take_desc_ownership(desc);
+ desc = (DmaDesc *)desc->data2;
+ }
+ else{
+ synopGMAC_take_desc_ownership(desc + i);
+ }
+ }
}
/**
@@ -2553,19 +2553,19 @@ void synopGMAC_take_desc_ownership_rx(synopGMACdevice * gmacdev)
*/
void synopGMAC_take_desc_ownership_tx(synopGMACdevice * gmacdev)
{
- s32 i;
- DmaDesc *desc;
- desc = gmacdev->TxDesc;
- for(i = 0; i < gmacdev->TxDescCount; i++){
- if(synopGMAC_is_tx_desc_chained(desc)){ //This descriptor is in chain mode
- synopGMAC_take_desc_ownership(desc);
- desc = (DmaDesc *)desc->data2;
- }
- else{
- synopGMAC_take_desc_ownership(desc + i);
- }
- }
-
+ s32 i;
+ DmaDesc *desc;
+ desc = gmacdev->TxDesc;
+ for(i = 0; i < gmacdev->TxDescCount; i++){
+ if(synopGMAC_is_tx_desc_chained(desc)){ //This descriptor is in chain mode
+ synopGMAC_take_desc_ownership(desc);
+ desc = (DmaDesc *)desc->data2;
+ }
+ else{
+ synopGMAC_take_desc_ownership(desc + i);
+ }
+ }
+
}
/**
@@ -2575,12 +2575,12 @@ void synopGMAC_take_desc_ownership_tx(synopGMACdevice * gmacdev)
*/
void synopGMAC_disable_dma_tx(synopGMACdevice * gmacdev)
-{
-// synopGMACClearBits(gmacdev->DmaBase, DmaControl, DmaTxStart);
- u32 data;
- data = synopGMACReadReg(gmacdev->DmaBase, DmaControl);
- data &= (~DmaTxStart);
- synopGMACWriteReg(gmacdev->DmaBase, DmaControl ,data);
+{
+// synopGMACClearBits(gmacdev->DmaBase, DmaControl, DmaTxStart);
+ u32 data;
+ data = synopGMACReadReg(gmacdev->DmaBase, DmaControl);
+ data &= (~DmaTxStart);
+ synopGMACWriteReg(gmacdev->DmaBase, DmaControl ,data);
}
/**
* Disable the DMA for Reception.
@@ -2588,16 +2588,16 @@ void synopGMAC_disable_dma_tx(synopGMACdevice * gmacdev)
* \return returns void.
*/
void synopGMAC_disable_dma_rx(synopGMACdevice * gmacdev)
-{
-// synopGMACClearBits(gmacdev->DmaBase, DmaControl, DmaRxStart);
- u32 data;
- data = synopGMACReadReg(gmacdev->DmaBase, DmaControl);
- data &= (~DmaRxStart);
- synopGMACWriteReg(gmacdev->DmaBase, DmaControl ,data);
+{
+// synopGMACClearBits(gmacdev->DmaBase, DmaControl, DmaRxStart);
+ u32 data;
+ data = synopGMACReadReg(gmacdev->DmaBase, DmaControl);
+ data &= (~DmaRxStart);
+ synopGMACWriteReg(gmacdev->DmaBase, DmaControl ,data);
}
-
+
/*******************PMT APIs***************************************/
@@ -2613,7 +2613,7 @@ void synopGMAC_disable_dma_rx(synopGMACdevice * gmacdev)
#if UNUSED
void synopGMAC_pmt_int_enable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
+ synopGMACClearBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
return;
}
#endif
@@ -2626,7 +2626,7 @@ void synopGMAC_pmt_int_enable(synopGMACdevice *gmacdev)
*/
void synopGMAC_pmt_int_disable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
+ synopGMACSetBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
return;
}
/**
@@ -2638,8 +2638,8 @@ void synopGMAC_pmt_int_disable(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_power_down_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtPowerDown);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtPowerDown);
+ return;
}
#endif
/**
@@ -2652,8 +2652,8 @@ void synopGMAC_power_down_enable(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_power_down_disable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtPowerDown);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtPowerDown);
+ return;
}
#endif
/**
@@ -2664,7 +2664,7 @@ void synopGMAC_power_down_disable(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_enable_pmt_interrupt(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
+ synopGMACClearBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
}
#endif
/**
@@ -2675,7 +2675,7 @@ void synopGMAC_enable_pmt_interrupt(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_disable_pmt_interrupt(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
+ synopGMACSetBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
}
#endif
/**
@@ -2686,13 +2686,13 @@ void synopGMAC_disable_pmt_interrupt(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_magic_packet_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtMagicPktEnable);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtMagicPktEnable);
+ return;
}
#endif
/**
- * Enables GMAC to look for wake up frame.
+ * Enables GMAC to look for wake up frame.
* Wake up frame is defined by the user.
* @param[in] pointer to synopGMACdevice.
* \return returns void.
@@ -2700,8 +2700,8 @@ void synopGMAC_magic_packet_enable(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_wakeup_frame_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtWakeupFrameEnable);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtWakeupFrameEnable);
+ return;
}
#endif
@@ -2713,8 +2713,8 @@ void synopGMAC_wakeup_frame_enable(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_pmt_unicast_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtGlobalUnicast);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtGlobalUnicast);
+ return;
}
#endif
/**
@@ -2724,9 +2724,9 @@ void synopGMAC_pmt_unicast_enable(synopGMACdevice *gmacdev)
*/
bool synopGMAC_is_magic_packet_received(synopGMACdevice *gmacdev)
{
- u32 data;
- data = synopGMACReadReg(gmacdev->MacBase,GmacPmtCtrlStatus);
- return((data & GmacPmtMagicPktReceived) == GmacPmtMagicPktReceived);
+ u32 data;
+ data = synopGMACReadReg(gmacdev->MacBase,GmacPmtCtrlStatus);
+ return((data & GmacPmtMagicPktReceived) == GmacPmtMagicPktReceived);
}
/**
* Checks whether the packet received is a wakeup frame?.
@@ -2735,9 +2735,9 @@ bool synopGMAC_is_magic_packet_received(synopGMACdevice *gmacdev)
*/
bool synopGMAC_is_wakeup_frame_received(synopGMACdevice *gmacdev)
{
- u32 data;
- data = synopGMACReadReg(gmacdev->MacBase,GmacPmtCtrlStatus);
- return((data & GmacPmtWakeupFrameReceived) == GmacPmtWakeupFrameReceived);
+ u32 data;
+ data = synopGMACReadReg(gmacdev->MacBase,GmacPmtCtrlStatus);
+ return((data & GmacPmtWakeupFrameReceived) == GmacPmtWakeupFrameReceived);
}
/**
@@ -2752,12 +2752,12 @@ bool synopGMAC_is_wakeup_frame_received(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_write_wakeup_frame_register(synopGMACdevice *gmacdev, u32 * filter_contents)
{
- s32 i;
- synopGMACSetBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtFrmFilterPtrReset);
- plat_delay(10);
- for(i =0; i<WAKEUP_REG_LENGTH; i++)
- synopGMACWriteReg(gmacdev->MacBase, GmacWakeupAddr, *(filter_contents + i));
- return;
+ s32 i;
+ synopGMACSetBits(gmacdev->MacBase,GmacPmtCtrlStatus,GmacPmtFrmFilterPtrReset);
+ plat_delay(10);
+ for(i =0; i<WAKEUP_REG_LENGTH; i++)
+ synopGMACWriteReg(gmacdev->MacBase, GmacWakeupAddr, *(filter_contents + i));
+ return;
}
#endif
@@ -2774,8 +2774,8 @@ void synopGMAC_write_wakeup_frame_register(synopGMACdevice *gmacdev, u32 * filte
#if UNUSED
void synopGMAC_mmc_counters_stop(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterFreeze);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterFreeze);
+ return;
}
#endif
/**
@@ -2786,8 +2786,8 @@ void synopGMAC_mmc_counters_stop(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_mmc_counters_resume(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterFreeze);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterFreeze);
+ return;
}
#endif
/**
@@ -2799,8 +2799,8 @@ void synopGMAC_mmc_counters_resume(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_mmc_counters_set_selfclear(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterResetOnRead);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterResetOnRead);
+ return;
}
#endif
/**
@@ -2812,8 +2812,8 @@ void synopGMAC_mmc_counters_set_selfclear(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_mmc_counters_reset_selfclear(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterResetOnRead);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterResetOnRead);
+ return;
}
#endif
/**
@@ -2825,8 +2825,8 @@ void synopGMAC_mmc_counters_reset_selfclear(synopGMACdevice *gmacdev)
#if UNUSED
void synopGMAC_mmc_counters_disable_rollover(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterStopRollover);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterStopRollover);
+ return;
}
/**
* Configures the MMC to rollover.
@@ -2836,8 +2836,8 @@ void synopGMAC_mmc_counters_disable_rollover(synopGMACdevice *gmacdev)
*/
void synopGMAC_mmc_counters_enable_rollover(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterStopRollover);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacMmcCntrl,GmacMmcCounterStopRollover);
+ return;
}
/**
@@ -2848,7 +2848,7 @@ void synopGMAC_mmc_counters_enable_rollover(synopGMACdevice *gmacdev)
*/
u32 synopGMAC_read_mmc_counter(synopGMACdevice *gmacdev, u32 counter)
{
- return( synopGMACReadReg(gmacdev->MacBase,counter));
+ return( synopGMACReadReg(gmacdev->MacBase,counter));
}
#endif
/**
@@ -2858,7 +2858,7 @@ u32 synopGMAC_read_mmc_counter(synopGMACdevice *gmacdev, u32 counter)
*/
u32 synopGMAC_read_mmc_rx_int_status(synopGMACdevice *gmacdev)
{
- return( synopGMACReadReg(gmacdev->MacBase,GmacMmcIntrRx));
+ return( synopGMACReadReg(gmacdev->MacBase,GmacMmcIntrRx));
}
/**
* Read the MMC Tx interrupt status.
@@ -2867,7 +2867,7 @@ u32 synopGMAC_read_mmc_rx_int_status(synopGMACdevice *gmacdev)
*/
u32 synopGMAC_read_mmc_tx_int_status(synopGMACdevice *gmacdev)
{
- return( synopGMACReadReg(gmacdev->MacBase,GmacMmcIntrTx));
+ return( synopGMACReadReg(gmacdev->MacBase,GmacMmcIntrTx));
}
/**
* Disable the MMC Tx interrupt.
@@ -2878,8 +2878,8 @@ u32 synopGMAC_read_mmc_tx_int_status(synopGMACdevice *gmacdev)
*/
void synopGMAC_disable_mmc_tx_interrupt(synopGMACdevice *gmacdev, u32 mask)
{
- synopGMACSetBits(gmacdev->MacBase,GmacMmcIntrMaskTx,mask);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacMmcIntrMaskTx,mask);
+ return;
}
/**
* Enable the MMC Tx interrupt.
@@ -2891,7 +2891,7 @@ void synopGMAC_disable_mmc_tx_interrupt(synopGMACdevice *gmacdev, u32 mask)
#if UNUSED
void synopGMAC_enable_mmc_tx_interrupt(synopGMACdevice *gmacdev, u32 mask)
{
- synopGMACClearBits(gmacdev->MacBase,GmacMmcIntrMaskTx,mask);
+ synopGMACClearBits(gmacdev->MacBase,GmacMmcIntrMaskTx,mask);
}
#endif
/**
@@ -2903,8 +2903,8 @@ void synopGMAC_enable_mmc_tx_interrupt(synopGMACdevice *gmacdev, u32 mask)
*/
void synopGMAC_disable_mmc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask)
{
- synopGMACSetBits(gmacdev->MacBase,GmacMmcIntrMaskRx,mask);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacMmcIntrMaskRx,mask);
+ return;
}
/**
* Enable the MMC Rx interrupt.
@@ -2916,8 +2916,8 @@ void synopGMAC_disable_mmc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask)
#if UNUSED
void synopGMAC_enable_mmc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask)
{
- synopGMACClearBits(gmacdev->MacBase,GmacMmcIntrMaskRx,mask);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacMmcIntrMaskRx,mask);
+ return;
}
#endif
/**
@@ -2929,8 +2929,8 @@ void synopGMAC_enable_mmc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask)
*/
void synopGMAC_disable_mmc_ipc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask)
{
- synopGMACSetBits(gmacdev->MacBase,GmacMmcRxIpcIntrMask,mask);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacMmcRxIpcIntrMask,mask);
+ return;
}
/**
* Enable the MMC ipc rx checksum offload interrupt.
@@ -2942,8 +2942,8 @@ void synopGMAC_disable_mmc_ipc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask)
#if UNUSED
void synopGMAC_enable_mmc_ipc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask)
{
- synopGMACClearBits(gmacdev->MacBase,GmacMmcRxIpcIntrMask,mask);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacMmcRxIpcIntrMask,mask);
+ return;
}
#endif
/*******************MMC APIs***************************************/
@@ -2960,8 +2960,8 @@ void synopGMAC_enable_mmc_ipc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask)
#if UNUSED
void synopGMAC_enable_rx_chksum_offload(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacConfig,GmacRxIpcOffload);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacConfig,GmacRxIpcOffload);
+ return;
}
/**
* Disable the ip checksum offloading in receive path.
@@ -2971,19 +2971,19 @@ void synopGMAC_enable_rx_chksum_offload(synopGMACdevice *gmacdev)
*/
void synopGMAC_disable_rx_Ipchecksum_offload(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacConfig,GmacRxIpcOffload);
+ synopGMACClearBits(gmacdev->MacBase,GmacConfig,GmacRxIpcOffload);
}
/**
* Instruct the DMA to drop the packets fails tcp ip checksum.
- * This is to instruct the receive DMA engine to drop the recevied packet if they
+ * This is to instruct the receive DMA engine to drop the recevied packet if they
* fails the tcp/ip checksum in hardware. Valid only when full checksum offloading is enabled(type-2).
* @param[in] pointer to synopGMACdevice.
* \return returns void.
*/
void synopGMAC_rx_tcpip_chksum_drop_enable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->DmaBase,DmaControl,DmaDisableDropTcpCs);
- return;
+ synopGMACClearBits(gmacdev->DmaBase,DmaControl,DmaDisableDropTcpCs);
+ return;
}
/**
* Instruct the DMA not to drop the packets even if it fails tcp ip checksum.
@@ -2994,12 +2994,12 @@ void synopGMAC_rx_tcpip_chksum_drop_enable(synopGMACdevice *gmacdev)
*/
void synopGMAC_rx_tcpip_chksum_drop_disable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->DmaBase,DmaControl,DmaDisableDropTcpCs);
- return;
+ synopGMACSetBits(gmacdev->DmaBase,DmaControl,DmaDisableDropTcpCs);
+ return;
}
#endif
-/**
+/**
* When the Enhanced Descriptor is enabled then the bit 0 of RDES0 indicates whether the
* Extended Status is available (RDES4). Time Stamp feature and the Checksum Offload Engine2
* makes use of this extended status to provide the status of the received packet.
@@ -3016,9 +3016,9 @@ void synopGMAC_rx_tcpip_chksum_drop_disable(synopGMACdevice *gmacdev)
* @param[in] u32 status field of the corresponding descriptor.
* \return returns TRUE or FALSE.
*/
-bool synopGMAC_is_ext_status(synopGMACdevice *gmacdev,u32 status) // extended status present indicates that the RDES4 need to be probed
+bool synopGMAC_is_ext_status(synopGMACdevice *gmacdev,u32 status) // extended status present indicates that the RDES4 need to be probed
{
- return((status & DescRxEXTsts ) != 0 ); // if extstatus set then it returns 1
+ return((status & DescRxEXTsts ) != 0 ); // if extstatus set then it returns 1
}
/**
* This function returns true if the IP header checksum bit is set in the extended status.
@@ -3030,7 +3030,7 @@ bool synopGMAC_is_ext_status(synopGMACdevice *gmacdev,u32 status) // ext
*/
bool synopGMAC_ES_is_IP_header_error(synopGMACdevice *gmacdev,u32 ext_status) // IP header (IPV4) checksum error
{
- return((ext_status & DescRxIpHeaderError) != 0 ); // if IPV4 header error return 1
+ return((ext_status & DescRxIpHeaderError) != 0 ); // if IPV4 header error return 1
}
/**
* This function returns true if the Checksum is bypassed in the hardware.
@@ -3042,7 +3042,7 @@ bool synopGMAC_ES_is_IP_header_error(synopGMACdevice *gmacdev,u32 ext_status)
*/
bool synopGMAC_ES_is_rx_checksum_bypassed(synopGMACdevice *gmacdev,u32 ext_status) // Hardware engine bypassed the checksum computation/checking
{
- return((ext_status & DescRxChkSumBypass ) != 0 ); // if checksum offloading bypassed return 1
+ return((ext_status & DescRxChkSumBypass ) != 0 ); // if checksum offloading bypassed return 1
}
/**
* This function returns true if payload checksum error is set in the extended status.
@@ -3054,7 +3054,7 @@ bool synopGMAC_ES_is_rx_checksum_bypassed(synopGMACdevice *gmacdev,u32 ext_statu
*/
bool synopGMAC_ES_is_IP_payload_error(synopGMACdevice *gmacdev,u32 ext_status) // IP payload checksum is in error (UDP/TCP/ICMP checksum error)
{
- return((ext_status & DescRxIpPayloadError) != 0 ); // if IP payload error return 1
+ return((ext_status & DescRxIpPayloadError) != 0 ); // if IP payload error return 1
}
#endif
@@ -3068,22 +3068,22 @@ bool synopGMAC_ES_is_IP_payload_error(synopGMACdevice *gmacdev,u32 ext_status)
*/
u32 synopGMAC_is_rx_checksum_error(synopGMACdevice *gmacdev, u32 status)
{
- if (((status & DescRxChkBit5) == 0) && ((status & DescRxChkBit7) == 0) && ((status & DescRxChkBit0) == 0))
- return RxLenLT600;
- else if(((status & DescRxChkBit5) == 0) && ((status & DescRxChkBit7) == 0) && ((status & DescRxChkBit0) != 0))
- return RxIpHdrPayLoadChkBypass;
- else if(((status & DescRxChkBit5) == 0) && ((status & DescRxChkBit7) != 0) && ((status & DescRxChkBit0) != 0))
- return RxChkBypass;
- else if(((status & DescRxChkBit5) != 0) && ((status & DescRxChkBit7) == 0) && ((status & DescRxChkBit0) == 0))
- return RxNoChkError;
- else if(((status & DescRxChkBit5) != 0) && ((status & DescRxChkBit7) == 0) && ((status & DescRxChkBit0) != 0))
- return RxPayLoadChkError;
- else if(((status & DescRxChkBit5) != 0) && ((status & DescRxChkBit7) != 0) && ((status & DescRxChkBit0) == 0))
- return RxIpHdrChkError;
- else if(((status & DescRxChkBit5) != 0) && ((status & DescRxChkBit7) != 0) && ((status & DescRxChkBit0) != 0))
- return RxIpHdrPayLoadChkError;
- else
- return RxIpHdrPayLoadRes;
+ if (((status & DescRxChkBit5) == 0) && ((status & DescRxChkBit7) == 0) && ((status & DescRxChkBit0) == 0))
+ return RxLenLT600;
+ else if(((status & DescRxChkBit5) == 0) && ((status & DescRxChkBit7) == 0) && ((status & DescRxChkBit0) != 0))
+ return RxIpHdrPayLoadChkBypass;
+ else if(((status & DescRxChkBit5) == 0) && ((status & DescRxChkBit7) != 0) && ((status & DescRxChkBit0) != 0))
+ return RxChkBypass;
+ else if(((status & DescRxChkBit5) != 0) && ((status & DescRxChkBit7) == 0) && ((status & DescRxChkBit0) == 0))
+ return RxNoChkError;
+ else if(((status & DescRxChkBit5) != 0) && ((status & DescRxChkBit7) == 0) && ((status & DescRxChkBit0) != 0))
+ return RxPayLoadChkError;
+ else if(((status & DescRxChkBit5) != 0) && ((status & DescRxChkBit7) != 0) && ((status & DescRxChkBit0) == 0))
+ return RxIpHdrChkError;
+ else if(((status & DescRxChkBit5) != 0) && ((status & DescRxChkBit7) != 0) && ((status & DescRxChkBit0) != 0))
+ return RxIpHdrPayLoadChkError;
+ else
+ return RxIpHdrPayLoadRes;
}
/**
* Checks if any Ipv4 header checksum error in the frame just transmitted.
@@ -3095,7 +3095,7 @@ u32 synopGMAC_is_rx_checksum_error(synopGMACdevice *gmacdev, u32 status)
*/
bool synopGMAC_is_tx_ipv4header_checksum_error(synopGMACdevice *gmacdev, u32 status)
{
- return((status & DescTxIpv4ChkError) == DescTxIpv4ChkError);
+ return((status & DescTxIpv4ChkError) == DescTxIpv4ChkError);
}
@@ -3109,7 +3109,7 @@ bool synopGMAC_is_tx_ipv4header_checksum_error(synopGMACdevice *gmacdev, u32 sta
*/
bool synopGMAC_is_tx_payload_checksum_error(synopGMACdevice *gmacdev, u32 status)
{
- return((status & DescTxPayChkError) == DescTxPayChkError);
+ return((status & DescTxPayChkError) == DescTxPayChkError);
}
/**
* The check summ offload engine is bypassed in the tx path.
@@ -3120,11 +3120,11 @@ bool synopGMAC_is_tx_payload_checksum_error(synopGMACdevice *gmacdev, u32 status
*/
void synopGMAC_tx_checksum_offload_bypass(synopGMACdevice *gmacdev, DmaDesc *desc)
{
- #ifdef ENH_DESC
- desc->status = (desc->length & (~DescTxCisMask));//ENH_DESC
- #else
- desc->length = (desc->length & (~DescTxCisMask));
- #endif
+ #ifdef ENH_DESC
+ desc->status = (desc->length & (~DescTxCisMask));//ENH_DESC
+ #else
+ desc->length = (desc->length & (~DescTxCisMask));
+ #endif
}
/**
@@ -3136,11 +3136,11 @@ void synopGMAC_tx_checksum_offload_bypass(synopGMACdevice *gmacdev, DmaDesc *des
*/
void synopGMAC_tx_checksum_offload_ipv4hdr(synopGMACdevice *gmacdev, DmaDesc *desc)
{
- #ifdef ENH_DESC
- desc->status = ((desc->status & (~DescTxCisMask)) | DescTxCisIpv4HdrCs);//ENH_DESC
- #else
- desc->length = ((desc->length & (~DescTxCisMask)) | DescTxCisIpv4HdrCs);
- #endif
+ #ifdef ENH_DESC
+ desc->status = ((desc->status & (~DescTxCisMask)) | DescTxCisIpv4HdrCs);//ENH_DESC
+ #else
+ desc->length = ((desc->length & (~DescTxCisMask)) | DescTxCisIpv4HdrCs);
+ #endif
}
@@ -3154,11 +3154,11 @@ void synopGMAC_tx_checksum_offload_ipv4hdr(synopGMACdevice *gmacdev, DmaDesc *de
*/
void synopGMAC_tx_checksum_offload_tcponly(synopGMACdevice *gmacdev, DmaDesc *desc)
{
- #ifdef ENH_DESC
- desc->status = ((desc->status & (~DescTxCisMask)) | DescTxCisTcpOnlyCs);//ENH_DESC
- #else
- desc->length = ((desc->length & (~DescTxCisMask)) | DescTxCisTcpOnlyCs);
- #endif
+ #ifdef ENH_DESC
+ desc->status = ((desc->status & (~DescTxCisMask)) | DescTxCisTcpOnlyCs);//ENH_DESC
+ #else
+ desc->length = ((desc->length & (~DescTxCisMask)) | DescTxCisTcpOnlyCs);
+ #endif
}
/**
@@ -3172,11 +3172,11 @@ void synopGMAC_tx_checksum_offload_tcponly(synopGMACdevice *gmacdev, DmaDesc *de
*/
void synopGMAC_tx_checksum_offload_tcp_pseudo(synopGMACdevice *gmacdev, DmaDesc *desc)
{
- #ifdef ENH_DESC
- desc->status = ((desc->length & (~DescTxCisMask)) | DescTxCisTcpPseudoCs);
- #else
- desc->length = ((desc->length & (~DescTxCisMask)) | DescTxCisTcpPseudoCs);
- #endif
+ #ifdef ENH_DESC
+ desc->status = ((desc->length & (~DescTxCisMask)) | DescTxCisTcpPseudoCs);
+ #else
+ desc->length = ((desc->length & (~DescTxCisMask)) | DescTxCisTcpPseudoCs);
+ #endif
}
/*******************Ip checksum offloading APIs***************************************/
@@ -3192,7 +3192,7 @@ void synopGMAC_tx_checksum_offload_tcp_pseudo(synopGMACdevice *gmacdev, DmaDesc
* At this time the driver supports the IEEE time stamping feature when the Enhanced Descriptors are enabled.
* For normal descriptor and the IEEE time stamp (version 1), driver support is not proviced
* Please make sure you have enabled the Advanced timestamp feature in the hardware and the driver should
- * be compiled with the ADV_TME_STAMP feature.
+ * be compiled with the ADV_TME_STAMP feature.
* Some of the APIs provided here may not be valid for all configurations. Please make sure you call the
* API with due care.
*/
@@ -3206,48 +3206,48 @@ void synopGMAC_tx_checksum_offload_tcp_pseudo(synopGMACdevice *gmacdev, DmaDesc
#if UNUSED
void synopGMAC_TS_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSENA);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSENA);
+ return;
}
/**
- * This function disables the timestamping.
+ * This function disables the timestamping.
* When disabled timestamp is not added to tx and receive frames and timestamp generator is suspended.
* @param[in] pointer to synopGMACdevice
* \return returns void
*/
void synopGMAC_TS_disable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacInterruptMask, GmacTSIntMask);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacInterruptMask, GmacTSIntMask);
+ return;
}
/**
- * Enable the interrupt to get timestamping interrupt.
- * This enables the host to get the interrupt when (1) system time is greater or equal to the
+ * Enable the interrupt to get timestamping interrupt.
+ * This enables the host to get the interrupt when (1) system time is greater or equal to the
* target time high and low register or (2) there is a overflow in th esecond register.
* @param[in] pointer to synopGMACdevice
* \return returns void
*/
void synopGMAC_TS_int_enable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
+ synopGMACClearBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
return;
}
/**
- * Disable the interrupt to get timestamping interrupt.
+ * Disable the interrupt to get timestamping interrupt.
* @param[in] pointer to synopGMACdevice
* \return returns void
*/
void synopGMAC_TS_int_disable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
+ synopGMACSetBits(gmacdev->MacBase,GmacInterruptMask,GmacPmtIntMask);
return;
}
/**
- * Enable MAC address for PTP frame filtering.
+ * Enable MAC address for PTP frame filtering.
* When enabled, uses MAC address (apart from MAC address 0) to filter the PTP frames when
* PTP is sent directly over Ethernet.
* @param[in] pointer to synopGMACdevice
@@ -3255,46 +3255,46 @@ void synopGMAC_TS_int_disable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_mac_addr_filt_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSENMACADDR);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSENMACADDR);
+ return;
}
/**
- * Disables MAC address for PTP frame filtering.
+ * Disables MAC address for PTP frame filtering.
* @param[in] pointer to synopGMACdevice
* \return returns void
*/
void synopGMAC_TS_mac_addr_filt_disable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSENMACADDR);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSENMACADDR);
+ return;
}
/**
- * Selet the type of clock mode for PTP.
+ * Selet the type of clock mode for PTP.
* Please note to use one of the follwoing as the clk_type argument.
- * GmacTSOrdClk = 0x00000000, 00=> Ordinary clock
- * GmacTSBouClk = 0x00010000, 01=> Boundary clock
- * GmacTSEtoEClk = 0x00020000, 10=> End-to-End transparent clock
- * GmacTSPtoPClk = 0x00030000, 11=> P-to-P transparent clock
+ * GmacTSOrdClk = 0x00000000, 00=> Ordinary clock
+ * GmacTSBouClk = 0x00010000, 01=> Boundary clock
+ * GmacTSEtoEClk = 0x00020000, 10=> End-to-End transparent clock
+ * GmacTSPtoPClk = 0x00030000, 11=> P-to-P transparent clock
* @param[in] pointer to synopGMACdevice
* @param[in] u32 value representing one of the above clk value
* \return returns void
*/
void synopGMAC_TS_set_clk_type(synopGMACdevice *gmacdev, u32 clk_type)
{
- u32 clkval;
- clkval = synopGMACReadReg(gmacdev->MacBase,GmacTSControl); //set the mdc clock to the user defined value
- clkval = clkval | clk_type;
- synopGMACWriteReg(gmacdev->MacBase,GmacTSControl,clkval);
- return;
+ u32 clkval;
+ clkval = synopGMACReadReg(gmacdev->MacBase,GmacTSControl); //set the mdc clock to the user defined value
+ clkval = clkval | clk_type;
+ synopGMACWriteReg(gmacdev->MacBase,GmacTSControl,clkval);
+ return;
}
/**
- * Enable Snapshot for messages relevant to Master.
- * When enabled, snapshot is taken for messages relevant to master mode only, else snapshot is taken for messages relevant
- * to slave node.
+ * Enable Snapshot for messages relevant to Master.
+ * When enabled, snapshot is taken for messages relevant to master mode only, else snapshot is taken for messages relevant
+ * to slave node.
* Valid only for Ordinary clock and Boundary clock
* Reserved when "Advanced Time Stamp" is not selected
* @param[in] pointer to synopGMACdevice
@@ -3302,13 +3302,13 @@ void synopGMAC_TS_set_clk_type(synopGMACdevice *gmacdev, u32 clk_type)
*/
void synopGMAC_TS_master_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSMSTRENA);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSMSTRENA);
+ return;
}
/**
- * Disable Snapshot for messages relevant to Master.
- * When disabled, snapshot is taken for messages relevant
- * to slave node.
+ * Disable Snapshot for messages relevant to Master.
+ * When disabled, snapshot is taken for messages relevant
+ * to slave node.
* Valid only for Ordinary clock and Boundary clock
* Reserved when "Advanced Time Stamp" is not selected
* @param[in] pointer to synopGMACdevice
@@ -3316,11 +3316,11 @@ void synopGMAC_TS_master_enable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_master_disable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSMSTRENA);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSMSTRENA);
+ return;
}
/**
- * Enable Snapshot for Event messages.
+ * Enable Snapshot for Event messages.
* When enabled, snapshot is taken for event messages only (SYNC, Delay_Req, Pdelay_Req or Pdelay_Resp)
* When disabled, snapshot is taken for all messages except Announce, Management and Signaling.
* Reserved when "Advanced Time Stamp" is not selected
@@ -3329,11 +3329,11 @@ void synopGMAC_TS_master_disable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_event_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSEVNTENA);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSEVNTENA);
+ return;
}
/**
- * Disable Snapshot for Event messages.
+ * Disable Snapshot for Event messages.
* When disabled, snapshot is taken for all messages except Announce, Management and Signaling.
* Reserved when "Advanced Time Stamp" is not selected
* @param[in] pointer to synopGMACdevice
@@ -3341,12 +3341,12 @@ void synopGMAC_TS_event_enable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_event_disable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSEVNTENA);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSEVNTENA);
+ return;
}
/**
- * Enable time stamp snapshot for IPV4 frames.
+ * Enable time stamp snapshot for IPV4 frames.
* When enabled, time stamp snapshot is taken for IPV4 frames
* Reserved when "Advanced Time Stamp" is not selected
* @param[in] pointer to synopGMACdevice
@@ -3354,11 +3354,11 @@ void synopGMAC_TS_event_disable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_IPV4_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSIPV4ENA);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSIPV4ENA);
+ return;
}
/**
- * Disable time stamp snapshot for IPV4 frames.
+ * Disable time stamp snapshot for IPV4 frames.
* When disabled, time stamp snapshot is not taken for IPV4 frames
* Reserved when "Advanced Time Stamp" is not selected
* @param[in] pointer to synopGMACdevice
@@ -3366,11 +3366,11 @@ void synopGMAC_TS_IPV4_enable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_IPV4_disable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSIPV4ENA);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSIPV4ENA);
+ return;
} // Only for "Advanced Time Stamp"
/**
- * Enable time stamp snapshot for IPV6 frames.
+ * Enable time stamp snapshot for IPV6 frames.
* When enabled, time stamp snapshot is taken for IPV6 frames
* Reserved when "Advanced Time Stamp" is not selected
* @param[in] pointer to synopGMACdevice
@@ -3378,11 +3378,11 @@ void synopGMAC_TS_IPV4_disable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_IPV6_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSIPV6ENA);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSIPV6ENA);
+ return;
}
/**
- * Disable time stamp snapshot for IPV6 frames.
+ * Disable time stamp snapshot for IPV6 frames.
* When disabled, time stamp snapshot is not taken for IPV6 frames
* Reserved when "Advanced Time Stamp" is not selected
* @param[in] pointer to synopGMACdevice
@@ -3390,12 +3390,12 @@ void synopGMAC_TS_IPV6_enable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_IPV6_disable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSIPV6ENA);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSIPV6ENA);
+ return;
}
/**
- * Enable time stamp snapshot for PTP over Ethernet frames.
+ * Enable time stamp snapshot for PTP over Ethernet frames.
* When enabled, time stamp snapshot is taken for PTP over Ethernet frames
* Reserved when "Advanced Time Stamp" is not selected
* @param[in] pointer to synopGMACdevice
@@ -3403,11 +3403,11 @@ void synopGMAC_TS_IPV6_disable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_ptp_over_ethernet_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSIPENA);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSIPENA);
+ return;
}
/**
- * Disable time stamp snapshot for PTP over Ethernet frames.
+ * Disable time stamp snapshot for PTP over Ethernet frames.
* When disabled, time stamp snapshot is not taken for PTP over Ethernet frames
* Reserved when "Advanced Time Stamp" is not selected
* @param[in] pointer to synopGMACdevice
@@ -3415,58 +3415,58 @@ void synopGMAC_TS_ptp_over_ethernet_enable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_ptp_over_ethernet_disable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSIPENA);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSIPENA);
+ return;
}
/**
- * Snoop PTP packet for version 2 format
+ * Snoop PTP packet for version 2 format
* When set the PTP packets are snooped using the version 2 format.
* @param[in] pointer to synopGMACdevice
* \return returns void
*/
void synopGMAC_TS_pkt_snoop_ver2(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSVER2ENA);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSVER2ENA);
+ return;
}
/**
- * Snoop PTP packet for version 2 format
+ * Snoop PTP packet for version 2 format
* When set the PTP packets are snooped using the version 2 format.
* @param[in] pointer to synopGMACdevice
* \return returns void
*/
void synopGMAC_TS_pkt_snoop_ver1(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSVER2ENA);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSVER2ENA);
+ return;
}
/**
- * Timestamp digital rollover
+ * Timestamp digital rollover
* When set the timestamp low register rolls over after 0x3B9A_C9FF value.
* @param[in] pointer to synopGMACdevice
* \return returns void
*/
void synopGMAC_TS_digital_rollover_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSCTRLSSR);
- return;
-}
+ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSCTRLSSR);
+ return;
+}
/**
- * Timestamp binary rollover
+ * Timestamp binary rollover
* When set the timestamp low register rolls over after 0x7FFF_FFFF value.
* @param[in] pointer to synopGMACdevice
* \return returns void
*/
void synopGMAC_TS_binary_rollover_enable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSCTRLSSR);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSCTRLSSR);
+ return;
}
/**
- * Enable Time Stamp for All frames
+ * Enable Time Stamp for All frames
* When set the timestamp snap shot is enabled for all frames received by the core.
* Reserved when "Advanced Time Stamp" is not selected
* @param[in] pointer to synopGMACdevice
@@ -3474,11 +3474,11 @@ void synopGMAC_TS_binary_rollover_enable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_all_frames_enable(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSENALL);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSENALL);
+ return;
}
/**
- * Disable Time Stamp for All frames
+ * Disable Time Stamp for All frames
* When reset the timestamp snap shot is not enabled for all frames received by the core.
* Reserved when "Advanced Time Stamp" is not selected
* @param[in] pointer to synopGMACdevice
@@ -3486,11 +3486,11 @@ void synopGMAC_TS_all_frames_enable(synopGMACdevice *gmacdev)
*/
void synopGMAC_TS_all_frames_disable(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSENALL);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSENALL);
+ return;
}
/**
- * Addend Register Update
+ * Addend Register Update
* This function loads the contents of Time stamp addend register with the supplied 32 value.
* This is reserved function when only coarse correction option is selected
* @param[in] pointer to synopGMACdevice
@@ -3499,25 +3499,25 @@ void synopGMAC_TS_all_frames_disable(synopGMACdevice *gmacdev)
*/
s32 synopGMAC_TS_addend_update(synopGMACdevice *gmacdev, u32 addend_value)
{
- u32 loop_variable;
+ u32 loop_variable;
synopGMACWriteReg(gmacdev->MacBase,GmacTSAddend,addend_value);// Load the addend_value in to Addend register
for(loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++){ //Wait till the busy bit gets cleared with in a certain amount of time
- if(!((synopGMACReadReg(gmacdev->MacBase,GmacTSControl)) & GmacTSADDREG)){ // if it is cleared then break
- break;
- }
+ if(!((synopGMACReadReg(gmacdev->MacBase,GmacTSControl)) & GmacTSADDREG)){ // if it is cleared then break
+ break;
+ }
plat_delay(DEFAULT_DELAY_VARIABLE);
}
if(loop_variable < DEFAULT_LOOP_VARIABLE)
synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSADDREG);
else{
TR("Error::: The TSADDREG bit is not getting cleared !!!!!!\n");
- return -ESYNOPGMACPHYERR;
+ return -ESYNOPGMACPHYERR;
}
return -ESYNOPGMACNOERR;
}
/**
- * time stamp Update
+ * time stamp Update
* This function updates (adds/subtracts) with the value specified in the Timestamp High Update and
* Timestamp Low Update register.
* @param[in] pointer to synopGMACdevice
@@ -3527,26 +3527,26 @@ return -ESYNOPGMACNOERR;
*/
s32 synopGMAC_TS_timestamp_update(synopGMACdevice *gmacdev, u32 high_value, u32 low_value)
{
- u32 loop_variable;
+ u32 loop_variable;
synopGMACWriteReg(gmacdev->MacBase,GmacTSHighUpdate,high_value);// Load the high value to Timestamp High register
synopGMACWriteReg(gmacdev->MacBase,GmacTSLowUpdate,low_value);// Load the high value to Timestamp High register
for(loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++){ //Wait till the busy bit gets cleared with in a certain amount of time
- if(!((synopGMACReadReg(gmacdev->MacBase,GmacTSControl)) & GmacTSUPDT)){ // if it is cleared then break
- break;
- }
+ if(!((synopGMACReadReg(gmacdev->MacBase,GmacTSControl)) & GmacTSUPDT)){ // if it is cleared then break
+ break;
+ }
plat_delay(DEFAULT_DELAY_VARIABLE);
}
if(loop_variable < DEFAULT_LOOP_VARIABLE)
synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSUPDT);
else{
TR("Error::: The TSADDREG bit is not getting cleared !!!!!!\n");
- return -ESYNOPGMACPHYERR;
+ return -ESYNOPGMACPHYERR;
}
return -ESYNOPGMACNOERR;
}
/**
- * time stamp Initialize
+ * time stamp Initialize
* This function Loads/Initializes h the value specified in the Timestamp High Update and
* Timestamp Low Update register.
* @param[in] pointer to synopGMACdevice
@@ -3556,59 +3556,59 @@ return -ESYNOPGMACNOERR;
*/
s32 synopGMAC_TS_timestamp_init(synopGMACdevice *gmacdev, u32 high_value, u32 low_value)
{
- u32 loop_variable;
+ u32 loop_variable;
synopGMACWriteReg(gmacdev->MacBase,GmacTSHighUpdate,high_value);// Load the high value to Timestamp High register
synopGMACWriteReg(gmacdev->MacBase,GmacTSLowUpdate,low_value);// Load the high value to Timestamp High register
for(loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++){ //Wait till the busy bit gets cleared with in a certain amount of time
- if(!((synopGMACReadReg(gmacdev->MacBase,GmacTSControl)) & GmacTSINT)){ // if it is cleared then break
- break;
- }
+ if(!((synopGMACReadReg(gmacdev->MacBase,GmacTSControl)) & GmacTSINT)){ // if it is cleared then break
+ break;
+ }
plat_delay(DEFAULT_DELAY_VARIABLE);
}
if(loop_variable < DEFAULT_LOOP_VARIABLE)
synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSINT);
else{
TR("Error::: The TSADDREG bit is not getting cleared !!!!!!\n");
- return -ESYNOPGMACPHYERR;
+ return -ESYNOPGMACPHYERR;
}
return -ESYNOPGMACNOERR;
}
/**
- * Time Stamp Update Coarse
+ * Time Stamp Update Coarse
* When reset the timestamp update is done using coarse method.
* @param[in] pointer to synopGMACdevice
* \return returns void
*/
void synopGMAC_TS_coarse_update(synopGMACdevice *gmacdev)
{
- synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSCFUPDT);
- return;
+ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSCFUPDT);
+ return;
}
/**
- * Time Stamp Update Fine
+ * Time Stamp Update Fine
* When reset the timestamp update is done using Fine method.
* @param[in] pointer to synopGMACdevice
* \return returns void
*/
void synopGMAC_TS_fine_update(synopGMACdevice *gmacdev)
{
- synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSCFUPDT);
- return;
+ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSCFUPDT);
+ return;
}
/**
- * Load the Sub Second Increment value in to Sub Second increment register
+ * Load the Sub Second Increment value in to Sub Second increment register
* @param[in] pointer to synopGMACdevice
* \return returns void
*/
void synopGMAC_TS_subsecond_init(synopGMACdevice *gmacdev, u32 sub_sec_inc_value)
{
- synopGMACWriteReg(gmacdev->MacBase,GmacTSSubSecIncr,(sub_sec_inc_value & GmacSSINCMsk));
- return;
+ synopGMACWriteReg(gmacdev->MacBase,GmacTSSubSecIncr,(sub_sec_inc_value & GmacSSINCMsk));
+ return;
}
/**
- * Reads the time stamp contents in to the respective pointers
+ * Reads the time stamp contents in to the respective pointers
* These registers are readonly.
* This function returns the 48 bit time stamp assuming Version 2 timestamp with higher word is selected.
* @param[in] pointer to synopGMACdevice
@@ -3616,40 +3616,40 @@ void synopGMAC_TS_subsecond_init(synopGMACdevice *gmacdev, u32 sub_sec_inc_value
* @param[in] pointer to hold 32 bit second register contents
* @param[in] pointer to hold 32 bit subnanosecond register contents
* \return returns void
- * \note Please note that since the atomic access to the timestamp registers is not possible,
- * the contents read may be different from the actual time stamp.
+ * \note Please note that since the atomic access to the timestamp registers is not possible,
+ * the contents read may be different from the actual time stamp.
*/
void synopGMAC_TS_read_timestamp(synopGMACdevice *gmacdev, u16 * higher_sec_val, u32 * sec_val, u32 * sub_sec_val)
{
- * higher_sec_val = (u16)(synopGMACReadReg(gmacdev->MacBase,GmacTSHighWord) & GmacTSHighWordMask);
+ * higher_sec_val = (u16)(synopGMACReadReg(gmacdev->MacBase,GmacTSHighWord) & GmacTSHighWordMask);
* sec_val = synopGMACReadReg(gmacdev->MacBase,GmacTSHigh);
* sub_sec_val = synopGMACReadReg(gmacdev->MacBase,GmacTSLow);
- return;
+ return;
}
/**
- * Loads the time stamp higher sec value from the value supplied
+ * Loads the time stamp higher sec value from the value supplied
* @param[in] pointer to synopGMACdevice
* @param[in] 16 higher bit second register contents passed as 32 bit value
* \return returns void
*/
void synopGMAC_TS_load_timestamp_higher_val(synopGMACdevice *gmacdev, u32 higher_sec_val)
{
- synopGMACWriteReg(gmacdev->MacBase,GmacTSHighWord, (higher_sec_val & GmacTSHighWordMask));
- return;
+ synopGMACWriteReg(gmacdev->MacBase,GmacTSHighWord, (higher_sec_val & GmacTSHighWordMask));
+ return;
}
/**
- * Reads the time stamp higher sec value to respective pointers
+ * Reads the time stamp higher sec value to respective pointers
* @param[in] pointer to synopGMACdevice
* @param[in] pointer to hold 16 higher bit second register contents
* \return returns void
*/
void synopGMAC_TS_read_timestamp_higher_val(synopGMACdevice *gmacdev, u16 * higher_sec_val)
{
- * higher_sec_val = (u16)(synopGMACReadReg(gmacdev->MacBase,GmacTSHighWord) & GmacTSHighWordMask);
- return;
+ * higher_sec_val = (u16)(synopGMACReadReg(gmacdev->MacBase,GmacTSHighWord) & GmacTSHighWordMask);
+ return;
}
/**
- * Load the Target time stamp registers
+ * Load the Target time stamp registers
* This function Loads the target time stamp registers with the values proviced
* @param[in] pointer to synopGMACdevice
* @param[in] target Timestamp High value
@@ -3658,12 +3658,12 @@ void synopGMAC_TS_read_timestamp_higher_val(synopGMACdevice *gmacdev, u16 * high
*/
void synopGMAC_TS_load_target_timestamp(synopGMACdevice *gmacdev, u32 sec_val, u32 sub_sec_val)
{
- synopGMACWriteReg(gmacdev->MacBase,GmacTSTargetTimeHigh,sec_val);
- synopGMACWriteReg(gmacdev->MacBase,GmacTSTargetTimeLow,sub_sec_val);
- return;
+ synopGMACWriteReg(gmacdev->MacBase,GmacTSTargetTimeHigh,sec_val);
+ synopGMACWriteReg(gmacdev->MacBase,GmacTSTargetTimeLow,sub_sec_val);
+ return;
}
/**
- * Reads the Target time stamp registers
+ * Reads the Target time stamp registers
* This function Loads the target time stamp registers with the values proviced
* @param[in] pointer to synopGMACdevice
* @param[in] pointer to hold target Timestamp High value
@@ -3672,8 +3672,8 @@ void synopGMAC_TS_load_target_timestamp(synopGMACdevice *gmacdev, u32 sec_val, u
*/
void synopGMAC_TS_read_target_timestamp(synopGMACdevice *gmacdev, u32 * sec_val, u32 * sub_sec_val)
{
- * sec_val = synopGMACReadReg(gmacdev->MacBase,GmacTSTargetTimeHigh);
- * sub_sec_val = synopGMACReadReg(gmacdev->MacBase,GmacTSTargetTimeLow);
- return;
+ * sec_val = synopGMACReadReg(gmacdev->MacBase,GmacTSTargetTimeHigh);
+ * sub_sec_val = synopGMACReadReg(gmacdev->MacBase,GmacTSTargetTimeLow);
+ return;
}
#endif