diff options
author | Martyn Welch <martyn.welch@ge.com> | 2010-02-18 15:13:32 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-03 16:43:01 -0800 |
commit | 21e0cf6d2e59e19f77096e73d83157734e7f7782 (patch) | |
tree | 6274c863c787efa6f4f47e6a64374a67a3740689 /drivers/staging/vme | |
parent | 4860ab74d4d577d21fbfe0da3bd0925f3efc8907 (diff) | |
download | blackbird-op-linux-21e0cf6d2e59e19f77096e73d83157734e7f7782.tar.gz blackbird-op-linux-21e0cf6d2e59e19f77096e73d83157734e7f7782.zip |
Staging: vme: Correct ca91cx42 resource handling
The ca91cx42 driver currently incorrectly handles master windows, setting
and retrieving the sizing parameters incorrectly. Also, in the slave window
handling, it uses an incorrectly set variable.
Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/vme')
-rw-r--r-- | drivers/staging/vme/bridges/vme_ca91cx42.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c index eddf071df40f..0348cc847302 100644 --- a/drivers/staging/vme/bridges/vme_ca91cx42.c +++ b/drivers/staging/vme/bridges/vme_ca91cx42.c @@ -337,7 +337,7 @@ int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled, unsigned long long vme_base, unsigned long long size, dma_addr_t pci_base, vme_address_t aspace, vme_cycle_t cycle) { - unsigned int i, addr = 0, granularity = 0; + unsigned int i, addr = 0, granularity; unsigned int temp_ctl = 0; unsigned int vme_bound, pci_offset; struct ca91cx42_driver *bridge; @@ -376,7 +376,7 @@ int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled, * Bound address is a valid address for the window, adjust * accordingly */ - vme_bound = vme_base + size - granularity; + vme_bound = vme_base + size; pci_offset = pci_base - vme_base; /* XXX Need to check that vme_base, vme_bound and pci_offset aren't @@ -609,20 +609,27 @@ int ca91cx42_master_set(struct vme_master_resource *image, int enabled, vme_address_t aspace, vme_cycle_t cycle, vme_width_t dwidth) { int retval = 0; - unsigned int i; + unsigned int i, granularity = 0; unsigned int temp_ctl = 0; unsigned long long pci_bound, vme_offset, pci_base; struct ca91cx42_driver *bridge; bridge = image->parent->driver_priv; + i = image->number; + + if ((i == 0) || (i == 4)) + granularity = 0x1000; + else + granularity = 0x10000; + /* Verify input data */ - if (vme_base & 0xFFF) { + if (vme_base & (granularity - 1)) { printk(KERN_ERR "Invalid VME Window alignment\n"); retval = -EINVAL; goto err_window; } - if (size & 0xFFF) { + if (size & (granularity - 1)) { printk(KERN_ERR "Invalid VME Window alignment\n"); retval = -EINVAL; goto err_window; @@ -652,11 +659,9 @@ int ca91cx42_master_set(struct vme_master_resource *image, int enabled, * Bound address is a valid address for the window, adjust * according to window granularity. */ - pci_bound = pci_base + (size - 0x1000); + pci_bound = pci_base + size; vme_offset = vme_base - pci_base; - i = image->number; - /* Disable while we are mucking around */ temp_ctl = ioread32(bridge->base + CA91CX42_LSI_CTL[i]); temp_ctl &= ~CA91CX42_LSI_CTL_EN; @@ -779,7 +784,7 @@ int __ca91cx42_master_get(struct vme_master_resource *image, int *enabled, pci_bound = ioread32(bridge->base + CA91CX42_LSI_BD[i]); *vme_base = pci_base + vme_offset; - *size = (pci_bound - pci_base) + 0x1000; + *size = (unsigned long long)(pci_bound - pci_base); *enabled = 0; *aspace = 0; @@ -872,7 +877,7 @@ int ca91cx42_master_get(struct vme_master_resource *image, int *enabled, ssize_t ca91cx42_master_read(struct vme_master_resource *image, void *buf, size_t count, loff_t offset) { - int retval; + ssize_t retval; spin_lock(&(image->lock)); |