diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2005-05-12 19:38:47 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-05-12 19:38:47 -0400 |
commit | 22f714b64b55012fa4e0d77132fa82719180f994 (patch) | |
tree | df18ecd5eafced6d770d6a15163743c08d9376d9 | |
parent | 88d7bd8cb9eb8d64bf7997600b0d64f7834047c5 (diff) |
[PATCH] 8139too: use iomap for pio/mmio
This patch converts the 8139too driver to use the iomap infrastructure
for PIO and MMIO instead of playing macro tricks. I also had to fix
read_eeprom(), mdio_sync(), mdio_read(), and mdio_write() to not pass
PIO base address to MMIO read() and write() functions. In addition,
the patch adds proper __iomem annotations for the driver.
Both modes, PIO and MMIO, were tested with a RealTel RTL8139 card on
an x86 box. The 8129 support remains untested due to lack of
hardware.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r-- | drivers/net/8139too.c | 194 |
1 files changed, 87 insertions, 107 deletions
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index d4bd20c21a1f..047202c4d9a8 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -569,7 +569,7 @@ struct rtl_extra_stats { | |||
569 | }; | 569 | }; |
570 | 570 | ||
571 | struct rtl8139_private { | 571 | struct rtl8139_private { |
572 | void *mmio_addr; | 572 | void __iomem *mmio_addr; |
573 | int drv_flags; | 573 | int drv_flags; |
574 | struct pci_dev *pci_dev; | 574 | struct pci_dev *pci_dev; |
575 | u32 msg_enable; | 575 | u32 msg_enable; |
@@ -614,7 +614,7 @@ MODULE_PARM_DESC (multicast_filter_limit, "8139too maximum number of filtered mu | |||
614 | MODULE_PARM_DESC (media, "8139too: Bits 4+9: force full duplex, bit 5: 100Mbps"); | 614 | MODULE_PARM_DESC (media, "8139too: Bits 4+9: force full duplex, bit 5: 100Mbps"); |
615 | MODULE_PARM_DESC (full_duplex, "8139too: Force full duplex for board(s) (1)"); | 615 | MODULE_PARM_DESC (full_duplex, "8139too: Force full duplex for board(s) (1)"); |
616 | 616 | ||
617 | static int read_eeprom (void *ioaddr, int location, int addr_len); | 617 | static int read_eeprom (void __iomem *ioaddr, int location, int addr_len); |
618 | static int rtl8139_open (struct net_device *dev); | 618 | static int rtl8139_open (struct net_device *dev); |
619 | static int mdio_read (struct net_device *dev, int phy_id, int location); | 619 | static int mdio_read (struct net_device *dev, int phy_id, int location); |
620 | static void mdio_write (struct net_device *dev, int phy_id, int location, | 620 | static void mdio_write (struct net_device *dev, int phy_id, int location, |
@@ -638,46 +638,20 @@ static void __set_rx_mode (struct net_device *dev); | |||
638 | static void rtl8139_hw_start (struct net_device *dev); | 638 | static void rtl8139_hw_start (struct net_device *dev); |
639 | static struct ethtool_ops rtl8139_ethtool_ops; | 639 | static struct ethtool_ops rtl8139_ethtool_ops; |
640 | 640 | ||
641 | #ifdef USE_IO_OPS | ||
642 | |||
643 | #define RTL_R8(reg) inb (((unsigned long)ioaddr) + (reg)) | ||
644 | #define RTL_R16(reg) inw (((unsigned long)ioaddr) + (reg)) | ||
645 | #define RTL_R32(reg) ((unsigned long) inl (((unsigned long)ioaddr) + (reg))) | ||
646 | #define RTL_W8(reg, val8) outb ((val8), ((unsigned long)ioaddr) + (reg)) | ||
647 | #define RTL_W16(reg, val16) outw ((val16), ((unsigned long)ioaddr) + (reg)) | ||
648 | #define RTL_W32(reg, val32) outl ((val32), ((unsigned long)ioaddr) + (reg)) | ||
649 | #define RTL_W8_F RTL_W8 | ||
650 | #define RTL_W16_F RTL_W16 | ||
651 | #define RTL_W32_F RTL_W32 | ||
652 | #undef readb | ||
653 | #undef readw | ||
654 | #undef readl | ||
655 | #undef writeb | ||
656 | #undef writew | ||
657 | #undef writel | ||
658 | #define readb(addr) inb((unsigned long)(addr)) | ||
659 | #define readw(addr) inw((unsigned long)(addr)) | ||
660 | #define readl(addr) inl((unsigned long)(addr)) | ||
661 | #define writeb(val,addr) outb((val),(unsigned long)(addr)) | ||
662 | #define writew(val,addr) outw((val),(unsigned long)(addr)) | ||
663 | #define writel(val,addr) outl((val),(unsigned long)(addr)) | ||
664 | |||
665 | #else | ||
666 | |||
667 | /* write MMIO register, with flush */ | 641 | /* write MMIO register, with flush */ |
668 | /* Flush avoids rtl8139 bug w/ posted MMIO writes */ | 642 | /* Flush avoids rtl8139 bug w/ posted MMIO writes */ |
669 | #define RTL_W8_F(reg, val8) do { writeb ((val8), ioaddr + (reg)); readb (ioaddr + (reg)); } while (0) | 643 | #define RTL_W8_F(reg, val8) do { iowrite8 ((val8), ioaddr + (reg)); ioread8 (ioaddr + (reg)); } while (0) |
670 | #define RTL_W16_F(reg, val16) do { writew ((val16), ioaddr + (reg)); readw (ioaddr + (reg)); } while (0) | 644 | #define RTL_W16_F(reg, val16) do { iowrite16 ((val16), ioaddr + (reg)); ioread16 (ioaddr + (reg)); } while (0) |
671 | #define RTL_W32_F(reg, val32) do { writel ((val32), ioaddr + (reg)); readl (ioaddr + (reg)); } while (0) | 645 | #define RTL_W32_F(reg, val32) do { iowrite32 ((val32), ioaddr + (reg)); ioread32 (ioaddr + (reg)); } while (0) |
672 | 646 | ||
673 | 647 | ||
674 | #define MMIO_FLUSH_AUDIT_COMPLETE 1 | 648 | #define MMIO_FLUSH_AUDIT_COMPLETE 1 |
675 | #if MMIO_FLUSH_AUDIT_COMPLETE | 649 | #if MMIO_FLUSH_AUDIT_COMPLETE |
676 | 650 | ||
677 | /* write MMIO register */ | 651 | /* write MMIO register */ |
678 | #define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg)) | 652 | #define RTL_W8(reg, val8) iowrite8 ((val8), ioaddr + (reg)) |
679 | #define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg)) | 653 | #define RTL_W16(reg, val16) iowrite16 ((val16), ioaddr + (reg)) |
680 | #define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg)) | 654 | #define RTL_W32(reg, val32) iowrite32 ((val32), ioaddr + (reg)) |
681 | 655 | ||
682 | #else | 656 | #else |
683 | 657 | ||
@@ -689,11 +663,9 @@ static struct ethtool_ops rtl8139_ethtool_ops; | |||
689 | #endif /* MMIO_FLUSH_AUDIT_COMPLETE */ | 663 | #endif /* MMIO_FLUSH_AUDIT_COMPLETE */ |
690 | 664 | ||
691 | /* read MMIO register */ | 665 | /* read MMIO register */ |
692 | #define RTL_R8(reg) readb (ioaddr + (reg)) | 666 | #define RTL_R8(reg) ioread8 (ioaddr + (reg)) |
693 | #define RTL_R16(reg) readw (ioaddr + (reg)) | 667 | #define RTL_R16(reg) ioread16 (ioaddr + (reg)) |
694 | #define RTL_R32(reg) ((unsigned long) readl (ioaddr + (reg))) | 668 | #define RTL_R32(reg) ((unsigned long) ioread32 (ioaddr + (reg))) |
695 | |||
696 | #endif /* USE_IO_OPS */ | ||
697 | 669 | ||
698 | 670 | ||
699 | static const u16 rtl8139_intr_mask = | 671 | static const u16 rtl8139_intr_mask = |
@@ -740,10 +712,13 @@ static void __rtl8139_cleanup_dev (struct net_device *dev) | |||
740 | assert (tp->pci_dev != NULL); | 712 | assert (tp->pci_dev != NULL); |
741 | pdev = tp->pci_dev; | 713 | pdev = tp->pci_dev; |
742 | 714 | ||
743 | #ifndef USE_IO_OPS | 715 | #ifdef USE_IO_OPS |
716 | if (tp->mmio_addr) | ||
717 | ioport_unmap (tp->mmio_addr); | ||
718 | #else | ||
744 | if (tp->mmio_addr) | 719 | if (tp->mmio_addr) |
745 | iounmap (tp->mmio_addr); | 720 | pci_iounmap (pdev, tp->mmio_addr); |
746 | #endif /* !USE_IO_OPS */ | 721 | #endif /* USE_IO_OPS */ |
747 | 722 | ||
748 | /* it's ok to call this even if we have no regions to free */ | 723 | /* it's ok to call this even if we have no regions to free */ |
749 | pci_release_regions (pdev); | 724 | pci_release_regions (pdev); |
@@ -753,7 +728,7 @@ static void __rtl8139_cleanup_dev (struct net_device *dev) | |||
753 | } | 728 | } |
754 | 729 | ||
755 | 730 | ||
756 | static void rtl8139_chip_reset (void *ioaddr) | 731 | static void rtl8139_chip_reset (void __iomem *ioaddr) |
757 | { | 732 | { |
758 | int i; | 733 | int i; |
759 | 734 | ||
@@ -773,7 +748,7 @@ static void rtl8139_chip_reset (void *ioaddr) | |||
773 | static int __devinit rtl8139_init_board (struct pci_dev *pdev, | 748 | static int __devinit rtl8139_init_board (struct pci_dev *pdev, |
774 | struct net_device **dev_out) | 749 | struct net_device **dev_out) |
775 | { | 750 | { |
776 | void *ioaddr; | 751 | void __iomem *ioaddr; |
777 | struct net_device *dev; | 752 | struct net_device *dev; |
778 | struct rtl8139_private *tp; | 753 | struct rtl8139_private *tp; |
779 | u8 tmp8; | 754 | u8 tmp8; |
@@ -855,13 +830,18 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev, | |||
855 | pci_set_master (pdev); | 830 | pci_set_master (pdev); |
856 | 831 | ||
857 | #ifdef USE_IO_OPS | 832 | #ifdef USE_IO_OPS |
858 | ioaddr = (void *) pio_start; | 833 | ioaddr = ioport_map(pio_start, pio_len); |
834 | if (!ioaddr) { | ||
835 | printk (KERN_ERR PFX "%s: cannot map PIO, aborting\n", pci_name(pdev)); | ||
836 | rc = -EIO; | ||
837 | goto err_out; | ||
838 | } | ||
859 | dev->base_addr = pio_start; | 839 | dev->base_addr = pio_start; |
860 | tp->mmio_addr = ioaddr; | 840 | tp->mmio_addr = ioaddr; |
861 | tp->regs_len = pio_len; | 841 | tp->regs_len = pio_len; |
862 | #else | 842 | #else |
863 | /* ioremap MMIO region */ | 843 | /* ioremap MMIO region */ |
864 | ioaddr = ioremap (mmio_start, mmio_len); | 844 | ioaddr = pci_iomap(pdev, 1, 0); |
865 | if (ioaddr == NULL) { | 845 | if (ioaddr == NULL) { |
866 | printk (KERN_ERR PFX "%s: cannot remap MMIO, aborting\n", pci_name(pdev)); | 846 | printk (KERN_ERR PFX "%s: cannot remap MMIO, aborting\n", pci_name(pdev)); |
867 | rc = -EIO; | 847 | rc = -EIO; |
@@ -947,7 +927,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev, | |||
947 | struct net_device *dev = NULL; | 927 | struct net_device *dev = NULL; |
948 | struct rtl8139_private *tp; | 928 | struct rtl8139_private *tp; |
949 | int i, addr_len, option; | 929 | int i, addr_len, option; |
950 | void *ioaddr; | 930 | void __iomem *ioaddr; |
951 | static int board_idx = -1; | 931 | static int board_idx = -1; |
952 | u8 pci_rev; | 932 | u8 pci_rev; |
953 | 933 | ||
@@ -1147,47 +1127,46 @@ static void __devexit rtl8139_remove_one (struct pci_dev *pdev) | |||
1147 | No extra delay is needed with 33Mhz PCI, but 66Mhz may change this. | 1127 | No extra delay is needed with 33Mhz PCI, but 66Mhz may change this. |
1148 | */ | 1128 | */ |
1149 | 1129 | ||
1150 | #define eeprom_delay() readl(ee_addr) | 1130 | #define eeprom_delay() RTL_R32(Cfg9346) |
1151 | 1131 | ||
1152 | /* The EEPROM commands include the alway-set leading bit. */ | 1132 | /* The EEPROM commands include the alway-set leading bit. */ |
1153 | #define EE_WRITE_CMD (5) | 1133 | #define EE_WRITE_CMD (5) |
1154 | #define EE_READ_CMD (6) | 1134 | #define EE_READ_CMD (6) |
1155 | #define EE_ERASE_CMD (7) | 1135 | #define EE_ERASE_CMD (7) |
1156 | 1136 | ||
1157 | static int __devinit read_eeprom (void *ioaddr, int location, int addr_len) | 1137 | static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_len) |
1158 | { | 1138 | { |
1159 | int i; | 1139 | int i; |
1160 | unsigned retval = 0; | 1140 | unsigned retval = 0; |
1161 | void *ee_addr = ioaddr + Cfg9346; | ||
1162 | int read_cmd = location | (EE_READ_CMD << addr_len); | 1141 | int read_cmd = location | (EE_READ_CMD << addr_len); |
1163 | 1142 | ||
1164 | writeb (EE_ENB & ~EE_CS, ee_addr); | 1143 | RTL_W8 (Cfg9346, EE_ENB & ~EE_CS); |
1165 | writeb (EE_ENB, ee_addr); | 1144 | RTL_W8 (Cfg9346, EE_ENB); |
1166 | eeprom_delay (); | 1145 | eeprom_delay (); |
1167 | 1146 | ||
1168 | /* Shift the read command bits out. */ | 1147 | /* Shift the read command bits out. */ |
1169 | for (i = 4 + addr_len; i >= 0; i--) { | 1148 | for (i = 4 + addr_len; i >= 0; i--) { |
1170 | int dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; | 1149 | int dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; |
1171 | writeb (EE_ENB | dataval, ee_addr); | 1150 | RTL_W8 (Cfg9346, EE_ENB | dataval); |
1172 | eeprom_delay (); | 1151 | eeprom_delay (); |
1173 | writeb (EE_ENB | dataval | EE_SHIFT_CLK, ee_addr); | 1152 | RTL_W8 (Cfg9346, EE_ENB | dataval | EE_SHIFT_CLK); |
1174 | eeprom_delay (); | 1153 | eeprom_delay (); |
1175 | } | 1154 | } |
1176 | writeb (EE_ENB, ee_addr); | 1155 | RTL_W8 (Cfg9346, EE_ENB); |
1177 | eeprom_delay (); | 1156 | eeprom_delay (); |
1178 | 1157 | ||
1179 | for (i = 16; i > 0; i--) { | 1158 | for (i = 16; i > 0; i--) { |
1180 | writeb (EE_ENB | EE_SHIFT_CLK, ee_addr); | 1159 | RTL_W8 (Cfg9346, EE_ENB | EE_SHIFT_CLK); |
1181 | eeprom_delay (); | 1160 | eeprom_delay (); |
1182 | retval = | 1161 | retval = |
1183 | (retval << 1) | ((readb (ee_addr) & EE_DATA_READ) ? 1 : | 1162 | (retval << 1) | ((RTL_R8 (Cfg9346) & EE_DATA_READ) ? 1 : |
1184 | 0); | 1163 | 0); |
1185 | writeb (EE_ENB, ee_addr); | 1164 | RTL_W8 (Cfg9346, EE_ENB); |
1186 | eeprom_delay (); | 1165 | eeprom_delay (); |
1187 | } | 1166 | } |
1188 | 1167 | ||
1189 | /* Terminate the EEPROM access. */ | 1168 | /* Terminate the EEPROM access. */ |
1190 | writeb (~EE_CS, ee_addr); | 1169 | RTL_W8 (Cfg9346, ~EE_CS); |
1191 | eeprom_delay (); | 1170 | eeprom_delay (); |
1192 | 1171 | ||
1193 | return retval; | 1172 | return retval; |
@@ -1206,7 +1185,7 @@ static int __devinit read_eeprom (void *ioaddr, int location, int addr_len) | |||
1206 | #define MDIO_WRITE0 (MDIO_DIR) | 1185 | #define MDIO_WRITE0 (MDIO_DIR) |
1207 | #define MDIO_WRITE1 (MDIO_DIR | MDIO_DATA_OUT) | 1186 | #define MDIO_WRITE1 (MDIO_DIR | MDIO_DATA_OUT) |
1208 | 1187 | ||
1209 | #define mdio_delay(mdio_addr) readb(mdio_addr) | 1188 | #define mdio_delay() RTL_R8(Config4) |
1210 | 1189 | ||
1211 | 1190 | ||
1212 | static char mii_2_8139_map[8] = { | 1191 | static char mii_2_8139_map[8] = { |
@@ -1223,15 +1202,15 @@ static char mii_2_8139_map[8] = { | |||
1223 | 1202 | ||
1224 | #ifdef CONFIG_8139TOO_8129 | 1203 | #ifdef CONFIG_8139TOO_8129 |
1225 | /* Syncronize the MII management interface by shifting 32 one bits out. */ | 1204 | /* Syncronize the MII management interface by shifting 32 one bits out. */ |
1226 | static void mdio_sync (void *mdio_addr) | 1205 | static void mdio_sync (void __iomem *ioaddr) |
1227 | { | 1206 | { |
1228 | int i; | 1207 | int i; |
1229 | 1208 | ||
1230 | for (i = 32; i >= 0; i--) { | 1209 | for (i = 32; i >= 0; i--) { |
1231 | writeb (MDIO_WRITE1, mdio_addr); | 1210 | RTL_W8 (Config4, MDIO_WRITE1); |
1232 | mdio_delay (mdio_addr); | 1211 | mdio_delay (); |
1233 | writeb (MDIO_WRITE1 | MDIO_CLK, mdio_addr); | 1212 | RTL_W8 (Config4, MDIO_WRITE1 | MDIO_CLK); |
1234 | mdio_delay (mdio_addr); | 1213 | mdio_delay (); |
1235 | } | 1214 | } |
1236 | } | 1215 | } |
1237 | #endif | 1216 | #endif |
@@ -1241,35 +1220,36 @@ static int mdio_read (struct net_device *dev, int phy_id, int location) | |||
1241 | struct rtl8139_private *tp = netdev_priv(dev); | 1220 | struct rtl8139_private *tp = netdev_priv(dev); |
1242 | int retval = 0; | 1221 | int retval = 0; |
1243 | #ifdef CONFIG_8139TOO_8129 | 1222 | #ifdef CONFIG_8139TOO_8129 |
1244 | void *mdio_addr = tp->mmio_addr + Config4; | 1223 | void __iomem *ioaddr = tp->mmio_addr; |
1245 | int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location; | 1224 | int mii_cmd = (0xf6 << 10) | (phy_id << 5) | location; |
1246 | int i; | 1225 | int i; |
1247 | #endif | 1226 | #endif |
1248 | 1227 | ||
1249 | if (phy_id > 31) { /* Really a 8139. Use internal registers. */ | 1228 | if (phy_id > 31) { /* Really a 8139. Use internal registers. */ |
1229 | void __iomem *ioaddr = tp->mmio_addr; | ||
1250 | return location < 8 && mii_2_8139_map[location] ? | 1230 | return location < 8 && mii_2_8139_map[location] ? |
1251 | readw (tp->mmio_addr + mii_2_8139_map[location]) : 0; | 1231 | RTL_R16 (mii_2_8139_map[location]) : 0; |
1252 | } | 1232 | } |
1253 | 1233 | ||
1254 | #ifdef CONFIG_8139TOO_8129 | 1234 | #ifdef CONFIG_8139TOO_8129 |
1255 | mdio_sync (mdio_addr); | 1235 | mdio_sync (ioaddr); |
1256 | /* Shift the read command bits out. */ | 1236 | /* Shift the read command bits out. */ |
1257 | for (i = 15; i >= 0; i--) { | 1237 | for (i = 15; i >= 0; i--) { |
1258 | int dataval = (mii_cmd & (1 << i)) ? MDIO_DATA_OUT : 0; | 1238 | int dataval = (mii_cmd & (1 << i)) ? MDIO_DATA_OUT : 0; |
1259 | 1239 | ||
1260 | writeb (MDIO_DIR | dataval, mdio_addr); | 1240 | RTL_W8 (Config4, MDIO_DIR | dataval); |
1261 | mdio_delay (mdio_addr); | 1241 | mdio_delay (); |
1262 | writeb (MDIO_DIR | dataval | MDIO_CLK, mdio_addr); | 1242 | RTL_W8 (Config4, MDIO_DIR | dataval | MDIO_CLK); |
1263 | mdio_delay (mdio_addr); | 1243 | mdio_delay (); |
1264 | } | 1244 | } |
1265 | 1245 | ||
1266 | /* Read the two transition, 16 data, and wire-idle bits. */ | 1246 | /* Read the two transition, 16 data, and wire-idle bits. */ |
1267 | for (i = 19; i > 0; i--) { | 1247 | for (i = 19; i > 0; i--) { |
1268 | writeb (0, mdio_addr); | 1248 | RTL_W8 (Config4, 0); |
1269 | mdio_delay (mdio_addr); | 1249 | mdio_delay (); |
1270 | retval = (retval << 1) | ((readb (mdio_addr) & MDIO_DATA_IN) ? 1 : 0); | 1250 | retval = (retval << 1) | ((RTL_R8 (Config4) & MDIO_DATA_IN) ? 1 : 0); |
1271 | writeb (MDIO_CLK, mdio_addr); | 1251 | RTL_W8 (Config4, MDIO_CLK); |
1272 | mdio_delay (mdio_addr); | 1252 | mdio_delay (); |
1273 | } | 1253 | } |
1274 | #endif | 1254 | #endif |
1275 | 1255 | ||
@@ -1282,13 +1262,13 @@ static void mdio_write (struct net_device *dev, int phy_id, int location, | |||
1282 | { | 1262 | { |
1283 | struct rtl8139_private *tp = netdev_priv(dev); | 1263 | struct rtl8139_private *tp = netdev_priv(dev); |
1284 | #ifdef CONFIG_8139TOO_8129 | 1264 | #ifdef CONFIG_8139TOO_8129 |
1285 | void *mdio_addr = tp->mmio_addr + Config4; | 1265 | void __iomem *ioaddr = tp->mmio_addr; |
1286 | int mii_cmd = (0x5002 << 16) | (phy_id << 23) | (location << 18) | value; | 1266 | int mii_cmd = (0x5002 << 16) | (phy_id << 23) | (location << 18) | value; |
1287 | int i; | 1267 | int i; |
1288 | #endif | 1268 | #endif |
1289 | 1269 | ||
1290 | if (phy_id > 31) { /* Really a 8139. Use internal registers. */ | 1270 | if (phy_id > 31) { /* Really a 8139. Use internal registers. */ |
1291 | void *ioaddr = tp->mmio_addr; | 1271 | void __iomem *ioaddr = tp->mmio_addr; |
1292 | if (location == 0) { | 1272 | if (location == 0) { |
1293 | RTL_W8 (Cfg9346, Cfg9346_Unlock); | 1273 | RTL_W8 (Cfg9346, Cfg9346_Unlock); |
1294 | RTL_W16 (BasicModeCtrl, value); | 1274 | RTL_W16 (BasicModeCtrl, value); |
@@ -1299,23 +1279,23 @@ static void mdio_write (struct net_device *dev, int phy_id, int location, | |||
1299 | } | 1279 | } |
1300 | 1280 | ||
1301 | #ifdef CONFIG_8139TOO_8129 | 1281 | #ifdef CONFIG_8139TOO_8129 |
1302 | mdio_sync (mdio_addr); | 1282 | mdio_sync (ioaddr); |
1303 | 1283 | ||
1304 | /* Shift the command bits out. */ | 1284 | /* Shift the command bits out. */ |
1305 | for (i = 31; i >= 0; i--) { | 1285 | for (i = 31; i >= 0; i--) { |
1306 | int dataval = | 1286 | int dataval = |
1307 | (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0; | 1287 | (mii_cmd & (1 << i)) ? MDIO_WRITE1 : MDIO_WRITE0; |
1308 | writeb (dataval, mdio_addr); | 1288 | RTL_W8 (Config4, dataval); |
1309 | mdio_delay (mdio_addr); | 1289 | mdio_delay (); |
1310 | writeb (dataval | MDIO_CLK, mdio_addr); | 1290 | RTL_W8 (Config4, dataval | MDIO_CLK); |
1311 | mdio_delay (mdio_addr); | 1291 | mdio_delay (); |
1312 | } | 1292 | } |
1313 | /* Clear out extra bits. */ | 1293 | /* Clear out extra bits. */ |
1314 | for (i = 2; i > 0; i--) { | 1294 | for (i = 2; i > 0; i--) { |
1315 | writeb (0, mdio_addr); | 1295 | RTL_W8 (Config4, 0); |
1316 | mdio_delay (mdio_addr); | 1296 | mdio_delay (); |
1317 | writeb (MDIO_CLK, mdio_addr); | 1297 | RTL_W8 (Config4, MDIO_CLK); |
1318 | mdio_delay (mdio_addr); | 1298 | mdio_delay (); |
1319 | } | 1299 | } |
1320 | #endif | 1300 | #endif |
1321 | } | 1301 | } |
@@ -1325,7 +1305,7 @@ static int rtl8139_open (struct net_device *dev) | |||
1325 | { | 1305 | { |
1326 | struct rtl8139_private *tp = netdev_priv(dev); | 1306 | struct rtl8139_private *tp = netdev_priv(dev); |
1327 | int retval; | 1307 | int retval; |
1328 | void *ioaddr = tp->mmio_addr; | 1308 | void __iomem *ioaddr = tp->mmio_addr; |
1329 | 1309 | ||
1330 | retval = request_irq (dev->irq, rtl8139_interrupt, SA_SHIRQ, dev->name, dev); | 1310 | retval = request_irq (dev->irq, rtl8139_interrupt, SA_SHIRQ, dev->name, dev); |
1331 | if (retval) | 1311 | if (retval) |
@@ -1382,7 +1362,7 @@ static void rtl_check_media (struct net_device *dev, unsigned int init_media) | |||
1382 | static void rtl8139_hw_start (struct net_device *dev) | 1362 | static void rtl8139_hw_start (struct net_device *dev) |
1383 | { | 1363 | { |
1384 | struct rtl8139_private *tp = netdev_priv(dev); | 1364 | struct rtl8139_private *tp = netdev_priv(dev); |
1385 | void *ioaddr = tp->mmio_addr; | 1365 | void __iomem *ioaddr = tp->mmio_addr; |
1386 | u32 i; | 1366 | u32 i; |
1387 | u8 tmp; | 1367 | u8 tmp; |
1388 | 1368 | ||
@@ -1484,7 +1464,7 @@ static void rtl8139_tune_twister (struct net_device *dev, | |||
1484 | struct rtl8139_private *tp) | 1464 | struct rtl8139_private *tp) |
1485 | { | 1465 | { |
1486 | int linkcase; | 1466 | int linkcase; |
1487 | void *ioaddr = tp->mmio_addr; | 1467 | void __iomem *ioaddr = tp->mmio_addr; |
1488 | 1468 | ||
1489 | /* This is a complicated state machine to configure the "twister" for | 1469 | /* This is a complicated state machine to configure the "twister" for |
1490 | impedance/echos based on the cable length. | 1470 | impedance/echos based on the cable length. |
@@ -1568,7 +1548,7 @@ static void rtl8139_tune_twister (struct net_device *dev, | |||
1568 | 1548 | ||
1569 | static inline void rtl8139_thread_iter (struct net_device *dev, | 1549 | static inline void rtl8139_thread_iter (struct net_device *dev, |
1570 | struct rtl8139_private *tp, | 1550 | struct rtl8139_private *tp, |
1571 | void *ioaddr) | 1551 | void __iomem *ioaddr) |
1572 | { | 1552 | { |
1573 | int mii_lpa; | 1553 | int mii_lpa; |
1574 | 1554 | ||
@@ -1676,7 +1656,7 @@ static inline void rtl8139_tx_clear (struct rtl8139_private *tp) | |||
1676 | static void rtl8139_tx_timeout (struct net_device *dev) | 1656 | static void rtl8139_tx_timeout (struct net_device *dev) |
1677 | { | 1657 | { |
1678 | struct rtl8139_private *tp = netdev_priv(dev); | 1658 | struct rtl8139_private *tp = netdev_priv(dev); |
1679 | void *ioaddr = tp->mmio_addr; | 1659 | void __iomem *ioaddr = tp->mmio_addr; |
1680 | int i; | 1660 | int i; |
1681 | u8 tmp8; | 1661 | u8 tmp8; |
1682 | unsigned long flags; | 1662 | unsigned long flags; |
@@ -1721,7 +1701,7 @@ static void rtl8139_tx_timeout (struct net_device *dev) | |||
1721 | static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) | 1701 | static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) |
1722 | { | 1702 | { |
1723 | struct rtl8139_private *tp = netdev_priv(dev); | 1703 | struct rtl8139_private *tp = netdev_priv(dev); |
1724 | void *ioaddr = tp->mmio_addr; | 1704 | void __iomem *ioaddr = tp->mmio_addr; |
1725 | unsigned int entry; | 1705 | unsigned int entry; |
1726 | unsigned int len = skb->len; | 1706 | unsigned int len = skb->len; |
1727 | 1707 | ||
@@ -1763,7 +1743,7 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
1763 | 1743 | ||
1764 | static void rtl8139_tx_interrupt (struct net_device *dev, | 1744 | static void rtl8139_tx_interrupt (struct net_device *dev, |
1765 | struct rtl8139_private *tp, | 1745 | struct rtl8139_private *tp, |
1766 | void *ioaddr) | 1746 | void __iomem *ioaddr) |
1767 | { | 1747 | { |
1768 | unsigned long dirty_tx, tx_left; | 1748 | unsigned long dirty_tx, tx_left; |
1769 | 1749 | ||
@@ -1833,7 +1813,7 @@ static void rtl8139_tx_interrupt (struct net_device *dev, | |||
1833 | 1813 | ||
1834 | /* TODO: clean this up! Rx reset need not be this intensive */ | 1814 | /* TODO: clean this up! Rx reset need not be this intensive */ |
1835 | static void rtl8139_rx_err (u32 rx_status, struct net_device *dev, | 1815 | static void rtl8139_rx_err (u32 rx_status, struct net_device *dev, |
1836 | struct rtl8139_private *tp, void *ioaddr) | 1816 | struct rtl8139_private *tp, void __iomem *ioaddr) |
1837 | { | 1817 | { |
1838 | u8 tmp8; | 1818 | u8 tmp8; |
1839 | #ifdef CONFIG_8139_OLD_RX_RESET | 1819 | #ifdef CONFIG_8139_OLD_RX_RESET |
@@ -1930,7 +1910,7 @@ static __inline__ void wrap_copy(struct sk_buff *skb, const unsigned char *ring, | |||
1930 | 1910 | ||
1931 | static void rtl8139_isr_ack(struct rtl8139_private *tp) | 1911 | static void rtl8139_isr_ack(struct rtl8139_private *tp) |
1932 | { | 1912 | { |
1933 | void *ioaddr = tp->mmio_addr; | 1913 | void __iomem *ioaddr = tp->mmio_addr; |
1934 | u16 status; | 1914 | u16 status; |
1935 | 1915 | ||
1936 | status = RTL_R16 (IntrStatus) & RxAckBits; | 1916 | status = RTL_R16 (IntrStatus) & RxAckBits; |
@@ -1949,7 +1929,7 @@ static void rtl8139_isr_ack(struct rtl8139_private *tp) | |||
1949 | static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp, | 1929 | static int rtl8139_rx(struct net_device *dev, struct rtl8139_private *tp, |
1950 | int budget) | 1930 | int budget) |
1951 | { | 1931 | { |
1952 | void *ioaddr = tp->mmio_addr; | 1932 | void __iomem *ioaddr = tp->mmio_addr; |
1953 | int received = 0; | 1933 | int received = 0; |
1954 | unsigned char *rx_ring = tp->rx_ring; | 1934 | unsigned char *rx_ring = tp->rx_ring; |
1955 | unsigned int cur_rx = tp->cur_rx; | 1935 | unsigned int cur_rx = tp->cur_rx; |
@@ -2087,7 +2067,7 @@ out: | |||
2087 | 2067 | ||
2088 | static void rtl8139_weird_interrupt (struct net_device *dev, | 2068 | static void rtl8139_weird_interrupt (struct net_device *dev, |
2089 | struct rtl8139_private *tp, | 2069 | struct rtl8139_private *tp, |
2090 | void *ioaddr, | 2070 | void __iomem *ioaddr, |
2091 | int status, int link_changed) | 2071 | int status, int link_changed) |
2092 | { | 2072 | { |
2093 | DPRINTK ("%s: Abnormal interrupt, status %8.8x.\n", | 2073 | DPRINTK ("%s: Abnormal interrupt, status %8.8x.\n", |
@@ -2127,7 +2107,7 @@ static void rtl8139_weird_interrupt (struct net_device *dev, | |||
2127 | static int rtl8139_poll(struct net_device *dev, int *budget) | 2107 | static int rtl8139_poll(struct net_device *dev, int *budget) |
2128 | { | 2108 | { |
2129 | struct rtl8139_private *tp = netdev_priv(dev); | 2109 | struct rtl8139_private *tp = netdev_priv(dev); |
2130 | void *ioaddr = tp->mmio_addr; | 2110 | void __iomem *ioaddr = tp->mmio_addr; |
2131 | int orig_budget = min(*budget, dev->quota); | 2111 | int orig_budget = min(*budget, dev->quota); |
2132 | int done = 1; | 2112 | int done = 1; |
2133 | 2113 | ||
@@ -2165,7 +2145,7 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance, | |||
2165 | { | 2145 | { |
2166 | struct net_device *dev = (struct net_device *) dev_instance; | 2146 | struct net_device *dev = (struct net_device *) dev_instance; |
2167 | struct rtl8139_private *tp = netdev_priv(dev); | 2147 | struct rtl8139_private *tp = netdev_priv(dev); |
2168 | void *ioaddr = tp->mmio_addr; | 2148 | void __iomem *ioaddr = tp->mmio_addr; |
2169 | u16 status, ackstat; | 2149 | u16 status, ackstat; |
2170 | int link_changed = 0; /* avoid bogus "uninit" warning */ | 2150 | int link_changed = 0; /* avoid bogus "uninit" warning */ |
2171 | int handled = 0; | 2151 | int handled = 0; |
@@ -2241,7 +2221,7 @@ static void rtl8139_poll_controller(struct net_device *dev) | |||
2241 | static int rtl8139_close (struct net_device *dev) | 2221 | static int rtl8139_close (struct net_device *dev) |
2242 | { | 2222 | { |
2243 | struct rtl8139_private *tp = netdev_priv(dev); | 2223 | struct rtl8139_private *tp = netdev_priv(dev); |
2244 | void *ioaddr = tp->mmio_addr; | 2224 | void __iomem *ioaddr = tp->mmio_addr; |
2245 | int ret = 0; | 2225 | int ret = 0; |
2246 | unsigned long flags; | 2226 | unsigned long flags; |
2247 | 2227 | ||
@@ -2304,7 +2284,7 @@ static int rtl8139_close (struct net_device *dev) | |||
2304 | static void rtl8139_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | 2284 | static void rtl8139_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
2305 | { | 2285 | { |
2306 | struct rtl8139_private *np = netdev_priv(dev); | 2286 | struct rtl8139_private *np = netdev_priv(dev); |
2307 | void *ioaddr = np->mmio_addr; | 2287 | void __iomem *ioaddr = np->mmio_addr; |
2308 | 2288 | ||
2309 | spin_lock_irq(&np->lock); | 2289 | spin_lock_irq(&np->lock); |
2310 | if (rtl_chip_info[np->chipset].flags & HasLWake) { | 2290 | if (rtl_chip_info[np->chipset].flags & HasLWake) { |
@@ -2338,7 +2318,7 @@ static void rtl8139_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
2338 | static int rtl8139_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | 2318 | static int rtl8139_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
2339 | { | 2319 | { |
2340 | struct rtl8139_private *np = netdev_priv(dev); | 2320 | struct rtl8139_private *np = netdev_priv(dev); |
2341 | void *ioaddr = np->mmio_addr; | 2321 | void __iomem *ioaddr = np->mmio_addr; |
2342 | u32 support; | 2322 | u32 support; |
2343 | u8 cfg3, cfg5; | 2323 | u8 cfg3, cfg5; |
2344 | 2324 | ||
@@ -2506,7 +2486,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
2506 | static struct net_device_stats *rtl8139_get_stats (struct net_device *dev) | 2486 | static struct net_device_stats *rtl8139_get_stats (struct net_device *dev) |
2507 | { | 2487 | { |
2508 | struct rtl8139_private *tp = netdev_priv(dev); | 2488 | struct rtl8139_private *tp = netdev_priv(dev); |
2509 | void *ioaddr = tp->mmio_addr; | 2489 | void __iomem *ioaddr = tp->mmio_addr; |
2510 | unsigned long flags; | 2490 | unsigned long flags; |
2511 | 2491 | ||
2512 | if (netif_running(dev)) { | 2492 | if (netif_running(dev)) { |
@@ -2525,7 +2505,7 @@ static struct net_device_stats *rtl8139_get_stats (struct net_device *dev) | |||
2525 | static void __set_rx_mode (struct net_device *dev) | 2505 | static void __set_rx_mode (struct net_device *dev) |
2526 | { | 2506 | { |
2527 | struct rtl8139_private *tp = netdev_priv(dev); | 2507 | struct rtl8139_private *tp = netdev_priv(dev); |
2528 | void *ioaddr = tp->mmio_addr; | 2508 | void __iomem *ioaddr = tp->mmio_addr; |
2529 | u32 mc_filter[2]; /* Multicast hash filter */ | 2509 | u32 mc_filter[2]; /* Multicast hash filter */ |
2530 | int i, rx_mode; | 2510 | int i, rx_mode; |
2531 | u32 tmp; | 2511 | u32 tmp; |
@@ -2586,7 +2566,7 @@ static int rtl8139_suspend (struct pci_dev *pdev, pm_message_t state) | |||
2586 | { | 2566 | { |
2587 | struct net_device *dev = pci_get_drvdata (pdev); | 2567 | struct net_device *dev = pci_get_drvdata (pdev); |
2588 | struct rtl8139_private *tp = netdev_priv(dev); | 2568 | struct rtl8139_private *tp = netdev_priv(dev); |
2589 | void *ioaddr = tp->mmio_addr; | 2569 | void __iomem *ioaddr = tp->mmio_addr; |
2590 | unsigned long flags; | 2570 | unsigned long flags; |
2591 | 2571 | ||
2592 | pci_save_state (pdev); | 2572 | pci_save_state (pdev); |