diff options
author | Mugunthan V N <mugunthanvnm@ti.com> | 2014-07-15 10:56:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-16 02:13:57 -0400 |
commit | a84bc2a9013fb123deeca7283480955d021503fb (patch) | |
tree | a47c93945856394da7790338705130036872c259 | |
parent | ff11d8b27dcd85e7b96ac2570116d5061130bd5e (diff) |
drivers: net: cpsw: disable coalesce when rx_coalesce_usecs is zero
instead of return error on zero rx_coalesce_usecs, disable coalesce
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/ti/cpsw.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index b988d16cd34e..ae6379af5b4d 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -884,14 +884,16 @@ static int cpsw_set_coalesce(struct net_device *ndev, | |||
884 | u32 addnl_dvdr = 1; | 884 | u32 addnl_dvdr = 1; |
885 | u32 coal_intvl = 0; | 885 | u32 coal_intvl = 0; |
886 | 886 | ||
887 | if (!coal->rx_coalesce_usecs) | ||
888 | return -EINVAL; | ||
889 | |||
890 | coal_intvl = coal->rx_coalesce_usecs; | 887 | coal_intvl = coal->rx_coalesce_usecs; |
891 | 888 | ||
892 | int_ctrl = readl(&priv->wr_regs->int_control); | 889 | int_ctrl = readl(&priv->wr_regs->int_control); |
893 | prescale = priv->bus_freq_mhz * 4; | 890 | prescale = priv->bus_freq_mhz * 4; |
894 | 891 | ||
892 | if (!coal->rx_coalesce_usecs) { | ||
893 | int_ctrl &= ~(CPSW_INTPRESCALE_MASK | CPSW_INTPACEEN); | ||
894 | goto update_return; | ||
895 | } | ||
896 | |||
895 | if (coal_intvl < CPSW_CMINTMIN_INTVL) | 897 | if (coal_intvl < CPSW_CMINTMIN_INTVL) |
896 | coal_intvl = CPSW_CMINTMIN_INTVL; | 898 | coal_intvl = CPSW_CMINTMIN_INTVL; |
897 | 899 | ||
@@ -919,6 +921,8 @@ static int cpsw_set_coalesce(struct net_device *ndev, | |||
919 | int_ctrl |= CPSW_INTPACEEN; | 921 | int_ctrl |= CPSW_INTPACEEN; |
920 | int_ctrl &= (~CPSW_INTPRESCALE_MASK); | 922 | int_ctrl &= (~CPSW_INTPRESCALE_MASK); |
921 | int_ctrl |= (prescale & CPSW_INTPRESCALE_MASK); | 923 | int_ctrl |= (prescale & CPSW_INTPRESCALE_MASK); |
924 | |||
925 | update_return: | ||
922 | writel(int_ctrl, &priv->wr_regs->int_control); | 926 | writel(int_ctrl, &priv->wr_regs->int_control); |
923 | 927 | ||
924 | cpsw_notice(priv, timer, "Set coalesce to %d usecs.\n", coal_intvl); | 928 | cpsw_notice(priv, timer, "Set coalesce to %d usecs.\n", coal_intvl); |