Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90850
b: refs/heads/master
c: 22adf7e
h: refs/heads/master
v: v3
  • Loading branch information
Atsushi Nemoto authored and Jeff Garzik committed Apr 17, 2008
1 parent 2203b40 commit 4872148
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 84 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ee79b7fbf0dbb9e6392d0aee73bf722b29e43c40
refs/heads/master: 22adf7e536df12b1793448972c908cb21ea5a17a
121 changes: 38 additions & 83 deletions trunk/drivers/net/tc35815.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,37 +94,37 @@ static struct tc35815_options {
* Registers
*/
struct tc35815_regs {
volatile __u32 DMA_Ctl; /* 0x00 */
volatile __u32 TxFrmPtr;
volatile __u32 TxThrsh;
volatile __u32 TxPollCtr;
volatile __u32 BLFrmPtr;
volatile __u32 RxFragSize;
volatile __u32 Int_En;
volatile __u32 FDA_Bas;
volatile __u32 FDA_Lim; /* 0x20 */
volatile __u32 Int_Src;
volatile __u32 unused0[2];
volatile __u32 PauseCnt;
volatile __u32 RemPauCnt;
volatile __u32 TxCtlFrmStat;
volatile __u32 unused1;
volatile __u32 MAC_Ctl; /* 0x40 */
volatile __u32 CAM_Ctl;
volatile __u32 Tx_Ctl;
volatile __u32 Tx_Stat;
volatile __u32 Rx_Ctl;
volatile __u32 Rx_Stat;
volatile __u32 MD_Data;
volatile __u32 MD_CA;
volatile __u32 CAM_Adr; /* 0x60 */
volatile __u32 CAM_Data;
volatile __u32 CAM_Ena;
volatile __u32 PROM_Ctl;
volatile __u32 PROM_Data;
volatile __u32 Algn_Cnt;
volatile __u32 CRC_Cnt;
volatile __u32 Miss_Cnt;
__u32 DMA_Ctl; /* 0x00 */
__u32 TxFrmPtr;
__u32 TxThrsh;
__u32 TxPollCtr;
__u32 BLFrmPtr;
__u32 RxFragSize;
__u32 Int_En;
__u32 FDA_Bas;
__u32 FDA_Lim; /* 0x20 */
__u32 Int_Src;
__u32 unused0[2];
__u32 PauseCnt;
__u32 RemPauCnt;
__u32 TxCtlFrmStat;
__u32 unused1;
__u32 MAC_Ctl; /* 0x40 */
__u32 CAM_Ctl;
__u32 Tx_Ctl;
__u32 Tx_Stat;
__u32 Rx_Ctl;
__u32 Rx_Stat;
__u32 MD_Data;
__u32 MD_CA;
__u32 CAM_Adr; /* 0x60 */
__u32 CAM_Data;
__u32 CAM_Ena;
__u32 PROM_Ctl;
__u32 PROM_Data;
__u32 Algn_Cnt;
__u32 CRC_Cnt;
__u32 Miss_Cnt;
};

/*
Expand Down Expand Up @@ -396,8 +396,8 @@ struct FrFD {
};


#define tc_readl(addr) readl(addr)
#define tc_writel(d, addr) writel(d, addr)
#define tc_readl(addr) ioread32(addr)
#define tc_writel(d, addr) iowrite32(d, addr)

#define TC35815_TX_TIMEOUT msecs_to_jiffies(400)

Expand Down Expand Up @@ -663,7 +663,6 @@ static int __devinit tc35815_init_one (struct pci_dev *pdev,
struct net_device *dev;
struct tc35815_local *lp;
int rc;
unsigned long mmio_start, mmio_end, mmio_flags, mmio_len;
DECLARE_MAC_BUF(mac);

static int printed_version;
Expand All @@ -690,45 +689,14 @@ static int __devinit tc35815_init_one (struct pci_dev *pdev,
lp->dev = dev;

/* enable device (incl. PCI PM wakeup), and bus-mastering */
rc = pci_enable_device (pdev);
rc = pcim_enable_device(pdev);
if (rc)
goto err_out;

mmio_start = pci_resource_start (pdev, 1);
mmio_end = pci_resource_end (pdev, 1);
mmio_flags = pci_resource_flags (pdev, 1);
mmio_len = pci_resource_len (pdev, 1);

/* set this immediately, we need to know before
* we talk to the chip directly */

/* make sure PCI base addr 1 is MMIO */
if (!(mmio_flags & IORESOURCE_MEM)) {
dev_err(&pdev->dev, "region #1 not an MMIO resource, aborting\n");
rc = -ENODEV;
goto err_out;
}

/* check for weird/broken PCI region reporting */
if ((mmio_len < sizeof(struct tc35815_regs))) {
dev_err(&pdev->dev, "Invalid PCI region size(s), aborting\n");
rc = -ENODEV;
goto err_out;
}

rc = pci_request_regions (pdev, MODNAME);
rc = pcim_iomap_regions(pdev, 1 << 1, MODNAME);
if (rc)
goto err_out;

pci_set_master (pdev);

/* ioremap MMIO region */
ioaddr = ioremap (mmio_start, mmio_len);
if (ioaddr == NULL) {
dev_err(&pdev->dev, "cannot remap MMIO, aborting\n");
rc = -EIO;
goto err_out_free_res;
}
pci_set_master(pdev);
ioaddr = pcim_iomap_table(pdev)[1];

/* Initialize the device structure. */
dev->open = tc35815_open;
Expand Down Expand Up @@ -768,7 +736,7 @@ static int __devinit tc35815_init_one (struct pci_dev *pdev,

rc = register_netdev (dev);
if (rc)
goto err_out_unmap;
goto err_out;

memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
printk(KERN_INFO "%s: %s at 0x%lx, %s, IRQ %d\n",
Expand All @@ -791,10 +759,6 @@ static int __devinit tc35815_init_one (struct pci_dev *pdev,

return 0;

err_out_unmap:
iounmap(ioaddr);
err_out_free_res:
pci_release_regions (pdev);
err_out:
free_netdev (dev);
return rc;
Expand All @@ -804,17 +768,8 @@ static int __devinit tc35815_init_one (struct pci_dev *pdev,
static void __devexit tc35815_remove_one (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata (pdev);
unsigned long mmio_addr;

mmio_addr = dev->base_addr;

unregister_netdev (dev);

if (mmio_addr) {
iounmap ((void __iomem *)mmio_addr);
pci_release_regions (pdev);
}

free_netdev (dev);

pci_set_drvdata (pdev, NULL);
Expand Down

0 comments on commit 4872148

Please sign in to comment.