~ubuntu-branches/ubuntu/lucid/linux-rt/lucid

« back to all changes in this revision

Viewing changes to drivers/isdn/hisax/hfc_pci.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-07-11 13:31:31 UTC
  • mfrom: (14.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090711133131-omdhleccno39rayr
Tags: 2.6.29.6-1.1
New upstream kernel and RT patchset release

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
        Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2);
83
83
        pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, 0);       /* disable memory mapped ports + busmaster */
84
84
        del_timer(&cs->hw.hfcpci.timer);
85
 
        kfree(cs->hw.hfcpci.share_start);
86
 
        cs->hw.hfcpci.share_start = NULL;
 
85
        pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
 
86
                cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
 
87
        cs->hw.hfcpci.fifos = NULL;
87
88
        iounmap((void *)cs->hw.hfcpci.pci_io);
88
89
}
89
90
 
1663
1664
                                             dev_hfcpci);
1664
1665
                i++;
1665
1666
                if (tmp_hfcpci) {
 
1667
                        dma_addr_t      dma_mask = DMA_BIT_MASK(32) & ~0x7fffUL;
1666
1668
                        if (pci_enable_device(tmp_hfcpci))
1667
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
1680
                        pci_set_master(tmp_hfcpci);
1669
1681
                        if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
1670
1682
                                continue;
1693
1705
                printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
1694
1706
                return (0);
1695
1707
        }
 
1708
 
1696
1709
        /* Allocate memory for FIFOS */
1697
 
        /* Because the HFC-PCI needs a 32K physical alignment, we */
1698
 
        /* need to allocate the double mem and align the address */
1699
 
        if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) {
1700
 
                printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
1701
 
                return 0;
1702
 
        }
1703
 
        cs->hw.hfcpci.fifos = (void *)
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));
 
1710
        cs->hw.hfcpci.fifos = pci_alloc_consistent(cs->hw.hfcpci.dev,
 
1711
                                        0x8000, &cs->hw.hfcpci.dma);
 
1712
        if (!cs->hw.hfcpci.fifos) {
 
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);
 
1722
                return 0;
 
1723
        }
 
1724
        pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u32)cs->hw.hfcpci.dma);
1706
1725
        cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256);
1707
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
1728
               cs->hw.hfcpci.pci_io,
1710
1729
               cs->hw.hfcpci.fifos,
1711
 
               (u_int) virt_to_bus(cs->hw.hfcpci.fifos),
 
1730
               (u_long)cs->hw.hfcpci.dma,
1712
1731
               cs->irq, HZ);
1713
1732
 
1714
1733
        spin_lock_irqsave(&cs->lock, flags);