aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/hfc_pci.c
diff options
context:
space:
mode:
authorKarsten Keil <keil@b1-systems.de>2009-06-02 08:57:35 -0400
committerKarsten Keil <keil@b1-systems.de>2009-06-11 13:04:48 -0400
commit8a745b9d91962991ce87a649a4dc3af3206c2c8b (patch)
tree9fc186dafbf64ce81cbb9be2f5a7379f0f1225f6 /drivers/isdn/hisax/hfc_pci.c
parentbb400801c2f40bbd9a688818323ad09abfc4e581 (diff)
ISDN:Fix DMA alloc for hfcpci
Replace wrong code with correct DMA API functions. Signed-off-by: Karsten Keil <keil@b1-systems.de>
Diffstat (limited to 'drivers/isdn/hisax/hfc_pci.c')
-rw-r--r--drivers/isdn/hisax/hfc_pci.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
index f1265667b062..3d337d924c23 100644
--- a/drivers/isdn/hisax/hfc_pci.c
+++ b/drivers/isdn/hisax/hfc_pci.c
@@ -82,8 +82,9 @@ release_io_hfcpci(struct IsdnCardState *cs)
82 Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2); 82 Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2);
83 pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */ 83 pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */
84 del_timer(&cs->hw.hfcpci.timer); 84 del_timer(&cs->hw.hfcpci.timer);
85 kfree(cs->hw.hfcpci.share_start); 85 pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
86 cs->hw.hfcpci.share_start = NULL; 86 cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
87 cs->hw.hfcpci.fifos = NULL;
87 iounmap((void *)cs->hw.hfcpci.pci_io); 88 iounmap((void *)cs->hw.hfcpci.pci_io);
88} 89}
89 90
@@ -1663,8 +1664,19 @@ setup_hfcpci(struct IsdnCard *card)
1663 dev_hfcpci); 1664 dev_hfcpci);
1664 i++; 1665 i++;
1665 if (tmp_hfcpci) { 1666 if (tmp_hfcpci) {
1667 dma_addr_t dma_mask = DMA_BIT_MASK(32) & ~0x7fffUL;
1666 if (pci_enable_device(tmp_hfcpci)) 1668 if (pci_enable_device(tmp_hfcpci))
1667 continue; 1669 continue;
1670 if (pci_set_dma_mask(tmp_hfcpci, dma_mask)) {
1671 printk(KERN_WARNING
1672 "HiSax hfc_pci: No suitable DMA available.\n");
1673 continue;
1674 }
1675 if (pci_set_consistent_dma_mask(tmp_hfcpci, dma_mask)) {
1676 printk(KERN_WARNING
1677 "HiSax hfc_pci: No suitable consistent DMA available.\n");
1678 continue;
1679 }
1668 pci_set_master(tmp_hfcpci); 1680 pci_set_master(tmp_hfcpci);
1669 if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK))) 1681 if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
1670 continue; 1682 continue;
@@ -1693,22 +1705,29 @@ setup_hfcpci(struct IsdnCard *card)
1693 printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n"); 1705 printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
1694 return (0); 1706 return (0);
1695 } 1707 }
1708
1696 /* Allocate memory for FIFOS */ 1709 /* Allocate memory for FIFOS */
1697 /* Because the HFC-PCI needs a 32K physical alignment, we */ 1710 cs->hw.hfcpci.fifos = pci_alloc_consistent(cs->hw.hfcpci.dev,
1698 /* need to allocate the double mem and align the address */ 1711 0x8000, &cs->hw.hfcpci.dma);
1699 if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) { 1712 if (!cs->hw.hfcpci.fifos) {
1700 printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n"); 1713 printk(KERN_WARNING "HFC-PCI: Error allocating FIFO memory!\n");
1714 return 0;
1715 }
1716 if (cs->hw.hfcpci.dma & 0x7fff) {
1717 printk(KERN_WARNING
1718 "HFC-PCI: Error DMA memory not on 32K boundary (%lx)\n",
1719 (u_long)cs->hw.hfcpci.dma);
1720 pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
1721 cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
1701 return 0; 1722 return 0;
1702 } 1723 }
1703 cs->hw.hfcpci.fifos = (void *) 1724 pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u32)cs->hw.hfcpci.dma);
1704 (((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000;
1705 pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u_int) virt_to_bus(cs->hw.hfcpci.fifos));
1706 cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256); 1725 cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256);
1707 printk(KERN_INFO 1726 printk(KERN_INFO
1708 "HFC-PCI: defined at mem %p fifo %p(%#x) IRQ %d HZ %d\n", 1727 "HFC-PCI: defined at mem %p fifo %p(%lx) IRQ %d HZ %d\n",
1709 cs->hw.hfcpci.pci_io, 1728 cs->hw.hfcpci.pci_io,
1710 cs->hw.hfcpci.fifos, 1729 cs->hw.hfcpci.fifos,
1711 (u_int) virt_to_bus(cs->hw.hfcpci.fifos), 1730 (u_long)cs->hw.hfcpci.dma,
1712 cs->irq, HZ); 1731 cs->irq, HZ);
1713 1732
1714 spin_lock_irqsave(&cs->lock, flags); 1733 spin_lock_irqsave(&cs->lock, flags);