aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fs_enet/mac-fcc.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2007-10-01 15:20:58 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:54:04 -0400
commit31a5bb04d59931eb4657826213a439d37d12d4a9 (patch)
tree865af87dcb382e4cf035c9ccf5bf3ea094f2a712 /drivers/net/fs_enet/mac-fcc.c
parent2b5b3a604a672be1d41728ed9e448ca3c9c23242 (diff)
fs_enet: sparse fixes
Mostly a bunch of __iomem annotations. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/fs_enet/mac-fcc.c')
-rw-r--r--drivers/net/fs_enet/mac-fcc.c71
1 files changed, 39 insertions, 32 deletions
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c
index 6094cbf542a2..da4efbca646e 100644
--- a/drivers/net/fs_enet/mac-fcc.c
+++ b/drivers/net/fs_enet/mac-fcc.c
@@ -81,8 +81,6 @@
81static inline int fcc_cr_cmd(struct fs_enet_private *fep, u32 op) 81static inline int fcc_cr_cmd(struct fs_enet_private *fep, u32 op)
82{ 82{
83 const struct fs_platform_info *fpi = fep->fpi; 83 const struct fs_platform_info *fpi = fep->fpi;
84 cpm2_map_t *immap = fs_enet_immap;
85 cpm_cpm2_t *cpmp = &immap->im_cpm;
86 int i; 84 int i;
87 85
88 W32(cpmp, cp_cpcr, fpi->cp_command | op | CPM_CR_FLG); 86 W32(cpmp, cp_cpcr, fpi->cp_command | op | CPM_CR_FLG);
@@ -118,8 +116,8 @@ static int do_pd_setup(struct fs_enet_private *fep)
118 if (!fep->fcc.fcccp) 116 if (!fep->fcc.fcccp)
119 goto out_ep; 117 goto out_ep;
120 118
121 fep->fcc.mem = (void *)cpm_dpalloc(128, 8); 119 fep->fcc.mem = (void __iomem *)cpm2_immr;
122 fpi->dpram_offset = (u32)cpm2_immr; 120 fpi->dpram_offset = cpm_dpalloc(128, 8);
123 if (IS_ERR_VALUE(fpi->dpram_offset)) { 121 if (IS_ERR_VALUE(fpi->dpram_offset)) {
124 ret = fpi->dpram_offset; 122 ret = fpi->dpram_offset;
125 goto out_fcccp; 123 goto out_fcccp;
@@ -146,29 +144,28 @@ out:
146 144
147 /* Attach the memory for the FCC Parameter RAM */ 145 /* Attach the memory for the FCC Parameter RAM */
148 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram"); 146 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram");
149 fep->fcc.ep = (void *)ioremap(r->start, r->end - r->start + 1); 147 fep->fcc.ep = ioremap(r->start, r->end - r->start + 1);
150 if (fep->fcc.ep == NULL) 148 if (fep->fcc.ep == NULL)
151 return -EINVAL; 149 return -EINVAL;
152 150
153 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_regs"); 151 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_regs");
154 fep->fcc.fccp = (void *)ioremap(r->start, r->end - r->start + 1); 152 fep->fcc.fccp = ioremap(r->start, r->end - r->start + 1);
155 if (fep->fcc.fccp == NULL) 153 if (fep->fcc.fccp == NULL)
156 return -EINVAL; 154 return -EINVAL;
157 155
158 if (fep->fpi->fcc_regs_c) { 156 if (fep->fpi->fcc_regs_c) {
159 157 fep->fcc.fcccp = (void __iomem *)fep->fpi->fcc_regs_c;
160 fep->fcc.fcccp = (void *)fep->fpi->fcc_regs_c;
161 } else { 158 } else {
162 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, 159 r = platform_get_resource_byname(pdev, IORESOURCE_MEM,
163 "fcc_regs_c"); 160 "fcc_regs_c");
164 fep->fcc.fcccp = (void *)ioremap(r->start, 161 fep->fcc.fcccp = ioremap(r->start,
165 r->end - r->start + 1); 162 r->end - r->start + 1);
166 } 163 }
167 164
168 if (fep->fcc.fcccp == NULL) 165 if (fep->fcc.fcccp == NULL)
169 return -EINVAL; 166 return -EINVAL;
170 167
171 fep->fcc.mem = (void *)fep->fpi->mem_offset; 168 fep->fcc.mem = (void __iomem *)fep->fpi->mem_offset;
172 if (fep->fcc.mem == NULL) 169 if (fep->fcc.mem == NULL)
173 return -EINVAL; 170 return -EINVAL;
174 171
@@ -212,7 +209,7 @@ static int allocate_bd(struct net_device *dev)
212 struct fs_enet_private *fep = netdev_priv(dev); 209 struct fs_enet_private *fep = netdev_priv(dev);
213 const struct fs_platform_info *fpi = fep->fpi; 210 const struct fs_platform_info *fpi = fep->fpi;
214 211
215 fep->ring_base = dma_alloc_coherent(fep->dev, 212 fep->ring_base = (void __iomem __force *)dma_alloc_coherent(fep->dev,
216 (fpi->tx_ring + fpi->rx_ring) * 213 (fpi->tx_ring + fpi->rx_ring) *
217 sizeof(cbd_t), &fep->ring_mem_addr, 214 sizeof(cbd_t), &fep->ring_mem_addr,
218 GFP_KERNEL); 215 GFP_KERNEL);
@@ -230,7 +227,7 @@ static void free_bd(struct net_device *dev)
230 if (fep->ring_base) 227 if (fep->ring_base)
231 dma_free_coherent(fep->dev, 228 dma_free_coherent(fep->dev,
232 (fpi->tx_ring + fpi->rx_ring) * sizeof(cbd_t), 229 (fpi->tx_ring + fpi->rx_ring) * sizeof(cbd_t),
233 fep->ring_base, fep->ring_mem_addr); 230 (void __force *)fep->ring_base, fep->ring_mem_addr);
234} 231}
235 232
236static void cleanup_data(struct net_device *dev) 233static void cleanup_data(struct net_device *dev)
@@ -241,7 +238,7 @@ static void cleanup_data(struct net_device *dev)
241static void set_promiscuous_mode(struct net_device *dev) 238static void set_promiscuous_mode(struct net_device *dev)
242{ 239{
243 struct fs_enet_private *fep = netdev_priv(dev); 240 struct fs_enet_private *fep = netdev_priv(dev);
244 fcc_t *fccp = fep->fcc.fccp; 241 fcc_t __iomem *fccp = fep->fcc.fccp;
245 242
246 S32(fccp, fcc_fpsmr, FCC_PSMR_PRO); 243 S32(fccp, fcc_fpsmr, FCC_PSMR_PRO);
247} 244}
@@ -249,7 +246,7 @@ static void set_promiscuous_mode(struct net_device *dev)
249static void set_multicast_start(struct net_device *dev) 246static void set_multicast_start(struct net_device *dev)
250{ 247{
251 struct fs_enet_private *fep = netdev_priv(dev); 248 struct fs_enet_private *fep = netdev_priv(dev);
252 fcc_enet_t *ep = fep->fcc.ep; 249 fcc_enet_t __iomem *ep = fep->fcc.ep;
253 250
254 W32(ep, fen_gaddrh, 0); 251 W32(ep, fen_gaddrh, 0);
255 W32(ep, fen_gaddrl, 0); 252 W32(ep, fen_gaddrl, 0);
@@ -258,7 +255,7 @@ static void set_multicast_start(struct net_device *dev)
258static void set_multicast_one(struct net_device *dev, const u8 *mac) 255static void set_multicast_one(struct net_device *dev, const u8 *mac)
259{ 256{
260 struct fs_enet_private *fep = netdev_priv(dev); 257 struct fs_enet_private *fep = netdev_priv(dev);
261 fcc_enet_t *ep = fep->fcc.ep; 258 fcc_enet_t __iomem *ep = fep->fcc.ep;
262 u16 taddrh, taddrm, taddrl; 259 u16 taddrh, taddrm, taddrl;
263 260
264 taddrh = ((u16)mac[5] << 8) | mac[4]; 261 taddrh = ((u16)mac[5] << 8) | mac[4];
@@ -274,8 +271,8 @@ static void set_multicast_one(struct net_device *dev, const u8 *mac)
274static void set_multicast_finish(struct net_device *dev) 271static void set_multicast_finish(struct net_device *dev)
275{ 272{
276 struct fs_enet_private *fep = netdev_priv(dev); 273 struct fs_enet_private *fep = netdev_priv(dev);
277 fcc_t *fccp = fep->fcc.fccp; 274 fcc_t __iomem *fccp = fep->fcc.fccp;
278 fcc_enet_t *ep = fep->fcc.ep; 275 fcc_enet_t __iomem *ep = fep->fcc.ep;
279 276
280 /* clear promiscuous always */ 277 /* clear promiscuous always */
281 C32(fccp, fcc_fpsmr, FCC_PSMR_PRO); 278 C32(fccp, fcc_fpsmr, FCC_PSMR_PRO);
@@ -310,12 +307,14 @@ static void restart(struct net_device *dev)
310{ 307{
311 struct fs_enet_private *fep = netdev_priv(dev); 308 struct fs_enet_private *fep = netdev_priv(dev);
312 const struct fs_platform_info *fpi = fep->fpi; 309 const struct fs_platform_info *fpi = fep->fpi;
313 fcc_t *fccp = fep->fcc.fccp; 310 fcc_t __iomem *fccp = fep->fcc.fccp;
314 fcc_c_t *fcccp = fep->fcc.fcccp; 311 fcc_c_t __iomem *fcccp = fep->fcc.fcccp;
315 fcc_enet_t *ep = fep->fcc.ep; 312 fcc_enet_t __iomem *ep = fep->fcc.ep;
316 dma_addr_t rx_bd_base_phys, tx_bd_base_phys; 313 dma_addr_t rx_bd_base_phys, tx_bd_base_phys;
317 u16 paddrh, paddrm, paddrl; 314 u16 paddrh, paddrm, paddrl;
315#ifndef CONFIG_PPC_CPM_NEW_BINDING
318 u16 mem_addr; 316 u16 mem_addr;
317#endif
319 const unsigned char *mac; 318 const unsigned char *mac;
320 int i; 319 int i;
321 320
@@ -347,14 +346,22 @@ static void restart(struct net_device *dev)
347 * this area. 346 * this area.
348 */ 347 */
349 348
349#ifdef CONFIG_PPC_CPM_NEW_BINDING
350 W16(ep, fen_genfcc.fcc_riptr, fpi->dpram_offset);
351 W16(ep, fen_genfcc.fcc_tiptr, fpi->dpram_offset + 32);
352
353 W16(ep, fen_padptr, fpi->dpram_offset + 64);
354#else
350 mem_addr = (u32) fep->fcc.mem; /* de-fixup dpram offset */ 355 mem_addr = (u32) fep->fcc.mem; /* de-fixup dpram offset */
351 356
352 W16(ep, fen_genfcc.fcc_riptr, (mem_addr & 0xffff)); 357 W16(ep, fen_genfcc.fcc_riptr, (mem_addr & 0xffff));
353 W16(ep, fen_genfcc.fcc_tiptr, ((mem_addr + 32) & 0xffff)); 358 W16(ep, fen_genfcc.fcc_tiptr, ((mem_addr + 32) & 0xffff));
359
354 W16(ep, fen_padptr, mem_addr + 64); 360 W16(ep, fen_padptr, mem_addr + 64);
361#endif
355 362
356 /* fill with special symbol... */ 363 /* fill with special symbol... */
357 memset(fep->fcc.mem + fpi->dpram_offset + 64, 0x88, 32); 364 memset_io(fep->fcc.mem + fpi->dpram_offset + 64, 0x88, 32);
358 365
359 W32(ep, fen_genfcc.fcc_rbptr, 0); 366 W32(ep, fen_genfcc.fcc_rbptr, 0);
360 W32(ep, fen_genfcc.fcc_tbptr, 0); 367 W32(ep, fen_genfcc.fcc_tbptr, 0);
@@ -470,7 +477,7 @@ static void restart(struct net_device *dev)
470static void stop(struct net_device *dev) 477static void stop(struct net_device *dev)
471{ 478{
472 struct fs_enet_private *fep = netdev_priv(dev); 479 struct fs_enet_private *fep = netdev_priv(dev);
473 fcc_t *fccp = fep->fcc.fccp; 480 fcc_t __iomem *fccp = fep->fcc.fccp;
474 481
475 /* stop ethernet */ 482 /* stop ethernet */
476 C32(fccp, fcc_gfmr, FCC_GFMR_ENR | FCC_GFMR_ENT); 483 C32(fccp, fcc_gfmr, FCC_GFMR_ENR | FCC_GFMR_ENT);
@@ -497,7 +504,7 @@ static void post_free_irq(struct net_device *dev, int irq)
497static void napi_clear_rx_event(struct net_device *dev) 504static void napi_clear_rx_event(struct net_device *dev)
498{ 505{
499 struct fs_enet_private *fep = netdev_priv(dev); 506 struct fs_enet_private *fep = netdev_priv(dev);
500 fcc_t *fccp = fep->fcc.fccp; 507 fcc_t __iomem *fccp = fep->fcc.fccp;
501 508
502 W16(fccp, fcc_fcce, FCC_NAPI_RX_EVENT_MSK); 509 W16(fccp, fcc_fcce, FCC_NAPI_RX_EVENT_MSK);
503} 510}
@@ -505,7 +512,7 @@ static void napi_clear_rx_event(struct net_device *dev)
505static void napi_enable_rx(struct net_device *dev) 512static void napi_enable_rx(struct net_device *dev)
506{ 513{
507 struct fs_enet_private *fep = netdev_priv(dev); 514 struct fs_enet_private *fep = netdev_priv(dev);
508 fcc_t *fccp = fep->fcc.fccp; 515 fcc_t __iomem *fccp = fep->fcc.fccp;
509 516
510 S16(fccp, fcc_fccm, FCC_NAPI_RX_EVENT_MSK); 517 S16(fccp, fcc_fccm, FCC_NAPI_RX_EVENT_MSK);
511} 518}
@@ -513,7 +520,7 @@ static void napi_enable_rx(struct net_device *dev)
513static void napi_disable_rx(struct net_device *dev) 520static void napi_disable_rx(struct net_device *dev)
514{ 521{
515 struct fs_enet_private *fep = netdev_priv(dev); 522 struct fs_enet_private *fep = netdev_priv(dev);
516 fcc_t *fccp = fep->fcc.fccp; 523 fcc_t __iomem *fccp = fep->fcc.fccp;
517 524
518 C16(fccp, fcc_fccm, FCC_NAPI_RX_EVENT_MSK); 525 C16(fccp, fcc_fccm, FCC_NAPI_RX_EVENT_MSK);
519} 526}
@@ -526,7 +533,7 @@ static void rx_bd_done(struct net_device *dev)
526static void tx_kickstart(struct net_device *dev) 533static void tx_kickstart(struct net_device *dev)
527{ 534{
528 struct fs_enet_private *fep = netdev_priv(dev); 535 struct fs_enet_private *fep = netdev_priv(dev);
529 fcc_t *fccp = fep->fcc.fccp; 536 fcc_t __iomem *fccp = fep->fcc.fccp;
530 537
531 S16(fccp, fcc_ftodr, 0x8000); 538 S16(fccp, fcc_ftodr, 0x8000);
532} 539}
@@ -534,7 +541,7 @@ static void tx_kickstart(struct net_device *dev)
534static u32 get_int_events(struct net_device *dev) 541static u32 get_int_events(struct net_device *dev)
535{ 542{
536 struct fs_enet_private *fep = netdev_priv(dev); 543 struct fs_enet_private *fep = netdev_priv(dev);
537 fcc_t *fccp = fep->fcc.fccp; 544 fcc_t __iomem *fccp = fep->fcc.fccp;
538 545
539 return (u32)R16(fccp, fcc_fcce); 546 return (u32)R16(fccp, fcc_fcce);
540} 547}
@@ -542,7 +549,7 @@ static u32 get_int_events(struct net_device *dev)
542static void clear_int_events(struct net_device *dev, u32 int_events) 549static void clear_int_events(struct net_device *dev, u32 int_events)
543{ 550{
544 struct fs_enet_private *fep = netdev_priv(dev); 551 struct fs_enet_private *fep = netdev_priv(dev);
545 fcc_t *fccp = fep->fcc.fccp; 552 fcc_t __iomem *fccp = fep->fcc.fccp;
546 553
547 W16(fccp, fcc_fcce, int_events & 0xffff); 554 W16(fccp, fcc_fcce, int_events & 0xffff);
548} 555}
@@ -553,7 +560,7 @@ static void ev_error(struct net_device *dev, u32 int_events)
553 ": %s FS_ENET ERROR(s) 0x%x\n", dev->name, int_events); 560 ": %s FS_ENET ERROR(s) 0x%x\n", dev->name, int_events);
554} 561}
555 562
556int get_regs(struct net_device *dev, void *p, int *sizep) 563static int get_regs(struct net_device *dev, void *p, int *sizep)
557{ 564{
558 struct fs_enet_private *fep = netdev_priv(dev); 565 struct fs_enet_private *fep = netdev_priv(dev);
559 566
@@ -570,7 +577,7 @@ int get_regs(struct net_device *dev, void *p, int *sizep)
570 return 0; 577 return 0;
571} 578}
572 579
573int get_regs_len(struct net_device *dev) 580static int get_regs_len(struct net_device *dev)
574{ 581{
575 return sizeof(fcc_t) + sizeof(fcc_enet_t) + 1; 582 return sizeof(fcc_t) + sizeof(fcc_enet_t) + 1;
576} 583}
@@ -583,10 +590,10 @@ int get_regs_len(struct net_device *dev)
583 * CPM37, we must disable and then re-enable the transmitter 590 * CPM37, we must disable and then re-enable the transmitter
584 * following a Late Collision, Underrun, or Retry Limit error. 591 * following a Late Collision, Underrun, or Retry Limit error.
585 */ 592 */
586void tx_restart(struct net_device *dev) 593static void tx_restart(struct net_device *dev)
587{ 594{
588 struct fs_enet_private *fep = netdev_priv(dev); 595 struct fs_enet_private *fep = netdev_priv(dev);
589 fcc_t *fccp = fep->fcc.fccp; 596 fcc_t __iomem *fccp = fep->fcc.fccp;
590 597
591 C32(fccp, fcc_gfmr, FCC_GFMR_ENT); 598 C32(fccp, fcc_gfmr, FCC_GFMR_ENT);
592 udelay(10); 599 udelay(10);