aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sb1250-mac.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2005-10-19 10:39:05 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-19 22:14:20 -0400
commit2039973af59889fea0d14362eae56792cfe8d25a (patch)
tree589acab53824f20a4cdd4cd5052ec9c6dc410abf /drivers/net/sb1250-mac.c
parentab7a435a01a9995359a72851ff6896dc110c243f (diff)
[PATCH] sb1250-mac: Get rid of all the funny SBMAC_WRITECSR and SBMAC_READCSR macros.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org> drivers/net/sb1250-mac.c | 303 ++++++++++++++++++++--------------------------- 1 files changed, 132 insertions(+), 171 deletions(-) Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/sb1250-mac.c')
-rw-r--r--drivers/net/sb1250-mac.c303
1 files changed, 132 insertions, 171 deletions
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index cb4ea4158457..f7dda6fabe82 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -118,8 +118,6 @@ MODULE_PARM_DESC(int_timeout, "Timeout value");
118 ********************************************************************* */ 118 ********************************************************************* */
119 119
120 120
121typedef unsigned long sbmac_port_t;
122
123typedef enum { sbmac_speed_auto, sbmac_speed_10, 121typedef enum { sbmac_speed_auto, sbmac_speed_10,
124 sbmac_speed_100, sbmac_speed_1000 } sbmac_speed_t; 122 sbmac_speed_100, sbmac_speed_1000 } sbmac_speed_t;
125 123
@@ -144,10 +142,6 @@ typedef enum { sbmac_state_uninit, sbmac_state_off, sbmac_state_on,
144 142
145#define NUMCACHEBLKS(x) (((x)+SMP_CACHE_BYTES-1)/SMP_CACHE_BYTES) 143#define NUMCACHEBLKS(x) (((x)+SMP_CACHE_BYTES-1)/SMP_CACHE_BYTES)
146 144
147#define SBMAC_READCSR(t) __raw_readq((unsigned long)t)
148#define SBMAC_WRITECSR(t,v) __raw_writeq(v, (unsigned long)t)
149
150
151#define SBMAC_MAX_TXDESCR 32 145#define SBMAC_MAX_TXDESCR 32
152#define SBMAC_MAX_RXDESCR 32 146#define SBMAC_MAX_RXDESCR 32
153 147
@@ -187,11 +181,11 @@ typedef struct sbmacdma_s {
187 int sbdma_int_timeout; /* # usec rx/tx interrupt */ 181 int sbdma_int_timeout; /* # usec rx/tx interrupt */
188#endif 182#endif
189 183
190 sbmac_port_t sbdma_config0; /* DMA config register 0 */ 184 volatile void __iomem *sbdma_config0; /* DMA config register 0 */
191 sbmac_port_t sbdma_config1; /* DMA config register 1 */ 185 volatile void __iomem *sbdma_config1; /* DMA config register 1 */
192 sbmac_port_t sbdma_dscrbase; /* Descriptor base address */ 186 volatile void __iomem *sbdma_dscrbase; /* Descriptor base address */
193 sbmac_port_t sbdma_dscrcnt; /* Descriptor count register */ 187 volatile void __iomem *sbdma_dscrcnt; /* Descriptor count register */
194 sbmac_port_t sbdma_curdscr; /* current descriptor address */ 188 volatile void __iomem *sbdma_curdscr; /* current descriptor address */
195 189
196 /* 190 /*
197 * This stuff is for maintenance of the ring 191 * This stuff is for maintenance of the ring
@@ -236,17 +230,17 @@ struct sbmac_softc {
236 * Controller-specific things 230 * Controller-specific things
237 */ 231 */
238 232
239 unsigned long sbm_base; /* MAC's base address */ 233 volatile void __iomem *sbm_base; /* MAC's base address */
240 sbmac_state_t sbm_state; /* current state */ 234 sbmac_state_t sbm_state; /* current state */
241 235
242 sbmac_port_t sbm_macenable; /* MAC Enable Register */ 236 volatile void __iomem *sbm_macenable; /* MAC Enable Register */
243 sbmac_port_t sbm_maccfg; /* MAC Configuration Register */ 237 volatile void __iomem *sbm_maccfg; /* MAC Configuration Register */
244 sbmac_port_t sbm_fifocfg; /* FIFO configuration register */ 238 volatile void __iomem *sbm_fifocfg; /* FIFO configuration register */
245 sbmac_port_t sbm_framecfg; /* Frame configuration register */ 239 volatile void __iomem *sbm_framecfg; /* Frame configuration register */
246 sbmac_port_t sbm_rxfilter; /* receive filter register */ 240 volatile void __iomem *sbm_rxfilter; /* receive filter register */
247 sbmac_port_t sbm_isr; /* Interrupt status register */ 241 volatile void __iomem *sbm_isr; /* Interrupt status register */
248 sbmac_port_t sbm_imr; /* Interrupt mask register */ 242 volatile void __iomem *sbm_imr; /* Interrupt mask register */
249 sbmac_port_t sbm_mdio; /* MDIO register */ 243 volatile void __iomem *sbm_mdio; /* MDIO register */
250 244
251 sbmac_speed_t sbm_speed; /* current speed */ 245 sbmac_speed_t sbm_speed; /* current speed */
252 sbmac_duplex_t sbm_duplex; /* current duplex */ 246 sbmac_duplex_t sbm_duplex; /* current duplex */
@@ -467,15 +461,15 @@ static void sbmac_mii_sync(struct sbmac_softc *s)
467 uint64_t bits; 461 uint64_t bits;
468 int mac_mdio_genc; 462 int mac_mdio_genc;
469 463
470 mac_mdio_genc = SBMAC_READCSR(s->sbm_mdio) & M_MAC_GENC; 464 mac_mdio_genc = __raw_readq(s->sbm_mdio) & M_MAC_GENC;
471 465
472 bits = M_MAC_MDIO_DIR_OUTPUT | M_MAC_MDIO_OUT; 466 bits = M_MAC_MDIO_DIR_OUTPUT | M_MAC_MDIO_OUT;
473 467
474 SBMAC_WRITECSR(s->sbm_mdio,bits | mac_mdio_genc); 468 __raw_writeq(bits | mac_mdio_genc, s->sbm_mdio);
475 469
476 for (cnt = 0; cnt < 32; cnt++) { 470 for (cnt = 0; cnt < 32; cnt++) {
477 SBMAC_WRITECSR(s->sbm_mdio,bits | M_MAC_MDC | mac_mdio_genc); 471 __raw_writeq(bits | M_MAC_MDC | mac_mdio_genc, s->sbm_mdio);
478 SBMAC_WRITECSR(s->sbm_mdio,bits | mac_mdio_genc); 472 __raw_writeq(bits | mac_mdio_genc, s->sbm_mdio);
479 } 473 }
480} 474}
481 475
@@ -498,10 +492,10 @@ static void sbmac_mii_senddata(struct sbmac_softc *s,unsigned int data, int bitc
498 unsigned int curmask; 492 unsigned int curmask;
499 int mac_mdio_genc; 493 int mac_mdio_genc;
500 494
501 mac_mdio_genc = SBMAC_READCSR(s->sbm_mdio) & M_MAC_GENC; 495 mac_mdio_genc = __raw_readq(s->sbm_mdio) & M_MAC_GENC;
502 496
503 bits = M_MAC_MDIO_DIR_OUTPUT; 497 bits = M_MAC_MDIO_DIR_OUTPUT;
504 SBMAC_WRITECSR(s->sbm_mdio,bits | mac_mdio_genc); 498 __raw_writeq(bits | mac_mdio_genc, s->sbm_mdio);
505 499
506 curmask = 1 << (bitcnt - 1); 500 curmask = 1 << (bitcnt - 1);
507 501
@@ -509,9 +503,9 @@ static void sbmac_mii_senddata(struct sbmac_softc *s,unsigned int data, int bitc
509 if (data & curmask) 503 if (data & curmask)
510 bits |= M_MAC_MDIO_OUT; 504 bits |= M_MAC_MDIO_OUT;
511 else bits &= ~M_MAC_MDIO_OUT; 505 else bits &= ~M_MAC_MDIO_OUT;
512 SBMAC_WRITECSR(s->sbm_mdio,bits | mac_mdio_genc); 506 __raw_writeq(bits | mac_mdio_genc, s->sbm_mdio);
513 SBMAC_WRITECSR(s->sbm_mdio,bits | M_MAC_MDC | mac_mdio_genc); 507 __raw_writeq(bits | M_MAC_MDC | mac_mdio_genc, s->sbm_mdio);
514 SBMAC_WRITECSR(s->sbm_mdio,bits | mac_mdio_genc); 508 __raw_writeq(bits | mac_mdio_genc, s->sbm_mdio);
515 curmask >>= 1; 509 curmask >>= 1;
516 } 510 }
517} 511}
@@ -559,33 +553,31 @@ static unsigned int sbmac_mii_read(struct sbmac_softc *s,int phyaddr,int regidx)
559 sbmac_mii_senddata(s,phyaddr, 5); 553 sbmac_mii_senddata(s,phyaddr, 5);
560 sbmac_mii_senddata(s,regidx, 5); 554 sbmac_mii_senddata(s,regidx, 5);
561 555
562 mac_mdio_genc = SBMAC_READCSR(s->sbm_mdio) & M_MAC_GENC; 556 mac_mdio_genc = __raw_readq(s->sbm_mdio) & M_MAC_GENC;
563 557
564 /* 558 /*
565 * Switch the port around without a clock transition. 559 * Switch the port around without a clock transition.
566 */ 560 */
567 SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_INPUT | mac_mdio_genc); 561 __raw_writeq(M_MAC_MDIO_DIR_INPUT | mac_mdio_genc, s->sbm_mdio);
568 562
569 /* 563 /*
570 * Send out a clock pulse to signal we want the status 564 * Send out a clock pulse to signal we want the status
571 */ 565 */
572 566
573 SBMAC_WRITECSR(s->sbm_mdio, 567 __raw_writeq(M_MAC_MDIO_DIR_INPUT | M_MAC_MDC | mac_mdio_genc, s->sbm_mdio);
574 M_MAC_MDIO_DIR_INPUT | M_MAC_MDC | mac_mdio_genc); 568 __raw_writeq(M_MAC_MDIO_DIR_INPUT | mac_mdio_genc, s->sbm_mdio);
575 SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_INPUT | mac_mdio_genc);
576 569
577 /* 570 /*
578 * If an error occurred, the PHY will signal '1' back 571 * If an error occurred, the PHY will signal '1' back
579 */ 572 */
580 error = SBMAC_READCSR(s->sbm_mdio) & M_MAC_MDIO_IN; 573 error = __raw_readq(s->sbm_mdio) & M_MAC_MDIO_IN;
581 574
582 /* 575 /*
583 * Issue an 'idle' clock pulse, but keep the direction 576 * Issue an 'idle' clock pulse, but keep the direction
584 * the same. 577 * the same.
585 */ 578 */
586 SBMAC_WRITECSR(s->sbm_mdio, 579 __raw_writeq(M_MAC_MDIO_DIR_INPUT | M_MAC_MDC | mac_mdio_genc, s->sbm_mdio);
587 M_MAC_MDIO_DIR_INPUT | M_MAC_MDC | mac_mdio_genc); 580 __raw_writeq(M_MAC_MDIO_DIR_INPUT | mac_mdio_genc, s->sbm_mdio);
588 SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_INPUT | mac_mdio_genc);
589 581
590 regval = 0; 582 regval = 0;
591 583
@@ -593,18 +585,16 @@ static unsigned int sbmac_mii_read(struct sbmac_softc *s,int phyaddr,int regidx)
593 regval <<= 1; 585 regval <<= 1;
594 586
595 if (error == 0) { 587 if (error == 0) {
596 if (SBMAC_READCSR(s->sbm_mdio) & M_MAC_MDIO_IN) 588 if (__raw_readq(s->sbm_mdio) & M_MAC_MDIO_IN)
597 regval |= 1; 589 regval |= 1;
598 } 590 }
599 591
600 SBMAC_WRITECSR(s->sbm_mdio, 592 __raw_writeq(M_MAC_MDIO_DIR_INPUT|M_MAC_MDC | mac_mdio_genc, s->sbm_mdio);
601 M_MAC_MDIO_DIR_INPUT|M_MAC_MDC | mac_mdio_genc); 593 __raw_writeq(M_MAC_MDIO_DIR_INPUT | mac_mdio_genc, s->sbm_mdio);
602 SBMAC_WRITECSR(s->sbm_mdio,
603 M_MAC_MDIO_DIR_INPUT | mac_mdio_genc);
604 } 594 }
605 595
606 /* Switch back to output */ 596 /* Switch back to output */
607 SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_OUTPUT | mac_mdio_genc); 597 __raw_writeq(M_MAC_MDIO_DIR_OUTPUT | mac_mdio_genc, s->sbm_mdio);
608 598
609 if (error == 0) 599 if (error == 0)
610 return regval; 600 return regval;
@@ -641,9 +631,9 @@ static void sbmac_mii_write(struct sbmac_softc *s,int phyaddr,int regidx,
641 sbmac_mii_senddata(s,MII_COMMAND_ACK,2); 631 sbmac_mii_senddata(s,MII_COMMAND_ACK,2);
642 sbmac_mii_senddata(s,regval,16); 632 sbmac_mii_senddata(s,regval,16);
643 633
644 mac_mdio_genc = SBMAC_READCSR(s->sbm_mdio) & M_MAC_GENC; 634 mac_mdio_genc = __raw_readq(s->sbm_mdio) & M_MAC_GENC;
645 635
646 SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_OUTPUT | mac_mdio_genc); 636 __raw_writeq(M_MAC_MDIO_DIR_OUTPUT | mac_mdio_genc, s->sbm_mdio);
647} 637}
648 638
649 639
@@ -685,48 +675,27 @@ static void sbdma_initctx(sbmacdma_t *d,
685 s->sbe_idx =(s->sbm_base - A_MAC_BASE_0)/MAC_SPACING; 675 s->sbe_idx =(s->sbm_base - A_MAC_BASE_0)/MAC_SPACING;
686#endif 676#endif
687 677
688 SBMAC_WRITECSR(IOADDR( 678 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_BYTES)));
689 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_BYTES)), 0); 679 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_COLLISIONS)));
690 SBMAC_WRITECSR(IOADDR( 680 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_LATE_COL)));
691 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_COLLISIONS)), 0); 681 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_EX_COL)));
692 SBMAC_WRITECSR(IOADDR( 682 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_FCS_ERROR)));
693 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_LATE_COL)), 0); 683 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_ABORT)));
694 SBMAC_WRITECSR(IOADDR( 684 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_BAD)));
695 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_EX_COL)), 0); 685 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_GOOD)));
696 SBMAC_WRITECSR(IOADDR( 686 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_RUNT)));
697 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_FCS_ERROR)), 0); 687 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_OVERSIZE)));
698 SBMAC_WRITECSR(IOADDR( 688 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BYTES)));
699 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_ABORT)), 0); 689 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_MCAST)));
700 SBMAC_WRITECSR(IOADDR( 690 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BCAST)));
701 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_BAD)), 0); 691 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BAD)));
702 SBMAC_WRITECSR(IOADDR( 692 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_GOOD)));
703 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_GOOD)), 0); 693 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_RUNT)));
704 SBMAC_WRITECSR(IOADDR( 694 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_OVERSIZE)));
705 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_RUNT)), 0); 695 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_FCS_ERROR)));
706 SBMAC_WRITECSR(IOADDR( 696 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_LENGTH_ERROR)));
707 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_TX_OVERSIZE)), 0); 697 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_CODE_ERROR)));
708 SBMAC_WRITECSR(IOADDR( 698 __raw_writeq(0, IOADDR(A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_ALIGN_ERROR)));
709 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BYTES)), 0);
710 SBMAC_WRITECSR(IOADDR(
711 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_MCAST)), 0);
712 SBMAC_WRITECSR(IOADDR(
713 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BCAST)), 0);
714 SBMAC_WRITECSR(IOADDR(
715 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_BAD)), 0);
716 SBMAC_WRITECSR(IOADDR(
717 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_GOOD)), 0);
718 SBMAC_WRITECSR(IOADDR(
719 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_RUNT)), 0);
720 SBMAC_WRITECSR(IOADDR(
721 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_OVERSIZE)), 0);
722 SBMAC_WRITECSR(IOADDR(
723 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_FCS_ERROR)), 0);
724 SBMAC_WRITECSR(IOADDR(
725 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_LENGTH_ERROR)), 0);
726 SBMAC_WRITECSR(IOADDR(
727 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_CODE_ERROR)), 0);
728 SBMAC_WRITECSR(IOADDR(
729 A_MAC_REGISTER(s->sbe_idx, R_MAC_RMON_RX_ALIGN_ERROR)), 0);
730 699
731 /* 700 /*
732 * initialize register pointers 701 * initialize register pointers
@@ -814,22 +783,19 @@ static void sbdma_channel_start(sbmacdma_t *d, int rxtx )
814 */ 783 */
815 784
816#ifdef CONFIG_SBMAC_COALESCE 785#ifdef CONFIG_SBMAC_COALESCE
817 SBMAC_WRITECSR(d->sbdma_config1, 786 __raw_writeq(V_DMA_INT_TIMEOUT(d->sbdma_int_timeout) |
818 V_DMA_INT_TIMEOUT(d->sbdma_int_timeout) | 787 0, d->sbdma_config1);
819 0); 788 __raw_writeq(M_DMA_EOP_INT_EN |
820 SBMAC_WRITECSR(d->sbdma_config0,
821 M_DMA_EOP_INT_EN |
822 V_DMA_RINGSZ(d->sbdma_maxdescr) | 789 V_DMA_RINGSZ(d->sbdma_maxdescr) |
823 V_DMA_INT_PKTCNT(d->sbdma_int_pktcnt) | 790 V_DMA_INT_PKTCNT(d->sbdma_int_pktcnt) |
824 0); 791 0, d->sbdma_config0);
825#else 792#else
826 SBMAC_WRITECSR(d->sbdma_config1,0); 793 __raw_writeq(0, d->sbdma_config1);
827 SBMAC_WRITECSR(d->sbdma_config0, 794 __raw_writeq(V_DMA_RINGSZ(d->sbdma_maxdescr) |
828 V_DMA_RINGSZ(d->sbdma_maxdescr) | 795 0, d->sbdma_config0);
829 0);
830#endif 796#endif
831 797
832 SBMAC_WRITECSR(d->sbdma_dscrbase,d->sbdma_dscrtable_phys); 798 __raw_writeq(d->sbdma_dscrtable_phys, d->sbdma_dscrbase);
833 799
834 /* 800 /*
835 * Initialize ring pointers 801 * Initialize ring pointers
@@ -857,18 +823,18 @@ static void sbdma_channel_stop(sbmacdma_t *d)
857 * Turn off the DMA channel 823 * Turn off the DMA channel
858 */ 824 */
859 825
860 SBMAC_WRITECSR(d->sbdma_config1,0); 826 __raw_writeq(0, d->sbdma_config1);
861 827
862 SBMAC_WRITECSR(d->sbdma_dscrbase,0); 828 __raw_writeq(0, d->sbdma_dscrbase);
863 829
864 SBMAC_WRITECSR(d->sbdma_config0,0); 830 __raw_writeq(0, d->sbdma_config0);
865 831
866 /* 832 /*
867 * Zero ring pointers 833 * Zero ring pointers
868 */ 834 */
869 835
870 d->sbdma_addptr = 0; 836 d->sbdma_addptr = NULL;
871 d->sbdma_remptr = 0; 837 d->sbdma_remptr = NULL;
872} 838}
873 839
874static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset) 840static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset)
@@ -971,8 +937,7 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb)
971 * Do not interrupt per DMA transfer. 937 * Do not interrupt per DMA transfer.
972 */ 938 */
973 dsc->dscr_a = virt_to_phys(sb_new->data) | 939 dsc->dscr_a = virt_to_phys(sb_new->data) |
974 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 940 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 0;
975 0;
976#else 941#else
977 dsc->dscr_a = virt_to_phys(sb_new->data) | 942 dsc->dscr_a = virt_to_phys(sb_new->data) |
978 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) | 943 V_DMA_DSCRA_A_SIZE(NUMCACHEBLKS(pktsize+ETHER_ALIGN)) |
@@ -998,7 +963,7 @@ static int sbdma_add_rcvbuffer(sbmacdma_t *d,struct sk_buff *sb)
998 * Give the buffer to the DMA engine. 963 * Give the buffer to the DMA engine.
999 */ 964 */
1000 965
1001 SBMAC_WRITECSR(d->sbdma_dscrcnt,1); 966 __raw_writeq(1, d->sbdma_dscrcnt);
1002 967
1003 return 0; /* we did it */ 968 return 0; /* we did it */
1004} 969}
@@ -1088,7 +1053,7 @@ static int sbdma_add_txbuffer(sbmacdma_t *d,struct sk_buff *sb)
1088 * Give the buffer to the DMA engine. 1053 * Give the buffer to the DMA engine.
1089 */ 1054 */
1090 1055
1091 SBMAC_WRITECSR(d->sbdma_dscrcnt,1); 1056 __raw_writeq(1, d->sbdma_dscrcnt);
1092 1057
1093 return 0; /* we did it */ 1058 return 0; /* we did it */
1094} 1059}
@@ -1184,7 +1149,7 @@ static void sbdma_rx_process(struct sbmac_softc *sc,sbmacdma_t *d)
1184 */ 1149 */
1185 1150
1186 curidx = d->sbdma_remptr - d->sbdma_dscrtable; 1151 curidx = d->sbdma_remptr - d->sbdma_dscrtable;
1187 hwidx = (int) (((SBMAC_READCSR(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - 1152 hwidx = (int) (((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) -
1188 d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); 1153 d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t));
1189 1154
1190 /* 1155 /*
@@ -1311,7 +1276,7 @@ static void sbdma_tx_process(struct sbmac_softc *sc,sbmacdma_t *d)
1311 */ 1276 */
1312 1277
1313 curidx = d->sbdma_remptr - d->sbdma_dscrtable; 1278 curidx = d->sbdma_remptr - d->sbdma_dscrtable;
1314 hwidx = (int) (((SBMAC_READCSR(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) - 1279 hwidx = (int) (((__raw_readq(d->sbdma_curdscr) & M_DMA_CURDSCR_ADDR) -
1315 d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t)); 1280 d->sbdma_dscrtable_phys) / sizeof(sbdmadscr_t));
1316 1281
1317 /* 1282 /*
@@ -1467,7 +1432,7 @@ static void sbmac_uninitctx(struct sbmac_softc *sc)
1467static void sbmac_channel_start(struct sbmac_softc *s) 1432static void sbmac_channel_start(struct sbmac_softc *s)
1468{ 1433{
1469 uint64_t reg; 1434 uint64_t reg;
1470 sbmac_port_t port; 1435 volatile void __iomem *port;
1471 uint64_t cfg,fifo,framecfg; 1436 uint64_t cfg,fifo,framecfg;
1472 int idx, th_value; 1437 int idx, th_value;
1473 1438
@@ -1482,13 +1447,13 @@ static void sbmac_channel_start(struct sbmac_softc *s)
1482 * Bring the controller out of reset, but leave it off. 1447 * Bring the controller out of reset, but leave it off.
1483 */ 1448 */
1484 1449
1485 SBMAC_WRITECSR(s->sbm_macenable,0); 1450 __raw_writeq(0, s->sbm_macenable);
1486 1451
1487 /* 1452 /*
1488 * Ignore all received packets 1453 * Ignore all received packets
1489 */ 1454 */
1490 1455
1491 SBMAC_WRITECSR(s->sbm_rxfilter,0); 1456 __raw_writeq(0, s->sbm_rxfilter);
1492 1457
1493 /* 1458 /*
1494 * Calculate values for various control registers. 1459 * Calculate values for various control registers.
@@ -1532,7 +1497,7 @@ static void sbmac_channel_start(struct sbmac_softc *s)
1532 1497
1533 port = s->sbm_base + R_MAC_HASH_BASE; 1498 port = s->sbm_base + R_MAC_HASH_BASE;
1534 for (idx = 0; idx < MAC_HASH_COUNT; idx++) { 1499 for (idx = 0; idx < MAC_HASH_COUNT; idx++) {
1535 SBMAC_WRITECSR(port,0); 1500 __raw_writeq(0, port);
1536 port += sizeof(uint64_t); 1501 port += sizeof(uint64_t);
1537 } 1502 }
1538 1503
@@ -1542,7 +1507,7 @@ static void sbmac_channel_start(struct sbmac_softc *s)
1542 1507
1543 port = s->sbm_base + R_MAC_ADDR_BASE; 1508 port = s->sbm_base + R_MAC_ADDR_BASE;
1544 for (idx = 0; idx < MAC_ADDR_COUNT; idx++) { 1509 for (idx = 0; idx < MAC_ADDR_COUNT; idx++) {
1545 SBMAC_WRITECSR(port,0); 1510 __raw_writeq(0, port);
1546 port += sizeof(uint64_t); 1511 port += sizeof(uint64_t);
1547 } 1512 }
1548 1513
@@ -1552,14 +1517,14 @@ static void sbmac_channel_start(struct sbmac_softc *s)
1552 1517
1553 port = s->sbm_base + R_MAC_CHUP0_BASE; 1518 port = s->sbm_base + R_MAC_CHUP0_BASE;
1554 for (idx = 0; idx < MAC_CHMAP_COUNT; idx++) { 1519 for (idx = 0; idx < MAC_CHMAP_COUNT; idx++) {
1555 SBMAC_WRITECSR(port,0); 1520 __raw_writeq(0, port);
1556 port += sizeof(uint64_t); 1521 port += sizeof(uint64_t);
1557 } 1522 }
1558 1523
1559 1524
1560 port = s->sbm_base + R_MAC_CHLO0_BASE; 1525 port = s->sbm_base + R_MAC_CHLO0_BASE;
1561 for (idx = 0; idx < MAC_CHMAP_COUNT; idx++) { 1526 for (idx = 0; idx < MAC_CHMAP_COUNT; idx++) {
1562 SBMAC_WRITECSR(port,0); 1527 __raw_writeq(0, port);
1563 port += sizeof(uint64_t); 1528 port += sizeof(uint64_t);
1564 } 1529 }
1565 1530
@@ -1571,7 +1536,7 @@ static void sbmac_channel_start(struct sbmac_softc *s)
1571 reg = sbmac_addr2reg(s->sbm_hwaddr); 1536 reg = sbmac_addr2reg(s->sbm_hwaddr);
1572 1537
1573 port = s->sbm_base + R_MAC_ADDR_BASE; 1538 port = s->sbm_base + R_MAC_ADDR_BASE;
1574 SBMAC_WRITECSR(port,reg); 1539 __raw_writeq(reg, port);
1575 port = s->sbm_base + R_MAC_ETHERNET_ADDR; 1540 port = s->sbm_base + R_MAC_ETHERNET_ADDR;
1576 1541
1577#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS 1542#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
@@ -1580,9 +1545,9 @@ static void sbmac_channel_start(struct sbmac_softc *s)
1580 * destination address in the R_MAC_ETHERNET_ADDR register. 1545 * destination address in the R_MAC_ETHERNET_ADDR register.
1581 * Set the value to zero. 1546 * Set the value to zero.
1582 */ 1547 */
1583 SBMAC_WRITECSR(port,0); 1548 __raw_writeq(0, port);
1584#else 1549#else
1585 SBMAC_WRITECSR(port,reg); 1550 __raw_writeq(reg, port);
1586#endif 1551#endif
1587 1552
1588 /* 1553 /*
@@ -1590,11 +1555,11 @@ static void sbmac_channel_start(struct sbmac_softc *s)
1590 * to the various config registers 1555 * to the various config registers
1591 */ 1556 */
1592 1557
1593 SBMAC_WRITECSR(s->sbm_rxfilter,0); 1558 __raw_writeq(0, s->sbm_rxfilter);
1594 SBMAC_WRITECSR(s->sbm_imr,0); 1559 __raw_writeq(0, s->sbm_imr);
1595 SBMAC_WRITECSR(s->sbm_framecfg,framecfg); 1560 __raw_writeq(framecfg, s->sbm_framecfg);
1596 SBMAC_WRITECSR(s->sbm_fifocfg,fifo); 1561 __raw_writeq(fifo, s->sbm_fifocfg);
1597 SBMAC_WRITECSR(s->sbm_maccfg,cfg); 1562 __raw_writeq(cfg, s->sbm_maccfg);
1598 1563
1599 /* 1564 /*
1600 * Initialize DMA channels (rings should be ok now) 1565 * Initialize DMA channels (rings should be ok now)
@@ -1620,11 +1585,10 @@ static void sbmac_channel_start(struct sbmac_softc *s)
1620 * Turn on the rest of the bits in the enable register 1585 * Turn on the rest of the bits in the enable register
1621 */ 1586 */
1622 1587
1623 SBMAC_WRITECSR(s->sbm_macenable, 1588 __raw_writeq(M_MAC_RXDMA_EN0 |
1624 M_MAC_RXDMA_EN0 |
1625 M_MAC_TXDMA_EN0 | 1589 M_MAC_TXDMA_EN0 |
1626 M_MAC_RX_ENABLE | 1590 M_MAC_RX_ENABLE |
1627 M_MAC_TX_ENABLE); 1591 M_MAC_TX_ENABLE, s->sbm_macenable);
1628 1592
1629 1593
1630 1594
@@ -1633,23 +1597,21 @@ static void sbmac_channel_start(struct sbmac_softc *s)
1633 /* 1597 /*
1634 * Accept any TX interrupt and EOP count/timer RX interrupts on ch 0 1598 * Accept any TX interrupt and EOP count/timer RX interrupts on ch 0
1635 */ 1599 */
1636 SBMAC_WRITECSR(s->sbm_imr, 1600 __raw_writeq(((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) |
1637 ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) | 1601 ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0), s->sbm_imr);
1638 ((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_RX_CH0));
1639#else 1602#else
1640 /* 1603 /*
1641 * Accept any kind of interrupt on TX and RX DMA channel 0 1604 * Accept any kind of interrupt on TX and RX DMA channel 0
1642 */ 1605 */
1643 SBMAC_WRITECSR(s->sbm_imr, 1606 __raw_writeq((M_MAC_INT_CHANNEL << S_MAC_TX_CH0) |
1644 (M_MAC_INT_CHANNEL << S_MAC_TX_CH0) | 1607 (M_MAC_INT_CHANNEL << S_MAC_RX_CH0), s->sbm_imr);
1645 (M_MAC_INT_CHANNEL << S_MAC_RX_CH0));
1646#endif 1608#endif
1647 1609
1648 /* 1610 /*
1649 * Enable receiving unicasts and broadcasts 1611 * Enable receiving unicasts and broadcasts
1650 */ 1612 */
1651 1613
1652 SBMAC_WRITECSR(s->sbm_rxfilter,M_MAC_UCAST_EN | M_MAC_BCAST_EN); 1614 __raw_writeq(M_MAC_UCAST_EN | M_MAC_BCAST_EN, s->sbm_rxfilter);
1653 1615
1654 /* 1616 /*
1655 * we're running now. 1617 * we're running now.
@@ -1695,8 +1657,8 @@ static void sbmac_channel_stop(struct sbmac_softc *s)
1695 1657
1696 /* don't accept any packets, disable all interrupts */ 1658 /* don't accept any packets, disable all interrupts */
1697 1659
1698 SBMAC_WRITECSR(s->sbm_rxfilter,0); 1660 __raw_writeq(0, s->sbm_rxfilter);
1699 SBMAC_WRITECSR(s->sbm_imr,0); 1661 __raw_writeq(0, s->sbm_imr);
1700 1662
1701 /* Turn off ticker */ 1663 /* Turn off ticker */
1702 1664
@@ -1704,7 +1666,7 @@ static void sbmac_channel_stop(struct sbmac_softc *s)
1704 1666
1705 /* turn off receiver and transmitter */ 1667 /* turn off receiver and transmitter */
1706 1668
1707 SBMAC_WRITECSR(s->sbm_macenable,0); 1669 __raw_writeq(0, s->sbm_macenable);
1708 1670
1709 /* We're stopped now. */ 1671 /* We're stopped now. */
1710 1672
@@ -1788,14 +1750,14 @@ static void sbmac_promiscuous_mode(struct sbmac_softc *sc,int onoff)
1788 return; 1750 return;
1789 1751
1790 if (onoff) { 1752 if (onoff) {
1791 reg = SBMAC_READCSR(sc->sbm_rxfilter); 1753 reg = __raw_readq(sc->sbm_rxfilter);
1792 reg |= M_MAC_ALLPKT_EN; 1754 reg |= M_MAC_ALLPKT_EN;
1793 SBMAC_WRITECSR(sc->sbm_rxfilter,reg); 1755 __raw_writeq(reg, sc->sbm_rxfilter);
1794 } 1756 }
1795 else { 1757 else {
1796 reg = SBMAC_READCSR(sc->sbm_rxfilter); 1758 reg = __raw_readq(sc->sbm_rxfilter);
1797 reg &= ~M_MAC_ALLPKT_EN; 1759 reg &= ~M_MAC_ALLPKT_EN;
1798 SBMAC_WRITECSR(sc->sbm_rxfilter,reg); 1760 __raw_writeq(reg, sc->sbm_rxfilter);
1799 } 1761 }
1800} 1762}
1801 1763
@@ -1816,9 +1778,9 @@ static void sbmac_set_iphdr_offset(struct sbmac_softc *sc)
1816 uint64_t reg; 1778 uint64_t reg;
1817 1779
1818 /* Hard code the off set to 15 for now */ 1780 /* Hard code the off set to 15 for now */
1819 reg = SBMAC_READCSR(sc->sbm_rxfilter); 1781 reg = __raw_readq(sc->sbm_rxfilter);
1820 reg &= ~M_MAC_IPHDR_OFFSET | V_MAC_IPHDR_OFFSET(15); 1782 reg &= ~M_MAC_IPHDR_OFFSET | V_MAC_IPHDR_OFFSET(15);
1821 SBMAC_WRITECSR(sc->sbm_rxfilter,reg); 1783 __raw_writeq(reg, sc->sbm_rxfilter);
1822 1784
1823 /* read system identification to determine revision */ 1785 /* read system identification to determine revision */
1824 if (periph_rev >= 2) { 1786 if (periph_rev >= 2) {
@@ -1897,8 +1859,8 @@ static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed)
1897 * Read current register values 1859 * Read current register values
1898 */ 1860 */
1899 1861
1900 cfg = SBMAC_READCSR(s->sbm_maccfg); 1862 cfg = __raw_readq(s->sbm_maccfg);
1901 framecfg = SBMAC_READCSR(s->sbm_framecfg); 1863 framecfg = __raw_readq(s->sbm_framecfg);
1902 1864
1903 /* 1865 /*
1904 * Mask out the stuff we want to change 1866 * Mask out the stuff we want to change
@@ -1947,8 +1909,8 @@ static int sbmac_set_speed(struct sbmac_softc *s,sbmac_speed_t speed)
1947 * Send the bits back to the hardware 1909 * Send the bits back to the hardware
1948 */ 1910 */
1949 1911
1950 SBMAC_WRITECSR(s->sbm_framecfg,framecfg); 1912 __raw_writeq(framecfg, s->sbm_framecfg);
1951 SBMAC_WRITECSR(s->sbm_maccfg,cfg); 1913 __raw_writeq(cfg, s->sbm_maccfg);
1952 1914
1953 return 1; 1915 return 1;
1954} 1916}
@@ -1987,7 +1949,7 @@ static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc
1987 * Read current register values 1949 * Read current register values
1988 */ 1950 */
1989 1951
1990 cfg = SBMAC_READCSR(s->sbm_maccfg); 1952 cfg = __raw_readq(s->sbm_maccfg);
1991 1953
1992 /* 1954 /*
1993 * Mask off the stuff we're about to change 1955 * Mask off the stuff we're about to change
@@ -2046,7 +2008,7 @@ static int sbmac_set_duplex(struct sbmac_softc *s,sbmac_duplex_t duplex,sbmac_fc
2046 * Send the bits back to the hardware 2008 * Send the bits back to the hardware
2047 */ 2009 */
2048 2010
2049 SBMAC_WRITECSR(s->sbm_maccfg,cfg); 2011 __raw_writeq(cfg, s->sbm_maccfg);
2050 2012
2051 return 1; 2013 return 1;
2052} 2014}
@@ -2079,7 +2041,7 @@ static irqreturn_t sbmac_intr(int irq,void *dev_instance,struct pt_regs *rgs)
2079 * register, except for counter addr) 2041 * register, except for counter addr)
2080 */ 2042 */
2081 2043
2082 isr = SBMAC_READCSR(sc->sbm_isr) & ~M_MAC_COUNTER_ADDR; 2044 isr = __raw_readq(sc->sbm_isr) & ~M_MAC_COUNTER_ADDR;
2083 2045
2084 if (isr == 0) 2046 if (isr == 0)
2085 break; 2047 break;
@@ -2180,7 +2142,7 @@ static int sbmac_start_tx(struct sk_buff *skb, struct net_device *dev)
2180static void sbmac_setmulti(struct sbmac_softc *sc) 2142static void sbmac_setmulti(struct sbmac_softc *sc)
2181{ 2143{
2182 uint64_t reg; 2144 uint64_t reg;
2183 sbmac_port_t port; 2145 volatile void __iomem *port;
2184 int idx; 2146 int idx;
2185 struct dev_mc_list *mclist; 2147 struct dev_mc_list *mclist;
2186 struct net_device *dev = sc->sbm_dev; 2148 struct net_device *dev = sc->sbm_dev;
@@ -2193,30 +2155,30 @@ static void sbmac_setmulti(struct sbmac_softc *sc)
2193 2155
2194 for (idx = 1; idx < MAC_ADDR_COUNT; idx++) { 2156 for (idx = 1; idx < MAC_ADDR_COUNT; idx++) {
2195 port = sc->sbm_base + R_MAC_ADDR_BASE+(idx*sizeof(uint64_t)); 2157 port = sc->sbm_base + R_MAC_ADDR_BASE+(idx*sizeof(uint64_t));
2196 SBMAC_WRITECSR(port,0); 2158 __raw_writeq(0, port);
2197 } 2159 }
2198 2160
2199 for (idx = 0; idx < MAC_HASH_COUNT; idx++) { 2161 for (idx = 0; idx < MAC_HASH_COUNT; idx++) {
2200 port = sc->sbm_base + R_MAC_HASH_BASE+(idx*sizeof(uint64_t)); 2162 port = sc->sbm_base + R_MAC_HASH_BASE+(idx*sizeof(uint64_t));
2201 SBMAC_WRITECSR(port,0); 2163 __raw_writeq(0, port);
2202 } 2164 }
2203 2165
2204 /* 2166 /*
2205 * Clear the filter to say we don't want any multicasts. 2167 * Clear the filter to say we don't want any multicasts.
2206 */ 2168 */
2207 2169
2208 reg = SBMAC_READCSR(sc->sbm_rxfilter); 2170 reg = __raw_readq(sc->sbm_rxfilter);
2209 reg &= ~(M_MAC_MCAST_INV | M_MAC_MCAST_EN); 2171 reg &= ~(M_MAC_MCAST_INV | M_MAC_MCAST_EN);
2210 SBMAC_WRITECSR(sc->sbm_rxfilter,reg); 2172 __raw_writeq(reg, sc->sbm_rxfilter);
2211 2173
2212 if (dev->flags & IFF_ALLMULTI) { 2174 if (dev->flags & IFF_ALLMULTI) {
2213 /* 2175 /*
2214 * Enable ALL multicasts. Do this by inverting the 2176 * Enable ALL multicasts. Do this by inverting the
2215 * multicast enable bit. 2177 * multicast enable bit.
2216 */ 2178 */
2217 reg = SBMAC_READCSR(sc->sbm_rxfilter); 2179 reg = __raw_readq(sc->sbm_rxfilter);
2218 reg |= (M_MAC_MCAST_INV | M_MAC_MCAST_EN); 2180 reg |= (M_MAC_MCAST_INV | M_MAC_MCAST_EN);
2219 SBMAC_WRITECSR(sc->sbm_rxfilter,reg); 2181 __raw_writeq(reg, sc->sbm_rxfilter);
2220 return; 2182 return;
2221 } 2183 }
2222 2184
@@ -2235,7 +2197,7 @@ static void sbmac_setmulti(struct sbmac_softc *sc)
2235 while (mclist && (idx < MAC_ADDR_COUNT)) { 2197 while (mclist && (idx < MAC_ADDR_COUNT)) {
2236 reg = sbmac_addr2reg(mclist->dmi_addr); 2198 reg = sbmac_addr2reg(mclist->dmi_addr);
2237 port = sc->sbm_base + R_MAC_ADDR_BASE+(idx * sizeof(uint64_t)); 2199 port = sc->sbm_base + R_MAC_ADDR_BASE+(idx * sizeof(uint64_t));
2238 SBMAC_WRITECSR(port,reg); 2200 __raw_writeq(reg, port);
2239 idx++; 2201 idx++;
2240 mclist = mclist->next; 2202 mclist = mclist->next;
2241 } 2203 }
@@ -2246,9 +2208,9 @@ static void sbmac_setmulti(struct sbmac_softc *sc)
2246 */ 2208 */
2247 2209
2248 if (idx > 1) { 2210 if (idx > 1) {
2249 reg = SBMAC_READCSR(sc->sbm_rxfilter); 2211 reg = __raw_readq(sc->sbm_rxfilter);
2250 reg |= M_MAC_MCAST_EN; 2212 reg |= M_MAC_MCAST_EN;
2251 SBMAC_WRITECSR(sc->sbm_rxfilter,reg); 2213 __raw_writeq(reg, sc->sbm_rxfilter);
2252 } 2214 }
2253} 2215}
2254 2216
@@ -2377,8 +2339,8 @@ static int sbmac_init(struct net_device *dev, int idx)
2377 * for us in the ethernet address register for each mac. 2339 * for us in the ethernet address register for each mac.
2378 */ 2340 */
2379 2341
2380 ea_reg = SBMAC_READCSR(sc->sbm_base + R_MAC_ETHERNET_ADDR); 2342 ea_reg = __raw_readq(sc->sbm_base + R_MAC_ETHERNET_ADDR);
2381 SBMAC_WRITECSR(sc->sbm_base + R_MAC_ETHERNET_ADDR, 0); 2343 __raw_writeq(0, sc->sbm_base + R_MAC_ETHERNET_ADDR);
2382 for (i = 0; i < 6; i++) { 2344 for (i = 0; i < 6; i++) {
2383 eaddr[i] = (uint8_t) (ea_reg & 0xFF); 2345 eaddr[i] = (uint8_t) (ea_reg & 0xFF);
2384 ea_reg >>= 8; 2346 ea_reg >>= 8;
@@ -2465,7 +2427,7 @@ static int sbmac_open(struct net_device *dev)
2465 * yet) 2427 * yet)
2466 */ 2428 */
2467 2429
2468 SBMAC_READCSR(sc->sbm_isr); 2430 __raw_readq(sc->sbm_isr);
2469 if (request_irq(dev->irq, &sbmac_intr, SA_SHIRQ, dev->name, dev)) 2431 if (request_irq(dev->irq, &sbmac_intr, SA_SHIRQ, dev->name, dev))
2470 return -EBUSY; 2432 return -EBUSY;
2471 2433
@@ -2800,13 +2762,13 @@ sbmac_setup_hwaddr(int chan,char *addr)
2800{ 2762{
2801 uint8_t eaddr[6]; 2763 uint8_t eaddr[6];
2802 uint64_t val; 2764 uint64_t val;
2803 sbmac_port_t port; 2765 unsigned long port;
2804 2766
2805 port = A_MAC_CHANNEL_BASE(chan); 2767 port = A_MAC_CHANNEL_BASE(chan);
2806 sbmac_parse_hwaddr(addr,eaddr); 2768 sbmac_parse_hwaddr(addr,eaddr);
2807 val = sbmac_addr2reg(eaddr); 2769 val = sbmac_addr2reg(eaddr);
2808 SBMAC_WRITECSR(IOADDR(port+R_MAC_ETHERNET_ADDR),val); 2770 __raw_writeq(val, IOADDR(port+R_MAC_ETHERNET_ADDR));
2809 val = SBMAC_READCSR(IOADDR(port+R_MAC_ETHERNET_ADDR)); 2771 val = __raw_readq(IOADDR(port+R_MAC_ETHERNET_ADDR));
2810} 2772}
2811#endif 2773#endif
2812 2774
@@ -2817,7 +2779,7 @@ sbmac_init_module(void)
2817{ 2779{
2818 int idx; 2780 int idx;
2819 struct net_device *dev; 2781 struct net_device *dev;
2820 sbmac_port_t port; 2782 unsigned long port;
2821 int chip_max_units; 2783 int chip_max_units;
2822 2784
2823 /* 2785 /*
@@ -2871,7 +2833,7 @@ sbmac_init_module(void)
2871 * If we find a zero, skip this MAC. 2833 * If we find a zero, skip this MAC.
2872 */ 2834 */
2873 2835
2874 sbmac_orig_hwaddr[idx] = SBMAC_READCSR(IOADDR(port+R_MAC_ETHERNET_ADDR)); 2836 sbmac_orig_hwaddr[idx] = __raw_readq(IOADDR(port+R_MAC_ETHERNET_ADDR));
2875 if (sbmac_orig_hwaddr[idx] == 0) { 2837 if (sbmac_orig_hwaddr[idx] == 0) {
2876 printk(KERN_DEBUG "sbmac: not configuring MAC at " 2838 printk(KERN_DEBUG "sbmac: not configuring MAC at "
2877 "%lx\n", port); 2839 "%lx\n", port);
@@ -2893,8 +2855,7 @@ sbmac_init_module(void)
2893 dev->mem_end = 0; 2855 dev->mem_end = 0;
2894 if (sbmac_init(dev, idx)) { 2856 if (sbmac_init(dev, idx)) {
2895 port = A_MAC_CHANNEL_BASE(idx); 2857 port = A_MAC_CHANNEL_BASE(idx);
2896 SBMAC_WRITECSR(IOADDR(port+R_MAC_ETHERNET_ADDR), 2858 __raw_writeq(sbmac_orig_hwaddr[idx], IOADDR(port+R_MAC_ETHERNET_ADDR));
2897 sbmac_orig_hwaddr[idx]);
2898 free_netdev(dev); 2859 free_netdev(dev);
2899 continue; 2860 continue;
2900 } 2861 }