aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-11-01 05:29:24 -0400
committerDavid S. Miller <davem@davemloft.net>2010-11-15 13:19:16 -0500
commit900fcf091e95fbcc773b72c770afcd2e8eda4da2 (patch)
tree41affc0ade36f066bb5e857f7df6628aadbdc99c
parent636e19a34275d7d6fda0fefa965b1e2a715e2b02 (diff)
net: sh_eth: Move off of deprecated I/O routines.
sh_eth is the last in-tree user of the ctrl_xxx I/O routines. This simply converts them over to regular MMIO accesors. Signed-off-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/sh_eth.c244
1 files changed, 122 insertions, 122 deletions
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 50259dfec583..b12660d72338 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -45,9 +45,9 @@ static void sh_eth_set_duplex(struct net_device *ndev)
45 u32 ioaddr = ndev->base_addr; 45 u32 ioaddr = ndev->base_addr;
46 46
47 if (mdp->duplex) /* Full */ 47 if (mdp->duplex) /* Full */
48 ctrl_outl(ctrl_inl(ioaddr + ECMR) | ECMR_DM, ioaddr + ECMR); 48 writel(readl(ioaddr + ECMR) | ECMR_DM, ioaddr + ECMR);
49 else /* Half */ 49 else /* Half */
50 ctrl_outl(ctrl_inl(ioaddr + ECMR) & ~ECMR_DM, ioaddr + ECMR); 50 writel(readl(ioaddr + ECMR) & ~ECMR_DM, ioaddr + ECMR);
51} 51}
52 52
53static void sh_eth_set_rate(struct net_device *ndev) 53static void sh_eth_set_rate(struct net_device *ndev)
@@ -57,10 +57,10 @@ static void sh_eth_set_rate(struct net_device *ndev)
57 57
58 switch (mdp->speed) { 58 switch (mdp->speed) {
59 case 10: /* 10BASE */ 59 case 10: /* 10BASE */
60 ctrl_outl(ctrl_inl(ioaddr + ECMR) & ~ECMR_RTM, ioaddr + ECMR); 60 writel(readl(ioaddr + ECMR) & ~ECMR_RTM, ioaddr + ECMR);
61 break; 61 break;
62 case 100:/* 100BASE */ 62 case 100:/* 100BASE */
63 ctrl_outl(ctrl_inl(ioaddr + ECMR) | ECMR_RTM, ioaddr + ECMR); 63 writel(readl(ioaddr + ECMR) | ECMR_RTM, ioaddr + ECMR);
64 break; 64 break;
65 default: 65 default:
66 break; 66 break;
@@ -96,9 +96,9 @@ static void sh_eth_set_duplex(struct net_device *ndev)
96 u32 ioaddr = ndev->base_addr; 96 u32 ioaddr = ndev->base_addr;
97 97
98 if (mdp->duplex) /* Full */ 98 if (mdp->duplex) /* Full */
99 ctrl_outl(ctrl_inl(ioaddr + ECMR) | ECMR_DM, ioaddr + ECMR); 99 writel(readl(ioaddr + ECMR) | ECMR_DM, ioaddr + ECMR);
100 else /* Half */ 100 else /* Half */
101 ctrl_outl(ctrl_inl(ioaddr + ECMR) & ~ECMR_DM, ioaddr + ECMR); 101 writel(readl(ioaddr + ECMR) & ~ECMR_DM, ioaddr + ECMR);
102} 102}
103 103
104static void sh_eth_set_rate(struct net_device *ndev) 104static void sh_eth_set_rate(struct net_device *ndev)
@@ -108,10 +108,10 @@ static void sh_eth_set_rate(struct net_device *ndev)
108 108
109 switch (mdp->speed) { 109 switch (mdp->speed) {
110 case 10: /* 10BASE */ 110 case 10: /* 10BASE */
111 ctrl_outl(0, ioaddr + RTRATE); 111 writel(0, ioaddr + RTRATE);
112 break; 112 break;
113 case 100:/* 100BASE */ 113 case 100:/* 100BASE */
114 ctrl_outl(1, ioaddr + RTRATE); 114 writel(1, ioaddr + RTRATE);
115 break; 115 break;
116 default: 116 default:
117 break; 117 break;
@@ -143,7 +143,7 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
143static void sh_eth_chip_reset(struct net_device *ndev) 143static void sh_eth_chip_reset(struct net_device *ndev)
144{ 144{
145 /* reset device */ 145 /* reset device */
146 ctrl_outl(ARSTR_ARSTR, ARSTR); 146 writel(ARSTR_ARSTR, ARSTR);
147 mdelay(1); 147 mdelay(1);
148} 148}
149 149
@@ -152,10 +152,10 @@ static void sh_eth_reset(struct net_device *ndev)
152 u32 ioaddr = ndev->base_addr; 152 u32 ioaddr = ndev->base_addr;
153 int cnt = 100; 153 int cnt = 100;
154 154
155 ctrl_outl(EDSR_ENALL, ioaddr + EDSR); 155 writel(EDSR_ENALL, ioaddr + EDSR);
156 ctrl_outl(ctrl_inl(ioaddr + EDMR) | EDMR_SRST, ioaddr + EDMR); 156 writel(readl(ioaddr + EDMR) | EDMR_SRST, ioaddr + EDMR);
157 while (cnt > 0) { 157 while (cnt > 0) {
158 if (!(ctrl_inl(ioaddr + EDMR) & 0x3)) 158 if (!(readl(ioaddr + EDMR) & 0x3))
159 break; 159 break;
160 mdelay(1); 160 mdelay(1);
161 cnt--; 161 cnt--;
@@ -164,14 +164,14 @@ static void sh_eth_reset(struct net_device *ndev)
164 printk(KERN_ERR "Device reset fail\n"); 164 printk(KERN_ERR "Device reset fail\n");
165 165
166 /* Table Init */ 166 /* Table Init */
167 ctrl_outl(0x0, ioaddr + TDLAR); 167 writel(0x0, ioaddr + TDLAR);
168 ctrl_outl(0x0, ioaddr + TDFAR); 168 writel(0x0, ioaddr + TDFAR);
169 ctrl_outl(0x0, ioaddr + TDFXR); 169 writel(0x0, ioaddr + TDFXR);
170 ctrl_outl(0x0, ioaddr + TDFFR); 170 writel(0x0, ioaddr + TDFFR);
171 ctrl_outl(0x0, ioaddr + RDLAR); 171 writel(0x0, ioaddr + RDLAR);
172 ctrl_outl(0x0, ioaddr + RDFAR); 172 writel(0x0, ioaddr + RDFAR);
173 ctrl_outl(0x0, ioaddr + RDFXR); 173 writel(0x0, ioaddr + RDFXR);
174 ctrl_outl(0x0, ioaddr + RDFFR); 174 writel(0x0, ioaddr + RDFFR);
175} 175}
176 176
177static void sh_eth_set_duplex(struct net_device *ndev) 177static void sh_eth_set_duplex(struct net_device *ndev)
@@ -180,9 +180,9 @@ static void sh_eth_set_duplex(struct net_device *ndev)
180 u32 ioaddr = ndev->base_addr; 180 u32 ioaddr = ndev->base_addr;
181 181
182 if (mdp->duplex) /* Full */ 182 if (mdp->duplex) /* Full */
183 ctrl_outl(ctrl_inl(ioaddr + ECMR) | ECMR_DM, ioaddr + ECMR); 183 writel(readl(ioaddr + ECMR) | ECMR_DM, ioaddr + ECMR);
184 else /* Half */ 184 else /* Half */
185 ctrl_outl(ctrl_inl(ioaddr + ECMR) & ~ECMR_DM, ioaddr + ECMR); 185 writel(readl(ioaddr + ECMR) & ~ECMR_DM, ioaddr + ECMR);
186} 186}
187 187
188static void sh_eth_set_rate(struct net_device *ndev) 188static void sh_eth_set_rate(struct net_device *ndev)
@@ -192,13 +192,13 @@ static void sh_eth_set_rate(struct net_device *ndev)
192 192
193 switch (mdp->speed) { 193 switch (mdp->speed) {
194 case 10: /* 10BASE */ 194 case 10: /* 10BASE */
195 ctrl_outl(GECMR_10, ioaddr + GECMR); 195 writel(GECMR_10, ioaddr + GECMR);
196 break; 196 break;
197 case 100:/* 100BASE */ 197 case 100:/* 100BASE */
198 ctrl_outl(GECMR_100, ioaddr + GECMR); 198 writel(GECMR_100, ioaddr + GECMR);
199 break; 199 break;
200 case 1000: /* 1000BASE */ 200 case 1000: /* 1000BASE */
201 ctrl_outl(GECMR_1000, ioaddr + GECMR); 201 writel(GECMR_1000, ioaddr + GECMR);
202 break; 202 break;
203 default: 203 default:
204 break; 204 break;
@@ -283,9 +283,9 @@ static void sh_eth_reset(struct net_device *ndev)
283{ 283{
284 u32 ioaddr = ndev->base_addr; 284 u32 ioaddr = ndev->base_addr;
285 285
286 ctrl_outl(ctrl_inl(ioaddr + EDMR) | EDMR_SRST, ioaddr + EDMR); 286 writel(readl(ioaddr + EDMR) | EDMR_SRST, ioaddr + EDMR);
287 mdelay(3); 287 mdelay(3);
288 ctrl_outl(ctrl_inl(ioaddr + EDMR) & ~EDMR_SRST, ioaddr + EDMR); 288 writel(readl(ioaddr + EDMR) & ~EDMR_SRST, ioaddr + EDMR);
289} 289}
290#endif 290#endif
291 291
@@ -336,10 +336,10 @@ static void update_mac_address(struct net_device *ndev)
336{ 336{
337 u32 ioaddr = ndev->base_addr; 337 u32 ioaddr = ndev->base_addr;
338 338
339 ctrl_outl((ndev->dev_addr[0] << 24) | (ndev->dev_addr[1] << 16) | 339 writel((ndev->dev_addr[0] << 24) | (ndev->dev_addr[1] << 16) |
340 (ndev->dev_addr[2] << 8) | (ndev->dev_addr[3]), 340 (ndev->dev_addr[2] << 8) | (ndev->dev_addr[3]),
341 ioaddr + MAHR); 341 ioaddr + MAHR);
342 ctrl_outl((ndev->dev_addr[4] << 8) | (ndev->dev_addr[5]), 342 writel((ndev->dev_addr[4] << 8) | (ndev->dev_addr[5]),
343 ioaddr + MALR); 343 ioaddr + MALR);
344} 344}
345 345
@@ -358,12 +358,12 @@ static void read_mac_address(struct net_device *ndev, unsigned char *mac)
358 if (mac[0] || mac[1] || mac[2] || mac[3] || mac[4] || mac[5]) { 358 if (mac[0] || mac[1] || mac[2] || mac[3] || mac[4] || mac[5]) {
359 memcpy(ndev->dev_addr, mac, 6); 359 memcpy(ndev->dev_addr, mac, 6);
360 } else { 360 } else {
361 ndev->dev_addr[0] = (ctrl_inl(ioaddr + MAHR) >> 24); 361 ndev->dev_addr[0] = (readl(ioaddr + MAHR) >> 24);
362 ndev->dev_addr[1] = (ctrl_inl(ioaddr + MAHR) >> 16) & 0xFF; 362 ndev->dev_addr[1] = (readl(ioaddr + MAHR) >> 16) & 0xFF;
363 ndev->dev_addr[2] = (ctrl_inl(ioaddr + MAHR) >> 8) & 0xFF; 363 ndev->dev_addr[2] = (readl(ioaddr + MAHR) >> 8) & 0xFF;
364 ndev->dev_addr[3] = (ctrl_inl(ioaddr + MAHR) & 0xFF); 364 ndev->dev_addr[3] = (readl(ioaddr + MAHR) & 0xFF);
365 ndev->dev_addr[4] = (ctrl_inl(ioaddr + MALR) >> 8) & 0xFF; 365 ndev->dev_addr[4] = (readl(ioaddr + MALR) >> 8) & 0xFF;
366 ndev->dev_addr[5] = (ctrl_inl(ioaddr + MALR) & 0xFF); 366 ndev->dev_addr[5] = (readl(ioaddr + MALR) & 0xFF);
367 } 367 }
368} 368}
369 369
@@ -379,19 +379,19 @@ struct bb_info {
379/* PHY bit set */ 379/* PHY bit set */
380static void bb_set(u32 addr, u32 msk) 380static void bb_set(u32 addr, u32 msk)
381{ 381{
382 ctrl_outl(ctrl_inl(addr) | msk, addr); 382 writel(readl(addr) | msk, addr);
383} 383}
384 384
385/* PHY bit clear */ 385/* PHY bit clear */
386static void bb_clr(u32 addr, u32 msk) 386static void bb_clr(u32 addr, u32 msk)
387{ 387{
388 ctrl_outl((ctrl_inl(addr) & ~msk), addr); 388 writel((readl(addr) & ~msk), addr);
389} 389}
390 390
391/* PHY bit read */ 391/* PHY bit read */
392static int bb_read(u32 addr, u32 msk) 392static int bb_read(u32 addr, u32 msk)
393{ 393{
394 return (ctrl_inl(addr) & msk) != 0; 394 return (readl(addr) & msk) != 0;
395} 395}
396 396
397/* Data I/O pin control */ 397/* Data I/O pin control */
@@ -506,9 +506,9 @@ static void sh_eth_ring_format(struct net_device *ndev)
506 rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16); 506 rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16);
507 /* Rx descriptor address set */ 507 /* Rx descriptor address set */
508 if (i == 0) { 508 if (i == 0) {
509 ctrl_outl(mdp->rx_desc_dma, ioaddr + RDLAR); 509 writel(mdp->rx_desc_dma, ioaddr + RDLAR);
510#if defined(CONFIG_CPU_SUBTYPE_SH7763) 510#if defined(CONFIG_CPU_SUBTYPE_SH7763)
511 ctrl_outl(mdp->rx_desc_dma, ioaddr + RDFAR); 511 writel(mdp->rx_desc_dma, ioaddr + RDFAR);
512#endif 512#endif
513 } 513 }
514 } 514 }
@@ -528,9 +528,9 @@ static void sh_eth_ring_format(struct net_device *ndev)
528 txdesc->buffer_length = 0; 528 txdesc->buffer_length = 0;
529 if (i == 0) { 529 if (i == 0) {
530 /* Tx descriptor address set */ 530 /* Tx descriptor address set */
531 ctrl_outl(mdp->tx_desc_dma, ioaddr + TDLAR); 531 writel(mdp->tx_desc_dma, ioaddr + TDLAR);
532#if defined(CONFIG_CPU_SUBTYPE_SH7763) 532#if defined(CONFIG_CPU_SUBTYPE_SH7763)
533 ctrl_outl(mdp->tx_desc_dma, ioaddr + TDFAR); 533 writel(mdp->tx_desc_dma, ioaddr + TDFAR);
534#endif 534#endif
535 } 535 }
536 } 536 }
@@ -623,71 +623,71 @@ static int sh_eth_dev_init(struct net_device *ndev)
623 /* Descriptor format */ 623 /* Descriptor format */
624 sh_eth_ring_format(ndev); 624 sh_eth_ring_format(ndev);
625 if (mdp->cd->rpadir) 625 if (mdp->cd->rpadir)
626 ctrl_outl(mdp->cd->rpadir_value, ioaddr + RPADIR); 626 writel(mdp->cd->rpadir_value, ioaddr + RPADIR);
627 627
628 /* all sh_eth int mask */ 628 /* all sh_eth int mask */
629 ctrl_outl(0, ioaddr + EESIPR); 629 writel(0, ioaddr + EESIPR);
630 630
631#if defined(__LITTLE_ENDIAN__) 631#if defined(__LITTLE_ENDIAN__)
632 if (mdp->cd->hw_swap) 632 if (mdp->cd->hw_swap)
633 ctrl_outl(EDMR_EL, ioaddr + EDMR); 633 writel(EDMR_EL, ioaddr + EDMR);
634 else 634 else
635#endif 635#endif
636 ctrl_outl(0, ioaddr + EDMR); 636 writel(0, ioaddr + EDMR);
637 637
638 /* FIFO size set */ 638 /* FIFO size set */
639 ctrl_outl(mdp->cd->fdr_value, ioaddr + FDR); 639 writel(mdp->cd->fdr_value, ioaddr + FDR);
640 ctrl_outl(0, ioaddr + TFTR); 640 writel(0, ioaddr + TFTR);
641 641
642 /* Frame recv control */ 642 /* Frame recv control */
643 ctrl_outl(mdp->cd->rmcr_value, ioaddr + RMCR); 643 writel(mdp->cd->rmcr_value, ioaddr + RMCR);
644 644
645 rx_int_var = mdp->rx_int_var = DESC_I_RINT8 | DESC_I_RINT5; 645 rx_int_var = mdp->rx_int_var = DESC_I_RINT8 | DESC_I_RINT5;
646 tx_int_var = mdp->tx_int_var = DESC_I_TINT2; 646 tx_int_var = mdp->tx_int_var = DESC_I_TINT2;
647 ctrl_outl(rx_int_var | tx_int_var, ioaddr + TRSCER); 647 writel(rx_int_var | tx_int_var, ioaddr + TRSCER);
648 648
649 if (mdp->cd->bculr) 649 if (mdp->cd->bculr)
650 ctrl_outl(0x800, ioaddr + BCULR); /* Burst sycle set */ 650 writel(0x800, ioaddr + BCULR); /* Burst sycle set */
651 651
652 ctrl_outl(mdp->cd->fcftr_value, ioaddr + FCFTR); 652 writel(mdp->cd->fcftr_value, ioaddr + FCFTR);
653 653
654 if (!mdp->cd->no_trimd) 654 if (!mdp->cd->no_trimd)
655 ctrl_outl(0, ioaddr + TRIMD); 655 writel(0, ioaddr + TRIMD);
656 656
657 /* Recv frame limit set register */ 657 /* Recv frame limit set register */
658 ctrl_outl(RFLR_VALUE, ioaddr + RFLR); 658 writel(RFLR_VALUE, ioaddr + RFLR);
659 659
660 ctrl_outl(ctrl_inl(ioaddr + EESR), ioaddr + EESR); 660 writel(readl(ioaddr + EESR), ioaddr + EESR);
661 ctrl_outl(mdp->cd->eesipr_value, ioaddr + EESIPR); 661 writel(mdp->cd->eesipr_value, ioaddr + EESIPR);
662 662
663 /* PAUSE Prohibition */ 663 /* PAUSE Prohibition */
664 val = (ctrl_inl(ioaddr + ECMR) & ECMR_DM) | 664 val = (readl(ioaddr + ECMR) & ECMR_DM) |
665 ECMR_ZPF | (mdp->duplex ? ECMR_DM : 0) | ECMR_TE | ECMR_RE; 665 ECMR_ZPF | (mdp->duplex ? ECMR_DM : 0) | ECMR_TE | ECMR_RE;
666 666
667 ctrl_outl(val, ioaddr + ECMR); 667 writel(val, ioaddr + ECMR);
668 668
669 if (mdp->cd->set_rate) 669 if (mdp->cd->set_rate)
670 mdp->cd->set_rate(ndev); 670 mdp->cd->set_rate(ndev);
671 671
672 /* E-MAC Status Register clear */ 672 /* E-MAC Status Register clear */
673 ctrl_outl(mdp->cd->ecsr_value, ioaddr + ECSR); 673 writel(mdp->cd->ecsr_value, ioaddr + ECSR);
674 674
675 /* E-MAC Interrupt Enable register */ 675 /* E-MAC Interrupt Enable register */
676 ctrl_outl(mdp->cd->ecsipr_value, ioaddr + ECSIPR); 676 writel(mdp->cd->ecsipr_value, ioaddr + ECSIPR);
677 677
678 /* Set MAC address */ 678 /* Set MAC address */
679 update_mac_address(ndev); 679 update_mac_address(ndev);
680 680
681 /* mask reset */ 681 /* mask reset */
682 if (mdp->cd->apr) 682 if (mdp->cd->apr)
683 ctrl_outl(APR_AP, ioaddr + APR); 683 writel(APR_AP, ioaddr + APR);
684 if (mdp->cd->mpr) 684 if (mdp->cd->mpr)
685 ctrl_outl(MPR_MP, ioaddr + MPR); 685 writel(MPR_MP, ioaddr + MPR);
686 if (mdp->cd->tpauser) 686 if (mdp->cd->tpauser)
687 ctrl_outl(TPAUSER_UNLIMITED, ioaddr + TPAUSER); 687 writel(TPAUSER_UNLIMITED, ioaddr + TPAUSER);
688 688
689 /* Setting the Rx mode will start the Rx process. */ 689 /* Setting the Rx mode will start the Rx process. */
690 ctrl_outl(EDRRR_R, ioaddr + EDRRR); 690 writel(EDRRR_R, ioaddr + EDRRR);
691 691
692 netif_start_queue(ndev); 692 netif_start_queue(ndev);
693 693
@@ -811,8 +811,8 @@ static int sh_eth_rx(struct net_device *ndev)
811 811
812 /* Restart Rx engine if stopped. */ 812 /* Restart Rx engine if stopped. */
813 /* If we don't need to check status, don't. -KDU */ 813 /* If we don't need to check status, don't. -KDU */
814 if (!(ctrl_inl(ndev->base_addr + EDRRR) & EDRRR_R)) 814 if (!(readl(ndev->base_addr + EDRRR) & EDRRR_R))
815 ctrl_outl(EDRRR_R, ndev->base_addr + EDRRR); 815 writel(EDRRR_R, ndev->base_addr + EDRRR);
816 816
817 return 0; 817 return 0;
818} 818}
@@ -827,8 +827,8 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
827 u32 mask; 827 u32 mask;
828 828
829 if (intr_status & EESR_ECI) { 829 if (intr_status & EESR_ECI) {
830 felic_stat = ctrl_inl(ioaddr + ECSR); 830 felic_stat = readl(ioaddr + ECSR);
831 ctrl_outl(felic_stat, ioaddr + ECSR); /* clear int */ 831 writel(felic_stat, ioaddr + ECSR); /* clear int */
832 if (felic_stat & ECSR_ICD) 832 if (felic_stat & ECSR_ICD)
833 mdp->stats.tx_carrier_errors++; 833 mdp->stats.tx_carrier_errors++;
834 if (felic_stat & ECSR_LCHNG) { 834 if (felic_stat & ECSR_LCHNG) {
@@ -839,25 +839,25 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
839 else 839 else
840 link_stat = PHY_ST_LINK; 840 link_stat = PHY_ST_LINK;
841 } else { 841 } else {
842 link_stat = (ctrl_inl(ioaddr + PSR)); 842 link_stat = (readl(ioaddr + PSR));
843 if (mdp->ether_link_active_low) 843 if (mdp->ether_link_active_low)
844 link_stat = ~link_stat; 844 link_stat = ~link_stat;
845 } 845 }
846 if (!(link_stat & PHY_ST_LINK)) { 846 if (!(link_stat & PHY_ST_LINK)) {
847 /* Link Down : disable tx and rx */ 847 /* Link Down : disable tx and rx */
848 ctrl_outl(ctrl_inl(ioaddr + ECMR) & 848 writel(readl(ioaddr + ECMR) &
849 ~(ECMR_RE | ECMR_TE), ioaddr + ECMR); 849 ~(ECMR_RE | ECMR_TE), ioaddr + ECMR);
850 } else { 850 } else {
851 /* Link Up */ 851 /* Link Up */
852 ctrl_outl(ctrl_inl(ioaddr + EESIPR) & 852 writel(readl(ioaddr + EESIPR) &
853 ~DMAC_M_ECI, ioaddr + EESIPR); 853 ~DMAC_M_ECI, ioaddr + EESIPR);
854 /*clear int */ 854 /*clear int */
855 ctrl_outl(ctrl_inl(ioaddr + ECSR), 855 writel(readl(ioaddr + ECSR),
856 ioaddr + ECSR); 856 ioaddr + ECSR);
857 ctrl_outl(ctrl_inl(ioaddr + EESIPR) | 857 writel(readl(ioaddr + EESIPR) |
858 DMAC_M_ECI, ioaddr + EESIPR); 858 DMAC_M_ECI, ioaddr + EESIPR);
859 /* enable tx and rx */ 859 /* enable tx and rx */
860 ctrl_outl(ctrl_inl(ioaddr + ECMR) | 860 writel(readl(ioaddr + ECMR) |
861 (ECMR_RE | ECMR_TE), ioaddr + ECMR); 861 (ECMR_RE | ECMR_TE), ioaddr + ECMR);
862 } 862 }
863 } 863 }
@@ -888,8 +888,8 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
888 /* Receive Descriptor Empty int */ 888 /* Receive Descriptor Empty int */
889 mdp->stats.rx_over_errors++; 889 mdp->stats.rx_over_errors++;
890 890
891 if (ctrl_inl(ioaddr + EDRRR) ^ EDRRR_R) 891 if (readl(ioaddr + EDRRR) ^ EDRRR_R)
892 ctrl_outl(EDRRR_R, ioaddr + EDRRR); 892 writel(EDRRR_R, ioaddr + EDRRR);
893 dev_err(&ndev->dev, "Receive Descriptor Empty\n"); 893 dev_err(&ndev->dev, "Receive Descriptor Empty\n");
894 } 894 }
895 if (intr_status & EESR_RFE) { 895 if (intr_status & EESR_RFE) {
@@ -903,7 +903,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
903 mask &= ~EESR_ADE; 903 mask &= ~EESR_ADE;
904 if (intr_status & mask) { 904 if (intr_status & mask) {
905 /* Tx error */ 905 /* Tx error */
906 u32 edtrr = ctrl_inl(ndev->base_addr + EDTRR); 906 u32 edtrr = readl(ndev->base_addr + EDTRR);
907 /* dmesg */ 907 /* dmesg */
908 dev_err(&ndev->dev, "TX error. status=%8.8x cur_tx=%8.8x ", 908 dev_err(&ndev->dev, "TX error. status=%8.8x cur_tx=%8.8x ",
909 intr_status, mdp->cur_tx); 909 intr_status, mdp->cur_tx);
@@ -915,7 +915,7 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
915 /* SH7712 BUG */ 915 /* SH7712 BUG */
916 if (edtrr ^ EDTRR_TRNS) { 916 if (edtrr ^ EDTRR_TRNS) {
917 /* tx dma start */ 917 /* tx dma start */
918 ctrl_outl(EDTRR_TRNS, ndev->base_addr + EDTRR); 918 writel(EDTRR_TRNS, ndev->base_addr + EDTRR);
919 } 919 }
920 /* wakeup */ 920 /* wakeup */
921 netif_wake_queue(ndev); 921 netif_wake_queue(ndev);
@@ -934,12 +934,12 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
934 spin_lock(&mdp->lock); 934 spin_lock(&mdp->lock);
935 935
936 /* Get interrpt stat */ 936 /* Get interrpt stat */
937 intr_status = ctrl_inl(ioaddr + EESR); 937 intr_status = readl(ioaddr + EESR);
938 /* Clear interrupt */ 938 /* Clear interrupt */
939 if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF | 939 if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF |
940 EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF | 940 EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF |
941 cd->tx_check | cd->eesr_err_check)) { 941 cd->tx_check | cd->eesr_err_check)) {
942 ctrl_outl(intr_status, ioaddr + EESR); 942 writel(intr_status, ioaddr + EESR);
943 ret = IRQ_HANDLED; 943 ret = IRQ_HANDLED;
944 } else 944 } else
945 goto other_irq; 945 goto other_irq;
@@ -1000,7 +1000,7 @@ static void sh_eth_adjust_link(struct net_device *ndev)
1000 mdp->cd->set_rate(ndev); 1000 mdp->cd->set_rate(ndev);
1001 } 1001 }
1002 if (mdp->link == PHY_DOWN) { 1002 if (mdp->link == PHY_DOWN) {
1003 ctrl_outl((ctrl_inl(ioaddr + ECMR) & ~ECMR_TXF) 1003 writel((readl(ioaddr + ECMR) & ~ECMR_TXF)
1004 | ECMR_DM, ioaddr + ECMR); 1004 | ECMR_DM, ioaddr + ECMR);
1005 new_state = 1; 1005 new_state = 1;
1006 mdp->link = phydev->link; 1006 mdp->link = phydev->link;
@@ -1125,7 +1125,7 @@ static void sh_eth_tx_timeout(struct net_device *ndev)
1125 1125
1126 /* worning message out. */ 1126 /* worning message out. */
1127 printk(KERN_WARNING "%s: transmit timed out, status %8.8x," 1127 printk(KERN_WARNING "%s: transmit timed out, status %8.8x,"
1128 " resetting...\n", ndev->name, (int)ctrl_inl(ioaddr + EESR)); 1128 " resetting...\n", ndev->name, (int)readl(ioaddr + EESR));
1129 1129
1130 /* tx_errors count up */ 1130 /* tx_errors count up */
1131 mdp->stats.tx_errors++; 1131 mdp->stats.tx_errors++;
@@ -1196,8 +1196,8 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1196 1196
1197 mdp->cur_tx++; 1197 mdp->cur_tx++;
1198 1198
1199 if (!(ctrl_inl(ndev->base_addr + EDTRR) & EDTRR_TRNS)) 1199 if (!(readl(ndev->base_addr + EDTRR) & EDTRR_TRNS))
1200 ctrl_outl(EDTRR_TRNS, ndev->base_addr + EDTRR); 1200 writel(EDTRR_TRNS, ndev->base_addr + EDTRR);
1201 1201
1202 return NETDEV_TX_OK; 1202 return NETDEV_TX_OK;
1203} 1203}
@@ -1212,11 +1212,11 @@ static int sh_eth_close(struct net_device *ndev)
1212 netif_stop_queue(ndev); 1212 netif_stop_queue(ndev);
1213 1213
1214 /* Disable interrupts by clearing the interrupt mask. */ 1214 /* Disable interrupts by clearing the interrupt mask. */
1215 ctrl_outl(0x0000, ioaddr + EESIPR); 1215 writel(0x0000, ioaddr + EESIPR);
1216 1216
1217 /* Stop the chip's Tx and Rx processes. */ 1217 /* Stop the chip's Tx and Rx processes. */
1218 ctrl_outl(0, ioaddr + EDTRR); 1218 writel(0, ioaddr + EDTRR);
1219 ctrl_outl(0, ioaddr + EDRRR); 1219 writel(0, ioaddr + EDRRR);
1220 1220
1221 /* PHY Disconnect */ 1221 /* PHY Disconnect */
1222 if (mdp->phydev) { 1222 if (mdp->phydev) {
@@ -1251,20 +1251,20 @@ static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev)
1251 1251
1252 pm_runtime_get_sync(&mdp->pdev->dev); 1252 pm_runtime_get_sync(&mdp->pdev->dev);
1253 1253
1254 mdp->stats.tx_dropped += ctrl_inl(ioaddr + TROCR); 1254 mdp->stats.tx_dropped += readl(ioaddr + TROCR);
1255 ctrl_outl(0, ioaddr + TROCR); /* (write clear) */ 1255 writel(0, ioaddr + TROCR); /* (write clear) */
1256 mdp->stats.collisions += ctrl_inl(ioaddr + CDCR); 1256 mdp->stats.collisions += readl(ioaddr + CDCR);
1257 ctrl_outl(0, ioaddr + CDCR); /* (write clear) */ 1257 writel(0, ioaddr + CDCR); /* (write clear) */
1258 mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + LCCR); 1258 mdp->stats.tx_carrier_errors += readl(ioaddr + LCCR);
1259 ctrl_outl(0, ioaddr + LCCR); /* (write clear) */ 1259 writel(0, ioaddr + LCCR); /* (write clear) */
1260#if defined(CONFIG_CPU_SUBTYPE_SH7763) 1260#if defined(CONFIG_CPU_SUBTYPE_SH7763)
1261 mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + CERCR);/* CERCR */ 1261 mdp->stats.tx_carrier_errors += readl(ioaddr + CERCR);/* CERCR */
1262 ctrl_outl(0, ioaddr + CERCR); /* (write clear) */ 1262 writel(0, ioaddr + CERCR); /* (write clear) */
1263 mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + CEECR);/* CEECR */ 1263 mdp->stats.tx_carrier_errors += readl(ioaddr + CEECR);/* CEECR */
1264 ctrl_outl(0, ioaddr + CEECR); /* (write clear) */ 1264 writel(0, ioaddr + CEECR); /* (write clear) */
1265#else 1265#else
1266 mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + CNDCR); 1266 mdp->stats.tx_carrier_errors += readl(ioaddr + CNDCR);
1267 ctrl_outl(0, ioaddr + CNDCR); /* (write clear) */ 1267 writel(0, ioaddr + CNDCR); /* (write clear) */
1268#endif 1268#endif
1269 pm_runtime_put_sync(&mdp->pdev->dev); 1269 pm_runtime_put_sync(&mdp->pdev->dev);
1270 1270
@@ -1295,11 +1295,11 @@ static void sh_eth_set_multicast_list(struct net_device *ndev)
1295 1295
1296 if (ndev->flags & IFF_PROMISC) { 1296 if (ndev->flags & IFF_PROMISC) {
1297 /* Set promiscuous. */ 1297 /* Set promiscuous. */
1298 ctrl_outl((ctrl_inl(ioaddr + ECMR) & ~ECMR_MCT) | ECMR_PRM, 1298 writel((readl(ioaddr + ECMR) & ~ECMR_MCT) | ECMR_PRM,
1299 ioaddr + ECMR); 1299 ioaddr + ECMR);
1300 } else { 1300 } else {
1301 /* Normal, unicast/broadcast-only mode. */ 1301 /* Normal, unicast/broadcast-only mode. */
1302 ctrl_outl((ctrl_inl(ioaddr + ECMR) & ~ECMR_PRM) | ECMR_MCT, 1302 writel((readl(ioaddr + ECMR) & ~ECMR_PRM) | ECMR_MCT,
1303 ioaddr + ECMR); 1303 ioaddr + ECMR);
1304 } 1304 }
1305} 1305}
@@ -1307,30 +1307,30 @@ static void sh_eth_set_multicast_list(struct net_device *ndev)
1307/* SuperH's TSU register init function */ 1307/* SuperH's TSU register init function */
1308static void sh_eth_tsu_init(u32 ioaddr) 1308static void sh_eth_tsu_init(u32 ioaddr)
1309{ 1309{
1310 ctrl_outl(0, ioaddr + TSU_FWEN0); /* Disable forward(0->1) */ 1310 writel(0, ioaddr + TSU_FWEN0); /* Disable forward(0->1) */
1311 ctrl_outl(0, ioaddr + TSU_FWEN1); /* Disable forward(1->0) */ 1311 writel(0, ioaddr + TSU_FWEN1); /* Disable forward(1->0) */
1312 ctrl_outl(0, ioaddr + TSU_FCM); /* forward fifo 3k-3k */ 1312 writel(0, ioaddr + TSU_FCM); /* forward fifo 3k-3k */
1313 ctrl_outl(0xc, ioaddr + TSU_BSYSL0); 1313 writel(0xc, ioaddr + TSU_BSYSL0);
1314 ctrl_outl(0xc, ioaddr + TSU_BSYSL1); 1314 writel(0xc, ioaddr + TSU_BSYSL1);
1315 ctrl_outl(0, ioaddr + TSU_PRISL0); 1315 writel(0, ioaddr + TSU_PRISL0);
1316 ctrl_outl(0, ioaddr + TSU_PRISL1); 1316 writel(0, ioaddr + TSU_PRISL1);
1317 ctrl_outl(0, ioaddr + TSU_FWSL0); 1317 writel(0, ioaddr + TSU_FWSL0);
1318 ctrl_outl(0, ioaddr + TSU_FWSL1); 1318 writel(0, ioaddr + TSU_FWSL1);
1319 ctrl_outl(TSU_FWSLC_POSTENU | TSU_FWSLC_POSTENL, ioaddr + TSU_FWSLC); 1319 writel(TSU_FWSLC_POSTENU | TSU_FWSLC_POSTENL, ioaddr + TSU_FWSLC);
1320#if defined(CONFIG_CPU_SUBTYPE_SH7763) 1320#if defined(CONFIG_CPU_SUBTYPE_SH7763)
1321 ctrl_outl(0, ioaddr + TSU_QTAG0); /* Disable QTAG(0->1) */ 1321 writel(0, ioaddr + TSU_QTAG0); /* Disable QTAG(0->1) */
1322 ctrl_outl(0, ioaddr + TSU_QTAG1); /* Disable QTAG(1->0) */ 1322 writel(0, ioaddr + TSU_QTAG1); /* Disable QTAG(1->0) */
1323#else 1323#else
1324 ctrl_outl(0, ioaddr + TSU_QTAGM0); /* Disable QTAG(0->1) */ 1324 writel(0, ioaddr + TSU_QTAGM0); /* Disable QTAG(0->1) */
1325 ctrl_outl(0, ioaddr + TSU_QTAGM1); /* Disable QTAG(1->0) */ 1325 writel(0, ioaddr + TSU_QTAGM1); /* Disable QTAG(1->0) */
1326#endif 1326#endif
1327 ctrl_outl(0, ioaddr + TSU_FWSR); /* all interrupt status clear */ 1327 writel(0, ioaddr + TSU_FWSR); /* all interrupt status clear */
1328 ctrl_outl(0, ioaddr + TSU_FWINMK); /* Disable all interrupt */ 1328 writel(0, ioaddr + TSU_FWINMK); /* Disable all interrupt */
1329 ctrl_outl(0, ioaddr + TSU_TEN); /* Disable all CAM entry */ 1329 writel(0, ioaddr + TSU_TEN); /* Disable all CAM entry */
1330 ctrl_outl(0, ioaddr + TSU_POST1); /* Disable CAM entry [ 0- 7] */ 1330 writel(0, ioaddr + TSU_POST1); /* Disable CAM entry [ 0- 7] */
1331 ctrl_outl(0, ioaddr + TSU_POST2); /* Disable CAM entry [ 8-15] */ 1331 writel(0, ioaddr + TSU_POST2); /* Disable CAM entry [ 8-15] */
1332 ctrl_outl(0, ioaddr + TSU_POST3); /* Disable CAM entry [16-23] */ 1332 writel(0, ioaddr + TSU_POST3); /* Disable CAM entry [16-23] */
1333 ctrl_outl(0, ioaddr + TSU_POST4); /* Disable CAM entry [24-31] */ 1333 writel(0, ioaddr + TSU_POST4); /* Disable CAM entry [24-31] */
1334} 1334}
1335#endif /* SH_ETH_HAS_TSU */ 1335#endif /* SH_ETH_HAS_TSU */
1336 1336