From d378a469140854edbea81bc744b6041ddcf0074a Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Fri, 21 May 2010 14:58:06 +0000 Subject: Merged revisions 8176,8560 via svnmerge from https://origsvn.digium.com/svn/dahdi/linux/trunk NOTE: These changes were already added to the 2.2.1.2 tag in r8666. I should have merged these two changes into the 2.2 branch first, and then cherry-picked them for the 2.2.1.2 release. ........ r8176 | sruffell | 2010-03-01 02:14:17 -0600 (Mon, 01 Mar 2010) | 4 lines wcte12xp, wctdm24xxp: Use memory mapped IO instead of port IO. Some systems do not like the port I/O and this change allows it to work. DAHDI-515. ........ r8560 | sruffell | 2010-04-22 16:36:16 -0500 (Thu, 22 Apr 2010) | 11 lines wcte12xp, wctdm24xxp: Ensure writes to I/O registers are flushed. In revision 8176 I changed register access from I/O space to memory mapped registers. Unfortunately, when I made that change, I didn't account for posted writes. This change makes sure all the registers are read back to ensure that they are posted through any intermediate bridges. The most readily observable symptom were cards that were taking 2000 interrupts/second. The card reported that it handled an interrupt but the write to silence the card wasn't flushed through until the second time the interrupt handler run. DAHDI-602. ........ git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/branches/2.2@8672 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/voicebus/voicebus.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/dahdi/voicebus/voicebus.c b/drivers/dahdi/voicebus/voicebus.c index dfe59be..2395cfa 100644 --- a/drivers/dahdi/voicebus/voicebus.c +++ b/drivers/dahdi/voicebus/voicebus.c @@ -169,8 +169,8 @@ struct voicebus { #else struct kmem_cache *buffer_cache; #endif - /*! Base address of the VoiceBus interface registers in I/O space. */ - u32 iobase; + /*! Base address of the VoiceBus interface registers in memory space. */ + void __iomem *iobase; /*! The IRQ line for this VoiceBus interface. */ unsigned int irq; #if VOICEBUS_DEFERRED == WORKQUEUE @@ -482,7 +482,7 @@ EXPORT_SYMBOL(voicebus_is_latency_locked); static inline u32 __vb_getctl(struct voicebus *vb, u32 addr) { - return le32_to_cpu(inl(vb->iobase + addr)); + return readl(vb->iobase + addr); } /*! @@ -599,7 +599,8 @@ static inline void __vb_setctl(struct voicebus *vb, u32 addr, u32 val) { wmb(); - outl(cpu_to_le32(val), vb->iobase + addr); + writel(val, vb->iobase + addr); + readl(vb->iobase + addr); } /*! @@ -1233,7 +1234,9 @@ voicebus_release(struct voicebus *vb) vb->idle_vbb, vb->idle_vbb_dma_addr); } kmem_cache_destroy(vb->buffer_cache); - release_region(vb->iobase, 0xff); + release_mem_region(pci_resource_start(vb->pdev, 1), + pci_resource_len(vb->pdev, 1)); + pci_iounmap(vb->pdev, vb->iobase); pci_disable_device(vb->pdev); kfree(vb); } @@ -1790,8 +1793,9 @@ voicebus_init(struct pci_dev *pdev, u32 framesize, const char *board_name, retval = -EIO; goto cleanup; } - vb->iobase = pci_resource_start(pdev, 0); - if (NULL == request_region(vb->iobase, 0xff, board_name)) { + vb->iobase = pci_iomap(vb->pdev, 1, 0); + if (!request_mem_region(pci_resource_start(vb->pdev, 1), + pci_resource_len(vb->pdev, 1), board_name)) { dev_err(&vb->pdev->dev, "IO Registers are in use by another " "module.\n"); retval = -EIO; @@ -1805,7 +1809,8 @@ voicebus_init(struct pci_dev *pdev, u32 framesize, const char *board_name, Configure the hardware interface. ---------------------------------------------------------------- */ if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { - release_region(vb->iobase, 0xff); + release_mem_region(pci_resource_start(vb->pdev, 1), + pci_resource_len(vb->pdev, 1)); dev_warn(&vb->pdev->dev, "No suitable DMA available.\n"); goto cleanup; } @@ -1865,7 +1870,7 @@ cleanup: kmem_cache_destroy(vb->buffer_cache); if (vb->iobase) - release_region(vb->iobase, 0xff); + pci_iounmap(vb->pdev, vb->iobase); if (vb->pdev) pci_disable_device(vb->pdev); -- cgit v1.2.3