Commit 9f072429 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

ax88796: fix codingstyle and checkpatch warnings

Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 59ed5aba
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/isapnp.h> #include <linux/isapnp.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/timer.h> #include <linux/timer.h>
...@@ -30,9 +31,8 @@ ...@@ -30,9 +31,8 @@
#include <net/ax88796.h> #include <net/ax88796.h>
#include <asm/system.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 */ /* Rename the lib8390.c functions to show that they are in this driver */
#define __ei_open ax_ei_open #define __ei_open ax_ei_open
...@@ -102,15 +102,15 @@ struct ax_device { ...@@ -102,15 +102,15 @@ struct ax_device {
static inline struct ax_device *to_ax_dev(struct net_device *dev) static inline struct ax_device *to_ax_dev(struct net_device *dev)
{ {
struct ei_device *ei_local = netdev_priv(dev); struct ei_device *ei_local = netdev_priv(dev);
return (struct ax_device *)(ei_local+1); 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 * do an initial probe for the card to check wether it exists
* and is functional * and is functional
*/ */
static int ax_initial_check(struct net_device *dev) static int ax_initial_check(struct net_device *dev)
{ {
struct ei_device *ei_local = netdev_priv(dev); struct ei_device *ei_local = netdev_priv(dev);
...@@ -122,10 +122,10 @@ static int ax_initial_check(struct net_device *dev) ...@@ -122,10 +122,10 @@ static int ax_initial_check(struct net_device *dev)
if (reg0 == 0xFF) if (reg0 == 0xFF)
return -ENODEV; return -ENODEV;
ei_outb(E8390_NODMA+E8390_PAGE1+E8390_STOP, ioaddr + E8390_CMD); ei_outb(E8390_NODMA + E8390_PAGE1 + E8390_STOP, ioaddr + E8390_CMD);
regd = ei_inb(ioaddr + 0x0d); regd = ei_inb(ioaddr + 0x0d);
ei_outb(0xff, ioaddr + 0x0d); ei_outb(0xff, ioaddr + 0x0d);
ei_outb(E8390_NODMA+E8390_PAGE0, ioaddr + E8390_CMD); ei_outb(E8390_NODMA + E8390_PAGE0, ioaddr + E8390_CMD);
ei_inb(ioaddr + EN0_COUNTER0); /* Clear the counter by reading. */ ei_inb(ioaddr + EN0_COUNTER0); /* Clear the counter by reading. */
if (ei_inb(ioaddr + EN0_COUNTER0) != 0) { if (ei_inb(ioaddr + EN0_COUNTER0) != 0) {
ei_outb(reg0, ioaddr); ei_outb(reg0, ioaddr);
...@@ -136,9 +136,10 @@ static int ax_initial_check(struct net_device *dev) ...@@ -136,9 +136,10 @@ static int ax_initial_check(struct net_device *dev)
return 0; 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) static void ax_reset_8390(struct net_device *dev)
{ {
struct ei_device *ei_local = netdev_priv(dev); struct ei_device *ei_local = netdev_priv(dev);
...@@ -156,7 +157,7 @@ static void ax_reset_8390(struct net_device *dev) ...@@ -156,7 +157,7 @@ static void ax_reset_8390(struct net_device *dev)
/* This check _should_not_ be necessary, omit eventually. */ /* This check _should_not_ be necessary, omit eventually. */
while ((ei_inb(addr + EN0_ISR) & ENISR_RESET) == 0) { while ((ei_inb(addr + EN0_ISR) & ENISR_RESET) == 0) {
if (jiffies - reset_start_time > 2*HZ/100) { if (jiffies - reset_start_time > 2 * HZ / 100) {
dev_warn(&ax->dev->dev, "%s: %s did not complete.\n", dev_warn(&ax->dev->dev, "%s: %s did not complete.\n",
__func__, dev->name); __func__, dev->name);
break; break;
...@@ -184,7 +185,7 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, ...@@ -184,7 +185,7 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
} }
ei_status.dmaing |= 0x01; ei_status.dmaing |= 0x01;
ei_outb(E8390_NODMA+E8390_PAGE0+E8390_START, nic_base+ NE_CMD); ei_outb(E8390_NODMA + E8390_PAGE0 + E8390_START, nic_base + NE_CMD);
ei_outb(sizeof(struct e8390_pkt_hdr), nic_base + EN0_RCNTLO); ei_outb(sizeof(struct e8390_pkt_hdr), nic_base + EN0_RCNTLO);
ei_outb(0, nic_base + EN0_RCNTHI); ei_outb(0, nic_base + EN0_RCNTHI);
ei_outb(0, nic_base + EN0_RSARLO); /* On page boundary */ ei_outb(0, nic_base + EN0_RSARLO); /* On page boundary */
...@@ -192,9 +193,11 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, ...@@ -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); ei_outb(E8390_RREAD+E8390_START, nic_base + NE_CMD);
if (ei_status.word16) 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 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_outb(ENISR_RDC, nic_base + EN0_ISR); /* Ack intr. */
ei_status.dmaing &= ~0x01; ei_status.dmaing &= ~0x01;
...@@ -203,11 +206,13 @@ static void ax_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, ...@@ -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. * Block input and output, similar to the Crynwr packet driver. If
The NEx000 doesn't share the on-board packet memory -- you have to put * you are porting to a new ethercard, look at the packet driver
the packet out through the "remote DMA" dataport using ei_outb. */ * 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, static void ax_block_input(struct net_device *dev, int count,
struct sk_buff *skb, int ring_offset) struct sk_buff *skb, int ring_offset)
{ {
...@@ -227,7 +232,7 @@ static void ax_block_input(struct net_device *dev, int count, ...@@ -227,7 +232,7 @@ static void ax_block_input(struct net_device *dev, int count,
ei_status.dmaing |= 0x01; ei_status.dmaing |= 0x01;
ei_outb(E8390_NODMA+E8390_PAGE0+E8390_START, nic_base+ NE_CMD); ei_outb(E8390_NODMA+E8390_PAGE0+E8390_START, nic_base + NE_CMD);
ei_outb(count & 0xff, nic_base + EN0_RCNTLO); ei_outb(count & 0xff, nic_base + EN0_RCNTLO);
ei_outb(count >> 8, nic_base + EN0_RCNTHI); ei_outb(count >> 8, nic_base + EN0_RCNTHI);
ei_outb(ring_offset & 0xff, nic_base + EN0_RSARLO); ei_outb(ring_offset & 0xff, nic_base + EN0_RSARLO);
...@@ -254,10 +259,11 @@ static void ax_block_output(struct net_device *dev, int count, ...@@ -254,10 +259,11 @@ static void ax_block_output(struct net_device *dev, int count,
void __iomem *nic_base = ei_local->mem; void __iomem *nic_base = ei_local->mem;
unsigned long dma_start; 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? * Round the count up for word writes. Do we need to do this?
I should check someday. */ * What effect will an odd byte count have on the 8390? I
* should check someday.
*/
if (ei_status.word16 && (count & 0x01)) if (ei_status.word16 && (count & 0x01))
count++; count++;
...@@ -283,20 +289,19 @@ static void ax_block_output(struct net_device *dev, int count, ...@@ -283,20 +289,19 @@ static void ax_block_output(struct net_device *dev, int count,
ei_outb(start_page, nic_base + EN0_RSARHI); ei_outb(start_page, nic_base + EN0_RSARHI);
ei_outb(E8390_RWRITE+E8390_START, nic_base + NE_CMD); 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); writesw(nic_base + NE_DATAPORT, buf, count >> 1);
} else { else
writesb(nic_base + NE_DATAPORT, buf, count); writesb(nic_base + NE_DATAPORT, buf, count);
}
dma_start = jiffies; dma_start = jiffies;
while ((ei_inb(nic_base + EN0_ISR) & ENISR_RDC) == 0) { while ((ei_inb(nic_base + EN0_ISR) & ENISR_RDC) == 0) {
if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ if (jiffies - dma_start > 2 * HZ / 100) { /* 20ms */
dev_warn(&ax->dev->dev, dev_warn(&ax->dev->dev,
"%s: timeout waiting for Tx RDC.\n", dev->name); "%s: timeout waiting for Tx RDC.\n", dev->name);
ax_reset_8390(dev); ax_reset_8390(dev);
ax_NS8390_init(dev,1); ax_NS8390_init(dev, 1);
break; break;
} }
} }
...@@ -308,20 +313,20 @@ static void ax_block_output(struct net_device *dev, int count, ...@@ -308,20 +313,20 @@ static void ax_block_output(struct net_device *dev, int count,
/* definitions for accessing MII/EEPROM interface */ /* definitions for accessing MII/EEPROM interface */
#define AX_MEMR EI_SHIFT(0x14) #define AX_MEMR EI_SHIFT(0x14)
#define AX_MEMR_MDC (1<<0) #define AX_MEMR_MDC BIT(0)
#define AX_MEMR_MDIR (1<<1) #define AX_MEMR_MDIR BIT(1)
#define AX_MEMR_MDI (1<<2) #define AX_MEMR_MDI BIT(2)
#define AX_MEMR_MDO (1<<3) #define AX_MEMR_MDO BIT(3)
#define AX_MEMR_EECS (1<<4) #define AX_MEMR_EECS BIT(4)
#define AX_MEMR_EEI (1<<5) #define AX_MEMR_EEI BIT(5)
#define AX_MEMR_EEO (1<<6) #define AX_MEMR_EEO BIT(6)
#define AX_MEMR_EECLK (1<<7) #define AX_MEMR_EECLK BIT(7)
/* ax_mii_ei_outbits /*
* ax_mii_ei_outbits
* *
* write the specified set of bits to the phy * write the specified set of bits to the phy
*/ */
static void static void
ax_mii_ei_outbits(struct net_device *dev, unsigned int bits, int len) ax_mii_ei_outbits(struct net_device *dev, unsigned int bits, int len)
{ {
...@@ -356,11 +361,11 @@ ax_mii_ei_outbits(struct net_device *dev, unsigned int bits, int len) ...@@ -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); 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 * read a specified number of bits from the phy
*/ */
static unsigned int static unsigned int
ax_phy_ei_inbits(struct net_device *dev, int no) ax_phy_ei_inbits(struct net_device *dev, int no)
{ {
...@@ -381,7 +386,7 @@ ax_phy_ei_inbits(struct net_device *dev, int no) ...@@ -381,7 +386,7 @@ ax_phy_ei_inbits(struct net_device *dev, int no)
udelay(1); udelay(1);
if (ei_inb(memr_addr) & AX_MEMR_MDI) if (ei_inb(memr_addr) & AX_MEMR_MDI)
result |= (1<<no); result |= (1 << no);
ei_outb(memr, memr_addr); ei_outb(memr, memr_addr);
} }
...@@ -389,12 +394,12 @@ ax_phy_ei_inbits(struct net_device *dev, int no) ...@@ -389,12 +394,12 @@ ax_phy_ei_inbits(struct net_device *dev, int no)
return result; return result;
} }
/* ax_phy_issueaddr /*
* ax_phy_issueaddr
* *
* use the low level bit shifting routines to send the address * use the low level bit shifting routines to send the address
* and command to the specified phy * and command to the specified phy
*/ */
static void static void
ax_phy_issueaddr(struct net_device *dev, int phy_addr, int reg, int opc) ax_phy_issueaddr(struct net_device *dev, int phy_addr, int reg, int opc)
{ {
...@@ -421,7 +426,7 @@ ax_phy_read(struct net_device *dev, int phy_addr, int reg) ...@@ -421,7 +426,7 @@ ax_phy_read(struct net_device *dev, int phy_addr, int reg)
ax_phy_issueaddr(dev, phy_addr, reg, 2); ax_phy_issueaddr(dev, phy_addr, reg, 2);
result = ax_phy_ei_inbits(dev, 17); result = ax_phy_ei_inbits(dev, 17);
result &= ~(3<<16); result &= ~(3 << 16);
spin_unlock_irqrestore(&ei_local->page_lock, flags); spin_unlock_irqrestore(&ei_local->page_lock, flags);
...@@ -495,7 +500,7 @@ static int ax_open(struct net_device *dev) ...@@ -495,7 +500,7 @@ static int ax_open(struct net_device *dev)
init_timer(&ax->mii_timer); init_timer(&ax->mii_timer);
ax->mii_timer.expires = jiffies+1; ax->mii_timer.expires = jiffies + 1;
ax->mii_timer.data = (unsigned long) dev; ax->mii_timer.data = (unsigned long) dev;
ax->mii_timer.function = ax_mii_expiry; ax->mii_timer.function = ax_mii_expiry;
...@@ -513,7 +518,7 @@ static int ax_close(struct net_device *dev) ...@@ -513,7 +518,7 @@ static int ax_close(struct net_device *dev)
/* turn the phy off */ /* turn the phy off */
ei_outb(ax->plat->gpoc_val | (1<<6), ei_outb(ax->plat->gpoc_val | (1 << 6),
ei_local->mem + EI_SHIFT(0x17)); ei_local->mem + EI_SHIFT(0x17));
ax->running = 0; ax->running = 0;
...@@ -654,22 +659,22 @@ static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local) ...@@ -654,22 +659,22 @@ static void ax_initial_setup(struct net_device *dev, struct ei_device *ei_local)
void __iomem *ioaddr = ei_local->mem; void __iomem *ioaddr = ei_local->mem;
struct ax_device *ax = to_ax_dev(dev); struct ax_device *ax = to_ax_dev(dev);
/* Select page 0*/ /* Select page 0 */
ei_outb(E8390_NODMA+E8390_PAGE0+E8390_STOP, ioaddr + E8390_CMD); ei_outb(E8390_NODMA + E8390_PAGE0 + E8390_STOP, ioaddr + E8390_CMD);
/* set to byte access */ /* set to byte access */
ei_outb(ax->plat->dcr_val & ~1, ioaddr + EN0_DCFG); ei_outb(ax->plat->dcr_val & ~1, ioaddr + EN0_DCFG);
ei_outb(ax->plat->gpoc_val, ioaddr + EI_SHIFT(0x17)); 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 * initialise the specified device, taking care to note the MAC
* address it may already have (if configured), ensure * address it may already have (if configured), ensure
* the device is ready to be used by lib8390.c and registerd with * the device is ready to be used by lib8390.c and registerd with
* the network layer. * the network layer.
*/ */
static int ax_init_dev(struct net_device *dev, int first_init) static int ax_init_dev(struct net_device *dev, int first_init)
{ {
struct ei_device *ei_local = netdev_priv(dev); struct ei_device *ei_local = netdev_priv(dev);
...@@ -693,9 +698,9 @@ static int ax_init_dev(struct net_device *dev, int first_init) ...@@ -693,9 +698,9 @@ static int ax_init_dev(struct net_device *dev, int first_init)
if (first_init && ax->plat->flags & AXFLG_HAS_EEPROM) { if (first_init && ax->plat->flags & AXFLG_HAS_EEPROM) {
unsigned char SA_prom[32]; unsigned char SA_prom[32];
for(i = 0; i < sizeof(SA_prom); i+=2) { for (i = 0; i < sizeof(SA_prom); i += 2) {
SA_prom[i] = ei_inb(ioaddr + NE_DATAPORT); SA_prom[i] = ei_inb(ioaddr + NE_DATAPORT);
SA_prom[i+1] = ei_inb(ioaddr + NE_DATAPORT); SA_prom[i + 1] = ei_inb(ioaddr + NE_DATAPORT);
} }
if (ax->plat->wordlength == 2) if (ax->plat->wordlength == 2)
...@@ -732,9 +737,10 @@ static int ax_init_dev(struct net_device *dev, int first_init) ...@@ -732,9 +737,10 @@ static int ax_init_dev(struct net_device *dev, int first_init)
stop_page = NE1SM_STOP_PG; 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 (first_init) {
if (ax->plat->flags & AXFLG_MAC_FROMDEV) { if (ax->plat->flags & AXFLG_MAC_FROMDEV) {
ei_outb(E8390_NODMA + E8390_PAGE1 + E8390_STOP, ei_outb(E8390_NODMA + E8390_PAGE1 + E8390_STOP,
...@@ -786,7 +792,7 @@ static int ax_init_dev(struct net_device *dev, int first_init) ...@@ -786,7 +792,7 @@ static int ax_init_dev(struct net_device *dev, int first_init)
if (first_init) if (first_init)
dev_info(&ax->dev->dev, "%dbit, irq %d, %lx, MAC: %pM\n", dev_info(&ax->dev->dev, "%dbit, irq %d, %lx, MAC: %pM\n",
ei_status.word16 ? 16:8, dev->irq, dev->base_addr, ei_status.word16 ? 16 : 8, dev->irq, dev->base_addr,
dev->dev_addr); dev->dev_addr);
ret = register_netdev(dev); ret = register_netdev(dev);
...@@ -827,13 +833,13 @@ static int ax_remove(struct platform_device *_dev) ...@@ -827,13 +833,13 @@ static int ax_remove(struct platform_device *_dev)
return 0; return 0;
} }
/* ax_probe /*
* ax_probe
* *
* This is the entry point when the platform device system uses to * This is the entry point when the platform device system uses to
* notify us of a new device to attach to. Allocate memory, find * notify us of a new device to attach to. Allocate memory, find the
* the resources and information passed, and map the necessary registers. * resources and information passed, and map the necessary registers.
*/ */
static int ax_probe(struct platform_device *pdev) static int ax_probe(struct platform_device *pdev)
{ {
struct net_device *dev; struct net_device *dev;
...@@ -860,7 +866,6 @@ static int ax_probe(struct platform_device *pdev) ...@@ -860,7 +866,6 @@ static int ax_probe(struct platform_device *pdev)
ei_status.rxcr_base = ax->plat->rcr_val; ei_status.rxcr_base = ax->plat->rcr_val;
/* find the platform resources */ /* find the platform resources */
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res == NULL) { if (res == NULL) {
dev_err(&pdev->dev, "no IRQ specified\n"); dev_err(&pdev->dev, "no IRQ specified\n");
...@@ -880,9 +885,10 @@ static int ax_probe(struct platform_device *pdev) ...@@ -880,9 +885,10 @@ static int ax_probe(struct platform_device *pdev)
size = (res->end - res->start) + 1; 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) if (ax->plat->reg_offsets)
ei_status.reg_offset = ax->plat->reg_offsets; ei_status.reg_offset = ax->plat->reg_offsets;
else { else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment