diff options
author | Giuseppe CAVALLARO <peppe.cavallaro@st.com> | 2012-11-25 18:10:41 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-26 17:22:10 -0500 |
commit | 7284a3f1ad0d09dcf3cc5a1914ceaf01a3352314 (patch) | |
tree | 4652abd497c5ce9ebd5c95f6a61a6f2fd864abf7 | |
parent | 3872baf6186388b6ed977fcf9620f2a1c0a33235 (diff) |
stmmac: remove dead code for STMMAC_TIMER support
The TIMER option is not longer supported and this
code can be considered dead for this driver in
the new kernel series.
In fact, It was not updated at all and never used.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/Kconfig | 25 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/Makefile | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac.h | 6 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 101 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c | 134 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h | 46 |
6 files changed, 3 insertions, 310 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index 9f448279e12a..1164930a40a5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig | |||
@@ -54,31 +54,6 @@ config STMMAC_DA | |||
54 | By default, the DMA arbitration scheme is based on Round-robin | 54 | By default, the DMA arbitration scheme is based on Round-robin |
55 | (rx:tx priority is 1:1). | 55 | (rx:tx priority is 1:1). |
56 | 56 | ||
57 | config STMMAC_TIMER | ||
58 | bool "STMMAC Timer optimisation" | ||
59 | default n | ||
60 | depends on RTC_HCTOSYS_DEVICE | ||
61 | ---help--- | ||
62 | Use an external timer for mitigating the number of network | ||
63 | interrupts. Currently, for SH architectures, it is possible | ||
64 | to use the TMU channel 2 and the SH-RTC device. | ||
65 | |||
66 | choice | ||
67 | prompt "Select Timer device" | ||
68 | depends on STMMAC_TIMER | ||
69 | |||
70 | config STMMAC_TMU_TIMER | ||
71 | bool "TMU channel 2" | ||
72 | depends on CPU_SH4 | ||
73 | ---help--- | ||
74 | |||
75 | config STMMAC_RTC_TIMER | ||
76 | bool "Real time clock" | ||
77 | depends on RTC_CLASS | ||
78 | ---help--- | ||
79 | |||
80 | endchoice | ||
81 | |||
82 | choice | 57 | choice |
83 | prompt "Select the DMA TX/RX descriptor operating modes" | 58 | prompt "Select the DMA TX/RX descriptor operating modes" |
84 | depends on STMMAC_ETH | 59 | depends on STMMAC_ETH |
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index bc965ac9e025..c8e8ea60ac19 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile | |||
@@ -1,5 +1,4 @@ | |||
1 | obj-$(CONFIG_STMMAC_ETH) += stmmac.o | 1 | obj-$(CONFIG_STMMAC_ETH) += stmmac.o |
2 | stmmac-$(CONFIG_STMMAC_TIMER) += stmmac_timer.o | ||
3 | stmmac-$(CONFIG_STMMAC_RING) += ring_mode.o | 2 | stmmac-$(CONFIG_STMMAC_RING) += ring_mode.o |
4 | stmmac-$(CONFIG_STMMAC_CHAINED) += chain_mode.o | 3 | stmmac-$(CONFIG_STMMAC_CHAINED) += chain_mode.o |
5 | stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o | 4 | stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 7d51a65ab099..5f89415bdbc8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h | |||
@@ -31,9 +31,6 @@ | |||
31 | #include <linux/phy.h> | 31 | #include <linux/phy.h> |
32 | #include <linux/pci.h> | 32 | #include <linux/pci.h> |
33 | #include "common.h" | 33 | #include "common.h" |
34 | #ifdef CONFIG_STMMAC_TIMER | ||
35 | #include "stmmac_timer.h" | ||
36 | #endif | ||
37 | 34 | ||
38 | struct stmmac_priv { | 35 | struct stmmac_priv { |
39 | /* Frequently used values are kept adjacent for cache effect */ | 36 | /* Frequently used values are kept adjacent for cache effect */ |
@@ -77,9 +74,6 @@ struct stmmac_priv { | |||
77 | spinlock_t tx_lock; | 74 | spinlock_t tx_lock; |
78 | int wolopts; | 75 | int wolopts; |
79 | int wol_irq; | 76 | int wol_irq; |
80 | #ifdef CONFIG_STMMAC_TIMER | ||
81 | struct stmmac_timer *tm; | ||
82 | #endif | ||
83 | struct plat_stmmacenet_data *plat; | 77 | struct plat_stmmacenet_data *plat; |
84 | struct stmmac_counters mmc; | 78 | struct stmmac_counters mmc; |
85 | struct dma_features dma_cap; | 79 | struct dma_features dma_cap; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index c6cdbc4eb05e..777234cb30d6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -115,16 +115,6 @@ static int tc = TC_DEFAULT; | |||
115 | module_param(tc, int, S_IRUGO | S_IWUSR); | 115 | module_param(tc, int, S_IRUGO | S_IWUSR); |
116 | MODULE_PARM_DESC(tc, "DMA threshold control value"); | 116 | MODULE_PARM_DESC(tc, "DMA threshold control value"); |
117 | 117 | ||
118 | /* Pay attention to tune this parameter; take care of both | ||
119 | * hardware capability and network stabitily/performance impact. | ||
120 | * Many tests showed that ~4ms latency seems to be good enough. */ | ||
121 | #ifdef CONFIG_STMMAC_TIMER | ||
122 | #define DEFAULT_PERIODIC_RATE 256 | ||
123 | static int tmrate = DEFAULT_PERIODIC_RATE; | ||
124 | module_param(tmrate, int, S_IRUGO | S_IWUSR); | ||
125 | MODULE_PARM_DESC(tmrate, "External timer freq. (default: 256Hz)"); | ||
126 | #endif | ||
127 | |||
128 | #define DMA_BUFFER_SIZE BUF_SIZE_2KiB | 118 | #define DMA_BUFFER_SIZE BUF_SIZE_2KiB |
129 | static int buf_sz = DMA_BUFFER_SIZE; | 119 | static int buf_sz = DMA_BUFFER_SIZE; |
130 | module_param(buf_sz, int, S_IRUGO | S_IWUSR); | 120 | module_param(buf_sz, int, S_IRUGO | S_IWUSR); |
@@ -536,12 +526,6 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
536 | else | 526 | else |
537 | bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz); | 527 | bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz); |
538 | 528 | ||
539 | #ifdef CONFIG_STMMAC_TIMER | ||
540 | /* Disable interrupts on completion for the reception if timer is on */ | ||
541 | if (likely(priv->tm->enable)) | ||
542 | dis_ic = 1; | ||
543 | #endif | ||
544 | |||
545 | DBG(probe, INFO, "stmmac: txsize %d, rxsize %d, bfsize %d\n", | 529 | DBG(probe, INFO, "stmmac: txsize %d, rxsize %d, bfsize %d\n", |
546 | txsize, rxsize, bfsize); | 530 | txsize, rxsize, bfsize); |
547 | 531 | ||
@@ -775,22 +759,12 @@ static void stmmac_tx(struct stmmac_priv *priv) | |||
775 | 759 | ||
776 | static inline void stmmac_enable_irq(struct stmmac_priv *priv) | 760 | static inline void stmmac_enable_irq(struct stmmac_priv *priv) |
777 | { | 761 | { |
778 | #ifdef CONFIG_STMMAC_TIMER | 762 | priv->hw->dma->enable_dma_irq(priv->ioaddr); |
779 | if (likely(priv->tm->enable)) | ||
780 | priv->tm->timer_start(tmrate); | ||
781 | else | ||
782 | #endif | ||
783 | priv->hw->dma->enable_dma_irq(priv->ioaddr); | ||
784 | } | 763 | } |
785 | 764 | ||
786 | static inline void stmmac_disable_irq(struct stmmac_priv *priv) | 765 | static inline void stmmac_disable_irq(struct stmmac_priv *priv) |
787 | { | 766 | { |
788 | #ifdef CONFIG_STMMAC_TIMER | 767 | priv->hw->dma->disable_dma_irq(priv->ioaddr); |
789 | if (likely(priv->tm->enable)) | ||
790 | priv->tm->timer_stop(); | ||
791 | else | ||
792 | #endif | ||
793 | priv->hw->dma->disable_dma_irq(priv->ioaddr); | ||
794 | } | 768 | } |
795 | 769 | ||
796 | static int stmmac_has_work(struct stmmac_priv *priv) | 770 | static int stmmac_has_work(struct stmmac_priv *priv) |
@@ -818,25 +792,6 @@ static inline void _stmmac_schedule(struct stmmac_priv *priv) | |||
818 | } | 792 | } |
819 | } | 793 | } |
820 | 794 | ||
821 | #ifdef CONFIG_STMMAC_TIMER | ||
822 | void stmmac_schedule(struct net_device *dev) | ||
823 | { | ||
824 | struct stmmac_priv *priv = netdev_priv(dev); | ||
825 | |||
826 | priv->xstats.sched_timer_n++; | ||
827 | |||
828 | _stmmac_schedule(priv); | ||
829 | } | ||
830 | |||
831 | static void stmmac_no_timer_started(unsigned int x) | ||
832 | {; | ||
833 | }; | ||
834 | |||
835 | static void stmmac_no_timer_stopped(void) | ||
836 | {; | ||
837 | }; | ||
838 | #endif | ||
839 | |||
840 | /** | 795 | /** |
841 | * stmmac_tx_err: | 796 | * stmmac_tx_err: |
842 | * @priv: pointer to the private device structure | 797 | * @priv: pointer to the private device structure |
@@ -1038,23 +993,6 @@ static int stmmac_open(struct net_device *dev) | |||
1038 | struct stmmac_priv *priv = netdev_priv(dev); | 993 | struct stmmac_priv *priv = netdev_priv(dev); |
1039 | int ret; | 994 | int ret; |
1040 | 995 | ||
1041 | #ifdef CONFIG_STMMAC_TIMER | ||
1042 | priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); | ||
1043 | if (unlikely(priv->tm == NULL)) | ||
1044 | return -ENOMEM; | ||
1045 | |||
1046 | priv->tm->freq = tmrate; | ||
1047 | |||
1048 | /* Test if the external timer can be actually used. | ||
1049 | * In case of failure continue without timer. */ | ||
1050 | if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) { | ||
1051 | pr_warning("stmmaceth: cannot attach the external timer.\n"); | ||
1052 | priv->tm->freq = 0; | ||
1053 | priv->tm->timer_start = stmmac_no_timer_started; | ||
1054 | priv->tm->timer_stop = stmmac_no_timer_stopped; | ||
1055 | } else | ||
1056 | priv->tm->enable = 1; | ||
1057 | #endif | ||
1058 | clk_prepare_enable(priv->stmmac_clk); | 996 | clk_prepare_enable(priv->stmmac_clk); |
1059 | 997 | ||
1060 | stmmac_check_ether_addr(priv); | 998 | stmmac_check_ether_addr(priv); |
@@ -1141,10 +1079,6 @@ static int stmmac_open(struct net_device *dev) | |||
1141 | priv->hw->dma->start_tx(priv->ioaddr); | 1079 | priv->hw->dma->start_tx(priv->ioaddr); |
1142 | priv->hw->dma->start_rx(priv->ioaddr); | 1080 | priv->hw->dma->start_rx(priv->ioaddr); |
1143 | 1081 | ||
1144 | #ifdef CONFIG_STMMAC_TIMER | ||
1145 | priv->tm->timer_start(tmrate); | ||
1146 | #endif | ||
1147 | |||
1148 | /* Dump DMA/MAC registers */ | 1082 | /* Dump DMA/MAC registers */ |
1149 | if (netif_msg_hw(priv)) { | 1083 | if (netif_msg_hw(priv)) { |
1150 | priv->hw->mac->dump_regs(priv->ioaddr); | 1084 | priv->hw->mac->dump_regs(priv->ioaddr); |
@@ -1170,9 +1104,6 @@ open_error_wolirq: | |||
1170 | free_irq(dev->irq, dev); | 1104 | free_irq(dev->irq, dev); |
1171 | 1105 | ||
1172 | open_error: | 1106 | open_error: |
1173 | #ifdef CONFIG_STMMAC_TIMER | ||
1174 | kfree(priv->tm); | ||
1175 | #endif | ||
1176 | if (priv->phydev) | 1107 | if (priv->phydev) |
1177 | phy_disconnect(priv->phydev); | 1108 | phy_disconnect(priv->phydev); |
1178 | 1109 | ||
@@ -1203,12 +1134,6 @@ static int stmmac_release(struct net_device *dev) | |||
1203 | 1134 | ||
1204 | netif_stop_queue(dev); | 1135 | netif_stop_queue(dev); |
1205 | 1136 | ||
1206 | #ifdef CONFIG_STMMAC_TIMER | ||
1207 | /* Stop and release the timer */ | ||
1208 | stmmac_close_ext_timer(); | ||
1209 | if (priv->tm != NULL) | ||
1210 | kfree(priv->tm); | ||
1211 | #endif | ||
1212 | napi_disable(&priv->napi); | 1137 | napi_disable(&priv->napi); |
1213 | 1138 | ||
1214 | /* Free the IRQ lines */ | 1139 | /* Free the IRQ lines */ |
@@ -1323,12 +1248,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1323 | /* Interrupt on completition only for the latest segment */ | 1248 | /* Interrupt on completition only for the latest segment */ |
1324 | priv->hw->desc->close_tx_desc(desc); | 1249 | priv->hw->desc->close_tx_desc(desc); |
1325 | 1250 | ||
1326 | #ifdef CONFIG_STMMAC_TIMER | ||
1327 | /* Clean IC while using timer */ | ||
1328 | if (likely(priv->tm->enable)) | ||
1329 | priv->hw->desc->clear_tx_ic(desc); | ||
1330 | #endif | ||
1331 | |||
1332 | wmb(); | 1251 | wmb(); |
1333 | 1252 | ||
1334 | /* To avoid raise condition */ | 1253 | /* To avoid raise condition */ |
@@ -1523,7 +1442,7 @@ static int stmmac_poll(struct napi_struct *napi, int budget) | |||
1523 | * stmmac_tx_timeout | 1442 | * stmmac_tx_timeout |
1524 | * @dev : Pointer to net device structure | 1443 | * @dev : Pointer to net device structure |
1525 | * Description: this function is called when a packet transmission fails to | 1444 | * Description: this function is called when a packet transmission fails to |
1526 | * complete within a reasonable tmrate. The driver will mark the error in the | 1445 | * complete within a reasonable time. The driver will mark the error in the |
1527 | * netdev structure and arrange for the device to be reset to a sane state | 1446 | * netdev structure and arrange for the device to be reset to a sane state |
1528 | * in order to transmit a new packet. | 1447 | * in order to transmit a new packet. |
1529 | */ | 1448 | */ |
@@ -2141,11 +2060,6 @@ int stmmac_suspend(struct net_device *ndev) | |||
2141 | netif_device_detach(ndev); | 2060 | netif_device_detach(ndev); |
2142 | netif_stop_queue(ndev); | 2061 | netif_stop_queue(ndev); |
2143 | 2062 | ||
2144 | #ifdef CONFIG_STMMAC_TIMER | ||
2145 | priv->tm->timer_stop(); | ||
2146 | if (likely(priv->tm->enable)) | ||
2147 | dis_ic = 1; | ||
2148 | #endif | ||
2149 | napi_disable(&priv->napi); | 2063 | napi_disable(&priv->napi); |
2150 | 2064 | ||
2151 | /* Stop TX/RX DMA */ | 2065 | /* Stop TX/RX DMA */ |
@@ -2196,10 +2110,6 @@ int stmmac_resume(struct net_device *ndev) | |||
2196 | priv->hw->dma->start_tx(priv->ioaddr); | 2110 | priv->hw->dma->start_tx(priv->ioaddr); |
2197 | priv->hw->dma->start_rx(priv->ioaddr); | 2111 | priv->hw->dma->start_rx(priv->ioaddr); |
2198 | 2112 | ||
2199 | #ifdef CONFIG_STMMAC_TIMER | ||
2200 | if (likely(priv->tm->enable)) | ||
2201 | priv->tm->timer_start(tmrate); | ||
2202 | #endif | ||
2203 | napi_enable(&priv->napi); | 2113 | napi_enable(&priv->napi); |
2204 | 2114 | ||
2205 | netif_start_queue(ndev); | 2115 | netif_start_queue(ndev); |
@@ -2295,11 +2205,6 @@ static int __init stmmac_cmdline_opt(char *str) | |||
2295 | } else if (!strncmp(opt, "eee_timer:", 6)) { | 2205 | } else if (!strncmp(opt, "eee_timer:", 6)) { |
2296 | if (kstrtoint(opt + 10, 0, &eee_timer)) | 2206 | if (kstrtoint(opt + 10, 0, &eee_timer)) |
2297 | goto err; | 2207 | goto err; |
2298 | #ifdef CONFIG_STMMAC_TIMER | ||
2299 | } else if (!strncmp(opt, "tmrate:", 7)) { | ||
2300 | if (kstrtoint(opt + 7, 0, &tmrate)) | ||
2301 | goto err; | ||
2302 | #endif | ||
2303 | } | 2208 | } |
2304 | } | 2209 | } |
2305 | return 0; | 2210 | return 0; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c deleted file mode 100644 index 4ccd4e2977b7..000000000000 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
1 | /******************************************************************************* | ||
2 | STMMAC external timer support. | ||
3 | |||
4 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify it | ||
7 | under the terms and conditions of the GNU General Public License, | ||
8 | version 2, as published by the Free Software Foundation. | ||
9 | |||
10 | This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License along with | ||
16 | this program; if not, write to the Free Software Foundation, Inc., | ||
17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | |||
19 | The full GNU General Public License is included in this distribution in | ||
20 | the file called "COPYING". | ||
21 | |||
22 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
23 | *******************************************************************************/ | ||
24 | |||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/etherdevice.h> | ||
27 | #include "stmmac_timer.h" | ||
28 | |||
29 | static void stmmac_timer_handler(void *data) | ||
30 | { | ||
31 | struct net_device *dev = (struct net_device *)data; | ||
32 | |||
33 | stmmac_schedule(dev); | ||
34 | } | ||
35 | |||
36 | #define STMMAC_TIMER_MSG(timer, freq) \ | ||
37 | printk(KERN_INFO "stmmac_timer: %s Timer ON (freq %dHz)\n", timer, freq); | ||
38 | |||
39 | #if defined(CONFIG_STMMAC_RTC_TIMER) | ||
40 | #include <linux/rtc.h> | ||
41 | static struct rtc_device *stmmac_rtc; | ||
42 | static rtc_task_t stmmac_task; | ||
43 | |||
44 | static void stmmac_rtc_start(unsigned int new_freq) | ||
45 | { | ||
46 | rtc_irq_set_freq(stmmac_rtc, &stmmac_task, new_freq); | ||
47 | rtc_irq_set_state(stmmac_rtc, &stmmac_task, 1); | ||
48 | } | ||
49 | |||
50 | static void stmmac_rtc_stop(void) | ||
51 | { | ||
52 | rtc_irq_set_state(stmmac_rtc, &stmmac_task, 0); | ||
53 | } | ||
54 | |||
55 | int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | ||
56 | { | ||
57 | stmmac_task.private_data = dev; | ||
58 | stmmac_task.func = stmmac_timer_handler; | ||
59 | |||
60 | stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); | ||
61 | if (stmmac_rtc == NULL) { | ||
62 | pr_err("open rtc device failed\n"); | ||
63 | return -ENODEV; | ||
64 | } | ||
65 | |||
66 | rtc_irq_register(stmmac_rtc, &stmmac_task); | ||
67 | |||
68 | /* Periodic mode is not supported */ | ||
69 | if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) { | ||
70 | pr_err("set periodic failed\n"); | ||
71 | rtc_irq_unregister(stmmac_rtc, &stmmac_task); | ||
72 | rtc_class_close(stmmac_rtc); | ||
73 | return -1; | ||
74 | } | ||
75 | |||
76 | STMMAC_TIMER_MSG(CONFIG_RTC_HCTOSYS_DEVICE, tm->freq); | ||
77 | |||
78 | tm->timer_start = stmmac_rtc_start; | ||
79 | tm->timer_stop = stmmac_rtc_stop; | ||
80 | |||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | int stmmac_close_ext_timer(void) | ||
85 | { | ||
86 | rtc_irq_set_state(stmmac_rtc, &stmmac_task, 0); | ||
87 | rtc_irq_unregister(stmmac_rtc, &stmmac_task); | ||
88 | rtc_class_close(stmmac_rtc); | ||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | #elif defined(CONFIG_STMMAC_TMU_TIMER) | ||
93 | #include <linux/clk.h> | ||
94 | #define TMU_CHANNEL "tmu2_clk" | ||
95 | static struct clk *timer_clock; | ||
96 | |||
97 | static void stmmac_tmu_start(unsigned int new_freq) | ||
98 | { | ||
99 | clk_set_rate(timer_clock, new_freq); | ||
100 | clk_prepare_enable(timer_clock); | ||
101 | } | ||
102 | |||
103 | static void stmmac_tmu_stop(void) | ||
104 | { | ||
105 | clk_disable_unprepare(timer_clock); | ||
106 | } | ||
107 | |||
108 | int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | ||
109 | { | ||
110 | timer_clock = clk_get(NULL, TMU_CHANNEL); | ||
111 | |||
112 | if (IS_ERR(timer_clock)) | ||
113 | return -1; | ||
114 | |||
115 | if (tmu2_register_user(stmmac_timer_handler, (void *)dev) < 0) { | ||
116 | timer_clock = NULL; | ||
117 | return -1; | ||
118 | } | ||
119 | |||
120 | STMMAC_TIMER_MSG("TMU2", tm->freq); | ||
121 | tm->timer_start = stmmac_tmu_start; | ||
122 | tm->timer_stop = stmmac_tmu_stop; | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | int stmmac_close_ext_timer(void) | ||
128 | { | ||
129 | clk_disable_unprepare(timer_clock); | ||
130 | tmu2_unregister_user(); | ||
131 | clk_put(timer_clock); | ||
132 | return 0; | ||
133 | } | ||
134 | #endif | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h deleted file mode 100644 index aea9b14cdfbe..000000000000 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.h +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /******************************************************************************* | ||
2 | STMMAC external timer Header File. | ||
3 | |||
4 | Copyright (C) 2007-2009 STMicroelectronics Ltd | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify it | ||
7 | under the terms and conditions of the GNU General Public License, | ||
8 | version 2, as published by the Free Software Foundation. | ||
9 | |||
10 | This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License along with | ||
16 | this program; if not, write to the Free Software Foundation, Inc., | ||
17 | 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | |||
19 | The full GNU General Public License is included in this distribution in | ||
20 | the file called "COPYING". | ||
21 | |||
22 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
23 | *******************************************************************************/ | ||
24 | #ifndef __STMMAC_TIMER_H__ | ||
25 | #define __STMMAC_TIMER_H__ | ||
26 | |||
27 | struct stmmac_timer { | ||
28 | void (*timer_start) (unsigned int new_freq); | ||
29 | void (*timer_stop) (void); | ||
30 | unsigned int freq; | ||
31 | unsigned int enable; | ||
32 | }; | ||
33 | |||
34 | /* Open the HW timer device and return 0 in case of success */ | ||
35 | int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm); | ||
36 | /* Stop the timer and release it */ | ||
37 | int stmmac_close_ext_timer(void); | ||
38 | /* Function used for scheduling task within the stmmac */ | ||
39 | void stmmac_schedule(struct net_device *dev); | ||
40 | |||
41 | #if defined(CONFIG_STMMAC_TMU_TIMER) | ||
42 | extern int tmu2_register_user(void *fnt, void *data); | ||
43 | extern void tmu2_unregister_user(void); | ||
44 | #endif | ||
45 | |||
46 | #endif /* __STMMAC_TIMER_H__ */ | ||