aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 19:08:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 19:08:50 -0400
commit65a6ec0d72a07f16719e9b7a96e1c4bae044b591 (patch)
tree344e03a5039a44982c1b78d6113633b21b434820 /drivers/net
parent541010e4b8921cd781ff02ae68028501457045b6 (diff)
parent0181b61a988424b5cc44fe09e6968142359c815e (diff)
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (95 commits) [ARM] 4578/1: CM-x270: PCMCIA support [ARM] 4577/1: ITE 8152 PCI bridge support [ARM] 4576/1: CM-X270 machine support [ARM] pxa: Avoid pxa_gpio_mode() in gpio_direction_{in,out}put() [ARM] pxa: move pxa_set_mode() from pxa2xx_mainstone.c to mainstone.c [ARM] pxa: move pxa_set_mode() from pxa2xx_lubbock.c to lubbock.c [ARM] pxa: Make cpu_is_pxaXXX dependent on configuration symbols [ARM] pxa: PXA3xx base support [NET] smc91x: fix PXA DMA support code [SERIAL] Fix console initialisation ordering [ARM] pxa: tidy up arch/arm/mach-pxa/Makefile [ARM] Update arch/arm/Kconfig for drivers/Kconfig changes [ARM] 4600/1: fix kernel build failure with build-id-supporting binutils [ARM] 4599/1: Preserve ATAG list for use with kexec (2.6.23) [ARM] Rename consistent_sync() as dma_cache_maint() [ARM] 4572/1: ep93xx: add cirrus logic edb9307 support [ARM] 4596/1: S3C2412: Correct IRQs for SDI+CF and add decoding support [ARM] 4595/1: ns9xxx: define registers as void __iomem * instead of volatile u32 [ARM] 4594/1: ns9xxx: use the new gpio functions [ARM] 4593/1: ns9xxx: implement generic clockevents ...
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/irda/pxaficp_ir.c51
-rw-r--r--drivers/net/smc91x.c55
-rw-r--r--drivers/net/smc91x.h64
3 files changed, 106 insertions, 64 deletions
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 55ff0fbe525a..8c09344f58dc 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -23,6 +23,7 @@
23#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/pm.h> 25#include <linux/pm.h>
26#include <linux/clk.h>
26 27
27#include <net/irda/irda.h> 28#include <net/irda/irda.h>
28#include <net/irda/irmod.h> 29#include <net/irda/irmod.h>
@@ -87,8 +88,30 @@ struct pxa_irda {
87 88
88 struct device *dev; 89 struct device *dev;
89 struct pxaficp_platform_data *pdata; 90 struct pxaficp_platform_data *pdata;
91 struct clk *fir_clk;
92 struct clk *sir_clk;
93 struct clk *cur_clk;
90}; 94};
91 95
96static inline void pxa_irda_disable_clk(struct pxa_irda *si)
97{
98 if (si->cur_clk)
99 clk_disable(si->cur_clk);
100 si->cur_clk = NULL;
101}
102
103static inline void pxa_irda_enable_firclk(struct pxa_irda *si)
104{
105 si->cur_clk = si->fir_clk;
106 clk_enable(si->fir_clk);
107}
108
109static inline void pxa_irda_enable_sirclk(struct pxa_irda *si)
110{
111 si->cur_clk = si->sir_clk;
112 clk_enable(si->sir_clk);
113}
114
92 115
93#define IS_FIR(si) ((si)->speed >= 4000000) 116#define IS_FIR(si) ((si)->speed >= 4000000)
94#define IRDA_FRAME_SIZE_LIMIT 2047 117#define IRDA_FRAME_SIZE_LIMIT 2047
@@ -134,7 +157,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
134 DCSR(si->rxdma) &= ~DCSR_RUN; 157 DCSR(si->rxdma) &= ~DCSR_RUN;
135 /* disable FICP */ 158 /* disable FICP */
136 ICCR0 = 0; 159 ICCR0 = 0;
137 pxa_set_cken(CKEN_FICP, 0); 160 pxa_irda_disable_clk(si);
138 161
139 /* set board transceiver to SIR mode */ 162 /* set board transceiver to SIR mode */
140 si->pdata->transceiver_mode(si->dev, IR_SIRMODE); 163 si->pdata->transceiver_mode(si->dev, IR_SIRMODE);
@@ -144,7 +167,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
144 pxa_gpio_mode(GPIO47_STTXD_MD); 167 pxa_gpio_mode(GPIO47_STTXD_MD);
145 168
146 /* enable the STUART clock */ 169 /* enable the STUART clock */
147 pxa_set_cken(CKEN_STUART, 1); 170 pxa_irda_enable_sirclk(si);
148 } 171 }
149 172
150 /* disable STUART first */ 173 /* disable STUART first */
@@ -169,7 +192,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
169 /* disable STUART */ 192 /* disable STUART */
170 STIER = 0; 193 STIER = 0;
171 STISR = 0; 194 STISR = 0;
172 pxa_set_cken(CKEN_STUART, 0); 195 pxa_irda_disable_clk(si);
173 196
174 /* disable FICP first */ 197 /* disable FICP first */
175 ICCR0 = 0; 198 ICCR0 = 0;
@@ -182,7 +205,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
182 pxa_gpio_mode(GPIO47_ICPTXD_MD); 205 pxa_gpio_mode(GPIO47_ICPTXD_MD);
183 206
184 /* enable the FICP clock */ 207 /* enable the FICP clock */
185 pxa_set_cken(CKEN_FICP, 1); 208 pxa_irda_enable_firclk(si);
186 209
187 si->speed = speed; 210 si->speed = speed;
188 pxa_irda_fir_dma_rx_start(si); 211 pxa_irda_fir_dma_rx_start(si);
@@ -592,16 +615,15 @@ static void pxa_irda_shutdown(struct pxa_irda *si)
592 STIER = 0; 615 STIER = 0;
593 /* disable STUART SIR mode */ 616 /* disable STUART SIR mode */
594 STISR = 0; 617 STISR = 0;
595 /* disable the STUART clock */
596 pxa_set_cken(CKEN_STUART, 0);
597 618
598 /* disable DMA */ 619 /* disable DMA */
599 DCSR(si->txdma) &= ~DCSR_RUN; 620 DCSR(si->txdma) &= ~DCSR_RUN;
600 DCSR(si->rxdma) &= ~DCSR_RUN; 621 DCSR(si->rxdma) &= ~DCSR_RUN;
601 /* disable FICP */ 622 /* disable FICP */
602 ICCR0 = 0; 623 ICCR0 = 0;
603 /* disable the FICP clock */ 624
604 pxa_set_cken(CKEN_FICP, 0); 625 /* disable the STUART or FICP clocks */
626 pxa_irda_disable_clk(si);
605 627
606 DRCMR17 = 0; 628 DRCMR17 = 0;
607 DRCMR18 = 0; 629 DRCMR18 = 0;
@@ -792,6 +814,13 @@ static int pxa_irda_probe(struct platform_device *pdev)
792 si->dev = &pdev->dev; 814 si->dev = &pdev->dev;
793 si->pdata = pdev->dev.platform_data; 815 si->pdata = pdev->dev.platform_data;
794 816
817 si->sir_clk = clk_get(&pdev->dev, "UARTCLK");
818 si->fir_clk = clk_get(&pdev->dev, "FICPCLK");
819 if (IS_ERR(si->sir_clk) || IS_ERR(si->fir_clk)) {
820 err = PTR_ERR(IS_ERR(si->sir_clk) ? si->sir_clk : si->fir_clk);
821 goto err_mem_4;
822 }
823
795 /* 824 /*
796 * Initialise the SIR buffers 825 * Initialise the SIR buffers
797 */ 826 */
@@ -831,6 +860,10 @@ static int pxa_irda_probe(struct platform_device *pdev)
831err_mem_5: 860err_mem_5:
832 kfree(si->rx_buff.head); 861 kfree(si->rx_buff.head);
833err_mem_4: 862err_mem_4:
863 if (si->sir_clk && !IS_ERR(si->sir_clk))
864 clk_put(si->sir_clk);
865 if (si->fir_clk && !IS_ERR(si->fir_clk))
866 clk_put(si->fir_clk);
834 free_netdev(dev); 867 free_netdev(dev);
835err_mem_3: 868err_mem_3:
836 release_mem_region(__PREG(FICP), 0x1c); 869 release_mem_region(__PREG(FICP), 0x1c);
@@ -850,6 +883,8 @@ static int pxa_irda_remove(struct platform_device *_dev)
850 unregister_netdev(dev); 883 unregister_netdev(dev);
851 kfree(si->tx_buff.head); 884 kfree(si->tx_buff.head);
852 kfree(si->rx_buff.head); 885 kfree(si->rx_buff.head);
886 clk_put(si->fir_clk);
887 clk_put(si->sir_clk);
853 free_netdev(dev); 888 free_netdev(dev);
854 } 889 }
855 890
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 24e610e711e8..7da7589d45dd 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -173,49 +173,6 @@ MODULE_LICENSE("GPL");
173 */ 173 */
174#define MII_DELAY 1 174#define MII_DELAY 1
175 175
176/* store this information for the driver.. */
177struct smc_local {
178 /*
179 * If I have to wait until memory is available to send a
180 * packet, I will store the skbuff here, until I get the
181 * desired memory. Then, I'll send it out and free it.
182 */
183 struct sk_buff *pending_tx_skb;
184 struct tasklet_struct tx_task;
185
186 /* version/revision of the SMC91x chip */
187 int version;
188
189 /* Contains the current active transmission mode */
190 int tcr_cur_mode;
191
192 /* Contains the current active receive mode */
193 int rcr_cur_mode;
194
195 /* Contains the current active receive/phy mode */
196 int rpc_cur_mode;
197 int ctl_rfduplx;
198 int ctl_rspeed;
199
200 u32 msg_enable;
201 u32 phy_type;
202 struct mii_if_info mii;
203
204 /* work queue */
205 struct work_struct phy_configure;
206 struct net_device *dev;
207 int work_pending;
208
209 spinlock_t lock;
210
211#ifdef SMC_USE_PXA_DMA
212 /* DMA needs the physical address of the chip */
213 u_long physaddr;
214#endif
215 void __iomem *base;
216 void __iomem *datacs;
217};
218
219#if SMC_DEBUG > 0 176#if SMC_DEBUG > 0
220#define DBG(n, args...) \ 177#define DBG(n, args...) \
221 do { \ 178 do { \
@@ -2215,17 +2172,19 @@ static int smc_drv_probe(struct platform_device *pdev)
2215 goto out_release_attrib; 2172 goto out_release_attrib;
2216 } 2173 }
2217 2174
2218 platform_set_drvdata(pdev, ndev);
2219 ret = smc_probe(ndev, addr);
2220 if (ret != 0)
2221 goto out_iounmap;
2222#ifdef SMC_USE_PXA_DMA 2175#ifdef SMC_USE_PXA_DMA
2223 else { 2176 {
2224 struct smc_local *lp = netdev_priv(ndev); 2177 struct smc_local *lp = netdev_priv(ndev);
2178 lp->device = &pdev->dev;
2225 lp->physaddr = res->start; 2179 lp->physaddr = res->start;
2226 } 2180 }
2227#endif 2181#endif
2228 2182
2183 platform_set_drvdata(pdev, ndev);
2184 ret = smc_probe(ndev, addr);
2185 if (ret != 0)
2186 goto out_iounmap;
2187
2229 smc_request_datacs(pdev, ndev); 2188 smc_request_datacs(pdev, ndev);
2230 2189
2231 return 0; 2190 return 0;
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index af9e6bf59552..729fd28c08b5 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -462,6 +462,52 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r,
462 462
463#endif 463#endif
464 464
465
466/* store this information for the driver.. */
467struct smc_local {
468 /*
469 * If I have to wait until memory is available to send a
470 * packet, I will store the skbuff here, until I get the
471 * desired memory. Then, I'll send it out and free it.
472 */
473 struct sk_buff *pending_tx_skb;
474 struct tasklet_struct tx_task;
475
476 /* version/revision of the SMC91x chip */
477 int version;
478
479 /* Contains the current active transmission mode */
480 int tcr_cur_mode;
481
482 /* Contains the current active receive mode */
483 int rcr_cur_mode;
484
485 /* Contains the current active receive/phy mode */
486 int rpc_cur_mode;
487 int ctl_rfduplx;
488 int ctl_rspeed;
489
490 u32 msg_enable;
491 u32 phy_type;
492 struct mii_if_info mii;
493
494 /* work queue */
495 struct work_struct phy_configure;
496 struct net_device *dev;
497 int work_pending;
498
499 spinlock_t lock;
500
501#ifdef SMC_USE_PXA_DMA
502 /* DMA needs the physical address of the chip */
503 u_long physaddr;
504 struct device *device;
505#endif
506 void __iomem *base;
507 void __iomem *datacs;
508};
509
510
465#ifdef SMC_USE_PXA_DMA 511#ifdef SMC_USE_PXA_DMA
466/* 512/*
467 * Let's use the DMA engine on the XScale PXA2xx for RX packets. This is 513 * Let's use the DMA engine on the XScale PXA2xx for RX packets. This is
@@ -476,11 +522,12 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r,
476#ifdef SMC_insl 522#ifdef SMC_insl
477#undef SMC_insl 523#undef SMC_insl
478#define SMC_insl(a, r, p, l) \ 524#define SMC_insl(a, r, p, l) \
479 smc_pxa_dma_insl(a, lp->physaddr, r, dev->dma, p, l) 525 smc_pxa_dma_insl(a, lp, r, dev->dma, p, l)
480static inline void 526static inline void
481smc_pxa_dma_insl(void __iomem *ioaddr, u_long physaddr, int reg, int dma, 527smc_pxa_dma_insl(void __iomem *ioaddr, struct smc_local *lp, int reg, int dma,
482 u_char *buf, int len) 528 u_char *buf, int len)
483{ 529{
530 u_long physaddr = lp->physaddr;
484 dma_addr_t dmabuf; 531 dma_addr_t dmabuf;
485 532
486 /* fallback if no DMA available */ 533 /* fallback if no DMA available */
@@ -497,7 +544,7 @@ smc_pxa_dma_insl(void __iomem *ioaddr, u_long physaddr, int reg, int dma,
497 } 544 }
498 545
499 len *= 4; 546 len *= 4;
500 dmabuf = dma_map_single(NULL, buf, len, DMA_FROM_DEVICE); 547 dmabuf = dma_map_single(lp->device, buf, len, DMA_FROM_DEVICE);
501 DCSR(dma) = DCSR_NODESC; 548 DCSR(dma) = DCSR_NODESC;
502 DTADR(dma) = dmabuf; 549 DTADR(dma) = dmabuf;
503 DSADR(dma) = physaddr + reg; 550 DSADR(dma) = physaddr + reg;
@@ -507,18 +554,19 @@ smc_pxa_dma_insl(void __iomem *ioaddr, u_long physaddr, int reg, int dma,
507 while (!(DCSR(dma) & DCSR_STOPSTATE)) 554 while (!(DCSR(dma) & DCSR_STOPSTATE))
508 cpu_relax(); 555 cpu_relax();
509 DCSR(dma) = 0; 556 DCSR(dma) = 0;
510 dma_unmap_single(NULL, dmabuf, len, DMA_FROM_DEVICE); 557 dma_unmap_single(lp->device, dmabuf, len, DMA_FROM_DEVICE);
511} 558}
512#endif 559#endif
513 560
514#ifdef SMC_insw 561#ifdef SMC_insw
515#undef SMC_insw 562#undef SMC_insw
516#define SMC_insw(a, r, p, l) \ 563#define SMC_insw(a, r, p, l) \
517 smc_pxa_dma_insw(a, lp->physaddr, r, dev->dma, p, l) 564 smc_pxa_dma_insw(a, lp, r, dev->dma, p, l)
518static inline void 565static inline void
519smc_pxa_dma_insw(void __iomem *ioaddr, u_long physaddr, int reg, int dma, 566smc_pxa_dma_insw(void __iomem *ioaddr, struct smc_local *lp, int reg, int dma,
520 u_char *buf, int len) 567 u_char *buf, int len)
521{ 568{
569 u_long physaddr = lp->physaddr;
522 dma_addr_t dmabuf; 570 dma_addr_t dmabuf;
523 571
524 /* fallback if no DMA available */ 572 /* fallback if no DMA available */
@@ -535,7 +583,7 @@ smc_pxa_dma_insw(void __iomem *ioaddr, u_long physaddr, int reg, int dma,
535 } 583 }
536 584
537 len *= 2; 585 len *= 2;
538 dmabuf = dma_map_single(NULL, buf, len, DMA_FROM_DEVICE); 586 dmabuf = dma_map_single(lp->device, buf, len, DMA_FROM_DEVICE);
539 DCSR(dma) = DCSR_NODESC; 587 DCSR(dma) = DCSR_NODESC;
540 DTADR(dma) = dmabuf; 588 DTADR(dma) = dmabuf;
541 DSADR(dma) = physaddr + reg; 589 DSADR(dma) = physaddr + reg;
@@ -545,7 +593,7 @@ smc_pxa_dma_insw(void __iomem *ioaddr, u_long physaddr, int reg, int dma,
545 while (!(DCSR(dma) & DCSR_STOPSTATE)) 593 while (!(DCSR(dma) & DCSR_STOPSTATE))
546 cpu_relax(); 594 cpu_relax();
547 DCSR(dma) = 0; 595 DCSR(dma) = 0;
548 dma_unmap_single(NULL, dmabuf, len, DMA_FROM_DEVICE); 596 dma_unmap_single(lp->device, dmabuf, len, DMA_FROM_DEVICE);
549} 597}
550#endif 598#endif
551 599