Loading drivers/net/ax88796.c +134 −128 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <linux/isapnp.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/platform_device.h> #include <linux/delay.h> #include <linux/timer.h> Loading @@ -30,9 +31,8 @@ #include <net/ax88796.h> #include <asm/system.h> #include <asm/io.h> static int phy_debug = 0; static int phy_debug; /* Rename the lib8390.c functions to show that they are in this driver */ #define __ei_open ax_ei_open Loading Loading @@ -105,12 +105,12 @@ static inline struct ax_device *to_ax_dev(struct net_device *dev) return (struct ax_device *)(ei_local + 1); } /* ax_initial_check /* * ax_initial_check * * do an initial probe for the card to check wether it exists * and is functional */ static int ax_initial_check(struct net_device *dev) { struct ei_device *ei_local = netdev_priv(dev); Loading @@ -136,9 +136,10 @@ static int ax_initial_check(struct net_device *dev) return 0; } /* Hard reset the card. This used to pause for the same period that a 8390 reset command required, but that shouldn't be necessary. */ /* * Hard reset the card. This used to pause for the same period that a * 8390 reset command required, but that shouldn't be necessary. */ static void ax_reset_8390(struct net_device *dev) { struct ei_device *ei_local = netdev_priv(dev); Loading Loading @@ -192,9 +193,11 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, ei_outb(E8390_RREAD+E8390_START, nic_base + NE_CMD); if (ei_status.word16) readsw(nic_base + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)>>1); readsw(nic_base + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr) >> 1); else readsb(nic_base + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)); readsb(nic_base + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)); ei_outb(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ ei_status.dmaing &= ~0x01; Loading @@ -203,11 +206,13 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, } /* Block input and output, similar to the Crynwr packet driver. If you are porting to a new ethercard, look at the packet driver source for hints. The NEx000 doesn't share the on-board packet memory -- you have to put the packet out through the "remote DMA" dataport using ei_outb. */ /* * Block input and output, similar to the Crynwr packet driver. If * you are porting to a new ethercard, look at the packet driver * source for hints. The NEx000 doesn't share the on-board packet * memory -- you have to put the packet out through the "remote DMA" * dataport using ei_outb. */ static void ax_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset) { Loading Loading @@ -254,10 +259,11 @@ static void ax_block_output(struct net_device *dev, int count, void __iomem *nic_base = ei_local->mem; unsigned long dma_start; /* Round the count up for word writes. Do we need to do this? What effect will an odd byte count have on the 8390? I should check someday. */ /* * Round the count up for word writes. Do we need to do this? * What effect will an odd byte count have on the 8390? I * should check someday. */ if (ei_status.word16 && (count & 0x01)) count++; Loading @@ -283,11 +289,10 @@ static void ax_block_output(struct net_device *dev, int count, ei_outb(start_page, nic_base + EN0_RSARHI); ei_outb(E8390_RWRITE+E8390_START, nic_base + NE_CMD); if (ei_status.word16) { if (ei_status.word16) writesw(nic_base + NE_DATAPORT, buf, count >> 1); } else { else writesb(nic_base + NE_DATAPORT, buf, count); } dma_start = jiffies; Loading @@ -308,20 +313,20 @@ static void ax_block_output(struct net_device *dev, int count, /* definitions for accessing MII/EEPROM interface */ #define AX_MEMR EI_SHIFT(0x14) #define AX_MEMR_MDC (1<<0) #define AX_MEMR_MDIR (1<<1) #define AX_MEMR_MDI (1<<2) #define AX_MEMR_MDO (1<<3) #define AX_MEMR_EECS (1<<4) #define AX_MEMR_EEI (1<<5) #define AX_MEMR_EEO (1<<6) #define AX_MEMR_EECLK (1<<7) /* ax_mii_ei_outbits #define AX_MEMR_MDC BIT(0) #define AX_MEMR_MDIR BIT(1) #define AX_MEMR_MDI BIT(2) #define AX_MEMR_MDO BIT(3) #define AX_MEMR_EECS BIT(4) #define AX_MEMR_EEI BIT(5) #define AX_MEMR_EEO BIT(6) #define AX_MEMR_EECLK BIT(7) /* * ax_mii_ei_outbits * * write the specified set of bits to the phy */ static void ax_mii_ei_outbits(struct net_device *dev, unsigned int bits, int len) { Loading Loading @@ -356,11 +361,11 @@ ax_mii_ei_outbits(struct net_device *dev, unsigned int bits, int len) ei_outb(memr, (void __iomem *)dev->base_addr + AX_MEMR); } /* ax_phy_ei_inbits /* * ax_phy_ei_inbits * * read a specified number of bits from the phy */ static unsigned int ax_phy_ei_inbits(struct net_device *dev, int no) { Loading Loading @@ -389,12 +394,12 @@ ax_phy_ei_inbits(struct net_device *dev, int no) return result; } /* ax_phy_issueaddr /* * ax_phy_issueaddr * * use the low level bit shifting routines to send the address * and command to the specified phy */ static void ax_phy_issueaddr(struct net_device *dev, int phy_addr, int reg, int opc) { Loading Loading @@ -662,14 +667,14 @@ static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) ei_outb(ax->plat->gpoc_val, ioaddr + EI_SHIFT(0x17)); } /* ax_init_dev /* * ax_init_dev * * initialise the specified device, taking care to note the MAC * address it may already have (if configured), ensure * the device is ready to be used by lib8390.c and registerd with * the network layer. */ static int ax_init_dev(struct net_device *dev, int first_init) { struct ei_device *ei_local = netdev_priv(dev); Loading Loading @@ -732,9 +737,10 @@ static int ax_init_dev(struct net_device *dev, int first_init) stop_page = NE1SM_STOP_PG; } /* load the mac-address from the device if this is the * first time we've initialised */ /* * load the mac-address from the device if this is the first * time we've initialised */ if (first_init) { if (ax->plat->flags & AXFLG_MAC_FROMDEV) { ei_outb(E8390_NODMA + E8390_PAGE1 + E8390_STOP, Loading Loading @@ -827,13 +833,13 @@ static int ax_remove(struct platform_device *_dev) return 0; } /* ax_probe /* * ax_probe * * This is the entry point when the platform device system uses to * notify us of a new device to attach to. Allocate memory, find * the resources and information passed, and map the necessary registers. * notify us of a new device to attach to. Allocate memory, find the * resources and information passed, and map the necessary registers. */ static int ax_probe(struct platform_device *pdev) { struct net_device *dev; Loading @@ -860,7 +866,6 @@ static int ax_probe(struct platform_device *pdev) ei_status.rxcr_base = ax->plat->rcr_val; /* find the platform resources */ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (res == NULL) { dev_err(&pdev->dev, "no IRQ specified\n"); Loading @@ -880,9 +885,10 @@ static int ax_probe(struct platform_device *pdev) size = (res->end - res->start) + 1; /* setup the register offsets from either the platform data * or by using the size of the resource provided */ /* * setup the register offsets from either the platform data or * by using the size of the resource provided */ if (ax->plat->reg_offsets) ei_status.reg_offset = ax->plat->reg_offsets; else { Loading Loading
drivers/net/ax88796.c +134 −128 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <linux/isapnp.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/platform_device.h> #include <linux/delay.h> #include <linux/timer.h> Loading @@ -30,9 +31,8 @@ #include <net/ax88796.h> #include <asm/system.h> #include <asm/io.h> static int phy_debug = 0; static int phy_debug; /* Rename the lib8390.c functions to show that they are in this driver */ #define __ei_open ax_ei_open Loading Loading @@ -105,12 +105,12 @@ static inline struct ax_device *to_ax_dev(struct net_device *dev) return (struct ax_device *)(ei_local + 1); } /* ax_initial_check /* * ax_initial_check * * do an initial probe for the card to check wether it exists * and is functional */ static int ax_initial_check(struct net_device *dev) { struct ei_device *ei_local = netdev_priv(dev); Loading @@ -136,9 +136,10 @@ static int ax_initial_check(struct net_device *dev) return 0; } /* Hard reset the card. This used to pause for the same period that a 8390 reset command required, but that shouldn't be necessary. */ /* * Hard reset the card. This used to pause for the same period that a * 8390 reset command required, but that shouldn't be necessary. */ static void ax_reset_8390(struct net_device *dev) { struct ei_device *ei_local = netdev_priv(dev); Loading Loading @@ -192,9 +193,11 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, ei_outb(E8390_RREAD+E8390_START, nic_base + NE_CMD); if (ei_status.word16) readsw(nic_base + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)>>1); readsw(nic_base + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr) >> 1); else readsb(nic_base + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)); readsb(nic_base + NE_DATAPORT, hdr, sizeof(struct e8390_pkt_hdr)); ei_outb(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */ ei_status.dmaing &= ~0x01; Loading @@ -203,11 +206,13 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, } /* Block input and output, similar to the Crynwr packet driver. If you are porting to a new ethercard, look at the packet driver source for hints. The NEx000 doesn't share the on-board packet memory -- you have to put the packet out through the "remote DMA" dataport using ei_outb. */ /* * Block input and output, similar to the Crynwr packet driver. If * you are porting to a new ethercard, look at the packet driver * source for hints. The NEx000 doesn't share the on-board packet * memory -- you have to put the packet out through the "remote DMA" * dataport using ei_outb. */ static void ax_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset) { Loading Loading @@ -254,10 +259,11 @@ static void ax_block_output(struct net_device *dev, int count, void __iomem *nic_base = ei_local->mem; unsigned long dma_start; /* Round the count up for word writes. Do we need to do this? What effect will an odd byte count have on the 8390? I should check someday. */ /* * Round the count up for word writes. Do we need to do this? * What effect will an odd byte count have on the 8390? I * should check someday. */ if (ei_status.word16 && (count & 0x01)) count++; Loading @@ -283,11 +289,10 @@ static void ax_block_output(struct net_device *dev, int count, ei_outb(start_page, nic_base + EN0_RSARHI); ei_outb(E8390_RWRITE+E8390_START, nic_base + NE_CMD); if (ei_status.word16) { if (ei_status.word16) writesw(nic_base + NE_DATAPORT, buf, count >> 1); } else { else writesb(nic_base + NE_DATAPORT, buf, count); } dma_start = jiffies; Loading @@ -308,20 +313,20 @@ static void ax_block_output(struct net_device *dev, int count, /* definitions for accessing MII/EEPROM interface */ #define AX_MEMR EI_SHIFT(0x14) #define AX_MEMR_MDC (1<<0) #define AX_MEMR_MDIR (1<<1) #define AX_MEMR_MDI (1<<2) #define AX_MEMR_MDO (1<<3) #define AX_MEMR_EECS (1<<4) #define AX_MEMR_EEI (1<<5) #define AX_MEMR_EEO (1<<6) #define AX_MEMR_EECLK (1<<7) /* ax_mii_ei_outbits #define AX_MEMR_MDC BIT(0) #define AX_MEMR_MDIR BIT(1) #define AX_MEMR_MDI BIT(2) #define AX_MEMR_MDO BIT(3) #define AX_MEMR_EECS BIT(4) #define AX_MEMR_EEI BIT(5) #define AX_MEMR_EEO BIT(6) #define AX_MEMR_EECLK BIT(7) /* * ax_mii_ei_outbits * * write the specified set of bits to the phy */ static void ax_mii_ei_outbits(struct net_device *dev, unsigned int bits, int len) { Loading Loading @@ -356,11 +361,11 @@ ax_mii_ei_outbits(struct net_device *dev, unsigned int bits, int len) ei_outb(memr, (void __iomem *)dev->base_addr + AX_MEMR); } /* ax_phy_ei_inbits /* * ax_phy_ei_inbits * * read a specified number of bits from the phy */ static unsigned int ax_phy_ei_inbits(struct net_device *dev, int no) { Loading Loading @@ -389,12 +394,12 @@ ax_phy_ei_inbits(struct net_device *dev, int no) return result; } /* ax_phy_issueaddr /* * ax_phy_issueaddr * * use the low level bit shifting routines to send the address * and command to the specified phy */ static void ax_phy_issueaddr(struct net_device *dev, int phy_addr, int reg, int opc) { Loading Loading @@ -662,14 +667,14 @@ static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) ei_outb(ax->plat->gpoc_val, ioaddr + EI_SHIFT(0x17)); } /* ax_init_dev /* * ax_init_dev * * initialise the specified device, taking care to note the MAC * address it may already have (if configured), ensure * the device is ready to be used by lib8390.c and registerd with * the network layer. */ static int ax_init_dev(struct net_device *dev, int first_init) { struct ei_device *ei_local = netdev_priv(dev); Loading Loading @@ -732,9 +737,10 @@ static int ax_init_dev(struct net_device *dev, int first_init) stop_page = NE1SM_STOP_PG; } /* load the mac-address from the device if this is the * first time we've initialised */ /* * load the mac-address from the device if this is the first * time we've initialised */ if (first_init) { if (ax->plat->flags & AXFLG_MAC_FROMDEV) { ei_outb(E8390_NODMA + E8390_PAGE1 + E8390_STOP, Loading Loading @@ -827,13 +833,13 @@ static int ax_remove(struct platform_device *_dev) return 0; } /* ax_probe /* * ax_probe * * This is the entry point when the platform device system uses to * notify us of a new device to attach to. Allocate memory, find * the resources and information passed, and map the necessary registers. * notify us of a new device to attach to. Allocate memory, find the * resources and information passed, and map the necessary registers. */ static int ax_probe(struct platform_device *pdev) { struct net_device *dev; Loading @@ -860,7 +866,6 @@ static int ax_probe(struct platform_device *pdev) ei_status.rxcr_base = ax->plat->rcr_val; /* find the platform resources */ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (res == NULL) { dev_err(&pdev->dev, "no IRQ specified\n"); Loading @@ -880,9 +885,10 @@ static int ax_probe(struct platform_device *pdev) size = (res->end - res->start) + 1; /* setup the register offsets from either the platform data * or by using the size of the resource provided */ /* * setup the register offsets from either the platform data or * by using the size of the resource provided */ if (ax->plat->reg_offsets) ei_status.reg_offset = ax->plat->reg_offsets; else { Loading