diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-21 12:48:55 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-21 12:48:55 -0700 |
commit | c8d1a126924fcbc1d61ceb830226e0c7afdcc841 (patch) | |
tree | d3f3c850481c33b7f433175e83a189f958b1b868 /drivers/staging/vme | |
parent | d7dbf4ffee1c7a17e2e5b5f01efe76fbd1671db6 (diff) | |
parent | 107c161b7ddeeb7da43509cc6b29211885ccd9af (diff) |
Merge staging-next tree into Linus's latest version
Conflicts:
drivers/staging/arlan/arlan-main.c
drivers/staging/comedi/drivers/cb_das16_cs.c
drivers/staging/cx25821/cx25821-alsa.c
drivers/staging/dt3155/dt3155_drv.c
drivers/staging/hv/hv.c
drivers/staging/netwave/netwave_cs.c
drivers/staging/wavelan/wavelan.c
drivers/staging/wavelan/wavelan_cs.c
drivers/staging/wlags49_h2/wl_cs.c
This required a bit of hand merging due to the conflicts
that happened in the later .34-rc releases, as well as
some staging driver changing coming in through other trees
(v4l and pcmcia).
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/vme')
-rw-r--r-- | drivers/staging/vme/boards/vme_vmivme7805.c | 1 | ||||
-rw-r--r-- | drivers/staging/vme/bridges/vme_ca91cx42.c | 115 | ||||
-rw-r--r-- | drivers/staging/vme/bridges/vme_tsi148.c | 396 | ||||
-rw-r--r-- | drivers/staging/vme/bridges/vme_tsi148.h | 26 | ||||
-rw-r--r-- | drivers/staging/vme/devices/vme_user.c | 18 | ||||
-rw-r--r-- | drivers/staging/vme/vme.c | 4 |
6 files changed, 295 insertions, 265 deletions
diff --git a/drivers/staging/vme/boards/vme_vmivme7805.c b/drivers/staging/vme/boards/vme_vmivme7805.c index 843c9edde555..80eaa0c4fe1c 100644 --- a/drivers/staging/vme/boards/vme_vmivme7805.c +++ b/drivers/staging/vme/boards/vme_vmivme7805.c @@ -10,7 +10,6 @@ * option) any later version. */ -#include <linux/version.h> #include <linux/module.h> #include <linux/types.h> #include <linux/errno.h> diff --git a/drivers/staging/vme/bridges/vme_ca91cx42.c b/drivers/staging/vme/bridges/vme_ca91cx42.c index b159ea58adf7..0c82eb47a28d 100644 --- a/drivers/staging/vme/bridges/vme_ca91cx42.c +++ b/drivers/staging/vme/bridges/vme_ca91cx42.c @@ -26,9 +26,9 @@ #include <linux/spinlock.h> #include <linux/sched.h> #include <linux/slab.h> -#include <asm/time.h> -#include <asm/io.h> -#include <asm/uaccess.h> +#include <linux/time.h> +#include <linux/io.h> +#include <linux/uaccess.h> #include "../vme.h" #include "../vme_bridge.h" @@ -94,31 +94,35 @@ static u32 ca91cx42_IACK_irqhandler(struct ca91cx42_driver *bridge) return CA91CX42_LINT_SW_IACK; } -static u32 ca91cx42_VERR_irqhandler(struct ca91cx42_driver *bridge) +static u32 ca91cx42_VERR_irqhandler(struct vme_bridge *ca91cx42_bridge) { int val; + struct ca91cx42_driver *bridge; + + bridge = ca91cx42_bridge->driver_priv; val = ioread32(bridge->base + DGCS); if (!(val & 0x00000800)) { - printk(KERN_ERR "ca91c042: ca91cx42_VERR_irqhandler DMA Read " - "Error DGCS=%08X\n", val); + dev_err(ca91cx42_bridge->parent, "ca91cx42_VERR_irqhandler DMA " + "Read Error DGCS=%08X\n", val); } return CA91CX42_LINT_VERR; } -static u32 ca91cx42_LERR_irqhandler(struct ca91cx42_driver *bridge) +static u32 ca91cx42_LERR_irqhandler(struct vme_bridge *ca91cx42_bridge) { int val; + struct ca91cx42_driver *bridge; - val = ioread32(bridge->base + DGCS); + bridge = ca91cx42_bridge->driver_priv; - if (!(val & 0x00000800)) { - printk(KERN_ERR "ca91c042: ca91cx42_LERR_irqhandler DMA Read " - "Error DGCS=%08X\n", val); + val = ioread32(bridge->base + DGCS); - } + if (!(val & 0x00000800)) + dev_err(ca91cx42_bridge->parent, "ca91cx42_LERR_irqhandler DMA " + "Read Error DGCS=%08X\n", val); return CA91CX42_LINT_LERR; } @@ -176,9 +180,9 @@ static irqreturn_t ca91cx42_irqhandler(int irq, void *ptr) if (stat & CA91CX42_LINT_SW_IACK) serviced |= ca91cx42_IACK_irqhandler(bridge); if (stat & CA91CX42_LINT_VERR) - serviced |= ca91cx42_VERR_irqhandler(bridge); + serviced |= ca91cx42_VERR_irqhandler(ca91cx42_bridge); if (stat & CA91CX42_LINT_LERR) - serviced |= ca91cx42_LERR_irqhandler(bridge); + serviced |= ca91cx42_LERR_irqhandler(ca91cx42_bridge); if (stat & (CA91CX42_LINT_VIRQ1 | CA91CX42_LINT_VIRQ2 | CA91CX42_LINT_VIRQ3 | CA91CX42_LINT_VIRQ4 | CA91CX42_LINT_VIRQ5 | CA91CX42_LINT_VIRQ6 | @@ -326,9 +330,12 @@ int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled, unsigned int i, addr = 0, granularity; unsigned int temp_ctl = 0; unsigned int vme_bound, pci_offset; + struct vme_bridge *ca91cx42_bridge; struct ca91cx42_driver *bridge; - bridge = image->parent->driver_priv; + ca91cx42_bridge = image->parent; + + bridge = ca91cx42_bridge->driver_priv; i = image->number; @@ -353,7 +360,7 @@ int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled, case VME_USER3: case VME_USER4: default: - printk(KERN_ERR "Invalid address space\n"); + dev_err(ca91cx42_bridge->parent, "Invalid address space\n"); return -EINVAL; break; } @@ -371,15 +378,18 @@ int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled, granularity = 0x10000; if (vme_base & (granularity - 1)) { - printk(KERN_ERR "Invalid VME base alignment\n"); + dev_err(ca91cx42_bridge->parent, "Invalid VME base " + "alignment\n"); return -EINVAL; } if (vme_bound & (granularity - 1)) { - printk(KERN_ERR "Invalid VME bound alignment\n"); + dev_err(ca91cx42_bridge->parent, "Invalid VME bound " + "alignment\n"); return -EINVAL; } if (pci_offset & (granularity - 1)) { - printk(KERN_ERR "Invalid PCI Offset alignment\n"); + dev_err(ca91cx42_bridge->parent, "Invalid PCI Offset " + "alignment\n"); return -EINVAL; } @@ -491,7 +501,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image, /* Find pci_dev container of dev */ if (ca91cx42_bridge->parent == NULL) { - printk(KERN_ERR "Dev entry NULL\n"); + dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n"); return -EINVAL; } pdev = container_of(ca91cx42_bridge->parent, struct pci_dev, dev); @@ -515,8 +525,8 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image, if (image->bus_resource.name == NULL) { image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_KERNEL); if (image->bus_resource.name == NULL) { - printk(KERN_ERR "Unable to allocate memory for resource" - " name\n"); + dev_err(ca91cx42_bridge->parent, "Unable to allocate " + "memory for resource name\n"); retval = -ENOMEM; goto err_name; } @@ -533,8 +543,8 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image, &(image->bus_resource), size, size, PCIBIOS_MIN_MEM, 0, NULL, NULL); if (retval) { - printk(KERN_ERR "Failed to allocate mem resource for " - "window %d size 0x%lx start 0x%lx\n", + dev_err(ca91cx42_bridge->parent, "Failed to allocate mem " + "resource for window %d size 0x%lx start 0x%lx\n", image->number, (unsigned long)size, (unsigned long)image->bus_resource.start); goto err_resource; @@ -543,7 +553,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image, image->kern_base = ioremap_nocache( image->bus_resource.start, size); if (image->kern_base == NULL) { - printk(KERN_ERR "Failed to remap resource\n"); + dev_err(ca91cx42_bridge->parent, "Failed to remap resource\n"); retval = -ENOMEM; goto err_remap; } @@ -582,9 +592,12 @@ int ca91cx42_master_set(struct vme_master_resource *image, int enabled, unsigned int i, granularity = 0; unsigned int temp_ctl = 0; unsigned long long pci_bound, vme_offset, pci_base; + struct vme_bridge *ca91cx42_bridge; struct ca91cx42_driver *bridge; - bridge = image->parent->driver_priv; + ca91cx42_bridge = image->parent; + + bridge = ca91cx42_bridge->driver_priv; i = image->number; @@ -595,12 +608,14 @@ int ca91cx42_master_set(struct vme_master_resource *image, int enabled, /* Verify input data */ if (vme_base & (granularity - 1)) { - printk(KERN_ERR "Invalid VME Window alignment\n"); + dev_err(ca91cx42_bridge->parent, "Invalid VME Window " + "alignment\n"); retval = -EINVAL; goto err_window; } if (size & (granularity - 1)) { - printk(KERN_ERR "Invalid VME Window alignment\n"); + dev_err(ca91cx42_bridge->parent, "Invalid VME Window " + "alignment\n"); retval = -EINVAL; goto err_window; } @@ -614,8 +629,8 @@ int ca91cx42_master_set(struct vme_master_resource *image, int enabled, retval = ca91cx42_alloc_resource(image, size); if (retval) { spin_unlock(&(image->lock)); - printk(KERN_ERR "Unable to allocate memory for resource " - "name\n"); + dev_err(ca91cx42_bridge->parent, "Unable to allocate memory " + "for resource name\n"); retval = -ENOMEM; goto err_res; } @@ -658,7 +673,7 @@ int ca91cx42_master_set(struct vme_master_resource *image, int enabled, break; default: spin_unlock(&(image->lock)); - printk(KERN_ERR "Invalid data width\n"); + dev_err(ca91cx42_bridge->parent, "Invalid data width\n"); retval = -EINVAL; goto err_dwidth; break; @@ -690,7 +705,7 @@ int ca91cx42_master_set(struct vme_master_resource *image, int enabled, case VME_USER4: default: spin_unlock(&(image->lock)); - printk(KERN_ERR "Invalid address space\n"); + dev_err(ca91cx42_bridge->parent, "Invalid address space\n"); retval = -EINVAL; goto err_aspace; break; @@ -921,12 +936,14 @@ int ca91cx42_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src, struct vme_dma_vme *vme_attr; dma_addr_t desc_ptr; int retval = 0; + struct device *dev; + + dev = list->parent->parent->parent; /* XXX descriptor must be aligned on 64-bit boundaries */ - entry = (struct ca91cx42_dma_entry *) - kmalloc(sizeof(struct ca91cx42_dma_entry), GFP_KERNEL); + entry = kmalloc(sizeof(struct ca91cx42_dma_entry), GFP_KERNEL); if (entry == NULL) { - printk(KERN_ERR "Failed to allocate memory for dma resource " + dev_err(dev, "Failed to allocate memory for dma resource " "structure\n"); retval = -ENOMEM; goto err_mem; @@ -934,7 +951,7 @@ int ca91cx42_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src, /* Test descriptor alignment */ if ((unsigned long)&(entry->descriptor) & CA91CX42_DCPP_M) { - printk("Descriptor not aligned to 16 byte boundary as " + dev_err(dev, "Descriptor not aligned to 16 byte boundary as " "required: %p\n", &(entry->descriptor)); retval = -EINVAL; goto err_align; @@ -955,7 +972,7 @@ int ca91cx42_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src, if ((vme_attr->aspace & ~(VME_A16 | VME_A24 | VME_A32 | VME_USER1 | VME_USER2)) != 0) { - printk(KERN_ERR "Unsupported cycle type\n"); + dev_err(dev, "Unsupported cycle type\n"); retval = -EINVAL; goto err_aspace; } @@ -963,7 +980,7 @@ int ca91cx42_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src, if ((vme_attr->cycle & ~(VME_SCT | VME_BLT | VME_SUPER | VME_USER | VME_PROG | VME_DATA)) != 0) { - printk(KERN_ERR "Unsupported cycle type\n"); + dev_err(dev, "Unsupported cycle type\n"); retval = -EINVAL; goto err_cycle; } @@ -972,7 +989,7 @@ int ca91cx42_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src, if (!(((src->type == VME_DMA_PCI) && (dest->type == VME_DMA_VME)) || ((src->type == VME_DMA_VME) && (dest->type == VME_DMA_PCI)))) { - printk(KERN_ERR "Cannot perform transfer with this " + dev_err(dev, "Cannot perform transfer with this " "source-destination combination\n"); retval = -EINVAL; goto err_direct; @@ -997,7 +1014,7 @@ int ca91cx42_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src, entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D64; break; default: - printk(KERN_ERR "Invalid data width\n"); + dev_err(dev, "Invalid data width\n"); return -EINVAL; } @@ -1019,7 +1036,7 @@ int ca91cx42_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src, entry->descriptor.dctl |= CA91CX42_DCTL_VAS_USER2; break; default: - printk(KERN_ERR "Invalid address space\n"); + dev_err(dev, "Invalid address space\n"); return -EINVAL; break; } @@ -1079,12 +1096,13 @@ int ca91cx42_dma_list_exec(struct vme_dma_list *list) int retval = 0; dma_addr_t bus_addr; u32 val; - + struct device *dev; struct ca91cx42_driver *bridge; ctrlr = list->parent; bridge = ctrlr->parent->driver_priv; + dev = ctrlr->parent->parent; mutex_lock(&(ctrlr->mtx)); @@ -1140,7 +1158,7 @@ int ca91cx42_dma_list_exec(struct vme_dma_list *list) if (val & (CA91CX42_DGCS_LERR | CA91CX42_DGCS_VERR | CA91CX42_DGCS_PERR)) { - printk(KERN_ERR "ca91c042: DMA Error. DGCS=%08X\n", val); + dev_err(dev, "ca91c042: DMA Error. DGCS=%08X\n", val); val = ioread32(bridge->base + DCTL); } @@ -1476,7 +1494,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* We want to support more than one of each bridge so we need to * dynamically allocate the bridge structure */ - ca91cx42_bridge = kmalloc(sizeof(struct vme_bridge), GFP_KERNEL); + ca91cx42_bridge = kzalloc(sizeof(struct vme_bridge), GFP_KERNEL); if (ca91cx42_bridge == NULL) { dev_err(&pdev->dev, "Failed to allocate memory for device " @@ -1485,9 +1503,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err_struct; } - memset(ca91cx42_bridge, 0, sizeof(struct vme_bridge)); - - ca91cx42_device = kmalloc(sizeof(struct ca91cx42_driver), GFP_KERNEL); + ca91cx42_device = kzalloc(sizeof(struct ca91cx42_driver), GFP_KERNEL); if (ca91cx42_device == NULL) { dev_err(&pdev->dev, "Failed to allocate memory for device " @@ -1496,8 +1512,6 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err_driver; } - memset(ca91cx42_device, 0, sizeof(struct ca91cx42_driver)); - ca91cx42_bridge->driver_priv = ca91cx42_device; /* Enable the device */ @@ -1665,9 +1679,8 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id) dev_info(&pdev->dev, "Slot ID is %d\n", ca91cx42_slot_get(ca91cx42_bridge)); - if (ca91cx42_crcsr_init(ca91cx42_bridge, pdev)) { + if (ca91cx42_crcsr_init(ca91cx42_bridge, pdev)) dev_err(&pdev->dev, "CR/CSR configuration failed.\n"); - } /* Need to save ca91cx42_bridge pointer locally in link list for use in * ca91cx42_remove() diff --git a/drivers/staging/vme/bridges/vme_tsi148.c b/drivers/staging/vme/bridges/vme_tsi148.c index 783051f59f19..abe88a380b72 100644 --- a/drivers/staging/vme/bridges/vme_tsi148.c +++ b/drivers/staging/vme/bridges/vme_tsi148.c @@ -26,9 +26,9 @@ #include <linux/spinlock.h> #include <linux/sched.h> #include <linux/slab.h> -#include <asm/time.h> -#include <asm/io.h> -#include <asm/uaccess.h> +#include <linux/time.h> +#include <linux/io.h> +#include <linux/uaccess.h> #include "../vme.h" #include "../vme_bridge.h" @@ -40,27 +40,6 @@ static void tsi148_remove(struct pci_dev *); static void __exit tsi148_exit(void); -int tsi148_slave_set(struct vme_slave_resource *, int, unsigned long long, - unsigned long long, dma_addr_t, vme_address_t, vme_cycle_t); -int tsi148_slave_get(struct vme_slave_resource *, int *, unsigned long long *, - unsigned long long *, dma_addr_t *, vme_address_t *, vme_cycle_t *); - -int tsi148_master_get(struct vme_master_resource *, int *, unsigned long long *, - unsigned long long *, vme_address_t *, vme_cycle_t *, vme_width_t *); -int tsi148_master_set(struct vme_master_resource *, int, unsigned long long, - unsigned long long, vme_address_t, vme_cycle_t, vme_width_t); -ssize_t tsi148_master_read(struct vme_master_resource *, void *, size_t, - loff_t); -ssize_t tsi148_master_write(struct vme_master_resource *, void *, size_t, - loff_t); -unsigned int tsi148_master_rmw(struct vme_master_resource *, unsigned int, - unsigned int, unsigned int, loff_t); -int tsi148_dma_list_add (struct vme_dma_list *, struct vme_dma_attr *, - struct vme_dma_attr *, size_t); -int tsi148_dma_list_exec(struct vme_dma_list *); -int tsi148_dma_list_empty(struct vme_dma_list *); -int tsi148_generate_irq(int, int); - /* Module parameter */ static int err_chk; static int geoid; @@ -122,7 +101,7 @@ static u32 tsi148_LM_irqhandler(struct tsi148_driver *bridge, u32 stat) u32 serviced = 0; for (i = 0; i < 4; i++) { - if(stat & TSI148_LCSR_INTS_LMS[i]) { + if (stat & TSI148_LCSR_INTS_LMS[i]) { /* We only enable interrupts if the callback is set */ bridge->lm_callback[i](i); serviced |= TSI148_LCSR_INTC_LMC[i]; @@ -137,16 +116,20 @@ static u32 tsi148_LM_irqhandler(struct tsi148_driver *bridge, u32 stat) * * XXX This functionality is not exposed up though API. */ -static u32 tsi148_MB_irqhandler(struct tsi148_driver *bridge, u32 stat) +static u32 tsi148_MB_irqhandler(struct vme_bridge *tsi148_bridge, u32 stat) { int i; u32 val; u32 serviced = 0; + struct tsi148_driver *bridge; + + bridge = tsi148_bridge->driver_priv; for (i = 0; i < 4; i++) { - if(stat & TSI148_LCSR_INTS_MBS[i]) { + if (stat & TSI148_LCSR_INTS_MBS[i]) { val = ioread32be(bridge->base + TSI148_GCSR_MBOX[i]); - printk("VME Mailbox %d received: 0x%x\n", i, val); + dev_err(tsi148_bridge->parent, "VME Mailbox %d received" + ": 0x%x\n", i, val); serviced |= TSI148_LCSR_INTC_MBC[i]; } } @@ -157,19 +140,22 @@ static u32 tsi148_MB_irqhandler(struct tsi148_driver *bridge, u32 stat) /* * Display error & status message when PERR (PCI) exception interrupt occurs. */ -static u32 tsi148_PERR_irqhandler(struct tsi148_driver *bridge) +static u32 tsi148_PERR_irqhandler(struct vme_bridge *tsi148_bridge) { - printk(KERN_ERR - "PCI Exception at address: 0x%08x:%08x, attributes: %08x\n", + struct tsi148_driver *bridge; + + bridge = tsi148_bridge->driver_priv; + + dev_err(tsi148_bridge->parent, "PCI Exception at address: 0x%08x:%08x, " + "attributes: %08x\n", ioread32be(bridge->base + TSI148_LCSR_EDPAU), ioread32be(bridge->base + TSI148_LCSR_EDPAL), - ioread32be(bridge->base + TSI148_LCSR_EDPAT) - ); - printk(KERN_ERR - "PCI-X attribute reg: %08x, PCI-X split completion reg: %08x\n", + ioread32be(bridge->base + TSI148_LCSR_EDPAT)); + + dev_err(tsi148_bridge->parent, "PCI-X attribute reg: %08x, PCI-X split " + "completion reg: %08x\n", ioread32be(bridge->base + TSI148_LCSR_EDPXA), - ioread32be(bridge->base + TSI148_LCSR_EDPXS) - ); + ioread32be(bridge->base + TSI148_LCSR_EDPXS)); iowrite32be(TSI148_LCSR_EDPAT_EDPCL, bridge->base + TSI148_LCSR_EDPAT); @@ -196,22 +182,21 @@ static u32 tsi148_VERR_irqhandler(struct vme_bridge *tsi148_bridge) reg_join(error_addr_high, error_addr_low, &error_addr); /* Check for exception register overflow (we have lost error data) */ - if(error_attrib & TSI148_LCSR_VEAT_VEOF) { - printk(KERN_ERR "VME Bus Exception Overflow Occurred\n"); + if (error_attrib & TSI148_LCSR_VEAT_VEOF) { + dev_err(tsi148_bridge->parent, "VME Bus Exception Overflow " + "Occurred\n"); } - error = (struct vme_bus_error *)kmalloc(sizeof (struct vme_bus_error), - GFP_ATOMIC); + error = kmalloc(sizeof(struct vme_bus_error), GFP_ATOMIC); if (error) { error->address = error_addr; error->attributes = error_attrib; list_add_tail(&(error->list), &(tsi148_bridge->vme_errors)); } else { - printk(KERN_ERR - "Unable to alloc memory for VMEbus Error reporting\n"); - printk(KERN_ERR - "VME Bus Error at address: 0x%llx, attributes: %08x\n", - error_addr, error_attrib); + dev_err(tsi148_bridge->parent, "Unable to alloc memory for " + "VMEbus Error reporting\n"); + dev_err(tsi148_bridge->parent, "VME Bus Error at address: " + "0x%llx, attributes: %08x\n", error_addr, error_attrib); } /* Clear Status */ @@ -244,10 +229,9 @@ static u32 tsi148_VIRQ_irqhandler(struct vme_bridge *tsi148_bridge, for (i = 7; i > 0; i--) { if (stat & (1 << i)) { /* - * Note: Even though the registers are defined - * as 32-bits in the spec, we only want to issue - * 8-bit IACK cycles on the bus, read from offset - * 3. + * Note: Even though the registers are defined as + * 32-bits in the spec, we only want to issue 8-bit + * IACK cycles on the bus, read from offset 3. */ vec = ioread8(bridge->base + TSI148_LCSR_VIACK[i] + 3); @@ -281,9 +265,8 @@ static irqreturn_t tsi148_irqhandler(int irq, void *ptr) /* Only look at unmasked interrupts */ stat &= enable; - if (unlikely(!stat)) { + if (unlikely(!stat)) return IRQ_NONE; - } /* Call subhandlers as appropriate */ /* DMA irqs */ @@ -298,11 +281,11 @@ static irqreturn_t tsi148_irqhandler(int irq, void *ptr) /* Mail box irqs */ if (stat & (TSI148_LCSR_INTS_MB3S | TSI148_LCSR_INTS_MB2S | TSI148_LCSR_INTS_MB1S | TSI148_LCSR_INTS_MB0S)) - serviced |= tsi148_MB_irqhandler(bridge, stat); + serviced |= tsi148_MB_irqhandler(tsi148_bridge, stat); /* PCI bus error */ if (stat & TSI148_LCSR_INTS_PERRS) - serviced |= tsi148_PERR_irqhandler(bridge); + serviced |= tsi148_PERR_irqhandler(tsi148_bridge); /* VME bus error */ if (stat & TSI148_LCSR_INTS_VERRS) @@ -346,8 +329,8 @@ static int tsi148_irq_init(struct vme_bridge *tsi148_bridge) IRQF_SHARED, driver_name, tsi148_bridge); if (result) { - dev_err(&pdev->dev, "Can't get assigned pci irq vector %02X\n", - pdev->irq); + dev_err(tsi148_bridge->parent, "Can't get assigned pci irq " + "vector %02X\n", pdev->irq); return result; } @@ -515,7 +498,9 @@ static struct vme_bus_error *tsi148_find_error(struct vme_bridge *tsi148_bridge, /* Iterate through errors */ list_for_each(err_pos, &(tsi148_bridge->vme_errors)) { vme_err = list_entry(err_pos, struct vme_bus_error, list); - if((vme_err->address >= address) && (vme_err->address < bound)){ + if ((vme_err->address >= address) && + (vme_err->address < bound)) { + valid = vme_err; break; } @@ -548,7 +533,9 @@ static void tsi148_clear_errors(struct vme_bridge *tsi148_bridge, list_for_each_safe(err_pos, temp, &(tsi148_bridge->vme_errors)) { vme_err = list_entry(err_pos, struct vme_bus_error, list); - if((vme_err->address >= address) && (vme_err->address < bound)){ + if ((vme_err->address >= address) && + (vme_err->address < bound)) { + list_del(err_pos); kfree(vme_err); } @@ -568,9 +555,11 @@ int tsi148_slave_set(struct vme_slave_resource *image, int enabled, unsigned int vme_bound_low, vme_bound_high; unsigned int pci_offset_low, pci_offset_high; unsigned long long vme_bound, pci_offset; + struct vme_bridge *tsi148_bridge; struct tsi148_driver *bridge; - bridge = image->parent->driver_priv; + tsi148_bridge = image->parent; + bridge = tsi148_bridge->driver_priv; i = image->number; @@ -597,7 +586,7 @@ int tsi148_slave_set(struct vme_slave_resource *image, int enabled, case VME_USER3: case VME_USER4: default: - printk("Invalid address space\n"); + dev_err(tsi148_bridge->parent, "Invalid address space\n"); return -EINVAL; break; } @@ -615,15 +604,16 @@ int tsi148_slave_set(struct vme_slave_resource *image, int enabled, reg_split(pci_offset, &pci_offset_high, &pci_offset_low); if (vme_base_low & (granularity - 1)) { - printk("Invalid VME base alignment\n"); + dev_err(tsi148_bridge->parent, "Invalid VME base alignment\n"); return -EINVAL; } if (vme_bound_low & (granularity - 1)) { - printk("Invalid VME bound alignment\n"); + dev_err(tsi148_bridge->parent, "Invalid VME bound alignment\n"); return -EINVAL; } if (pci_offset_low & (granularity - 1)) { - printk("Invalid PCI Offset alignment\n"); + dev_err(tsi148_bridge->parent, "Invalid PCI Offset " + "alignment\n"); return -EINVAL; } @@ -815,12 +805,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image, tsi148_bridge = image->parent; - /* Find pci_dev container of dev */ - if (tsi148_bridge->parent == NULL) { - printk("Dev entry NULL\n"); - return -EINVAL; - } - pdev = container_of(tsi148_bridge->parent, struct pci_dev, dev); + pdev = container_of(tsi148_bridge->parent, struct pci_dev, dev); existing_size = (unsigned long long)(image->bus_resource.end - image->bus_resource.start); @@ -839,15 +824,14 @@ static int tsi148_alloc_resource(struct vme_master_resource *image, } /* Exit here if size is zero */ - if (size == 0) { + if (size == 0) return 0; - } if (image->bus_resource.name == NULL) { image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_KERNEL); if (image->bus_resource.name == NULL) { - printk(KERN_ERR "Unable to allocate memory for resource" - " name\n"); + dev_err(tsi148_bridge->parent, "Unable to allocate " + "memory for resource name\n"); retval = -ENOMEM; goto err_name; } @@ -864,8 +848,8 @@ static int tsi148_alloc_resource(struct vme_master_resource *image, &(image->bus_resource), size, size, PCIBIOS_MIN_MEM, 0, NULL, NULL); if (retval) { - printk(KERN_ERR "Failed to allocate mem resource for " - "window %d size 0x%lx start 0x%lx\n", + dev_err(tsi148_bridge->parent, "Failed to allocate mem " + "resource for window %d size 0x%lx start 0x%lx\n", image->number, (unsigned long)size, (unsigned long)image->bus_resource.start); goto err_resource; @@ -874,7 +858,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image, image->kern_base = ioremap_nocache( image->bus_resource.start, size); if (image->kern_base == NULL) { - printk(KERN_ERR "Failed to remap resource\n"); + dev_err(tsi148_bridge->parent, "Failed to remap resource\n"); retval = -ENOMEM; goto err_remap; } @@ -907,7 +891,7 @@ static void tsi148_free_resource(struct vme_master_resource *image) /* * Set the attributes of an outbound window. */ -int tsi148_master_set( struct vme_master_resource *image, int enabled, +int tsi148_master_set(struct vme_master_resource *image, int enabled, unsigned long long vme_base, unsigned long long size, vme_address_t aspace, vme_cycle_t cycle, vme_width_t dwidth) { @@ -918,19 +902,24 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, unsigned int pci_bound_low, pci_bound_high; unsigned int vme_offset_low, vme_offset_high; unsigned long long pci_bound, vme_offset, pci_base; + struct vme_bridge *tsi148_bridge; struct tsi148_driver *bridge; - bridge = image->parent->driver_priv; + tsi148_bridge = image->parent; + + bridge = tsi148_bridge->driver_priv; /* Verify input data */ if (vme_base & 0xFFFF) { - printk(KERN_ERR "Invalid VME Window alignment\n"); + dev_err(tsi148_bridge->parent, "Invalid VME Window " + "alignment\n"); retval = -EINVAL; goto err_window; } if ((size == 0) && (enabled != 0)) { - printk(KERN_ERR "Size must be non-zero for enabled windows\n"); + dev_err(tsi148_bridge->parent, "Size must be non-zero for " + "enabled windows\n"); retval = -EINVAL; goto err_window; } @@ -944,7 +933,7 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, retval = tsi148_alloc_resource(image, size); if (retval) { spin_unlock(&(image->lock)); - printk(KERN_ERR "Unable to allocate memory for " + dev_err(tsi148_bridge->parent, "Unable to allocate memory for " "resource\n"); goto err_res; } @@ -971,19 +960,20 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, if (pci_base_low & 0xFFFF) { spin_unlock(&(image->lock)); - printk(KERN_ERR "Invalid PCI base alignment\n"); + dev_err(tsi148_bridge->parent, "Invalid PCI base alignment\n"); retval = -EINVAL; goto err_gran; } if (pci_bound_low & 0xFFFF) { spin_unlock(&(image->lock)); - printk(KERN_ERR "Invalid PCI bound alignment\n"); + dev_err(tsi148_bridge->parent, "Invalid PCI bound alignment\n"); retval = -EINVAL; goto err_gran; } if (vme_offset_low & 0xFFFF) { spin_unlock(&(image->lock)); - printk(KERN_ERR "Invalid VME Offset alignment\n"); + dev_err(tsi148_bridge->parent, "Invalid VME Offset " + "alignment\n"); retval = -EINVAL; goto err_gran; } @@ -1029,8 +1019,8 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, temp_ctl |= TSI148_LCSR_OTAT_TM_2eSST; } if (cycle & VME_2eSSTB) { - printk(KERN_WARNING "Currently not setting Broadcast Select " - "Registers\n"); + dev_warn(tsi148_bridge->parent, "Currently not setting " + "Broadcast Select Registers\n"); temp_ctl &= ~TSI148_LCSR_OTAT_TM_M; temp_ctl |= TSI148_LCSR_OTAT_TM_2eSSTB; } @@ -1046,7 +1036,7 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, break; default: spin_unlock(&(image->lock)); - printk(KERN_ERR "Invalid data width\n"); + dev_err(tsi148_bridge->parent, "Invalid data width\n"); retval = -EINVAL; goto err_dwidth; } @@ -1083,7 +1073,7 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled, break; default: spin_unlock(&(image->lock)); - printk(KERN_ERR "Invalid address space\n"); + dev_err(tsi148_bridge->parent, "Invalid address space\n"); retval = -EINVAL; goto err_aspace; break; @@ -1137,7 +1127,7 @@ err_window: * * XXX Not parsing prefetch information. */ -int __tsi148_master_get( struct vme_master_resource *image, int *enabled, +int __tsi148_master_get(struct vme_master_resource *image, int *enabled, unsigned long long *vme_base, unsigned long long *size, vme_address_t *aspace, vme_cycle_t *cycle, vme_width_t *dwidth) { @@ -1214,17 +1204,17 @@ int __tsi148_master_get( struct vme_master_resource *image, int *enabled, *cycle |= VME_2eSST320; /* Setup cycle types */ - if ((ctl & TSI148_LCSR_OTAT_TM_M ) == TSI148_LCSR_OTAT_TM_SCT) + if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_SCT) *cycle |= VME_SCT; - if ((ctl & TSI148_LCSR_OTAT_TM_M ) == TSI148_LCSR_OTAT_TM_BLT) + if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_BLT) *cycle |= VME_BLT; - if ((ctl & TSI148_LCSR_OTAT_TM_M ) == TSI148_LCSR_OTAT_TM_MBLT) + if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_MBLT) *cycle |= VME_MBLT; - if ((ctl & TSI148_LCSR_OTAT_TM_M ) == TSI148_LCSR_OTAT_TM_2eVME) + if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_2eVME) *cycle |= VME_2eVME; - if ((ctl & TSI148_LCSR_OTAT_TM_M ) == TSI148_LCSR_OTAT_TM_2eSST) + if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_2eSST) *cycle |= VME_2eSST; - if ((ctl & TSI148_LCSR_OTAT_TM_M ) == TSI148_LCSR_OTAT_TM_2eSSTB) + if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_2eSSTB) *cycle |= VME_2eSSTB; if (ctl & TSI148_LCSR_OTAT_SUP) @@ -1247,7 +1237,7 @@ int __tsi148_master_get( struct vme_master_resource *image, int *enabled, } -int tsi148_master_get( struct vme_master_resource *image, int *enabled, +int tsi148_master_get(struct vme_master_resource *image, int *enabled, unsigned long long *vme_base, unsigned long long *size, vme_address_t *aspace, vme_cycle_t *cycle, vme_width_t *dwidth) { @@ -1289,7 +1279,7 @@ ssize_t tsi148_master_read(struct vme_master_resource *image, void *buf, vme_err = tsi148_find_error(tsi148_bridge, aspace, vme_base + offset, count); - if(vme_err != NULL) { + if (vme_err != NULL) { dev_err(image->parent->parent, "First VME read error detected " "an at address 0x%llx\n", vme_err->address); retval = vme_err->address - (vme_base + offset); @@ -1352,9 +1342,9 @@ ssize_t tsi148_master_write(struct vme_master_resource *image, void *buf, vme_err = tsi148_find_error(tsi148_bridge, aspace, vme_base + offset, count); - if(vme_err != NULL) { - printk("First VME write error detected an at address 0x%llx\n", - vme_err->address); + if (vme_err != NULL) { + dev_warn(tsi148_bridge->parent, "First VME write error detected" + " an at address 0x%llx\n", vme_err->address); retval = vme_err->address - (vme_base + offset); /* Clear down save errors in this address range */ tsi148_clear_errors(tsi148_bridge, aspace, vme_base + offset, @@ -1428,8 +1418,8 @@ unsigned int tsi148_master_rmw(struct vme_master_resource *image, return result; } -static int tsi148_dma_set_vme_src_attributes (u32 *attr, vme_address_t aspace, - vme_cycle_t cycle, vme_width_t dwidth) +static int tsi148_dma_set_vme_src_attributes(struct device *dev, u32 *attr, + vme_address_t aspace, vme_cycle_t cycle, vme_width_t dwidth) { /* Setup 2eSST speeds */ switch (cycle & (VME_2eSST160 | VME_2eSST267 | VME_2eSST320)) { @@ -1445,23 +1435,24 @@ static int tsi148_dma_set_vme_src_attributes (u32 *attr, vme_address_t aspace, } /* Setup cycle types */ - if (cycle & VME_SCT) { + if (cycle & VME_SCT) *attr |= TSI148_LCSR_DSAT_TM_SCT; - } - if (cycle & VME_BLT) { + + if (cycle & VME_BLT) *attr |= TSI148_LCSR_DSAT_TM_BLT; - } - if (cycle & VME_MBLT) { + + if (cycle & VME_MBLT) *attr |= TSI148_LCSR_DSAT_TM_MBLT; - } - if (cycle & VME_2eVME) { + + if (cycle & VME_2eVME) *attr |= TSI148_LCSR_DSAT_TM_2eVME; - } - if (cycle & VME_2eSST) { + + if (cycle & VME_2eSST) *attr |= TSI148_LCSR_DSAT_TM_2eSST; - } + if (cycle & VME_2eSSTB) { - printk("Currently not setting Broadcast Select Registers\n"); + dev_err(dev, "Currently not setting Broadcast Select " + "Registers\n"); *attr |= TSI148_LCSR_DSAT_TM_2eSSTB; } @@ -1474,7 +1465,7 @@ static int tsi148_dma_set_vme_src_attributes (u32 *attr, vme_address_t aspace, *attr |= TSI148_LCSR_DSAT_DBW_32; break; default: - printk("Invalid data width\n"); + dev_err(dev, "Invalid data width\n"); return -EINVAL; } @@ -1508,7 +1499,7 @@ static int tsi148_dma_set_vme_src_attributes (u32 *attr, vme_address_t aspace, *attr |= TSI148_LCSR_DSAT_AMODE_USER4; break; default: - printk("Invalid address space\n"); + dev_err(dev, "Invalid address space\n"); return -EINVAL; break; } @@ -1521,8 +1512,8 @@ static int tsi148_dma_set_vme_src_attributes (u32 *attr, vme_address_t aspace, return 0; } -static int tsi148_dma_set_vme_dest_attributes(u32 *attr, vme_address_t aspace, - vme_cycle_t cycle, vme_width_t dwidth) +static int tsi148_dma_set_vme_dest_attributes(struct device *dev, u32 *attr, + vme_address_t aspace, vme_cycle_t cycle, vme_width_t dwidth) { /* Setup 2eSST speeds */ switch (cycle & (VME_2eSST160 | VME_2eSST267 | VME_2eSST320)) { @@ -1538,23 +1529,24 @@ static int tsi148_dma_set_vme_dest_attributes(u32 *attr, vme_address_t aspace, } /* Setup cycle types */ - if (cycle & VME_SCT) { + if (cycle & VME_SCT) *attr |= TSI148_LCSR_DDAT_TM_SCT; - } - if (cycle & VME_BLT) { + + if (cycle & VME_BLT) *attr |= TSI148_LCSR_DDAT_TM_BLT; - } - if (cycle & VME_MBLT) { + + if (cycle & VME_MBLT) *attr |= TSI148_LCSR_DDAT_TM_MBLT; - } - if (cycle & VME_2eVME) { + + if (cycle & VME_2eVME) *attr |= TSI148_LCSR_DDAT_TM_2eVME; - } - if (cycle & VME_2eSST) { + + if (cycle & VME_2eSST) *attr |= TSI148_LCSR_DDAT_TM_2eSST; - } + if (cycle & |