ISDN:Fix DMA alloc for hfcpci
Replace wrong code with correct DMA API functions. Signed-off-by: Karsten Keil <keil@b1-systems.de>
This commit is contained in:
parent
bb400801c2
commit
8a745b9d91
|
@ -82,8 +82,9 @@ release_io_hfcpci(struct IsdnCardState *cs)
|
||||||
Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2);
|
Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2);
|
||||||
pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */
|
pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */
|
||||||
del_timer(&cs->hw.hfcpci.timer);
|
del_timer(&cs->hw.hfcpci.timer);
|
||||||
kfree(cs->hw.hfcpci.share_start);
|
pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
|
||||||
cs->hw.hfcpci.share_start = NULL;
|
cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
|
||||||
|
cs->hw.hfcpci.fifos = NULL;
|
||||||
iounmap((void *)cs->hw.hfcpci.pci_io);
|
iounmap((void *)cs->hw.hfcpci.pci_io);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1663,8 +1664,19 @@ setup_hfcpci(struct IsdnCard *card)
|
||||||
dev_hfcpci);
|
dev_hfcpci);
|
||||||
i++;
|
i++;
|
||||||
if (tmp_hfcpci) {
|
if (tmp_hfcpci) {
|
||||||
|
dma_addr_t dma_mask = DMA_BIT_MASK(32) & ~0x7fffUL;
|
||||||
if (pci_enable_device(tmp_hfcpci))
|
if (pci_enable_device(tmp_hfcpci))
|
||||||
continue;
|
continue;
|
||||||
|
if (pci_set_dma_mask(tmp_hfcpci, dma_mask)) {
|
||||||
|
printk(KERN_WARNING
|
||||||
|
"HiSax hfc_pci: No suitable DMA available.\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (pci_set_consistent_dma_mask(tmp_hfcpci, dma_mask)) {
|
||||||
|
printk(KERN_WARNING
|
||||||
|
"HiSax hfc_pci: No suitable consistent DMA available.\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
pci_set_master(tmp_hfcpci);
|
pci_set_master(tmp_hfcpci);
|
||||||
if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
|
if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1693,22 +1705,29 @@ setup_hfcpci(struct IsdnCard *card)
|
||||||
printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
|
printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for FIFOS */
|
/* Allocate memory for FIFOS */
|
||||||
/* Because the HFC-PCI needs a 32K physical alignment, we */
|
cs->hw.hfcpci.fifos = pci_alloc_consistent(cs->hw.hfcpci.dev,
|
||||||
/* need to allocate the double mem and align the address */
|
0x8000, &cs->hw.hfcpci.dma);
|
||||||
if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) {
|
if (!cs->hw.hfcpci.fifos) {
|
||||||
printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
|
printk(KERN_WARNING "HFC-PCI: Error allocating FIFO memory!\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cs->hw.hfcpci.fifos = (void *)
|
if (cs->hw.hfcpci.dma & 0x7fff) {
|
||||||
(((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000;
|
printk(KERN_WARNING
|
||||||
pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u_int) virt_to_bus(cs->hw.hfcpci.fifos));
|
"HFC-PCI: Error DMA memory not on 32K boundary (%lx)\n",
|
||||||
|
(u_long)cs->hw.hfcpci.dma);
|
||||||
|
pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
|
||||||
|
cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u32)cs->hw.hfcpci.dma);
|
||||||
cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256);
|
cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256);
|
||||||
printk(KERN_INFO
|
printk(KERN_INFO
|
||||||
"HFC-PCI: defined at mem %p fifo %p(%#x) IRQ %d HZ %d\n",
|
"HFC-PCI: defined at mem %p fifo %p(%lx) IRQ %d HZ %d\n",
|
||||||
cs->hw.hfcpci.pci_io,
|
cs->hw.hfcpci.pci_io,
|
||||||
cs->hw.hfcpci.fifos,
|
cs->hw.hfcpci.fifos,
|
||||||
(u_int) virt_to_bus(cs->hw.hfcpci.fifos),
|
(u_long)cs->hw.hfcpci.dma,
|
||||||
cs->irq, HZ);
|
cs->irq, HZ);
|
||||||
|
|
||||||
spin_lock_irqsave(&cs->lock, flags);
|
spin_lock_irqsave(&cs->lock, flags);
|
||||||
|
|
|
@ -703,7 +703,7 @@ struct hfcPCI_hw {
|
||||||
int nt_timer;
|
int nt_timer;
|
||||||
struct pci_dev *dev;
|
struct pci_dev *dev;
|
||||||
unsigned char *pci_io; /* start of PCI IO memory */
|
unsigned char *pci_io; /* start of PCI IO memory */
|
||||||
void *share_start; /* shared memory for Fifos start */
|
dma_addr_t dma; /* dma handle for Fifos */
|
||||||
void *fifos; /* FIFO memory */
|
void *fifos; /* FIFO memory */
|
||||||
int last_bfifo_cnt[2]; /* marker saving last b-fifo frame count */
|
int last_bfifo_cnt[2]; /* marker saving last b-fifo frame count */
|
||||||
struct timer_list timer;
|
struct timer_list timer;
|
||||||
|
|
Loading…
Reference in New Issue