Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186792
b: refs/heads/master
c: 21e0cf6
h: refs/heads/master
v: v3
  • Loading branch information
Martyn Welch authored and Greg Kroah-Hartman committed Mar 4, 2010
1 parent 32e41e7 commit f64ec7f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4860ab74d4d577d21fbfe0da3bd0925f3efc8907
refs/heads/master: 21e0cf6d2e59e19f77096e73d83157734e7f7782
25 changes: 15 additions & 10 deletions trunk/drivers/staging/vme/bridges/vme_ca91cx42.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));

Expand Down

0 comments on commit f64ec7f

Please sign in to comment.