diff options
author | David S. Miller <davem@davemloft.net> | 2009-11-29 03:57:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-29 03:57:15 -0500 |
commit | 9b963e5d0e01461099a40117b05480f24b63381f (patch) | |
tree | 4756d554e37bf4ab7202f2c564cbe629af98b576 /drivers/net/stmmac | |
parent | 3b8626ba01a8a745a3fdf22dd347edd708b0af13 (diff) | |
parent | 5fdd4baef6195a1f2960e901c8877e2105f832ca (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/ieee802154/fakehard.c
drivers/net/e1000e/ich8lan.c
drivers/net/e1000e/phy.c
drivers/net/netxen/netxen_nic_init.c
drivers/net/wireless/ath/ath9k/main.c
Diffstat (limited to 'drivers/net/stmmac')
-rw-r--r-- | drivers/net/stmmac/stmmac_main.c | 50 | ||||
-rw-r--r-- | drivers/net/stmmac/stmmac_timer.c | 4 | ||||
-rw-r--r-- | drivers/net/stmmac/stmmac_timer.h | 1 |
3 files changed, 31 insertions, 24 deletions
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c index e961e7593c1f..40813f0b5339 100644 --- a/drivers/net/stmmac/stmmac_main.c +++ b/drivers/net/stmmac/stmmac_main.c | |||
@@ -416,13 +416,8 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
416 | unsigned int txsize = priv->dma_tx_size; | 416 | unsigned int txsize = priv->dma_tx_size; |
417 | unsigned int rxsize = priv->dma_rx_size; | 417 | unsigned int rxsize = priv->dma_rx_size; |
418 | unsigned int bfsize = priv->dma_buf_sz; | 418 | unsigned int bfsize = priv->dma_buf_sz; |
419 | int buff2_needed = 0; | 419 | int buff2_needed = 0, dis_ic = 0; |
420 | int dis_ic = 0; | ||
421 | 420 | ||
422 | #ifdef CONFIG_STMMAC_TIMER | ||
423 | /* Using Timers disable interrupts on completion for the reception */ | ||
424 | dis_ic = 1; | ||
425 | #endif | ||
426 | /* Set the Buffer size according to the MTU; | 421 | /* Set the Buffer size according to the MTU; |
427 | * indeed, in case of jumbo we need to bump-up the buffer sizes. | 422 | * indeed, in case of jumbo we need to bump-up the buffer sizes. |
428 | */ | 423 | */ |
@@ -437,6 +432,11 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
437 | else | 432 | else |
438 | bfsize = DMA_BUFFER_SIZE; | 433 | bfsize = DMA_BUFFER_SIZE; |
439 | 434 | ||
435 | #ifdef CONFIG_STMMAC_TIMER | ||
436 | /* Disable interrupts on completion for the reception if timer is on */ | ||
437 | if (likely(priv->tm->enable)) | ||
438 | dis_ic = 1; | ||
439 | #endif | ||
440 | /* If the MTU exceeds 8k so use the second buffer in the chain */ | 440 | /* If the MTU exceeds 8k so use the second buffer in the chain */ |
441 | if (bfsize >= BUF_SIZE_8KiB) | 441 | if (bfsize >= BUF_SIZE_8KiB) |
442 | buff2_needed = 1; | 442 | buff2_needed = 1; |
@@ -809,20 +809,22 @@ static void stmmac_tx(struct stmmac_priv *priv) | |||
809 | 809 | ||
810 | static inline void stmmac_enable_irq(struct stmmac_priv *priv) | 810 | static inline void stmmac_enable_irq(struct stmmac_priv *priv) |
811 | { | 811 | { |
812 | #ifndef CONFIG_STMMAC_TIMER | 812 | #ifdef CONFIG_STMMAC_TIMER |
813 | writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA); | 813 | if (likely(priv->tm->enable)) |
814 | #else | 814 | priv->tm->timer_start(tmrate); |
815 | priv->tm->timer_start(tmrate); | 815 | else |
816 | #endif | 816 | #endif |
817 | writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA); | ||
817 | } | 818 | } |
818 | 819 | ||
819 | static inline void stmmac_disable_irq(struct stmmac_priv *priv) | 820 | static inline void stmmac_disable_irq(struct stmmac_priv *priv) |
820 | { | 821 | { |
821 | #ifndef CONFIG_STMMAC_TIMER | 822 | #ifdef CONFIG_STMMAC_TIMER |
822 | writel(0, priv->dev->base_addr + DMA_INTR_ENA); | 823 | if (likely(priv->tm->enable)) |
823 | #else | 824 | priv->tm->timer_stop(); |
824 | priv->tm->timer_stop(); | 825 | else |
825 | #endif | 826 | #endif |
827 | writel(0, priv->dev->base_addr + DMA_INTR_ENA); | ||
826 | } | 828 | } |
827 | 829 | ||
828 | static int stmmac_has_work(struct stmmac_priv *priv) | 830 | static int stmmac_has_work(struct stmmac_priv *priv) |
@@ -1031,22 +1033,23 @@ static int stmmac_open(struct net_device *dev) | |||
1031 | } | 1033 | } |
1032 | 1034 | ||
1033 | #ifdef CONFIG_STMMAC_TIMER | 1035 | #ifdef CONFIG_STMMAC_TIMER |
1034 | priv->tm = kmalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); | 1036 | priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); |
1035 | if (unlikely(priv->tm == NULL)) { | 1037 | if (unlikely(priv->tm == NULL)) { |
1036 | pr_err("%s: ERROR: timer memory alloc failed \n", __func__); | 1038 | pr_err("%s: ERROR: timer memory alloc failed \n", __func__); |
1037 | return -ENOMEM; | 1039 | return -ENOMEM; |
1038 | } | 1040 | } |
1039 | priv->tm->freq = tmrate; | 1041 | priv->tm->freq = tmrate; |
1040 | 1042 | ||
1041 | /* Test if the HW timer can be actually used. | 1043 | /* Test if the external timer can be actually used. |
1042 | * In case of failure continue with no timer. */ | 1044 | * In case of failure continue without timer. */ |
1043 | if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) { | 1045 | if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) { |
1044 | pr_warning("stmmaceth: cannot attach the HW timer\n"); | 1046 | pr_warning("stmmaceth: cannot attach the external timer.\n"); |
1045 | tmrate = 0; | 1047 | tmrate = 0; |
1046 | priv->tm->freq = 0; | 1048 | priv->tm->freq = 0; |
1047 | priv->tm->timer_start = stmmac_no_timer_started; | 1049 | priv->tm->timer_start = stmmac_no_timer_started; |
1048 | priv->tm->timer_stop = stmmac_no_timer_stopped; | 1050 | priv->tm->timer_stop = stmmac_no_timer_stopped; |
1049 | } | 1051 | } else |
1052 | priv->tm->enable = 1; | ||
1050 | #endif | 1053 | #endif |
1051 | 1054 | ||
1052 | /* Create and initialize the TX/RX descriptors chains. */ | 1055 | /* Create and initialize the TX/RX descriptors chains. */ |
@@ -1322,9 +1325,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1322 | 1325 | ||
1323 | /* Interrupt on completition only for the latest segment */ | 1326 | /* Interrupt on completition only for the latest segment */ |
1324 | priv->mac_type->ops->close_tx_desc(desc); | 1327 | priv->mac_type->ops->close_tx_desc(desc); |
1328 | |||
1325 | #ifdef CONFIG_STMMAC_TIMER | 1329 | #ifdef CONFIG_STMMAC_TIMER |
1326 | /* Clean IC while using timers */ | 1330 | /* Clean IC while using timer */ |
1327 | priv->mac_type->ops->clear_tx_ic(desc); | 1331 | if (likely(priv->tm->enable)) |
1332 | priv->mac_type->ops->clear_tx_ic(desc); | ||
1328 | #endif | 1333 | #endif |
1329 | /* To avoid raise condition */ | 1334 | /* To avoid raise condition */ |
1330 | priv->mac_type->ops->set_tx_owner(first); | 1335 | priv->mac_type->ops->set_tx_owner(first); |
@@ -2028,7 +2033,8 @@ static int stmmac_suspend(struct platform_device *pdev, pm_message_t state) | |||
2028 | 2033 | ||
2029 | #ifdef CONFIG_STMMAC_TIMER | 2034 | #ifdef CONFIG_STMMAC_TIMER |
2030 | priv->tm->timer_stop(); | 2035 | priv->tm->timer_stop(); |
2031 | dis_ic = 1; | 2036 | if (likely(priv->tm->enable)) |
2037 | dis_ic = 1; | ||
2032 | #endif | 2038 | #endif |
2033 | napi_disable(&priv->napi); | 2039 | napi_disable(&priv->napi); |
2034 | 2040 | ||
diff --git a/drivers/net/stmmac/stmmac_timer.c b/drivers/net/stmmac/stmmac_timer.c index b838c6582077..679f61ffb1f8 100644 --- a/drivers/net/stmmac/stmmac_timer.c +++ b/drivers/net/stmmac/stmmac_timer.c | |||
@@ -63,7 +63,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | |||
63 | 63 | ||
64 | stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); | 64 | stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); |
65 | if (stmmac_rtc == NULL) { | 65 | if (stmmac_rtc == NULL) { |
66 | pr_error("open rtc device failed\n"); | 66 | pr_err("open rtc device failed\n"); |
67 | return -ENODEV; | 67 | return -ENODEV; |
68 | } | 68 | } |
69 | 69 | ||
@@ -71,7 +71,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | |||
71 | 71 | ||
72 | /* Periodic mode is not supported */ | 72 | /* Periodic mode is not supported */ |
73 | if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) { | 73 | if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) { |
74 | pr_error("set periodic failed\n"); | 74 | pr_err("set periodic failed\n"); |
75 | rtc_irq_unregister(stmmac_rtc, &stmmac_task); | 75 | rtc_irq_unregister(stmmac_rtc, &stmmac_task); |
76 | rtc_class_close(stmmac_rtc); | 76 | rtc_class_close(stmmac_rtc); |
77 | return -1; | 77 | return -1; |
diff --git a/drivers/net/stmmac/stmmac_timer.h b/drivers/net/stmmac/stmmac_timer.h index f795cae33725..6863590d184b 100644 --- a/drivers/net/stmmac/stmmac_timer.h +++ b/drivers/net/stmmac/stmmac_timer.h | |||
@@ -26,6 +26,7 @@ struct stmmac_timer { | |||
26 | void (*timer_start) (unsigned int new_freq); | 26 | void (*timer_start) (unsigned int new_freq); |
27 | void (*timer_stop) (void); | 27 | void (*timer_stop) (void); |
28 | unsigned int freq; | 28 | unsigned int freq; |
29 | unsigned int enable; | ||
29 | }; | 30 | }; |
30 | 31 | ||
31 | /* Open the HW timer device and return 0 in case of success */ | 32 | /* Open the HW timer device and return 0 in case of success */ |