Commit 7aa3b084 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/jgarzik/pci-2.5

into home.osdl.org:/home/torvalds/v2.5/linux
parents 2bd49a75 12354010
...@@ -1809,10 +1809,6 @@ static int __devinit eni_start(struct atm_dev *dev) ...@@ -1809,10 +1809,6 @@ static int __devinit eni_start(struct atm_dev *dev)
"master (0x%02x)\n",dev->number,error); "master (0x%02x)\n",dev->number,error);
return error; return error;
} }
#ifdef __sparc_v9__ /* copied from drivers/net/sunhme.c */
/* NOTE: Cache line size is in 32-bit word units. */
pci_write_config_byte(eni_dev->pci_dev, PCI_CACHE_LINE_SIZE, 0x10);
#endif
if ((error = pci_write_config_byte(eni_dev->pci_dev,PCI_TONGA_CTRL, if ((error = pci_write_config_byte(eni_dev->pci_dev,PCI_TONGA_CTRL,
END_SWAP_DMA))) { END_SWAP_DMA))) {
printk(KERN_ERR DEV_LABEL "(itf %d): can't set endian swap " printk(KERN_ERR DEV_LABEL "(itf %d): can't set endian swap "
......
...@@ -628,10 +628,7 @@ static unsigned int __init init_chipset_cmd64x (struct pci_dev *dev, const char ...@@ -628,10 +628,7 @@ static unsigned int __init init_chipset_cmd64x (struct pci_dev *dev, const char
/* Set a good latency timer and cache line size value. */ /* Set a good latency timer and cache line size value. */
(void) pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); (void) pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
#ifdef __sparc_v9__ /* FIXME: pci_set_master() to ensure a good latency timer value */
(void) pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 0x10);
#endif
/* Setup interrupts. */ /* Setup interrupts. */
(void) pci_read_config_byte(dev, MRDMODE, &mrdmode); (void) pci_read_config_byte(dev, MRDMODE, &mrdmode);
......
...@@ -147,9 +147,7 @@ static void __init init_hwif_ns87415 (ide_hwif_t *hwif) ...@@ -147,9 +147,7 @@ static void __init init_hwif_ns87415 (ide_hwif_t *hwif)
/* Set a good latency timer and cache line size value. */ /* Set a good latency timer and cache line size value. */
(void) pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64); (void) pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
#ifdef __sparc_v9__ /* FIXME: use pci_set_master() to ensure good latency timer value */
(void) pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 0x10);
#endif
/* /*
* We cannot probe for IRQ: both ports share common IRQ on INTA. * We cannot probe for IRQ: both ports share common IRQ on INTA.
......
...@@ -2158,6 +2158,7 @@ static int find_planb(void) ...@@ -2158,6 +2158,7 @@ static int find_planb(void)
unsigned int old_base, new_base; unsigned int old_base, new_base;
unsigned int irq; unsigned int irq;
struct pci_dev *pdev; struct pci_dev *pdev;
int rc;
if (_machine != _MACH_Pmac) if (_machine != _MACH_Pmac)
return 0; return 0;
...@@ -2211,18 +2212,25 @@ static int find_planb(void) ...@@ -2211,18 +2212,25 @@ static int find_planb(void)
pdev = pci_find_slot (bus, dev_fn); pdev = pci_find_slot (bus, dev_fn);
if (!pdev) { if (!pdev) {
printk(KERN_ERR "cannot find slot\n"); printk(KERN_ERR "planb: cannot find slot\n");
/* XXX handle error */ goto err_out;
} }
/* Enable response in memory space, bus mastering, /* Enable response in memory space, bus mastering,
use memory write and invalidate */ use memory write and invalidate */
pci_write_config_word (pdev, PCI_COMMAND, rc = pci_enable_device(pdev);
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | if (rc) {
PCI_COMMAND_INVALIDATE); printk(KERN_ERR "planb: cannot enable PCI device %s\n",
/* Set PCI Cache line size & latency timer */ pci_name(pdev));
pci_write_config_byte (pdev, PCI_CACHE_LINE_SIZE, 0x8); goto err_out;
pci_write_config_byte (pdev, PCI_LATENCY_TIMER, 0x40); }
rc = pci_set_mwi(pdev);
if (rc) {
printk(KERN_ERR "planb: cannot enable MWI on PCI device %s\n",
pci_name(pdev));
goto err_out_disable;
}
pci_set_master(pdev);
/* Set the new base address */ /* Set the new base address */
pci_write_config_dword (pdev, confreg, new_base); pci_write_config_dword (pdev, confreg, new_base);
...@@ -2234,6 +2242,12 @@ static int find_planb(void) ...@@ -2234,6 +2242,12 @@ static int find_planb(void)
pb->irq = irq; pb->irq = irq;
return planb_num; return planb_num;
err_out_disable:
pci_disable_device(pdev);
err_out:
/* FIXME handle error */ /* comment moved from pci_find_slot, above */
return 0;
} }
static void release_planb(void) static void release_planb(void)
......
...@@ -228,7 +228,6 @@ static int __devinit streamer_init_one(struct pci_dev *pdev, ...@@ -228,7 +228,6 @@ static int __devinit streamer_init_one(struct pci_dev *pdev,
int rc = 0; int rc = 0;
static int card_no=-1; static int card_no=-1;
u16 pcr; u16 pcr;
u8 cls = 0;
#if STREAMER_DEBUG #if STREAMER_DEBUG
printk("lanstreamer::streamer_init_one, entry pdev %p\n",pdev); printk("lanstreamer::streamer_init_one, entry pdev %p\n",pdev);
...@@ -254,14 +253,16 @@ static int __devinit streamer_init_one(struct pci_dev *pdev, ...@@ -254,14 +253,16 @@ static int __devinit streamer_init_one(struct pci_dev *pdev,
#endif #endif
#endif #endif
if (pci_set_dma_mask(pdev, 0xFFFFFFFF)) { rc = pci_set_dma_mask(pdev, 0xFFFFFFFFULL);
if (rc) {
printk(KERN_ERR "%s: No suitable PCI mapping available.\n", printk(KERN_ERR "%s: No suitable PCI mapping available.\n",
dev->name); dev->name);
rc = -ENODEV; rc = -ENODEV;
goto err_out; goto err_out;
} }
if (pci_enable_device(pdev)) { rc = pci_enable_device(pdev);
if (rc) {
printk(KERN_ERR "lanstreamer: unable to enable pci device\n"); printk(KERN_ERR "lanstreamer: unable to enable pci device\n");
rc=-EIO; rc=-EIO;
goto err_out; goto err_out;
...@@ -269,6 +270,12 @@ static int __devinit streamer_init_one(struct pci_dev *pdev, ...@@ -269,6 +270,12 @@ static int __devinit streamer_init_one(struct pci_dev *pdev,
pci_set_master(pdev); pci_set_master(pdev);
rc = pci_set_mwi(pdev);
if (rc) {
printk(KERN_ERR "lanstreamer: unable to enable MWI on pci device\n");
goto err_out_disable;
}
pio_start = pci_resource_start(pdev, 0); pio_start = pci_resource_start(pdev, 0);
pio_end = pci_resource_end(pdev, 0); pio_end = pci_resource_end(pdev, 0);
pio_flags = pci_resource_flags(pdev, 0); pio_flags = pci_resource_flags(pdev, 0);
...@@ -290,7 +297,7 @@ static int __devinit streamer_init_one(struct pci_dev *pdev, ...@@ -290,7 +297,7 @@ static int __devinit streamer_init_one(struct pci_dev *pdev,
printk(KERN_ERR "lanstreamer: unable to get pci io addr %lx\n", printk(KERN_ERR "lanstreamer: unable to get pci io addr %lx\n",
pio_start); pio_start);
rc= -EBUSY; rc= -EBUSY;
goto err_out; goto err_out_mwi;
} }
if (!request_mem_region(mmio_start, mmio_len, "lanstreamer")) { if (!request_mem_region(mmio_start, mmio_len, "lanstreamer")) {
...@@ -341,26 +348,9 @@ static int __devinit streamer_init_one(struct pci_dev *pdev, ...@@ -341,26 +348,9 @@ static int __devinit streamer_init_one(struct pci_dev *pdev,
spin_lock_init(&streamer_priv->streamer_lock); spin_lock_init(&streamer_priv->streamer_lock);
pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cls);
cls <<= 2;
if (cls != SMP_CACHE_BYTES) {
printk(KERN_INFO " PCI cache line size set incorrectly "
"(%i bytes) by BIOS/FW, ", cls);
if (cls > SMP_CACHE_BYTES)
printk("expecting %i\n", SMP_CACHE_BYTES);
else {
printk("correcting to %i\n", SMP_CACHE_BYTES);
pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE,
SMP_CACHE_BYTES >> 2);
}
}
pci_read_config_word (pdev, PCI_COMMAND, &pcr); pci_read_config_word (pdev, PCI_COMMAND, &pcr);
pcr |= PCI_COMMAND_SERR;
pcr |= (PCI_COMMAND_INVALIDATE | PCI_COMMAND_SERR);
pci_write_config_word (pdev, PCI_COMMAND, pcr); pci_write_config_word (pdev, PCI_COMMAND, pcr);
pci_read_config_word (pdev, PCI_COMMAND, &pcr);
printk("%s \n", version); printk("%s \n", version);
printk("%s: %s. I/O at %hx, MMIO at %p, using irq %d\n",dev->name, printk("%s: %s. I/O at %hx, MMIO at %p, using irq %d\n",dev->name,
...@@ -383,8 +373,12 @@ static int __devinit streamer_init_one(struct pci_dev *pdev, ...@@ -383,8 +373,12 @@ static int __devinit streamer_init_one(struct pci_dev *pdev,
release_mem_region(mmio_start, mmio_len); release_mem_region(mmio_start, mmio_len);
err_out_free_pio: err_out_free_pio:
release_region(pio_start, pio_len); release_region(pio_start, pio_len);
err_out_mwi:
pci_clear_mwi(pdev);
err_out_disable:
pci_disable_device(pdev);
err_out: err_out:
kfree(dev); free_netdev(dev);
#if STREAMER_DEBUG #if STREAMER_DEBUG
printk("lanstreamer: Exit error %x\n",rc); printk("lanstreamer: Exit error %x\n",rc);
#endif #endif
...@@ -430,9 +424,11 @@ static void __devexit streamer_remove_one(struct pci_dev *pdev) ...@@ -430,9 +424,11 @@ static void __devexit streamer_remove_one(struct pci_dev *pdev)
#endif #endif
unregister_netdev(dev); unregister_netdev(dev);
/* shouldn't we do iounmap here? */ iounmap(streamer_priv->streamer_mmio);
release_region(pci_resource_start(pdev, 0), pci_resource_len(pdev,0));
release_mem_region(pci_resource_start(pdev, 1), pci_resource_len(pdev,1)); release_mem_region(pci_resource_start(pdev, 1), pci_resource_len(pdev,1));
release_region(pci_resource_start(pdev, 0), pci_resource_len(pdev,0));
pci_clear_mwi(pdev);
pci_disable_device(pdev);
free_netdev(dev); free_netdev(dev);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
} }
......
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