|
@@ -883,6 +883,7 @@ static int prueth_emac_start(struct prueth *prueth, struct prueth_emac *emac)
|
|
|
config->num_tx_threads = 0;
|
|
config->num_tx_threads = 0;
|
|
|
config->rx_flow_id = emac->rx_flow_id_base; /* flow id for host port */
|
|
config->rx_flow_id = emac->rx_flow_id_base; /* flow id for host port */
|
|
|
config->rx_mgr_flow_id = emac->rx_mgm_flow_id_base; /* for mgm ch */
|
|
config->rx_mgr_flow_id = emac->rx_mgm_flow_id_base; /* for mgm ch */
|
|
|
|
|
+ config->rand_seed = get_random_int();
|
|
|
|
|
|
|
|
/* set buffer sizes for the pools. 0-7 are not used for dual-emac */
|
|
/* set buffer sizes for the pools. 0-7 are not used for dual-emac */
|
|
|
for (i = PRUETH_EMAC_BUF_POOL_START;
|
|
for (i = PRUETH_EMAC_BUF_POOL_START;
|
|
@@ -937,9 +938,9 @@ static void emac_adjust_link(struct net_device *ndev)
|
|
|
{
|
|
{
|
|
|
struct prueth_emac *emac = netdev_priv(ndev);
|
|
struct prueth_emac *emac = netdev_priv(ndev);
|
|
|
struct phy_device *phydev = emac->phydev;
|
|
struct phy_device *phydev = emac->phydev;
|
|
|
- bool gig_en = false, full_duplex = false;
|
|
|
|
|
struct prueth *prueth = emac->prueth;
|
|
struct prueth *prueth = emac->prueth;
|
|
|
int slice = prueth_emac_slice(emac);
|
|
int slice = prueth_emac_slice(emac);
|
|
|
|
|
+ bool full_duplex = false;
|
|
|
bool new_state = false;
|
|
bool new_state = false;
|
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
|
@@ -963,11 +964,7 @@ static void emac_adjust_link(struct net_device *ndev)
|
|
|
new_state = true;
|
|
new_state = true;
|
|
|
emac->link = 0;
|
|
emac->link = 0;
|
|
|
/* defaults for no link */
|
|
/* defaults for no link */
|
|
|
-
|
|
|
|
|
- /* f/w should support 100 & 1000 */
|
|
|
|
|
emac->speed = SPEED_1000;
|
|
emac->speed = SPEED_1000;
|
|
|
-
|
|
|
|
|
- /* half duplex may not be supported by f/w */
|
|
|
|
|
emac->duplex = DUPLEX_FULL;
|
|
emac->duplex = DUPLEX_FULL;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -978,21 +975,29 @@ static void emac_adjust_link(struct net_device *ndev)
|
|
|
* values
|
|
* values
|
|
|
*/
|
|
*/
|
|
|
if (emac->link) {
|
|
if (emac->link) {
|
|
|
- if (phydev->speed == SPEED_1000)
|
|
|
|
|
- gig_en = true;
|
|
|
|
|
-
|
|
|
|
|
if (phydev->duplex == DUPLEX_FULL)
|
|
if (phydev->duplex == DUPLEX_FULL)
|
|
|
full_duplex = true;
|
|
full_duplex = true;
|
|
|
|
|
|
|
|
|
|
+ if (!full_duplex) {
|
|
|
|
|
+ void __iomem *va = prueth->shram.va +
|
|
|
|
|
+ slice * ICSSG_CONFIG_OFFSET_SLICE1;
|
|
|
|
|
+ struct icssg_config *config =
|
|
|
|
|
+ (struct icssg_config *)va;
|
|
|
|
|
+ u32 val = get_random_int();
|
|
|
|
|
+
|
|
|
|
|
+ writel(val, &config->rand_seed);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/* Set the RGMII cfg for gig en and full duplex */
|
|
/* Set the RGMII cfg for gig en and full duplex */
|
|
|
- icssg_update_rgmii_cfg(prueth->miig_rt, gig_en,
|
|
|
|
|
|
|
+ icssg_update_rgmii_cfg(prueth->miig_rt, emac->speed,
|
|
|
full_duplex, slice);
|
|
full_duplex, slice);
|
|
|
|
|
+
|
|
|
/* update the Tx IPG based on 100M/1G speed */
|
|
/* update the Tx IPG based on 100M/1G speed */
|
|
|
icssg_update_mii_rt_cfg(prueth->mii_rt, emac->speed,
|
|
icssg_update_mii_rt_cfg(prueth->mii_rt, emac->speed,
|
|
|
slice);
|
|
slice);
|
|
|
} else {
|
|
} else {
|
|
|
- icssg_update_rgmii_cfg(prueth->miig_rt, true, true,
|
|
|
|
|
- slice);
|
|
|
|
|
|
|
+ icssg_update_rgmii_cfg(prueth->miig_rt, emac->speed,
|
|
|
|
|
+ true, slice);
|
|
|
icssg_update_mii_rt_cfg(prueth->mii_rt, emac->speed,
|
|
icssg_update_mii_rt_cfg(prueth->mii_rt, emac->speed,
|
|
|
slice);
|
|
slice);
|
|
|
}
|
|
}
|