diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-06-01 19:54:16 -0400 |
---|---|---|
committer | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-06-12 02:40:37 -0400 |
commit | 773fc3ee7ef47081c018c964829b660d6be9ee01 (patch) | |
tree | 63cd9782ae0312cf044b2bd64ce8bc81002259ee /drivers/net/mv643xx_eth.c | |
parent | 226bb6b732f8c2cc7004279c509333fa41186a6d (diff) |
mv643xx_eth: detect extended rx coal register field
Newer hardware has a 16-bit instead of a 14-bit RX coalescing
count field in the SDMA_CONFIG register. This patch adds a run-time
check for which of the two we have, and adjusts further writes to the
rx coal count field accordingly.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Acked-by: Dale Farnsworth <dale@farnsworth.org>
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r-- | drivers/net/mv643xx_eth.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index c99915740779..296687baccf7 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -249,6 +249,7 @@ struct mv643xx_eth_shared_private { | |||
249 | * Hardware-specific parameters. | 249 | * Hardware-specific parameters. |
250 | */ | 250 | */ |
251 | unsigned int t_clk; | 251 | unsigned int t_clk; |
252 | int extended_rx_coal_limit; | ||
252 | }; | 253 | }; |
253 | 254 | ||
254 | 255 | ||
@@ -1815,14 +1816,22 @@ static void port_start(struct mv643xx_eth_private *mp) | |||
1815 | static void set_rx_coal(struct mv643xx_eth_private *mp, unsigned int delay) | 1816 | static void set_rx_coal(struct mv643xx_eth_private *mp, unsigned int delay) |
1816 | { | 1817 | { |
1817 | unsigned int coal = ((mp->shared->t_clk / 1000000) * delay) / 64; | 1818 | unsigned int coal = ((mp->shared->t_clk / 1000000) * delay) / 64; |
1819 | u32 val; | ||
1818 | 1820 | ||
1819 | if (coal > 0x3fff) | 1821 | val = rdl(mp, SDMA_CONFIG(mp->port_num)); |
1820 | coal = 0x3fff; | 1822 | if (mp->shared->extended_rx_coal_limit) { |
1821 | 1823 | if (coal > 0xffff) | |
1822 | wrl(mp, SDMA_CONFIG(mp->port_num), | 1824 | coal = 0xffff; |
1823 | ((coal & 0x3fff) << 8) | | 1825 | val &= ~0x023fff80; |
1824 | (rdl(mp, SDMA_CONFIG(mp->port_num)) | 1826 | val |= (coal & 0x8000) << 10; |
1825 | & 0xffc000ff)); | 1827 | val |= (coal & 0x7fff) << 7; |
1828 | } else { | ||
1829 | if (coal > 0x3fff) | ||
1830 | coal = 0x3fff; | ||
1831 | val &= ~0x003fff00; | ||
1832 | val |= (coal & 0x3fff) << 8; | ||
1833 | } | ||
1834 | wrl(mp, SDMA_CONFIG(mp->port_num), val); | ||
1826 | } | 1835 | } |
1827 | 1836 | ||
1828 | static void set_tx_coal(struct mv643xx_eth_private *mp, unsigned int delay) | 1837 | static void set_tx_coal(struct mv643xx_eth_private *mp, unsigned int delay) |
@@ -2087,6 +2096,20 @@ mv643xx_eth_conf_mbus_windows(struct mv643xx_eth_shared_private *msp, | |||
2087 | msp->win_protect = win_protect; | 2096 | msp->win_protect = win_protect; |
2088 | } | 2097 | } |
2089 | 2098 | ||
2099 | static void infer_hw_params(struct mv643xx_eth_shared_private *msp) | ||
2100 | { | ||
2101 | /* | ||
2102 | * Check whether we have a 14-bit coal limit field in bits | ||
2103 | * [21:8], or a 16-bit coal limit in bits [25,21:7] of the | ||
2104 | * SDMA config register. | ||
2105 | */ | ||
2106 | writel(0x02000000, msp->base + SDMA_CONFIG(0)); | ||
2107 | if (readl(msp->base + SDMA_CONFIG(0)) & 0x02000000) | ||
2108 | msp->extended_rx_coal_limit = 1; | ||
2109 | else | ||
2110 | msp->extended_rx_coal_limit = 0; | ||
2111 | } | ||
2112 | |||
2090 | static int mv643xx_eth_shared_probe(struct platform_device *pdev) | 2113 | static int mv643xx_eth_shared_probe(struct platform_device *pdev) |
2091 | { | 2114 | { |
2092 | static int mv643xx_eth_version_printed = 0; | 2115 | static int mv643xx_eth_version_printed = 0; |
@@ -2125,6 +2148,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev) | |||
2125 | * Detect hardware parameters. | 2148 | * Detect hardware parameters. |
2126 | */ | 2149 | */ |
2127 | msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000; | 2150 | msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000; |
2151 | infer_hw_params(msp); | ||
2128 | 2152 | ||
2129 | platform_set_drvdata(pdev, msp); | 2153 | platform_set_drvdata(pdev, msp); |
2130 | 2154 | ||