aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2008-04-23 19:27:32 -0400
committerDale Farnsworth <dale@farnsworth.org>2008-04-29 00:17:07 -0400
commitc416a41f99be190e1f558cb06f70ddd560ce8b4b (patch)
tree6cd9c1dc012066bc33f734264de72e9794b26808 /drivers
parentf2ce825d2a89b30af14fa577298fecaab7bc9504 (diff)
mv643xx_eth: configurable t_clk
Make t_clk configurable via platform device data (with the current hardcoded value, 133 MHz, being the default), as it varies across different chip families. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Nicolas Pitre <nico@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/mv643xx_eth.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index aabf1c60946d..8bd41e4e88a9 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -519,6 +519,8 @@ struct mv643xx_shared_private {
519 spinlock_t phy_lock; 519 spinlock_t phy_lock;
520 520
521 u32 win_protect; 521 u32 win_protect;
522
523 unsigned int t_clk;
522}; 524};
523 525
524struct mv643xx_private { 526struct mv643xx_private {
@@ -1129,7 +1131,6 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id)
1129 * 1131 *
1130 * INPUT: 1132 * INPUT:
1131 * struct mv643xx_private *mp Ethernet port 1133 * struct mv643xx_private *mp Ethernet port
1132 * unsigned int t_clk t_clk of the MV-643xx chip in HZ units
1133 * unsigned int delay Delay in usec 1134 * unsigned int delay Delay in usec
1134 * 1135 *
1135 * OUTPUT: 1136 * OUTPUT:
@@ -1140,10 +1141,10 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id)
1140 * 1141 *
1141 */ 1142 */
1142static unsigned int eth_port_set_rx_coal(struct mv643xx_private *mp, 1143static unsigned int eth_port_set_rx_coal(struct mv643xx_private *mp,
1143 unsigned int t_clk, unsigned int delay) 1144 unsigned int delay)
1144{ 1145{
1145 unsigned int port_num = mp->port_num; 1146 unsigned int port_num = mp->port_num;
1146 unsigned int coal = ((t_clk / 1000000) * delay) / 64; 1147 unsigned int coal = ((mp->shared->t_clk / 1000000) * delay) / 64;
1147 1148
1148 /* Set RX Coalescing mechanism */ 1149 /* Set RX Coalescing mechanism */
1149 wrl(mp, SDMA_CONFIG_REG(port_num), 1150 wrl(mp, SDMA_CONFIG_REG(port_num),
@@ -1168,7 +1169,6 @@ static unsigned int eth_port_set_rx_coal(struct mv643xx_private *mp,
1168 * 1169 *
1169 * INPUT: 1170 * INPUT:
1170 * struct mv643xx_private *mp Ethernet port 1171 * struct mv643xx_private *mp Ethernet port
1171 * unsigned int t_clk t_clk of the MV-643xx chip in HZ units
1172 * unsigned int delay Delay in uSeconds 1172 * unsigned int delay Delay in uSeconds
1173 * 1173 *
1174 * OUTPUT: 1174 * OUTPUT:
@@ -1179,9 +1179,9 @@ static unsigned int eth_port_set_rx_coal(struct mv643xx_private *mp,
1179 * 1179 *
1180 */ 1180 */
1181static unsigned int eth_port_set_tx_coal(struct mv643xx_private *mp, 1181static unsigned int eth_port_set_tx_coal(struct mv643xx_private *mp,
1182 unsigned int t_clk, unsigned int delay) 1182 unsigned int delay)
1183{ 1183{
1184 unsigned int coal = ((t_clk / 1000000) * delay) / 64; 1184 unsigned int coal = ((mp->shared->t_clk / 1000000) * delay) / 64;
1185 1185
1186 /* Set TX Coalescing mechanism */ 1186 /* Set TX Coalescing mechanism */
1187 wrl(mp, TX_FIFO_URGENT_THRESHOLD_REG(mp->port_num), coal << 4); 1187 wrl(mp, TX_FIFO_URGENT_THRESHOLD_REG(mp->port_num), coal << 4);
@@ -1423,11 +1423,11 @@ static int mv643xx_eth_open(struct net_device *dev)
1423 1423
1424#ifdef MV643XX_COAL 1424#ifdef MV643XX_COAL
1425 mp->rx_int_coal = 1425 mp->rx_int_coal =
1426 eth_port_set_rx_coal(mp, 133000000, MV643XX_RX_COAL); 1426 eth_port_set_rx_coal(mp, MV643XX_RX_COAL);
1427#endif 1427#endif
1428 1428
1429 mp->tx_int_coal = 1429 mp->tx_int_coal =
1430 eth_port_set_tx_coal(mp, 133000000, MV643XX_TX_COAL); 1430 eth_port_set_tx_coal(mp, MV643XX_TX_COAL);
1431 1431
1432 /* Unmask phy and link status changes interrupts */ 1432 /* Unmask phy and link status changes interrupts */
1433 wrl(mp, INTERRUPT_EXTEND_MASK_REG(port_num), ETH_INT_UNMASK_ALL_EXT); 1433 wrl(mp, INTERRUPT_EXTEND_MASK_REG(port_num), ETH_INT_UNMASK_ALL_EXT);
@@ -2063,6 +2063,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
2063 goto out_free; 2063 goto out_free;
2064 2064
2065 spin_lock_init(&msp->phy_lock); 2065 spin_lock_init(&msp->phy_lock);
2066 msp->t_clk = (pd != NULL && pd->t_clk != 0) ? pd->t_clk : 133000000;
2066 2067
2067 platform_set_drvdata(pdev, msp); 2068 platform_set_drvdata(pdev, msp);
2068 2069