2009-07-31 12:28:17 +04:00
|
|
|
/*
|
|
|
|
* Support for the Tundra TSI148 VME-PCI Bridge Chip
|
|
|
|
*
|
2010-02-18 18:12:52 +03:00
|
|
|
* Author: Martyn Welch <martyn.welch@ge.com>
|
|
|
|
* Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc.
|
2009-07-31 12:28:17 +04:00
|
|
|
*
|
|
|
|
* Based on work by Tom Armistead and Ajit Prem
|
|
|
|
* Copyright 2004 Motorola Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/moduleparam.h>
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/proc_fs.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/poll.h>
|
|
|
|
#include <linux/dma-mapping.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/spinlock.h>
|
2009-10-13 02:00:08 +04:00
|
|
|
#include <linux/sched.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 11:04:11 +03:00
|
|
|
#include <linux/slab.h>
|
2010-03-22 17:58:57 +03:00
|
|
|
#include <linux/time.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/uaccess.h>
|
2012-03-22 17:27:30 +04:00
|
|
|
#include <linux/byteorder/generic.h>
|
2012-04-26 23:34:58 +04:00
|
|
|
#include <linux/vme.h>
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
#include "../vme_bridge.h"
|
|
|
|
#include "vme_tsi148.h"
|
|
|
|
|
|
|
|
static int tsi148_probe(struct pci_dev *, const struct pci_device_id *);
|
|
|
|
static void tsi148_remove(struct pci_dev *);
|
|
|
|
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
/* Module parameter */
|
2012-01-13 03:02:20 +04:00
|
|
|
static bool err_chk;
|
2009-12-15 11:42:49 +03:00
|
|
|
static int geoid;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2011-06-03 13:07:39 +04:00
|
|
|
static const char driver_name[] = "vme_tsi148";
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2013-12-03 03:29:48 +04:00
|
|
|
static const struct pci_device_id tsi148_ids[] = {
|
2009-07-31 12:28:17 +04:00
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_TUNDRA, PCI_DEVICE_ID_TUNDRA_TSI148) },
|
|
|
|
{ },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pci_driver tsi148_driver = {
|
|
|
|
.name = driver_name,
|
|
|
|
.id_table = tsi148_ids,
|
|
|
|
.probe = tsi148_probe,
|
|
|
|
.remove = tsi148_remove,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void reg_join(unsigned int high, unsigned int low,
|
|
|
|
unsigned long long *variable)
|
|
|
|
{
|
|
|
|
*variable = (unsigned long long)high << 32;
|
|
|
|
*variable |= (unsigned long long)low;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void reg_split(unsigned long long variable, unsigned int *high,
|
|
|
|
unsigned int *low)
|
|
|
|
{
|
|
|
|
*low = (unsigned int)variable & 0xFFFFFFFF;
|
|
|
|
*high = (unsigned int)(variable >> 32);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Wakes up DMA queue.
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
static u32 tsi148_DMA_irqhandler(struct tsi148_driver *bridge,
|
|
|
|
int channel_mask)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
u32 serviced = 0;
|
|
|
|
|
|
|
|
if (channel_mask & TSI148_LCSR_INTS_DMA0S) {
|
2010-11-12 14:14:07 +03:00
|
|
|
wake_up(&bridge->dma_queue[0]);
|
2009-07-31 12:28:17 +04:00
|
|
|
serviced |= TSI148_LCSR_INTC_DMA0C;
|
|
|
|
}
|
|
|
|
if (channel_mask & TSI148_LCSR_INTS_DMA1S) {
|
2010-11-12 14:14:07 +03:00
|
|
|
wake_up(&bridge->dma_queue[1]);
|
2009-07-31 12:28:17 +04:00
|
|
|
serviced |= TSI148_LCSR_INTC_DMA1C;
|
|
|
|
}
|
|
|
|
|
|
|
|
return serviced;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Wake up location monitor queue
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
static u32 tsi148_LM_irqhandler(struct tsi148_driver *bridge, u32 stat)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
u32 serviced = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
2010-03-22 17:58:57 +03:00
|
|
|
if (stat & TSI148_LCSR_INTS_LMS[i]) {
|
2009-07-31 12:28:17 +04:00
|
|
|
/* We only enable interrupts if the callback is set */
|
2010-02-18 18:13:05 +03:00
|
|
|
bridge->lm_callback[i](i);
|
2009-07-31 12:28:17 +04:00
|
|
|
serviced |= TSI148_LCSR_INTC_LMC[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return serviced;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Wake up mail box queue.
|
|
|
|
*
|
|
|
|
* XXX This functionality is not exposed up though API.
|
|
|
|
*/
|
2010-03-22 17:58:50 +03:00
|
|
|
static u32 tsi148_MB_irqhandler(struct vme_bridge *tsi148_bridge, u32 stat)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
u32 val;
|
|
|
|
u32 serviced = 0;
|
2010-03-22 17:58:50 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
2010-03-22 17:58:57 +03:00
|
|
|
if (stat & TSI148_LCSR_INTS_MBS[i]) {
|
2010-02-18 18:13:05 +03:00
|
|
|
val = ioread32be(bridge->base + TSI148_GCSR_MBOX[i]);
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "VME Mailbox %d received"
|
|
|
|
": 0x%x\n", i, val);
|
2009-07-31 12:28:17 +04:00
|
|
|
serviced |= TSI148_LCSR_INTC_MBC[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return serviced;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Display error & status message when PERR (PCI) exception interrupt occurs.
|
|
|
|
*/
|
2010-03-22 17:58:50 +03:00
|
|
|
static u32 tsi148_PERR_irqhandler(struct vme_bridge *tsi148_bridge)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
2010-03-22 17:58:50 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
|
|
|
|
|
|
|
dev_err(tsi148_bridge->parent, "PCI Exception at address: 0x%08x:%08x, "
|
|
|
|
"attributes: %08x\n",
|
2010-02-18 18:13:05 +03:00
|
|
|
ioread32be(bridge->base + TSI148_LCSR_EDPAU),
|
|
|
|
ioread32be(bridge->base + TSI148_LCSR_EDPAL),
|
2010-03-22 17:58:50 +03:00
|
|
|
ioread32be(bridge->base + TSI148_LCSR_EDPAT));
|
|
|
|
|
|
|
|
dev_err(tsi148_bridge->parent, "PCI-X attribute reg: %08x, PCI-X split "
|
|
|
|
"completion reg: %08x\n",
|
2010-02-18 18:13:05 +03:00
|
|
|
ioread32be(bridge->base + TSI148_LCSR_EDPXA),
|
2010-03-22 17:58:50 +03:00
|
|
|
ioread32be(bridge->base + TSI148_LCSR_EDPXS));
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(TSI148_LCSR_EDPAT_EDPCL, bridge->base + TSI148_LCSR_EDPAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return TSI148_LCSR_INTC_PERRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Save address and status when VME error interrupt occurs.
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
static u32 tsi148_VERR_irqhandler(struct vme_bridge *tsi148_bridge)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
unsigned int error_addr_high, error_addr_low;
|
|
|
|
unsigned long long error_addr;
|
|
|
|
u32 error_attrib;
|
2013-06-11 14:20:17 +04:00
|
|
|
struct vme_bus_error *error = NULL;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
error_addr_high = ioread32be(bridge->base + TSI148_LCSR_VEAU);
|
|
|
|
error_addr_low = ioread32be(bridge->base + TSI148_LCSR_VEAL);
|
|
|
|
error_attrib = ioread32be(bridge->base + TSI148_LCSR_VEAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
reg_join(error_addr_high, error_addr_low, &error_addr);
|
|
|
|
|
|
|
|
/* Check for exception register overflow (we have lost error data) */
|
2010-03-22 17:58:57 +03:00
|
|
|
if (error_attrib & TSI148_LCSR_VEAT_VEOF) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "VME Bus Exception Overflow "
|
|
|
|
"Occurred\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
2013-06-11 14:20:17 +04:00
|
|
|
if (err_chk) {
|
|
|
|
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 {
|
|
|
|
dev_err(tsi148_bridge->parent,
|
|
|
|
"Unable to alloc memory for VMEbus Error reporting\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!error) {
|
|
|
|
dev_err(tsi148_bridge->parent,
|
|
|
|
"VME Bus Error at address: 0x%llx, attributes: %08x\n",
|
|
|
|
error_addr, error_attrib);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear Status */
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(TSI148_LCSR_VEAT_VESCL, bridge->base + TSI148_LCSR_VEAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return TSI148_LCSR_INTC_VERRC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Wake up IACK queue.
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
static u32 tsi148_IACK_irqhandler(struct tsi148_driver *bridge)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
2010-11-12 14:14:07 +03:00
|
|
|
wake_up(&bridge->iack_queue);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return TSI148_LCSR_INTC_IACKC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Calling VME bus interrupt callback if provided.
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
static u32 tsi148_VIRQ_irqhandler(struct vme_bridge *tsi148_bridge,
|
|
|
|
u32 stat)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
int vec, i, serviced = 0;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
for (i = 7; i > 0; i--) {
|
|
|
|
if (stat & (1 << i)) {
|
|
|
|
/*
|
2010-03-22 17:58:57 +03:00
|
|
|
* 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.
|
2009-07-31 12:28:17 +04:00
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
vec = ioread8(bridge->base + TSI148_LCSR_VIACK[i] + 3);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2009-10-29 19:34:54 +03:00
|
|
|
vme_irq_handler(tsi148_bridge, i, vec);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
serviced |= (1 << i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return serviced;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Top level interrupt handler. Clears appropriate interrupt status bits and
|
|
|
|
* then calls appropriate sub handler(s).
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
static irqreturn_t tsi148_irqhandler(int irq, void *ptr)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
u32 stat, enable, serviced = 0;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct vme_bridge *tsi148_bridge;
|
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
tsi148_bridge = ptr;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Determine which interrupts are unmasked and set */
|
2010-02-18 18:13:05 +03:00
|
|
|
enable = ioread32be(bridge->base + TSI148_LCSR_INTEO);
|
|
|
|
stat = ioread32be(bridge->base + TSI148_LCSR_INTS);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Only look at unmasked interrupts */
|
|
|
|
stat &= enable;
|
|
|
|
|
2010-03-22 17:58:57 +03:00
|
|
|
if (unlikely(!stat))
|
2009-07-31 12:28:17 +04:00
|
|
|
return IRQ_NONE;
|
|
|
|
|
|
|
|
/* Call subhandlers as appropriate */
|
|
|
|
/* DMA irqs */
|
|
|
|
if (stat & (TSI148_LCSR_INTS_DMA1S | TSI148_LCSR_INTS_DMA0S))
|
2010-02-18 18:13:05 +03:00
|
|
|
serviced |= tsi148_DMA_irqhandler(bridge, stat);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Location monitor irqs */
|
|
|
|
if (stat & (TSI148_LCSR_INTS_LM3S | TSI148_LCSR_INTS_LM2S |
|
|
|
|
TSI148_LCSR_INTS_LM1S | TSI148_LCSR_INTS_LM0S))
|
2010-02-18 18:13:05 +03:00
|
|
|
serviced |= tsi148_LM_irqhandler(bridge, stat);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Mail box irqs */
|
|
|
|
if (stat & (TSI148_LCSR_INTS_MB3S | TSI148_LCSR_INTS_MB2S |
|
|
|
|
TSI148_LCSR_INTS_MB1S | TSI148_LCSR_INTS_MB0S))
|
2010-03-22 17:58:50 +03:00
|
|
|
serviced |= tsi148_MB_irqhandler(tsi148_bridge, stat);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* PCI bus error */
|
|
|
|
if (stat & TSI148_LCSR_INTS_PERRS)
|
2010-03-22 17:58:50 +03:00
|
|
|
serviced |= tsi148_PERR_irqhandler(tsi148_bridge);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* VME bus error */
|
|
|
|
if (stat & TSI148_LCSR_INTS_VERRS)
|
2010-02-18 18:13:05 +03:00
|
|
|
serviced |= tsi148_VERR_irqhandler(tsi148_bridge);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* IACK irq */
|
|
|
|
if (stat & TSI148_LCSR_INTS_IACKS)
|
2010-02-18 18:13:05 +03:00
|
|
|
serviced |= tsi148_IACK_irqhandler(bridge);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* VME bus irqs */
|
|
|
|
if (stat & (TSI148_LCSR_INTS_IRQ7S | TSI148_LCSR_INTS_IRQ6S |
|
|
|
|
TSI148_LCSR_INTS_IRQ5S | TSI148_LCSR_INTS_IRQ4S |
|
|
|
|
TSI148_LCSR_INTS_IRQ3S | TSI148_LCSR_INTS_IRQ2S |
|
|
|
|
TSI148_LCSR_INTS_IRQ1S))
|
2010-02-18 18:13:05 +03:00
|
|
|
serviced |= tsi148_VIRQ_irqhandler(tsi148_bridge, stat);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Clear serviced interrupts */
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(serviced, bridge->base + TSI148_LCSR_INTC);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
static int tsi148_irq_init(struct vme_bridge *tsi148_bridge)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
int result;
|
|
|
|
unsigned int tmp;
|
|
|
|
struct pci_dev *pdev;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
2014-04-03 23:48:27 +04:00
|
|
|
pdev = to_pci_dev(tsi148_bridge->parent);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Initialise list for VME bus errors */
|
2010-11-12 14:14:07 +03:00
|
|
|
INIT_LIST_HEAD(&tsi148_bridge->vme_errors);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_init(&tsi148_bridge->irq_mtx);
|
2009-10-29 19:34:54 +03:00
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
result = request_irq(pdev->irq,
|
|
|
|
tsi148_irqhandler,
|
|
|
|
IRQF_SHARED,
|
2010-02-18 18:13:05 +03:00
|
|
|
driver_name, tsi148_bridge);
|
2009-07-31 12:28:17 +04:00
|
|
|
if (result) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Can't get assigned pci irq "
|
|
|
|
"vector %02X\n", pdev->irq);
|
2009-07-31 12:28:17 +04:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable and unmask interrupts */
|
|
|
|
tmp = TSI148_LCSR_INTEO_DMA1EO | TSI148_LCSR_INTEO_DMA0EO |
|
|
|
|
TSI148_LCSR_INTEO_MB3EO | TSI148_LCSR_INTEO_MB2EO |
|
|
|
|
TSI148_LCSR_INTEO_MB1EO | TSI148_LCSR_INTEO_MB0EO |
|
|
|
|
TSI148_LCSR_INTEO_PERREO | TSI148_LCSR_INTEO_VERREO |
|
|
|
|
TSI148_LCSR_INTEO_IACKEO;
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
/* This leaves the following interrupts masked.
|
2009-07-31 12:28:17 +04:00
|
|
|
* TSI148_LCSR_INTEO_VIEEO
|
|
|
|
* TSI148_LCSR_INTEO_SYSFLEO
|
|
|
|
* TSI148_LCSR_INTEO_ACFLEO
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Don't enable Location Monitor interrupts here - they will be
|
|
|
|
* enabled when the location monitors are properly configured and
|
|
|
|
* a callback has been attached.
|
|
|
|
* TSI148_LCSR_INTEO_LM0EO
|
|
|
|
* TSI148_LCSR_INTEO_LM1EO
|
|
|
|
* TSI148_LCSR_INTEO_LM2EO
|
|
|
|
* TSI148_LCSR_INTEO_LM3EO
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Don't enable VME interrupts until we add a handler, else the board
|
|
|
|
* will respond to it and we don't want that unless it knows how to
|
|
|
|
* properly deal with it.
|
|
|
|
* TSI148_LCSR_INTEO_IRQ7EO
|
|
|
|
* TSI148_LCSR_INTEO_IRQ6EO
|
|
|
|
* TSI148_LCSR_INTEO_IRQ5EO
|
|
|
|
* TSI148_LCSR_INTEO_IRQ4EO
|
|
|
|
* TSI148_LCSR_INTEO_IRQ3EO
|
|
|
|
* TSI148_LCSR_INTEO_IRQ2EO
|
|
|
|
* TSI148_LCSR_INTEO_IRQ1EO
|
|
|
|
*/
|
|
|
|
|
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEO);
|
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEN);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-11-12 14:14:47 +03:00
|
|
|
static void tsi148_irq_exit(struct vme_bridge *tsi148_bridge,
|
|
|
|
struct pci_dev *pdev)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
2010-11-12 14:14:47 +03:00
|
|
|
struct tsi148_driver *bridge = tsi148_bridge->driver_priv;
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/* Turn off interrupts */
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(0x0, bridge->base + TSI148_LCSR_INTEO);
|
|
|
|
iowrite32be(0x0, bridge->base + TSI148_LCSR_INTEN);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Clear all interrupts */
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(0xFFFFFFFF, bridge->base + TSI148_LCSR_INTC);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Detach interrupt handler */
|
2010-11-12 14:14:47 +03:00
|
|
|
free_irq(pdev->irq, tsi148_bridge);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if an IACk has been received, return true (1) or false (0).
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_iack_received(struct tsi148_driver *bridge)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
u32 tmp;
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_VICR);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
if (tmp & TSI148_LCSR_VICR_IRQS)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2009-10-29 19:34:54 +03:00
|
|
|
* Configure VME interrupt
|
2009-07-31 12:28:17 +04:00
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static void tsi148_irq_set(struct vme_bridge *tsi148_bridge, int level,
|
2010-02-18 18:13:05 +03:00
|
|
|
int state, int sync)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
2009-08-11 16:50:49 +04:00
|
|
|
struct pci_dev *pdev;
|
2009-10-29 19:34:54 +03:00
|
|
|
u32 tmp;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2009-10-29 19:34:54 +03:00
|
|
|
/* We need to do the ordering differently for enabling and disabling */
|
|
|
|
if (state == 0) {
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_INTEN);
|
2009-07-31 12:28:17 +04:00
|
|
|
tmp &= ~TSI148_LCSR_INTEN_IRQEN[level - 1];
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEN);
|
2009-08-05 20:38:31 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_INTEO);
|
2009-08-05 20:38:31 +04:00
|
|
|
tmp &= ~TSI148_LCSR_INTEO_IRQEO[level - 1];
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEO);
|
2009-08-11 16:50:49 +04:00
|
|
|
|
2009-10-29 19:34:54 +03:00
|
|
|
if (sync != 0) {
|
2014-04-03 23:48:27 +04:00
|
|
|
pdev = to_pci_dev(tsi148_bridge->parent);
|
2009-10-29 19:34:54 +03:00
|
|
|
synchronize_irq(pdev->irq);
|
|
|
|
}
|
|
|
|
} else {
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_INTEO);
|
2009-10-29 19:34:54 +03:00
|
|
|
tmp |= TSI148_LCSR_INTEO_IRQEO[level - 1];
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEO);
|
2009-08-05 20:38:31 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_INTEN);
|
2009-10-29 19:34:54 +03:00
|
|
|
tmp |= TSI148_LCSR_INTEN_IRQEN[level - 1];
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEN);
|
2009-10-29 19:34:54 +03:00
|
|
|
}
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Generate a VME bus interrupt at the requested level & vector. Wait for
|
|
|
|
* interrupt to be acked.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_irq_generate(struct vme_bridge *tsi148_bridge, int level,
|
|
|
|
int statid)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
u32 tmp;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_lock(&bridge->vme_int);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Read VICR register */
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_VICR);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Set Status/ID */
|
|
|
|
tmp = (tmp & ~TSI148_LCSR_VICR_STID_M) |
|
|
|
|
(statid & TSI148_LCSR_VICR_STID_M);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_VICR);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Assert VMEbus IRQ */
|
|
|
|
tmp = tmp | TSI148_LCSR_VICR_IRQL[level];
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_VICR);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* XXX Consider implementing a timeout? */
|
2010-02-18 18:13:05 +03:00
|
|
|
wait_event_interruptible(bridge->iack_queue,
|
|
|
|
tsi148_iack_received(bridge));
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&bridge->vme_int);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Find the first error in this address range
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
static struct vme_bus_error *tsi148_find_error(struct vme_bridge *tsi148_bridge,
|
2011-12-01 21:06:29 +04:00
|
|
|
u32 aspace, unsigned long long address, size_t count)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
struct list_head *err_pos;
|
|
|
|
struct vme_bus_error *vme_err, *valid = NULL;
|
|
|
|
unsigned long long bound;
|
|
|
|
|
|
|
|
bound = address + count;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX We are currently not looking at the address space when parsing
|
|
|
|
* for errors. This is because parsing the Address Modifier Codes
|
|
|
|
* is going to be quite resource intensive to do properly. We
|
|
|
|
* should be OK just looking at the addresses and this is certainly
|
|
|
|
* much better than what we had before.
|
|
|
|
*/
|
|
|
|
err_pos = NULL;
|
|
|
|
/* Iterate through errors */
|
2010-11-12 14:14:07 +03:00
|
|
|
list_for_each(err_pos, &tsi148_bridge->vme_errors) {
|
2009-07-31 12:28:17 +04:00
|
|
|
vme_err = list_entry(err_pos, struct vme_bus_error, list);
|
2010-03-22 17:58:57 +03:00
|
|
|
if ((vme_err->address >= address) &&
|
|
|
|
(vme_err->address < bound)) {
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
valid = vme_err;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return valid;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clear errors in the provided address range.
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
static void tsi148_clear_errors(struct vme_bridge *tsi148_bridge,
|
2011-12-01 21:06:29 +04:00
|
|
|
u32 aspace, unsigned long long address, size_t count)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
struct list_head *err_pos, *temp;
|
|
|
|
struct vme_bus_error *vme_err;
|
|
|
|
unsigned long long bound;
|
|
|
|
|
|
|
|
bound = address + count;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX We are currently not looking at the address space when parsing
|
|
|
|
* for errors. This is because parsing the Address Modifier Codes
|
|
|
|
* is going to be quite resource intensive to do properly. We
|
|
|
|
* should be OK just looking at the addresses and this is certainly
|
|
|
|
* much better than what we had before.
|
|
|
|
*/
|
|
|
|
err_pos = NULL;
|
|
|
|
/* Iterate through errors */
|
2010-11-12 14:14:07 +03:00
|
|
|
list_for_each_safe(err_pos, temp, &tsi148_bridge->vme_errors) {
|
2009-07-31 12:28:17 +04:00
|
|
|
vme_err = list_entry(err_pos, struct vme_bus_error, list);
|
|
|
|
|
2010-03-22 17:58:57 +03:00
|
|
|
if ((vme_err->address >= address) &&
|
|
|
|
(vme_err->address < bound)) {
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
list_del(err_pos);
|
|
|
|
kfree(vme_err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize a slave window with the requested attributes.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_slave_set(struct vme_slave_resource *image, int enabled,
|
2009-07-31 12:28:17 +04:00
|
|
|
unsigned long long vme_base, unsigned long long size,
|
2011-12-01 21:06:29 +04:00
|
|
|
dma_addr_t pci_base, u32 aspace, u32 cycle)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
unsigned int i, addr = 0, granularity = 0;
|
|
|
|
unsigned int temp_ctl = 0;
|
|
|
|
unsigned int vme_base_low, vme_base_high;
|
|
|
|
unsigned int vme_bound_low, vme_bound_high;
|
|
|
|
unsigned int pci_offset_low, pci_offset_high;
|
|
|
|
unsigned long long vme_bound, pci_offset;
|
2010-03-22 17:58:50 +03:00
|
|
|
struct vme_bridge *tsi148_bridge;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
2010-03-22 17:58:50 +03:00
|
|
|
tsi148_bridge = image->parent;
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
i = image->number;
|
|
|
|
|
|
|
|
switch (aspace) {
|
|
|
|
case VME_A16:
|
|
|
|
granularity = 0x10;
|
|
|
|
addr |= TSI148_LCSR_ITAT_AS_A16;
|
|
|
|
break;
|
|
|
|
case VME_A24:
|
|
|
|
granularity = 0x1000;
|
|
|
|
addr |= TSI148_LCSR_ITAT_AS_A24;
|
|
|
|
break;
|
|
|
|
case VME_A32:
|
|
|
|
granularity = 0x10000;
|
|
|
|
addr |= TSI148_LCSR_ITAT_AS_A32;
|
|
|
|
break;
|
|
|
|
case VME_A64:
|
|
|
|
granularity = 0x10000;
|
|
|
|
addr |= TSI148_LCSR_ITAT_AS_A64;
|
|
|
|
break;
|
|
|
|
case VME_CRCSR:
|
|
|
|
case VME_USER1:
|
|
|
|
case VME_USER2:
|
|
|
|
case VME_USER3:
|
|
|
|
case VME_USER4:
|
|
|
|
default:
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid address space\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert 64-bit variables to 2x 32-bit variables */
|
|
|
|
reg_split(vme_base, &vme_base_high, &vme_base_low);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Bound address is a valid address for the window, adjust
|
|
|
|
* accordingly
|
|
|
|
*/
|
|
|
|
vme_bound = vme_base + size - granularity;
|
|
|
|
reg_split(vme_bound, &vme_bound_high, &vme_bound_low);
|
|
|
|
pci_offset = (unsigned long long)pci_base - vme_base;
|
|
|
|
reg_split(pci_offset, &pci_offset_high, &pci_offset_low);
|
|
|
|
|
|
|
|
if (vme_base_low & (granularity - 1)) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid VME base alignment\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if (vme_bound_low & (granularity - 1)) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid VME bound alignment\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
if (pci_offset_low & (granularity - 1)) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid PCI Offset "
|
|
|
|
"alignment\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Disable while we are mucking around */
|
2010-02-18 18:13:05 +03:00
|
|
|
temp_ctl = ioread32be(bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITAT);
|
|
|
|
temp_ctl &= ~TSI148_LCSR_ITAT_EN;
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(temp_ctl, bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITAT);
|
|
|
|
|
|
|
|
/* Setup mapping */
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(vme_base_high, bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITSAU);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(vme_base_low, bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITSAL);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(vme_bound_high, bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITEAU);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(vme_bound_low, bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITEAL);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(pci_offset_high, bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITOFU);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(pci_offset_low, bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITOFL);
|
|
|
|
|
|
|
|
/* Setup 2eSST speeds */
|
|
|
|
temp_ctl &= ~TSI148_LCSR_ITAT_2eSSTM_M;
|
|
|
|
switch (cycle & (VME_2eSST160 | VME_2eSST267 | VME_2eSST320)) {
|
|
|
|
case VME_2eSST160:
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_2eSSTM_160;
|
|
|
|
break;
|
|
|
|
case VME_2eSST267:
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_2eSSTM_267;
|
|
|
|
break;
|
|
|
|
case VME_2eSST320:
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_2eSSTM_320;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup cycle types */
|
|
|
|
temp_ctl &= ~(0x1F << 7);
|
|
|
|
if (cycle & VME_BLT)
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_BLT;
|
|
|
|
if (cycle & VME_MBLT)
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_MBLT;
|
|
|
|
if (cycle & VME_2eVME)
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_2eVME;
|
|
|
|
if (cycle & VME_2eSST)
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_2eSST;
|
|
|
|
if (cycle & VME_2eSSTB)
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_2eSSTB;
|
|
|
|
|
|
|
|
/* Setup address space */
|
|
|
|
temp_ctl &= ~TSI148_LCSR_ITAT_AS_M;
|
|
|
|
temp_ctl |= addr;
|
|
|
|
|
|
|
|
temp_ctl &= ~0xF;
|
|
|
|
if (cycle & VME_SUPER)
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_SUPR ;
|
|
|
|
if (cycle & VME_USER)
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_NPRIV;
|
|
|
|
if (cycle & VME_PROG)
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_PGM;
|
|
|
|
if (cycle & VME_DATA)
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_DATA;
|
|
|
|
|
|
|
|
/* Write ctl reg without enable */
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(temp_ctl, bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITAT);
|
|
|
|
|
|
|
|
if (enabled)
|
|
|
|
temp_ctl |= TSI148_LCSR_ITAT_EN;
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(temp_ctl, bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITAT);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get slave window configuration.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_slave_get(struct vme_slave_resource *image, int *enabled,
|
2009-07-31 12:28:17 +04:00
|
|
|
unsigned long long *vme_base, unsigned long long *size,
|
2011-12-01 21:06:29 +04:00
|
|
|
dma_addr_t *pci_base, u32 *aspace, u32 *cycle)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
unsigned int i, granularity = 0, ctl = 0;
|
|
|
|
unsigned int vme_base_low, vme_base_high;
|
|
|
|
unsigned int vme_bound_low, vme_bound_high;
|
|
|
|
unsigned int pci_offset_low, pci_offset_high;
|
|
|
|
unsigned long long vme_bound, pci_offset;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
bridge = image->parent->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
i = image->number;
|
|
|
|
|
|
|
|
/* Read registers */
|
2010-02-18 18:13:05 +03:00
|
|
|
ctl = ioread32be(bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITAT);
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
vme_base_high = ioread32be(bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITSAU);
|
2010-02-18 18:13:05 +03:00
|
|
|
vme_base_low = ioread32be(bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITSAL);
|
2010-02-18 18:13:05 +03:00
|
|
|
vme_bound_high = ioread32be(bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITEAU);
|
2010-02-18 18:13:05 +03:00
|
|
|
vme_bound_low = ioread32be(bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITEAL);
|
2010-02-18 18:13:05 +03:00
|
|
|
pci_offset_high = ioread32be(bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITOFU);
|
2010-02-18 18:13:05 +03:00
|
|
|
pci_offset_low = ioread32be(bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITOFL);
|
|
|
|
|
|
|
|
/* Convert 64-bit variables to 2x 32-bit variables */
|
|
|
|
reg_join(vme_base_high, vme_base_low, vme_base);
|
|
|
|
reg_join(vme_bound_high, vme_bound_low, &vme_bound);
|
|
|
|
reg_join(pci_offset_high, pci_offset_low, &pci_offset);
|
|
|
|
|
2014-04-03 23:47:55 +04:00
|
|
|
*pci_base = (dma_addr_t)(*vme_base + pci_offset);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
*enabled = 0;
|
|
|
|
*aspace = 0;
|
|
|
|
*cycle = 0;
|
|
|
|
|
|
|
|
if (ctl & TSI148_LCSR_ITAT_EN)
|
|
|
|
*enabled = 1;
|
|
|
|
|
|
|
|
if ((ctl & TSI148_LCSR_ITAT_AS_M) == TSI148_LCSR_ITAT_AS_A16) {
|
|
|
|
granularity = 0x10;
|
|
|
|
*aspace |= VME_A16;
|
|
|
|
}
|
|
|
|
if ((ctl & TSI148_LCSR_ITAT_AS_M) == TSI148_LCSR_ITAT_AS_A24) {
|
|
|
|
granularity = 0x1000;
|
|
|
|
*aspace |= VME_A24;
|
|
|
|
}
|
|
|
|
if ((ctl & TSI148_LCSR_ITAT_AS_M) == TSI148_LCSR_ITAT_AS_A32) {
|
|
|
|
granularity = 0x10000;
|
|
|
|
*aspace |= VME_A32;
|
|
|
|
}
|
|
|
|
if ((ctl & TSI148_LCSR_ITAT_AS_M) == TSI148_LCSR_ITAT_AS_A64) {
|
|
|
|
granularity = 0x10000;
|
|
|
|
*aspace |= VME_A64;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Need granularity before we set the size */
|
|
|
|
*size = (unsigned long long)((vme_bound - *vme_base) + granularity);
|
|
|
|
|
|
|
|
|
|
|
|
if ((ctl & TSI148_LCSR_ITAT_2eSSTM_M) == TSI148_LCSR_ITAT_2eSSTM_160)
|
|
|
|
*cycle |= VME_2eSST160;
|
|
|
|
if ((ctl & TSI148_LCSR_ITAT_2eSSTM_M) == TSI148_LCSR_ITAT_2eSSTM_267)
|
|
|
|
*cycle |= VME_2eSST267;
|
|
|
|
if ((ctl & TSI148_LCSR_ITAT_2eSSTM_M) == TSI148_LCSR_ITAT_2eSSTM_320)
|
|
|
|
*cycle |= VME_2eSST320;
|
|
|
|
|
|
|
|
if (ctl & TSI148_LCSR_ITAT_BLT)
|
|
|
|
*cycle |= VME_BLT;
|
|
|
|
if (ctl & TSI148_LCSR_ITAT_MBLT)
|
|
|
|
*cycle |= VME_MBLT;
|
|
|
|
if (ctl & TSI148_LCSR_ITAT_2eVME)
|
|
|
|
*cycle |= VME_2eVME;
|
|
|
|
if (ctl & TSI148_LCSR_ITAT_2eSST)
|
|
|
|
*cycle |= VME_2eSST;
|
|
|
|
if (ctl & TSI148_LCSR_ITAT_2eSSTB)
|
|
|
|
*cycle |= VME_2eSSTB;
|
|
|
|
|
|
|
|
if (ctl & TSI148_LCSR_ITAT_SUPR)
|
|
|
|
*cycle |= VME_SUPER;
|
|
|
|
if (ctl & TSI148_LCSR_ITAT_NPRIV)
|
|
|
|
*cycle |= VME_USER;
|
|
|
|
if (ctl & TSI148_LCSR_ITAT_PGM)
|
|
|
|
*cycle |= VME_PROG;
|
|
|
|
if (ctl & TSI148_LCSR_ITAT_DATA)
|
|
|
|
*cycle |= VME_DATA;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate and map PCI Resource
|
|
|
|
*/
|
|
|
|
static int tsi148_alloc_resource(struct vme_master_resource *image,
|
|
|
|
unsigned long long size)
|
|
|
|
{
|
|
|
|
unsigned long long existing_size;
|
|
|
|
int retval = 0;
|
|
|
|
struct pci_dev *pdev;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct vme_bridge *tsi148_bridge;
|
|
|
|
|
|
|
|
tsi148_bridge = image->parent;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2014-04-03 23:48:27 +04:00
|
|
|
pdev = to_pci_dev(tsi148_bridge->parent);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:12 +03:00
|
|
|
existing_size = (unsigned long long)(image->bus_resource.end -
|
|
|
|
image->bus_resource.start);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* If the existing size is OK, return */
|
2009-10-29 19:35:01 +03:00
|
|
|
if ((size != 0) && (existing_size == (size - 1)))
|
2009-07-31 12:28:17 +04:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (existing_size != 0) {
|
|
|
|
iounmap(image->kern_base);
|
|
|
|
image->kern_base = NULL;
|
2011-03-13 08:29:13 +03:00
|
|
|
kfree(image->bus_resource.name);
|
2010-11-12 14:14:07 +03:00
|
|
|
release_resource(&image->bus_resource);
|
|
|
|
memset(&image->bus_resource, 0, sizeof(struct resource));
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
2009-10-29 19:35:01 +03:00
|
|
|
/* Exit here if size is zero */
|
2010-03-22 17:58:57 +03:00
|
|
|
if (size == 0)
|
2009-10-29 19:35:01 +03:00
|
|
|
return 0;
|
|
|
|
|
2010-02-18 18:13:12 +03:00
|
|
|
if (image->bus_resource.name == NULL) {
|
2010-05-31 00:27:46 +04:00
|
|
|
image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_ATOMIC);
|
2010-02-18 18:13:12 +03:00
|
|
|
if (image->bus_resource.name == NULL) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Unable to allocate "
|
|
|
|
"memory for resource name\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err_name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-18 18:13:12 +03:00
|
|
|
sprintf((char *)image->bus_resource.name, "%s.%d", tsi148_bridge->name,
|
2009-07-31 12:28:17 +04:00
|
|
|
image->number);
|
|
|
|
|
2010-02-18 18:13:12 +03:00
|
|
|
image->bus_resource.start = 0;
|
|
|
|
image->bus_resource.end = (unsigned long)size;
|
|
|
|
image->bus_resource.flags = IORESOURCE_MEM;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
retval = pci_bus_alloc_resource(pdev->bus,
|
2010-11-12 14:14:07 +03:00
|
|
|
&image->bus_resource, size, size, PCIBIOS_MIN_MEM,
|
2009-07-31 12:28:17 +04:00
|
|
|
0, NULL, NULL);
|
|
|
|
if (retval) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Failed to allocate mem "
|
|
|
|
"resource for window %d size 0x%lx start 0x%lx\n",
|
2009-07-31 12:28:17 +04:00
|
|
|
image->number, (unsigned long)size,
|
2010-02-18 18:13:12 +03:00
|
|
|
(unsigned long)image->bus_resource.start);
|
2009-07-31 12:28:17 +04:00
|
|
|
goto err_resource;
|
|
|
|
}
|
|
|
|
|
|
|
|
image->kern_base = ioremap_nocache(
|
2010-02-18 18:13:12 +03:00
|
|
|
image->bus_resource.start, size);
|
2009-07-31 12:28:17 +04:00
|
|
|
if (image->kern_base == NULL) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Failed to remap resource\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err_remap;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_remap:
|
2010-11-12 14:14:07 +03:00
|
|
|
release_resource(&image->bus_resource);
|
2009-07-31 12:28:17 +04:00
|
|
|
err_resource:
|
2010-02-18 18:13:12 +03:00
|
|
|
kfree(image->bus_resource.name);
|
2010-11-12 14:14:07 +03:00
|
|
|
memset(&image->bus_resource, 0, sizeof(struct resource));
|
2009-07-31 12:28:17 +04:00
|
|
|
err_name:
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Free and unmap PCI Resource
|
|
|
|
*/
|
|
|
|
static void tsi148_free_resource(struct vme_master_resource *image)
|
|
|
|
{
|
|
|
|
iounmap(image->kern_base);
|
|
|
|
image->kern_base = NULL;
|
2010-11-12 14:14:07 +03:00
|
|
|
release_resource(&image->bus_resource);
|
2010-02-18 18:13:12 +03:00
|
|
|
kfree(image->bus_resource.name);
|
2010-11-12 14:14:07 +03:00
|
|
|
memset(&image->bus_resource, 0, sizeof(struct resource));
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the attributes of an outbound window.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_master_set(struct vme_master_resource *image, int enabled,
|
2011-12-01 21:06:29 +04:00
|
|
|
unsigned long long vme_base, unsigned long long size, u32 aspace,
|
|
|
|
u32 cycle, u32 dwidth)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
int retval = 0;
|
|
|
|
unsigned int i;
|
|
|
|
unsigned int temp_ctl = 0;
|
|
|
|
unsigned int pci_base_low, pci_base_high;
|
|
|
|
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;
|
2010-03-22 17:58:50 +03:00
|
|
|
struct vme_bridge *tsi148_bridge;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
2014-04-03 23:48:16 +04:00
|
|
|
struct pci_bus_region region;
|
|
|
|
struct pci_dev *pdev;
|
2010-02-18 18:13:05 +03:00
|
|
|
|
2010-03-22 17:58:50 +03:00
|
|
|
tsi148_bridge = image->parent;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2014-04-03 23:48:27 +04:00
|
|
|
pdev = to_pci_dev(tsi148_bridge->parent);
|
2014-04-03 23:48:16 +04:00
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/* Verify input data */
|
|
|
|
if (vme_base & 0xFFFF) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid VME Window "
|
|
|
|
"alignment\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -EINVAL;
|
|
|
|
goto err_window;
|
|
|
|
}
|
2009-10-29 19:35:01 +03:00
|
|
|
|
|
|
|
if ((size == 0) && (enabled != 0)) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Size must be non-zero for "
|
|
|
|
"enabled windows\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -EINVAL;
|
|
|
|
goto err_window;
|
|
|
|
}
|
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_lock(&image->lock);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Let's allocate the resource here rather than further up the stack as
|
2011-03-31 05:57:33 +04:00
|
|
|
* it avoids pushing loads of bus dependent stuff up the stack. If size
|
2009-10-29 19:35:01 +03:00
|
|
|
* is zero, any existing resource will be freed.
|
2009-07-31 12:28:17 +04:00
|
|
|
*/
|
|
|
|
retval = tsi148_alloc_resource(image, size);
|
|
|
|
if (retval) {
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_unlock(&image->lock);
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Unable to allocate memory for "
|
2009-10-29 19:35:01 +03:00
|
|
|
"resource\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
goto err_res;
|
|
|
|
}
|
|
|
|
|
2009-10-29 19:35:01 +03:00
|
|
|
if (size == 0) {
|
|
|
|
pci_base = 0;
|
|
|
|
pci_bound = 0;
|
|
|
|
vme_offset = 0;
|
|
|
|
} else {
|
2014-04-03 23:48:16 +04:00
|
|
|
pcibios_resource_to_bus(pdev->bus, ®ion,
|
|
|
|
&image->bus_resource);
|
|
|
|
pci_base = region.start;
|
2009-10-29 19:35:01 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Bound address is a valid address for the window, adjust
|
|
|
|
* according to window granularity.
|
|
|
|
*/
|
|
|
|
pci_bound = pci_base + (size - 0x10000);
|
|
|
|
vme_offset = vme_base - pci_base;
|
|
|
|
}
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Convert 64-bit variables to 2x 32-bit variables */
|
|
|
|
reg_split(pci_base, &pci_base_high, &pci_base_low);
|
|
|
|
reg_split(pci_bound, &pci_bound_high, &pci_bound_low);
|
|
|
|
reg_split(vme_offset, &vme_offset_high, &vme_offset_low);
|
|
|
|
|
|
|
|
if (pci_base_low & 0xFFFF) {
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_unlock(&image->lock);
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid PCI base alignment\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -EINVAL;
|
|
|
|
goto err_gran;
|
|
|
|
}
|
|
|
|
if (pci_bound_low & 0xFFFF) {
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_unlock(&image->lock);
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid PCI bound alignment\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -EINVAL;
|
|
|
|
goto err_gran;
|
|
|
|
}
|
|
|
|
if (vme_offset_low & 0xFFFF) {
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_unlock(&image->lock);
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid VME Offset "
|
|
|
|
"alignment\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -EINVAL;
|
|
|
|
goto err_gran;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = image->number;
|
|
|
|
|
|
|
|
/* Disable while we are mucking around */
|
2010-02-18 18:13:05 +03:00
|
|
|
temp_ctl = ioread32be(bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTAT);
|
|
|
|
temp_ctl &= ~TSI148_LCSR_OTAT_EN;
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(temp_ctl, bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTAT);
|
|
|
|
|
|
|
|
/* Setup 2eSST speeds */
|
|
|
|
temp_ctl &= ~TSI148_LCSR_OTAT_2eSSTM_M;
|
|
|
|
switch (cycle & (VME_2eSST160 | VME_2eSST267 | VME_2eSST320)) {
|
|
|
|
case VME_2eSST160:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_2eSSTM_160;
|
|
|
|
break;
|
|
|
|
case VME_2eSST267:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_2eSSTM_267;
|
|
|
|
break;
|
|
|
|
case VME_2eSST320:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_2eSSTM_320;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup cycle types */
|
|
|
|
if (cycle & VME_BLT) {
|
|
|
|
temp_ctl &= ~TSI148_LCSR_OTAT_TM_M;
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_TM_BLT;
|
|
|
|
}
|
|
|
|
if (cycle & VME_MBLT) {
|
|
|
|
temp_ctl &= ~TSI148_LCSR_OTAT_TM_M;
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_TM_MBLT;
|
|
|
|
}
|
|
|
|
if (cycle & VME_2eVME) {
|
|
|
|
temp_ctl &= ~TSI148_LCSR_OTAT_TM_M;
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_TM_2eVME;
|
|
|
|
}
|
|
|
|
if (cycle & VME_2eSST) {
|
|
|
|
temp_ctl &= ~TSI148_LCSR_OTAT_TM_M;
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_TM_2eSST;
|
|
|
|
}
|
|
|
|
if (cycle & VME_2eSSTB) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_warn(tsi148_bridge->parent, "Currently not setting "
|
|
|
|
"Broadcast Select Registers\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
temp_ctl &= ~TSI148_LCSR_OTAT_TM_M;
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_TM_2eSSTB;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup data width */
|
|
|
|
temp_ctl &= ~TSI148_LCSR_OTAT_DBW_M;
|
|
|
|
switch (dwidth) {
|
|
|
|
case VME_D16:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_DBW_16;
|
|
|
|
break;
|
|
|
|
case VME_D32:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_DBW_32;
|
|
|
|
break;
|
|
|
|
default:
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_unlock(&image->lock);
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid data width\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -EINVAL;
|
|
|
|
goto err_dwidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup address space */
|
|
|
|
temp_ctl &= ~TSI148_LCSR_OTAT_AMODE_M;
|
|
|
|
switch (aspace) {
|
|
|
|
case VME_A16:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_AMODE_A16;
|
|
|
|
break;
|
|
|
|
case VME_A24:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_AMODE_A24;
|
|
|
|
break;
|
|
|
|
case VME_A32:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_AMODE_A32;
|
|
|
|
break;
|
|
|
|
case VME_A64:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_AMODE_A64;
|
|
|
|
break;
|
|
|
|
case VME_CRCSR:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_AMODE_CRCSR;
|
|
|
|
break;
|
|
|
|
case VME_USER1:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_AMODE_USER1;
|
|
|
|
break;
|
|
|
|
case VME_USER2:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_AMODE_USER2;
|
|
|
|
break;
|
|
|
|
case VME_USER3:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_AMODE_USER3;
|
|
|
|
break;
|
|
|
|
case VME_USER4:
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_AMODE_USER4;
|
|
|
|
break;
|
|
|
|
default:
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_unlock(&image->lock);
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid address space\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -EINVAL;
|
|
|
|
goto err_aspace;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
temp_ctl &= ~(3<<4);
|
|
|
|
if (cycle & VME_SUPER)
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_SUP;
|
|
|
|
if (cycle & VME_PROG)
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_PGM;
|
|
|
|
|
|
|
|
/* Setup mapping */
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(pci_base_high, bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTSAU);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(pci_base_low, bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTSAL);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(pci_bound_high, bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTEAU);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(pci_bound_low, bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTEAL);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(vme_offset_high, bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTOFU);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(vme_offset_low, bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTOFL);
|
|
|
|
|
|
|
|
/* Write ctl reg without enable */
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(temp_ctl, bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTAT);
|
|
|
|
|
|
|
|
if (enabled)
|
|
|
|
temp_ctl |= TSI148_LCSR_OTAT_EN;
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(temp_ctl, bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTAT);
|
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_unlock(&image->lock);
|
2009-07-31 12:28:17 +04:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_aspace:
|
|
|
|
err_dwidth:
|
|
|
|
err_gran:
|
|
|
|
tsi148_free_resource(image);
|
|
|
|
err_res:
|
|
|
|
err_window:
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the attributes of an outbound window.
|
|
|
|
*
|
|
|
|
* XXX Not parsing prefetch information.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int __tsi148_master_get(struct vme_master_resource *image, int *enabled,
|
2011-12-01 21:06:29 +04:00
|
|
|
unsigned long long *vme_base, unsigned long long *size, u32 *aspace,
|
|
|
|
u32 *cycle, u32 *dwidth)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
unsigned int i, ctl;
|
|
|
|
unsigned int pci_base_low, pci_base_high;
|
|
|
|
unsigned int pci_bound_low, pci_bound_high;
|
|
|
|
unsigned int vme_offset_low, vme_offset_high;
|
|
|
|
|
|
|
|
unsigned long long pci_base, pci_bound, vme_offset;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = image->parent->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
i = image->number;
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
ctl = ioread32be(bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTAT);
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
pci_base_high = ioread32be(bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTSAU);
|
2010-02-18 18:13:05 +03:00
|
|
|
pci_base_low = ioread32be(bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTSAL);
|
2010-02-18 18:13:05 +03:00
|
|
|
pci_bound_high = ioread32be(bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTEAU);
|
2010-02-18 18:13:05 +03:00
|
|
|
pci_bound_low = ioread32be(bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTEAL);
|
2010-02-18 18:13:05 +03:00
|
|
|
vme_offset_high = ioread32be(bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTOFU);
|
2010-02-18 18:13:05 +03:00
|
|
|
vme_offset_low = ioread32be(bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTOFL);
|
|
|
|
|
|
|
|
/* Convert 64-bit variables to 2x 32-bit variables */
|
|
|
|
reg_join(pci_base_high, pci_base_low, &pci_base);
|
|
|
|
reg_join(pci_bound_high, pci_bound_low, &pci_bound);
|
|
|
|
reg_join(vme_offset_high, vme_offset_low, &vme_offset);
|
|
|
|
|
|
|
|
*vme_base = pci_base + vme_offset;
|
|
|
|
*size = (unsigned long long)(pci_bound - pci_base) + 0x10000;
|
|
|
|
|
|
|
|
*enabled = 0;
|
|
|
|
*aspace = 0;
|
|
|
|
*cycle = 0;
|
|
|
|
*dwidth = 0;
|
|
|
|
|
|
|
|
if (ctl & TSI148_LCSR_OTAT_EN)
|
|
|
|
*enabled = 1;
|
|
|
|
|
|
|
|
/* Setup address space */
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_AMODE_M) == TSI148_LCSR_OTAT_AMODE_A16)
|
|
|
|
*aspace |= VME_A16;
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_AMODE_M) == TSI148_LCSR_OTAT_AMODE_A24)
|
|
|
|
*aspace |= VME_A24;
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_AMODE_M) == TSI148_LCSR_OTAT_AMODE_A32)
|
|
|
|
*aspace |= VME_A32;
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_AMODE_M) == TSI148_LCSR_OTAT_AMODE_A64)
|
|
|
|
*aspace |= VME_A64;
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_AMODE_M) == TSI148_LCSR_OTAT_AMODE_CRCSR)
|
|
|
|
*aspace |= VME_CRCSR;
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_AMODE_M) == TSI148_LCSR_OTAT_AMODE_USER1)
|
|
|
|
*aspace |= VME_USER1;
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_AMODE_M) == TSI148_LCSR_OTAT_AMODE_USER2)
|
|
|
|
*aspace |= VME_USER2;
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_AMODE_M) == TSI148_LCSR_OTAT_AMODE_USER3)
|
|
|
|
*aspace |= VME_USER3;
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_AMODE_M) == TSI148_LCSR_OTAT_AMODE_USER4)
|
|
|
|
*aspace |= VME_USER4;
|
|
|
|
|
|
|
|
/* Setup 2eSST speeds */
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_2eSSTM_M) == TSI148_LCSR_OTAT_2eSSTM_160)
|
|
|
|
*cycle |= VME_2eSST160;
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_2eSSTM_M) == TSI148_LCSR_OTAT_2eSSTM_267)
|
|
|
|
*cycle |= VME_2eSST267;
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_2eSSTM_M) == TSI148_LCSR_OTAT_2eSSTM_320)
|
|
|
|
*cycle |= VME_2eSST320;
|
|
|
|
|
|
|
|
/* Setup cycle types */
|
2010-03-22 17:58:57 +03:00
|
|
|
if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_SCT)
|
2009-07-31 12:28:17 +04:00
|
|
|
*cycle |= VME_SCT;
|
2010-03-22 17:58:57 +03:00
|
|
|
if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_BLT)
|
2009-07-31 12:28:17 +04:00
|
|
|
*cycle |= VME_BLT;
|
2010-03-22 17:58:57 +03:00
|
|
|
if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_MBLT)
|
2009-07-31 12:28:17 +04:00
|
|
|
*cycle |= VME_MBLT;
|
2010-03-22 17:58:57 +03:00
|
|
|
if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_2eVME)
|
2009-07-31 12:28:17 +04:00
|
|
|
*cycle |= VME_2eVME;
|
2010-03-22 17:58:57 +03:00
|
|
|
if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_2eSST)
|
2009-07-31 12:28:17 +04:00
|
|
|
*cycle |= VME_2eSST;
|
2010-03-22 17:58:57 +03:00
|
|
|
if ((ctl & TSI148_LCSR_OTAT_TM_M) == TSI148_LCSR_OTAT_TM_2eSSTB)
|
2009-07-31 12:28:17 +04:00
|
|
|
*cycle |= VME_2eSSTB;
|
|
|
|
|
|
|
|
if (ctl & TSI148_LCSR_OTAT_SUP)
|
|
|
|
*cycle |= VME_SUPER;
|
|
|
|
else
|
|
|
|
*cycle |= VME_USER;
|
|
|
|
|
|
|
|
if (ctl & TSI148_LCSR_OTAT_PGM)
|
|
|
|
*cycle |= VME_PROG;
|
|
|
|
else
|
|
|
|
*cycle |= VME_DATA;
|
|
|
|
|
|
|
|
/* Setup data width */
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_DBW_M) == TSI148_LCSR_OTAT_DBW_16)
|
|
|
|
*dwidth = VME_D16;
|
|
|
|
if ((ctl & TSI148_LCSR_OTAT_DBW_M) == TSI148_LCSR_OTAT_DBW_32)
|
|
|
|
*dwidth = VME_D32;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_master_get(struct vme_master_resource *image, int *enabled,
|
2011-12-01 21:06:29 +04:00
|
|
|
unsigned long long *vme_base, unsigned long long *size, u32 *aspace,
|
|
|
|
u32 *cycle, u32 *dwidth)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_lock(&image->lock);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
retval = __tsi148_master_get(image, enabled, vme_base, size, aspace,
|
|
|
|
cycle, dwidth);
|
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_unlock(&image->lock);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2010-11-12 14:15:00 +03:00
|
|
|
static ssize_t tsi148_master_read(struct vme_master_resource *image, void *buf,
|
2009-07-31 12:28:17 +04:00
|
|
|
size_t count, loff_t offset)
|
|
|
|
{
|
|
|
|
int retval, enabled;
|
|
|
|
unsigned long long vme_base, size;
|
2011-12-01 21:06:29 +04:00
|
|
|
u32 aspace, cycle, dwidth;
|
2009-07-31 12:28:17 +04:00
|
|
|
struct vme_bus_error *vme_err = NULL;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct vme_bridge *tsi148_bridge;
|
2013-08-19 11:40:15 +04:00
|
|
|
void __iomem *addr = image->kern_base + offset;
|
2012-07-19 20:48:46 +04:00
|
|
|
unsigned int done = 0;
|
|
|
|
unsigned int count32;
|
2010-02-18 18:13:05 +03:00
|
|
|
|
|
|
|
tsi148_bridge = image->parent;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_lock(&image->lock);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2012-07-19 20:48:46 +04:00
|
|
|
/* The following code handles VME address alignment. We cannot use
|
2014-02-06 17:35:36 +04:00
|
|
|
* memcpy_xxx here because it may cut data transfers in to 8-bit
|
|
|
|
* cycles when D16 or D32 cycles are required on the VME bus.
|
2012-07-19 20:48:46 +04:00
|
|
|
* On the other hand, the bridge itself assures that the maximum data
|
|
|
|
* cycle configured for the transfer is used and splits it
|
|
|
|
* automatically for non-aligned addresses, so we don't want the
|
|
|
|
* overhead of needlessly forcing small transfers for the entire cycle.
|
|
|
|
*/
|
|
|
|
if ((uintptr_t)addr & 0x1) {
|
|
|
|
*(u8 *)buf = ioread8(addr);
|
|
|
|
done += 1;
|
|
|
|
if (done == count)
|
|
|
|
goto out;
|
|
|
|
}
|
2014-02-07 19:48:56 +04:00
|
|
|
if ((uintptr_t)(addr + done) & 0x2) {
|
2012-07-19 20:48:46 +04:00
|
|
|
if ((count - done) < 2) {
|
|
|
|
*(u8 *)(buf + done) = ioread8(addr + done);
|
|
|
|
done += 1;
|
|
|
|
goto out;
|
|
|
|
} else {
|
|
|
|
*(u16 *)(buf + done) = ioread16(addr + done);
|
|
|
|
done += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
count32 = (count - done) & ~0x3;
|
2014-02-06 17:35:36 +04:00
|
|
|
while (done < count32) {
|
|
|
|
*(u32 *)(buf + done) = ioread32(addr + done);
|
|
|
|
done += 4;
|
2012-07-19 20:48:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((count - done) & 0x2) {
|
|
|
|
*(u16 *)(buf + done) = ioread16(addr + done);
|
|
|
|
done += 2;
|
|
|
|
}
|
|
|
|
if ((count - done) & 0x1) {
|
|
|
|
*(u8 *)(buf + done) = ioread8(addr + done);
|
|
|
|
done += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = count;
|
|
|
|
|
|
|
|
if (!err_chk)
|
|
|
|
goto skip_chk;
|
|
|
|
|
|
|
|
__tsi148_master_get(image, &enabled, &vme_base, &size, &aspace, &cycle,
|
|
|
|
&dwidth);
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
vme_err = tsi148_find_error(tsi148_bridge, aspace, vme_base + offset,
|
|
|
|
count);
|
2010-03-22 17:58:57 +03:00
|
|
|
if (vme_err != NULL) {
|
2009-07-31 12:28:17 +04:00
|
|
|
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);
|
|
|
|
/* Clear down save errors in this address range */
|
2010-02-18 18:13:05 +03:00
|
|
|
tsi148_clear_errors(tsi148_bridge, aspace, vme_base + offset,
|
|
|
|
count);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
skip_chk:
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_unlock(&image->lock);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-12 14:15:00 +03:00
|
|
|
static ssize_t tsi148_master_write(struct vme_master_resource *image, void *buf,
|
2009-07-31 12:28:17 +04:00
|
|
|
size_t count, loff_t offset)
|
|
|
|
{
|
|
|
|
int retval = 0, enabled;
|
|
|
|
unsigned long long vme_base, size;
|
2011-12-01 21:06:29 +04:00
|
|
|
u32 aspace, cycle, dwidth;
|
2013-08-19 11:40:15 +04:00
|
|
|
void __iomem *addr = image->kern_base + offset;
|
2012-07-19 20:48:46 +04:00
|
|
|
unsigned int done = 0;
|
|
|
|
unsigned int count32;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
struct vme_bus_error *vme_err = NULL;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct vme_bridge *tsi148_bridge;
|
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
tsi148_bridge = image->parent;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_lock(&image->lock);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2012-07-19 20:48:46 +04:00
|
|
|
/* Here we apply for the same strategy we do in master_read
|
2014-02-06 17:35:36 +04:00
|
|
|
* function in order to assure the correct cycles.
|
2012-07-19 20:48:46 +04:00
|
|
|
*/
|
|
|
|
if ((uintptr_t)addr & 0x1) {
|
|
|
|
iowrite8(*(u8 *)buf, addr);
|
|
|
|
done += 1;
|
|
|
|
if (done == count)
|
|
|
|
goto out;
|
|
|
|
}
|
2014-02-07 19:48:56 +04:00
|
|
|
if ((uintptr_t)(addr + done) & 0x2) {
|
2012-07-19 20:48:46 +04:00
|
|
|
if ((count - done) < 2) {
|
|
|
|
iowrite8(*(u8 *)(buf + done), addr + done);
|
|
|
|
done += 1;
|
|
|
|
goto out;
|
|
|
|
} else {
|
|
|
|
iowrite16(*(u16 *)(buf + done), addr + done);
|
|
|
|
done += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
count32 = (count - done) & ~0x3;
|
2014-02-06 17:35:36 +04:00
|
|
|
while (done < count32) {
|
|
|
|
iowrite32(*(u32 *)(buf + done), addr + done);
|
|
|
|
done += 4;
|
2012-07-19 20:48:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((count - done) & 0x2) {
|
|
|
|
iowrite16(*(u16 *)(buf + done), addr + done);
|
|
|
|
done += 2;
|
|
|
|
}
|
|
|
|
if ((count - done) & 0x1) {
|
|
|
|
iowrite8(*(u8 *)(buf + done), addr + done);
|
|
|
|
done += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = count;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Writes are posted. We need to do a read on the VME bus to flush out
|
2011-03-31 05:57:33 +04:00
|
|
|
* all of the writes before we check for errors. We can't guarantee
|
2009-07-31 12:28:17 +04:00
|
|
|
* that reading the data we have just written is safe. It is believed
|
|
|
|
* that there isn't any read, write re-ordering, so we can read any
|
|
|
|
* location in VME space, so lets read the Device ID from the tsi148's
|
|
|
|
* own registers as mapped into CR/CSR space.
|
|
|
|
*
|
|
|
|
* We check for saved errors in the written address range/space.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (!err_chk)
|
|
|
|
goto skip_chk;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get window info first, to maximise the time that the buffers may
|
|
|
|
* fluch on their own
|
|
|
|
*/
|
|
|
|
__tsi148_master_get(image, &enabled, &vme_base, &size, &aspace, &cycle,
|
|
|
|
&dwidth);
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
ioread16(bridge->flush_image->kern_base + 0x7F000);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
vme_err = tsi148_find_error(tsi148_bridge, aspace, vme_base + offset,
|
|
|
|
count);
|
2010-03-22 17:58:57 +03:00
|
|
|
if (vme_err != NULL) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_warn(tsi148_bridge->parent, "First VME write error detected"
|
|
|
|
" an at address 0x%llx\n", vme_err->address);
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = vme_err->address - (vme_base + offset);
|
|
|
|
/* Clear down save errors in this address range */
|
2010-02-18 18:13:05 +03:00
|
|
|
tsi148_clear_errors(tsi148_bridge, aspace, vme_base + offset,
|
|
|
|
count);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
skip_chk:
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_unlock(&image->lock);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Perform an RMW cycle on the VME bus.
|
|
|
|
*
|
|
|
|
* Requires a previously configured master window, returns final value.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static unsigned int tsi148_master_rmw(struct vme_master_resource *image,
|
2009-07-31 12:28:17 +04:00
|
|
|
unsigned int mask, unsigned int compare, unsigned int swap,
|
|
|
|
loff_t offset)
|
|
|
|
{
|
|
|
|
unsigned long long pci_addr;
|
|
|
|
unsigned int pci_addr_high, pci_addr_low;
|
|
|
|
u32 tmp, result;
|
|
|
|
int i;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
bridge = image->parent->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Find the PCI address that maps to the desired VME address */
|
|
|
|
i = image->number;
|
|
|
|
|
|
|
|
/* Locking as we can only do one of these at a time */
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_lock(&bridge->vme_rmw);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Lock image */
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_lock(&image->lock);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
pci_addr_high = ioread32be(bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTSAU);
|
2010-02-18 18:13:05 +03:00
|
|
|
pci_addr_low = ioread32be(bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTSAL);
|
|
|
|
|
|
|
|
reg_join(pci_addr_high, pci_addr_low, &pci_addr);
|
|
|
|
reg_split(pci_addr + offset, &pci_addr_high, &pci_addr_low);
|
|
|
|
|
|
|
|
/* Configure registers */
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(mask, bridge->base + TSI148_LCSR_RMWEN);
|
|
|
|
iowrite32be(compare, bridge->base + TSI148_LCSR_RMWC);
|
|
|
|
iowrite32be(swap, bridge->base + TSI148_LCSR_RMWS);
|
|
|
|
iowrite32be(pci_addr_high, bridge->base + TSI148_LCSR_RMWAU);
|
|
|
|
iowrite32be(pci_addr_low, bridge->base + TSI148_LCSR_RMWAL);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Enable RMW */
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_VMCTRL);
|
2009-07-31 12:28:17 +04:00
|
|
|
tmp |= TSI148_LCSR_VMCTRL_RMWEN;
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_VMCTRL);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Kick process off with a read to the required address. */
|
|
|
|
result = ioread32be(image->kern_base + offset);
|
|
|
|
|
|
|
|
/* Disable RMW */
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_VMCTRL);
|
2009-07-31 12:28:17 +04:00
|
|
|
tmp &= ~TSI148_LCSR_VMCTRL_RMWEN;
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_VMCTRL);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_unlock(&image->lock);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&bridge->vme_rmw);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2012-03-22 17:27:30 +04:00
|
|
|
static int tsi148_dma_set_vme_src_attributes(struct device *dev, __be32 *attr,
|
2011-12-01 21:06:29 +04:00
|
|
|
u32 aspace, u32 cycle, u32 dwidth)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
2012-03-22 17:27:30 +04:00
|
|
|
u32 val;
|
|
|
|
|
|
|
|
val = be32_to_cpu(*attr);
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/* Setup 2eSST speeds */
|
|
|
|
switch (cycle & (VME_2eSST160 | VME_2eSST267 | VME_2eSST320)) {
|
|
|
|
case VME_2eSST160:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_2eSSTM_160;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_2eSST267:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_2eSSTM_267;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_2eSST320:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_2eSSTM_320;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup cycle types */
|
2010-03-22 17:58:57 +03:00
|
|
|
if (cycle & VME_SCT)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_TM_SCT;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
|
|
|
if (cycle & VME_BLT)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_TM_BLT;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
|
|
|
if (cycle & VME_MBLT)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_TM_MBLT;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
|
|
|
if (cycle & VME_2eVME)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_TM_2eVME;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
|
|
|
if (cycle & VME_2eSST)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_TM_2eSST;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
if (cycle & VME_2eSSTB) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(dev, "Currently not setting Broadcast Select "
|
|
|
|
"Registers\n");
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_TM_2eSSTB;
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup data width */
|
|
|
|
switch (dwidth) {
|
|
|
|
case VME_D16:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_DBW_16;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_D32:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_DBW_32;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
default:
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(dev, "Invalid data width\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup address space */
|
|
|
|
switch (aspace) {
|
|
|
|
case VME_A16:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_AMODE_A16;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_A24:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_AMODE_A24;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_A32:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_AMODE_A32;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_A64:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_AMODE_A64;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_CRCSR:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_AMODE_CRCSR;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_USER1:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_AMODE_USER1;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_USER2:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_AMODE_USER2;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_USER3:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_AMODE_USER3;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_USER4:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_AMODE_USER4;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
default:
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(dev, "Invalid address space\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cycle & VME_SUPER)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_SUP;
|
2009-07-31 12:28:17 +04:00
|
|
|
if (cycle & VME_PROG)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_PGM;
|
|
|
|
|
|
|
|
*attr = cpu_to_be32(val);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-03-22 17:27:30 +04:00
|
|
|
static int tsi148_dma_set_vme_dest_attributes(struct device *dev, __be32 *attr,
|
2011-12-01 21:06:29 +04:00
|
|
|
u32 aspace, u32 cycle, u32 dwidth)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
2012-03-22 17:27:30 +04:00
|
|
|
u32 val;
|
|
|
|
|
|
|
|
val = be32_to_cpu(*attr);
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/* Setup 2eSST speeds */
|
|
|
|
switch (cycle & (VME_2eSST160 | VME_2eSST267 | VME_2eSST320)) {
|
|
|
|
case VME_2eSST160:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_2eSSTM_160;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_2eSST267:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_2eSSTM_267;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_2eSST320:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_2eSSTM_320;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup cycle types */
|
2010-03-22 17:58:57 +03:00
|
|
|
if (cycle & VME_SCT)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_TM_SCT;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
|
|
|
if (cycle & VME_BLT)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_TM_BLT;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
|
|
|
if (cycle & VME_MBLT)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_TM_MBLT;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
|
|
|
if (cycle & VME_2eVME)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_TM_2eVME;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
|
|
|
if (cycle & VME_2eSST)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_TM_2eSST;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
if (cycle & VME_2eSSTB) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(dev, "Currently not setting Broadcast Select "
|
|
|
|
"Registers\n");
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_TM_2eSSTB;
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup data width */
|
|
|
|
switch (dwidth) {
|
|
|
|
case VME_D16:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_DBW_16;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_D32:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_DBW_32;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
default:
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(dev, "Invalid data width\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup address space */
|
|
|
|
switch (aspace) {
|
|
|
|
case VME_A16:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_AMODE_A16;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_A24:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_AMODE_A24;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_A32:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_AMODE_A32;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_A64:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_AMODE_A64;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_CRCSR:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_AMODE_CRCSR;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_USER1:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_AMODE_USER1;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_USER2:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_AMODE_USER2;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_USER3:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_AMODE_USER3;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_USER4:
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_AMODE_USER4;
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
default:
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(dev, "Invalid address space\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cycle & VME_SUPER)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_SUP;
|
2009-07-31 12:28:17 +04:00
|
|
|
if (cycle & VME_PROG)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DDAT_PGM;
|
|
|
|
|
|
|
|
*attr = cpu_to_be32(val);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add a link list descriptor to the list
|
2012-03-22 17:27:30 +04:00
|
|
|
*
|
|
|
|
* Note: DMA engine expects the DMA descriptor to be big endian.
|
2009-07-31 12:28:17 +04:00
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_dma_list_add(struct vme_dma_list *list,
|
|
|
|
struct vme_dma_attr *src, struct vme_dma_attr *dest, size_t count)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
struct tsi148_dma_entry *entry, *prev;
|
2012-03-22 17:27:30 +04:00
|
|
|
u32 address_high, address_low, val;
|
2009-07-31 12:28:17 +04:00
|
|
|
struct vme_dma_pattern *pattern_attr;
|
|
|
|
struct vme_dma_pci *pci_attr;
|
|
|
|
struct vme_dma_vme *vme_attr;
|
|
|
|
int retval = 0;
|
2010-03-22 17:58:50 +03:00
|
|
|
struct vme_bridge *tsi148_bridge;
|
|
|
|
|
|
|
|
tsi148_bridge = list->parent->parent;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 19:22:13 +03:00
|
|
|
/* Descriptor must be aligned on 64-bit boundaries */
|
2010-03-22 17:58:57 +03:00
|
|
|
entry = kmalloc(sizeof(struct tsi148_dma_entry), GFP_KERNEL);
|
2009-07-31 12:28:17 +04:00
|
|
|
if (entry == NULL) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Failed to allocate memory for "
|
|
|
|
"dma resource structure\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err_mem;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Test descriptor alignment */
|
2010-11-12 14:14:07 +03:00
|
|
|
if ((unsigned long)&entry->descriptor & 0x7) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Descriptor not aligned to 8 "
|
|
|
|
"byte boundary as required: %p\n",
|
2010-11-12 14:14:07 +03:00
|
|
|
&entry->descriptor);
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -EINVAL;
|
|
|
|
goto err_align;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Given we are going to fill out the structure, we probably don't
|
|
|
|
* need to zero it, but better safe than sorry for now.
|
|
|
|
*/
|
2010-11-12 14:14:07 +03:00
|
|
|
memset(&entry->descriptor, 0, sizeof(struct tsi148_dma_descriptor));
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Fill out source part */
|
|
|
|
switch (src->type) {
|
|
|
|
case VME_DMA_PATTERN:
|
2010-06-29 14:16:20 +04:00
|
|
|
pattern_attr = src->private;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2012-03-22 17:27:30 +04:00
|
|
|
entry->descriptor.dsal = cpu_to_be32(pattern_attr->pattern);
|
|
|
|
|
|
|
|
val = TSI148_LCSR_DSAT_TYP_PAT;
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/* Default behaviour is 32 bit pattern */
|
2010-03-22 17:58:57 +03:00
|
|
|
if (pattern_attr->type & VME_DMA_PATTERN_BYTE)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_PSZ;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/* It seems that the default behaviour is to increment */
|
2010-03-22 17:58:57 +03:00
|
|
|
if ((pattern_attr->type & VME_DMA_PATTERN_INCREMENT) == 0)
|
2012-03-22 17:27:30 +04:00
|
|
|
val |= TSI148_LCSR_DSAT_NIN;
|
|
|
|
entry->descriptor.dsat = cpu_to_be32(val);
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_DMA_PCI:
|
2010-06-29 14:16:20 +04:00
|
|
|
pci_attr = src->private;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
reg_split((unsigned long long)pci_attr->address, &address_high,
|
|
|
|
&address_low);
|
2012-03-22 17:27:30 +04:00
|
|
|
entry->descriptor.dsau = cpu_to_be32(address_high);
|
|
|
|
entry->descriptor.dsal = cpu_to_be32(address_low);
|
|
|
|
entry->descriptor.dsat = cpu_to_be32(TSI148_LCSR_DSAT_TYP_PCI);
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_DMA_VME:
|
2010-06-29 14:16:20 +04:00
|
|
|
vme_attr = src->private;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
reg_split((unsigned long long)vme_attr->address, &address_high,
|
|
|
|
&address_low);
|
2012-03-22 17:27:30 +04:00
|
|
|
entry->descriptor.dsau = cpu_to_be32(address_high);
|
|
|
|
entry->descriptor.dsal = cpu_to_be32(address_low);
|
|
|
|
entry->descriptor.dsat = cpu_to_be32(TSI148_LCSR_DSAT_TYP_VME);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
retval = tsi148_dma_set_vme_src_attributes(
|
2010-11-12 14:14:07 +03:00
|
|
|
tsi148_bridge->parent, &entry->descriptor.dsat,
|
2010-03-22 17:58:50 +03:00
|
|
|
vme_attr->aspace, vme_attr->cycle, vme_attr->dwidth);
|
2010-03-22 17:58:57 +03:00
|
|
|
if (retval < 0)
|
2009-07-31 12:28:17 +04:00
|
|
|
goto err_source;
|
|
|
|
break;
|
|
|
|
default:
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid source type\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -EINVAL;
|
|
|
|
goto err_source;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Assume last link - this will be over-written by adding another */
|
2012-03-22 17:27:30 +04:00
|
|
|
entry->descriptor.dnlau = cpu_to_be32(0);
|
|
|
|
entry->descriptor.dnlal = cpu_to_be32(TSI148_LCSR_DNLAL_LLA);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Fill out destination part */
|
|
|
|
switch (dest->type) {
|
|
|
|
case VME_DMA_PCI:
|
2010-06-29 14:16:20 +04:00
|
|
|
pci_attr = dest->private;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
reg_split((unsigned long long)pci_attr->address, &address_high,
|
|
|
|
&address_low);
|
2012-03-22 17:27:30 +04:00
|
|
|
entry->descriptor.ddau = cpu_to_be32(address_high);
|
|
|
|
entry->descriptor.ddal = cpu_to_be32(address_low);
|
|
|
|
entry->descriptor.ddat = cpu_to_be32(TSI148_LCSR_DDAT_TYP_PCI);
|
2009-07-31 12:28:17 +04:00
|
|
|
break;
|
|
|
|
case VME_DMA_VME:
|
2010-06-29 14:16:20 +04:00
|
|
|
vme_attr = dest->private;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
reg_split((unsigned long long)vme_attr->address, &address_high,
|
|
|
|
&address_low);
|
2012-03-22 17:27:30 +04:00
|
|
|
entry->descriptor.ddau = cpu_to_be32(address_high);
|
|
|
|
entry->descriptor.ddal = cpu_to_be32(address_low);
|
|
|
|
entry->descriptor.ddat = cpu_to_be32(TSI148_LCSR_DDAT_TYP_VME);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
retval = tsi148_dma_set_vme_dest_attributes(
|
2010-11-12 14:14:07 +03:00
|
|
|
tsi148_bridge->parent, &entry->descriptor.ddat,
|
2010-03-22 17:58:50 +03:00
|
|
|
vme_attr->aspace, vme_attr->cycle, vme_attr->dwidth);
|
2010-03-22 17:58:57 +03:00
|
|
|
if (retval < 0)
|
2009-07-31 12:28:17 +04:00
|
|
|
goto err_dest;
|
|
|
|
break;
|
|
|
|
default:
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid destination type\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -EINVAL;
|
|
|
|
goto err_dest;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Fill out count */
|
2012-03-22 17:27:30 +04:00
|
|
|
entry->descriptor.dcnt = cpu_to_be32((u32)count);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Add to list */
|
2010-11-12 14:14:07 +03:00
|
|
|
list_add_tail(&entry->list, &list->entries);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Fill out previous descriptors "Next Address" */
|
2010-11-12 14:14:07 +03:00
|
|
|
if (entry->list.prev != &list->entries) {
|
2009-07-31 12:28:17 +04:00
|
|
|
prev = list_entry(entry->list.prev, struct tsi148_dma_entry,
|
|
|
|
list);
|
|
|
|
/* We need the bus address for the pointer */
|
2012-03-22 17:27:29 +04:00
|
|
|
entry->dma_handle = dma_map_single(tsi148_bridge->parent,
|
|
|
|
&entry->descriptor,
|
|
|
|
sizeof(struct tsi148_dma_descriptor), DMA_TO_DEVICE);
|
|
|
|
|
2012-03-22 17:27:30 +04:00
|
|
|
reg_split((unsigned long long)entry->dma_handle, &address_high,
|
|
|
|
&address_low);
|
|
|
|
entry->descriptor.dnlau = cpu_to_be32(address_high);
|
|
|
|
entry->descriptor.dnlal = cpu_to_be32(address_low);
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_dest:
|
|
|
|
err_source:
|
|
|
|
err_align:
|
|
|
|
kfree(entry);
|
|
|
|
err_mem:
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if the provided DMA channel is busy.
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
static int tsi148_dma_busy(struct vme_bridge *tsi148_bridge, int channel)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
u32 tmp;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_DMA[channel] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_DSTA);
|
|
|
|
|
|
|
|
if (tmp & TSI148_LCSR_DSTA_BSY)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Execute a previously generated link list
|
|
|
|
*
|
|
|
|
* XXX Need to provide control register configuration.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_dma_list_exec(struct vme_dma_list *list)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
struct vme_dma_resource *ctrlr;
|
|
|
|
int channel, retval = 0;
|
|
|
|
struct tsi148_dma_entry *entry;
|
|
|
|
u32 bus_addr_high, bus_addr_low;
|
|
|
|
u32 val, dctlreg = 0;
|
2010-03-22 17:58:50 +03:00
|
|
|
struct vme_bridge *tsi148_bridge;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
ctrlr = list->parent;
|
|
|
|
|
2010-03-22 17:58:50 +03:00
|
|
|
tsi148_bridge = ctrlr->parent;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2010-02-18 18:13:05 +03:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_lock(&ctrlr->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
channel = ctrlr->number;
|
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
if (!list_empty(&ctrlr->running)) {
|
2009-07-31 12:28:17 +04:00
|
|
|
/*
|
|
|
|
* XXX We have an active DMA transfer and currently haven't
|
|
|
|
* sorted out the mechanism for "pending" DMA transfers.
|
|
|
|
* Return busy.
|
|
|
|
*/
|
|
|
|
/* Need to add to pending here */
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&ctrlr->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EBUSY;
|
|
|
|
} else {
|
2010-11-12 14:14:07 +03:00
|
|
|
list_add(&list->list, &ctrlr->running);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get first bus address and write into registers */
|
2010-11-12 14:14:07 +03:00
|
|
|
entry = list_first_entry(&list->entries, struct tsi148_dma_entry,
|
2009-07-31 12:28:17 +04:00
|
|
|
list);
|
|
|
|
|
2012-03-22 17:27:29 +04:00
|
|
|
entry->dma_handle = dma_map_single(tsi148_bridge->parent,
|
|
|
|
&entry->descriptor,
|
|
|
|
sizeof(struct tsi148_dma_descriptor), DMA_TO_DEVICE);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&ctrlr->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2012-03-22 17:27:29 +04:00
|
|
|
reg_split(entry->dma_handle, &bus_addr_high, &bus_addr_low);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(bus_addr_high, bridge->base +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_DMA[channel] + TSI148_LCSR_OFFSET_DNLAU);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(bus_addr_low, bridge->base +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_DMA[channel] + TSI148_LCSR_OFFSET_DNLAL);
|
|
|
|
|
2012-03-22 17:27:30 +04:00
|
|
|
dctlreg = ioread32be(bridge->base + TSI148_LCSR_DMA[channel] +
|
|
|
|
TSI148_LCSR_OFFSET_DCTL);
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/* Start the operation */
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(dctlreg | TSI148_LCSR_DCTL_DGO, bridge->base +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_DMA[channel] + TSI148_LCSR_OFFSET_DCTL);
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
wait_event_interruptible(bridge->dma_queue[channel],
|
|
|
|
tsi148_dma_busy(ctrlr->parent, channel));
|
2012-03-22 17:27:30 +04:00
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/*
|
|
|
|
* Read status register, this register is valid until we kick off a
|
|
|
|
* new transfer.
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
val = ioread32be(bridge->base + TSI148_LCSR_DMA[channel] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_DSTA);
|
|
|
|
|
|
|
|
if (val & TSI148_LCSR_DSTA_VBE) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "DMA Error. DSTA=%08X\n", val);
|
2009-07-31 12:28:17 +04:00
|
|
|
retval = -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Remove list from running list */
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_lock(&ctrlr->mtx);
|
|
|
|
list_del(&list->list);
|
|
|
|
mutex_unlock(&ctrlr->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clean up a previously generated link list
|
|
|
|
*
|
|
|
|
* We have a separate function, don't assume that the chain can't be reused.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_dma_list_empty(struct vme_dma_list *list)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
struct list_head *pos, *temp;
|
2010-03-22 17:58:57 +03:00
|
|
|
struct tsi148_dma_entry *entry;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2012-03-22 17:27:29 +04:00
|
|
|
struct vme_bridge *tsi148_bridge = list->parent->parent;
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/* detach and free each entry */
|
2010-11-12 14:14:07 +03:00
|
|
|
list_for_each_safe(pos, temp, &list->entries) {
|
2009-07-31 12:28:17 +04:00
|
|
|
list_del(pos);
|
|
|
|
entry = list_entry(pos, struct tsi148_dma_entry, list);
|
2012-03-22 17:27:29 +04:00
|
|
|
|
|
|
|
dma_unmap_single(tsi148_bridge->parent, entry->dma_handle,
|
|
|
|
sizeof(struct tsi148_dma_descriptor), DMA_TO_DEVICE);
|
2009-07-31 12:28:17 +04:00
|
|
|
kfree(entry);
|
|
|
|
}
|
|
|
|
|
2010-03-22 17:58:57 +03:00
|
|
|
return 0;
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* All 4 location monitors reside at the same base - this is therefore a
|
|
|
|
* system wide configuration.
|
|
|
|
*
|
|
|
|
* This does not enable the LM monitor - that should be done when the first
|
|
|
|
* callback is attached and disabled when the last callback is removed.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base,
|
2011-12-01 21:06:29 +04:00
|
|
|
u32 aspace, u32 cycle)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
u32 lm_base_high, lm_base_low, lm_ctl = 0;
|
|
|
|
int i;
|
2010-03-22 17:58:50 +03:00
|
|
|
struct vme_bridge *tsi148_bridge;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
2010-03-22 17:58:50 +03:00
|
|
|
tsi148_bridge = lm->parent;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_lock(&lm->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* If we already have a callback attached, we can't move it! */
|
2009-08-11 20:44:56 +04:00
|
|
|
for (i = 0; i < lm->monitors; i++) {
|
2010-02-18 18:13:05 +03:00
|
|
|
if (bridge->lm_callback[i] != NULL) {
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&lm->mtx);
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Location monitor "
|
|
|
|
"callback attached, can't reset\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (aspace) {
|
|
|
|
case VME_A16:
|
|
|
|
lm_ctl |= TSI148_LCSR_LMAT_AS_A16;
|
|
|
|
break;
|
|
|
|
case VME_A24:
|
|
|
|
lm_ctl |= TSI148_LCSR_LMAT_AS_A24;
|
|
|
|
break;
|
|
|
|
case VME_A32:
|
|
|
|
lm_ctl |= TSI148_LCSR_LMAT_AS_A32;
|
|
|
|
break;
|
|
|
|
case VME_A64:
|
|
|
|
lm_ctl |= TSI148_LCSR_LMAT_AS_A64;
|
|
|
|
break;
|
|
|
|
default:
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&lm->mtx);
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Invalid address space\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cycle & VME_SUPER)
|
|
|
|
lm_ctl |= TSI148_LCSR_LMAT_SUPR ;
|
|
|
|
if (cycle & VME_USER)
|
|
|
|
lm_ctl |= TSI148_LCSR_LMAT_NPRIV;
|
|
|
|
if (cycle & VME_PROG)
|
|
|
|
lm_ctl |= TSI148_LCSR_LMAT_PGM;
|
|
|
|
if (cycle & VME_DATA)
|
|
|
|
lm_ctl |= TSI148_LCSR_LMAT_DATA;
|
|
|
|
|
|
|
|
reg_split(lm_base, &lm_base_high, &lm_base_low);
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(lm_base_high, bridge->base + TSI148_LCSR_LMBAU);
|
|
|
|
iowrite32be(lm_base_low, bridge->base + TSI148_LCSR_LMBAL);
|
|
|
|
iowrite32be(lm_ctl, bridge->base + TSI148_LCSR_LMAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&lm->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get configuration of the callback monitor and return whether it is enabled
|
|
|
|
* or disabled.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_lm_get(struct vme_lm_resource *lm,
|
2011-12-01 21:06:29 +04:00
|
|
|
unsigned long long *lm_base, u32 *aspace, u32 *cycle)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
u32 lm_base_high, lm_base_low, lm_ctl, enabled = 0;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = lm->parent->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_lock(&lm->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
lm_base_high = ioread32be(bridge->base + TSI148_LCSR_LMBAU);
|
|
|
|
lm_base_low = ioread32be(bridge->base + TSI148_LCSR_LMBAL);
|
|
|
|
lm_ctl = ioread32be(bridge->base + TSI148_LCSR_LMAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
reg_join(lm_base_high, lm_base_low, lm_base);
|
|
|
|
|
|
|
|
if (lm_ctl & TSI148_LCSR_LMAT_EN)
|
|
|
|
enabled = 1;
|
|
|
|
|
2010-03-22 17:58:57 +03:00
|
|
|
if ((lm_ctl & TSI148_LCSR_LMAT_AS_M) == TSI148_LCSR_LMAT_AS_A16)
|
2009-07-31 12:28:17 +04:00
|
|
|
*aspace |= VME_A16;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
|
|
|
if ((lm_ctl & TSI148_LCSR_LMAT_AS_M) == TSI148_LCSR_LMAT_AS_A24)
|
2009-07-31 12:28:17 +04:00
|
|
|
*aspace |= VME_A24;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
|
|
|
if ((lm_ctl & TSI148_LCSR_LMAT_AS_M) == TSI148_LCSR_LMAT_AS_A32)
|
2009-07-31 12:28:17 +04:00
|
|
|
*aspace |= VME_A32;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
|
|
|
if ((lm_ctl & TSI148_LCSR_LMAT_AS_M) == TSI148_LCSR_LMAT_AS_A64)
|
2009-07-31 12:28:17 +04:00
|
|
|
*aspace |= VME_A64;
|
2010-03-22 17:58:57 +03:00
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
if (lm_ctl & TSI148_LCSR_LMAT_SUPR)
|
|
|
|
*cycle |= VME_SUPER;
|
|
|
|
if (lm_ctl & TSI148_LCSR_LMAT_NPRIV)
|
|
|
|
*cycle |= VME_USER;
|
|
|
|
if (lm_ctl & TSI148_LCSR_LMAT_PGM)
|
|
|
|
*cycle |= VME_PROG;
|
|
|
|
if (lm_ctl & TSI148_LCSR_LMAT_DATA)
|
|
|
|
*cycle |= VME_DATA;
|
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&lm->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attach a callback to a specific location monitor.
|
|
|
|
*
|
|
|
|
* Callback will be passed the monitor triggered.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_lm_attach(struct vme_lm_resource *lm, int monitor,
|
2009-08-11 20:44:56 +04:00
|
|
|
void (*callback)(int))
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
u32 lm_ctl, tmp;
|
2010-03-22 17:58:50 +03:00
|
|
|
struct vme_bridge *tsi148_bridge;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
2010-03-22 17:58:50 +03:00
|
|
|
tsi148_bridge = lm->parent;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_lock(&lm->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Ensure that the location monitor is configured - need PGM or DATA */
|
2010-02-18 18:13:05 +03:00
|
|
|
lm_ctl = ioread32be(bridge->base + TSI148_LCSR_LMAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
if ((lm_ctl & (TSI148_LCSR_LMAT_PGM | TSI148_LCSR_LMAT_DATA)) == 0) {
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&lm->mtx);
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Location monitor not properly "
|
|
|
|
"configured\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check that a callback isn't already attached */
|
2010-02-18 18:13:05 +03:00
|
|
|
if (bridge->lm_callback[monitor] != NULL) {
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&lm->mtx);
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Existing callback attached\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Attach callback */
|
2010-02-18 18:13:05 +03:00
|
|
|
bridge->lm_callback[monitor] = callback;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Enable Location Monitor interrupt */
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_INTEN);
|
2009-07-31 12:28:17 +04:00
|
|
|
tmp |= TSI148_LCSR_INTEN_LMEN[monitor];
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEN);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_INTEO);
|
2009-07-31 12:28:17 +04:00
|
|
|
tmp |= TSI148_LCSR_INTEO_LMEO[monitor];
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEO);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Ensure that global Location Monitor Enable set */
|
|
|
|
if ((lm_ctl & TSI148_LCSR_LMAT_EN) == 0) {
|
|
|
|
lm_ctl |= TSI148_LCSR_LMAT_EN;
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(lm_ctl, bridge->base + TSI148_LCSR_LMAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&lm->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Detach a callback function forn a specific location monitor.
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_lm_detach(struct vme_lm_resource *lm, int monitor)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
u32 lm_en, tmp;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = lm->parent->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_lock(&lm->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Disable Location Monitor and ensure previous interrupts are clear */
|
2010-02-18 18:13:05 +03:00
|
|
|
lm_en = ioread32be(bridge->base + TSI148_LCSR_INTEN);
|
2009-07-31 12:28:17 +04:00
|
|
|
lm_en &= ~TSI148_LCSR_INTEN_LMEN[monitor];
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(lm_en, bridge->base + TSI148_LCSR_INTEN);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_INTEO);
|
2009-07-31 12:28:17 +04:00
|
|
|
tmp &= ~TSI148_LCSR_INTEO_LMEO[monitor];
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_INTEO);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
iowrite32be(TSI148_LCSR_INTC_LMC[monitor],
|
2010-02-18 18:13:05 +03:00
|
|
|
bridge->base + TSI148_LCSR_INTC);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Detach callback */
|
2010-02-18 18:13:05 +03:00
|
|
|
bridge->lm_callback[monitor] = NULL;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* If all location monitors disabled, disable global Location Monitor */
|
|
|
|
if ((lm_en & (TSI148_LCSR_INTS_LM0S | TSI148_LCSR_INTS_LM1S |
|
|
|
|
TSI148_LCSR_INTS_LM2S | TSI148_LCSR_INTS_LM3S)) == 0) {
|
2010-02-18 18:13:05 +03:00
|
|
|
tmp = ioread32be(bridge->base + TSI148_LCSR_LMAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
tmp &= ~TSI148_LCSR_LMAT_EN;
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(tmp, bridge->base + TSI148_LCSR_LMAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_unlock(&lm->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Determine Geographical Addressing
|
|
|
|
*/
|
2010-11-12 14:15:00 +03:00
|
|
|
static int tsi148_slot_get(struct vme_bridge *tsi148_bridge)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
2010-03-22 17:58:57 +03:00
|
|
|
u32 slot = 0;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2009-12-15 11:42:49 +03:00
|
|
|
if (!geoid) {
|
2010-02-18 18:13:05 +03:00
|
|
|
slot = ioread32be(bridge->base + TSI148_LCSR_VSTAT);
|
2009-12-15 11:42:49 +03:00
|
|
|
slot = slot & TSI148_LCSR_VSTAT_GA_M;
|
|
|
|
} else
|
|
|
|
slot = geoid;
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
return (int)slot;
|
|
|
|
}
|
|
|
|
|
2012-05-03 04:08:38 +04:00
|
|
|
static void *tsi148_alloc_consistent(struct device *parent, size_t size,
|
2011-08-10 13:33:46 +04:00
|
|
|
dma_addr_t *dma)
|
|
|
|
{
|
|
|
|
struct pci_dev *pdev;
|
|
|
|
|
|
|
|
/* Find pci_dev container of dev */
|
2014-04-03 23:48:27 +04:00
|
|
|
pdev = to_pci_dev(parent);
|
2011-08-10 13:33:46 +04:00
|
|
|
|
|
|
|
return pci_alloc_consistent(pdev, size, dma);
|
|
|
|
}
|
|
|
|
|
2012-05-03 04:08:38 +04:00
|
|
|
static void tsi148_free_consistent(struct device *parent, size_t size,
|
|
|
|
void *vaddr, dma_addr_t dma)
|
2011-08-10 13:33:46 +04:00
|
|
|
{
|
|
|
|
struct pci_dev *pdev;
|
|
|
|
|
|
|
|
/* Find pci_dev container of dev */
|
2014-04-03 23:48:27 +04:00
|
|
|
pdev = to_pci_dev(parent);
|
2011-08-10 13:33:46 +04:00
|
|
|
|
|
|
|
pci_free_consistent(pdev, size, vaddr, dma);
|
|
|
|
}
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/*
|
|
|
|
* Configure CR/CSR space
|
|
|
|
*
|
|
|
|
* Access to the CR/CSR can be configured at power-up. The location of the
|
|
|
|
* CR/CSR registers in the CR/CSR address space is determined by the boards
|
|
|
|
* Auto-ID or Geographic address. This function ensures that the window is
|
|
|
|
* enabled at an offset consistent with the boards geopgraphic address.
|
|
|
|
*
|
|
|
|
* Each board has a 512kB window, with the highest 4kB being used for the
|
|
|
|
* boards registers, this means there is a fix length 508kB window which must
|
|
|
|
* be mapped onto PCI memory.
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
static int tsi148_crcsr_init(struct vme_bridge *tsi148_bridge,
|
|
|
|
struct pci_dev *pdev)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
u32 cbar, crat, vstat;
|
|
|
|
u32 crcsr_bus_high, crcsr_bus_low;
|
|
|
|
int retval;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Allocate mem for CR/CSR image */
|
2014-08-09 01:24:53 +04:00
|
|
|
bridge->crcsr_kernel = pci_zalloc_consistent(pdev, VME_CRCSR_BUF_SIZE,
|
|
|
|
&bridge->crcsr_bus);
|
2010-02-18 18:13:05 +03:00
|
|
|
if (bridge->crcsr_kernel == NULL) {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Failed to allocate memory for "
|
|
|
|
"CR/CSR image\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
reg_split(bridge->crcsr_bus, &crcsr_bus_high, &crcsr_bus_low);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(crcsr_bus_high, bridge->base + TSI148_LCSR_CROU);
|
|
|
|
iowrite32be(crcsr_bus_low, bridge->base + TSI148_LCSR_CROL);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Ensure that the CR/CSR is configured at the correct offset */
|
2010-02-18 18:13:05 +03:00
|
|
|
cbar = ioread32be(bridge->base + TSI148_CBAR);
|
2009-07-31 12:28:17 +04:00
|
|
|
cbar = (cbar & TSI148_CRCSR_CBAR_M)>>3;
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
vstat = tsi148_slot_get(tsi148_bridge);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
if (cbar != vstat) {
|
2009-12-15 11:42:49 +03:00
|
|
|
cbar = vstat;
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_info(tsi148_bridge->parent, "Setting CR/CSR offset\n");
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(cbar<<3, bridge->base + TSI148_CBAR);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_info(tsi148_bridge->parent, "CR/CSR Offset: %d\n", cbar);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
crat = ioread32be(bridge->base + TSI148_LCSR_CRAT);
|
2013-06-11 20:03:14 +04:00
|
|
|
if (crat & TSI148_LCSR_CRAT_EN)
|
|
|
|
dev_info(tsi148_bridge->parent, "CR/CSR already enabled\n");
|
|
|
|
else {
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_info(tsi148_bridge->parent, "Enabling CR/CSR space\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
iowrite32be(crat | TSI148_LCSR_CRAT_EN,
|
2010-02-18 18:13:05 +03:00
|
|
|
bridge->base + TSI148_LCSR_CRAT);
|
2013-06-11 20:03:14 +04:00
|
|
|
}
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* If we want flushed, error-checked writes, set up a window
|
|
|
|
* over the CR/CSR registers. We read from here to safely flush
|
|
|
|
* through VME writes.
|
|
|
|
*/
|
2010-03-22 17:58:57 +03:00
|
|
|
if (err_chk) {
|
2010-02-18 18:13:05 +03:00
|
|
|
retval = tsi148_master_set(bridge->flush_image, 1,
|
|
|
|
(vstat * 0x80000), 0x80000, VME_CRCSR, VME_SCT,
|
|
|
|
VME_D16);
|
2009-07-31 12:28:17 +04:00
|
|
|
if (retval)
|
2010-03-22 17:58:50 +03:00
|
|
|
dev_err(tsi148_bridge->parent, "Configuring flush image"
|
|
|
|
" failed\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
static void tsi148_crcsr_exit(struct vme_bridge *tsi148_bridge,
|
|
|
|
struct pci_dev *pdev)
|
2009-07-31 12:28:17 +04:00
|
|
|
{
|
|
|
|
u32 crat;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Turn off CR/CSR space */
|
2010-02-18 18:13:05 +03:00
|
|
|
crat = ioread32be(bridge->base + TSI148_LCSR_CRAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
iowrite32be(crat & ~TSI148_LCSR_CRAT_EN,
|
2010-02-18 18:13:05 +03:00
|
|
|
bridge->base + TSI148_LCSR_CRAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* Free image */
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(0, bridge->base + TSI148_LCSR_CROU);
|
|
|
|
iowrite32be(0, bridge->base + TSI148_LCSR_CROL);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
pci_free_consistent(pdev, VME_CRCSR_BUF_SIZE, bridge->crcsr_kernel,
|
|
|
|
bridge->crcsr_bus);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|
|
|
{
|
|
|
|
int retval, i, master_num;
|
|
|
|
u32 data;
|
2012-08-21 08:19:01 +04:00
|
|
|
struct list_head *pos = NULL, *n;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct vme_bridge *tsi148_bridge;
|
|
|
|
struct tsi148_driver *tsi148_device;
|
2009-07-31 12:28:17 +04:00
|
|
|
struct vme_master_resource *master_image;
|
|
|
|
struct vme_slave_resource *slave_image;
|
|
|
|
struct vme_dma_resource *dma_ctrlr;
|
2009-08-11 20:44:56 +04:00
|
|
|
struct vme_lm_resource *lm;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* If we want to support more than one of each bridge, we need to
|
|
|
|
* dynamically generate this so we get one per device
|
|
|
|
*/
|
Staging: Use kcalloc or kzalloc
Use kcalloc or kzalloc rather than the combination of kmalloc and memset.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,y,flags;
statement S;
type T;
@@
x =
- kmalloc
+ kcalloc
(
- y * sizeof(T),
+ y, sizeof(T),
flags);
if (x == NULL) S
-memset(x, 0, y * sizeof(T));
@@
expression x,size,flags;
statement S;
@@
-x = kmalloc(size,flags);
+x = kzalloc(size,flags);
if (x == NULL) S
-memset(x, 0, size);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
2010-05-14 00:00:05 +04:00
|
|
|
tsi148_bridge = kzalloc(sizeof(struct vme_bridge), GFP_KERNEL);
|
2009-07-31 12:28:17 +04:00
|
|
|
if (tsi148_bridge == NULL) {
|
|
|
|
dev_err(&pdev->dev, "Failed to allocate memory for device "
|
|
|
|
"structure\n");
|
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err_struct;
|
|
|
|
}
|
|
|
|
|
Staging: Use kcalloc or kzalloc
Use kcalloc or kzalloc rather than the combination of kmalloc and memset.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,y,flags;
statement S;
type T;
@@
x =
- kmalloc
+ kcalloc
(
- y * sizeof(T),
+ y, sizeof(T),
flags);
if (x == NULL) S
-memset(x, 0, y * sizeof(T));
@@
expression x,size,flags;
statement S;
@@
-x = kmalloc(size,flags);
+x = kzalloc(size,flags);
if (x == NULL) S
-memset(x, 0, size);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
2010-05-14 00:00:05 +04:00
|
|
|
tsi148_device = kzalloc(sizeof(struct tsi148_driver), GFP_KERNEL);
|
2010-02-18 18:13:05 +03:00
|
|
|
if (tsi148_device == NULL) {
|
|
|
|
dev_err(&pdev->dev, "Failed to allocate memory for device "
|
|
|
|
"structure\n");
|
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err_driver;
|
|
|
|
}
|
|
|
|
|
|
|
|
tsi148_bridge->driver_priv = tsi148_device;
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/* Enable the device */
|
|
|
|
retval = pci_enable_device(pdev);
|
|
|
|
if (retval) {
|
|
|
|
dev_err(&pdev->dev, "Unable to enable device\n");
|
|
|
|
goto err_enable;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Map Registers */
|
|
|
|
retval = pci_request_regions(pdev, driver_name);
|
|
|
|
if (retval) {
|
|
|
|
dev_err(&pdev->dev, "Unable to reserve resources\n");
|
|
|
|
goto err_resource;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* map registers in BAR 0 */
|
2010-02-18 18:13:05 +03:00
|
|
|
tsi148_device->base = ioremap_nocache(pci_resource_start(pdev, 0),
|
|
|
|
4096);
|
|
|
|
if (!tsi148_device->base) {
|
2009-07-31 12:28:17 +04:00
|
|
|
dev_err(&pdev->dev, "Unable to remap CRG region\n");
|
|
|
|
retval = -EIO;
|
|
|
|
goto err_remap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check to see if the mapping worked out */
|
2010-02-18 18:13:05 +03:00
|
|
|
data = ioread32(tsi148_device->base + TSI148_PCFS_ID) & 0x0000FFFF;
|
2009-07-31 12:28:17 +04:00
|
|
|
if (data != PCI_VENDOR_ID_TUNDRA) {
|
|
|
|
dev_err(&pdev->dev, "CRG region check failed\n");
|
|
|
|
retval = -EIO;
|
|
|
|
goto err_test;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize wait queues & mutual exclusion flags */
|
2010-11-12 14:14:07 +03:00
|
|
|
init_waitqueue_head(&tsi148_device->dma_queue[0]);
|
|
|
|
init_waitqueue_head(&tsi148_device->dma_queue[1]);
|
|
|
|
init_waitqueue_head(&tsi148_device->iack_queue);
|
|
|
|
mutex_init(&tsi148_device->vme_int);
|
|
|
|
mutex_init(&tsi148_device->vme_rmw);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:07 +03:00
|
|
|
tsi148_bridge->parent = &pdev->dev;
|
2009-07-31 12:28:17 +04:00
|
|
|
strcpy(tsi148_bridge->name, driver_name);
|
|
|
|
|
|
|
|
/* Setup IRQ */
|
|
|
|
retval = tsi148_irq_init(tsi148_bridge);
|
|
|
|
if (retval != 0) {
|
|
|
|
dev_err(&pdev->dev, "Chip Initialization failed.\n");
|
|
|
|
goto err_irq;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we are going to flush writes, we need to read from the VME bus.
|
|
|
|
* We need to do this safely, thus we read the devices own CR/CSR
|
|
|
|
* register. To do this we must set up a window in CR/CSR space and
|
|
|
|
* hence have one less master window resource available.
|
|
|
|
*/
|
|
|
|
master_num = TSI148_MAX_MASTER;
|
2010-03-22 17:58:57 +03:00
|
|
|
if (err_chk) {
|
2009-07-31 12:28:17 +04:00
|
|
|
master_num--;
|
2010-02-18 18:13:05 +03:00
|
|
|
|
2010-05-11 22:26:57 +04:00
|
|
|
tsi148_device->flush_image =
|
2010-02-18 18:13:05 +03:00
|
|
|
kmalloc(sizeof(struct vme_master_resource), GFP_KERNEL);
|
|
|
|
if (tsi148_device->flush_image == NULL) {
|
2009-07-31 12:28:17 +04:00
|
|
|
dev_err(&pdev->dev, "Failed to allocate memory for "
|
|
|
|
"flush resource structure\n");
|
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err_master;
|
|
|
|
}
|
2010-02-18 18:13:05 +03:00
|
|
|
tsi148_device->flush_image->parent = tsi148_bridge;
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_lock_init(&tsi148_device->flush_image->lock);
|
2010-02-18 18:13:05 +03:00
|
|
|
tsi148_device->flush_image->locked = 1;
|
|
|
|
tsi148_device->flush_image->number = master_num;
|
2010-11-12 14:14:07 +03:00
|
|
|
memset(&tsi148_device->flush_image->bus_resource, 0,
|
2009-07-31 12:28:17 +04:00
|
|
|
sizeof(struct resource));
|
2010-02-18 18:13:05 +03:00
|
|
|
tsi148_device->flush_image->kern_base = NULL;
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Add master windows to list */
|
2010-11-12 14:14:07 +03:00
|
|
|
INIT_LIST_HEAD(&tsi148_bridge->master_resources);
|
2009-07-31 12:28:17 +04:00
|
|
|
for (i = 0; i < master_num; i++) {
|
2010-03-22 17:58:57 +03:00
|
|
|
master_image = kmalloc(sizeof(struct vme_master_resource),
|
|
|
|
GFP_KERNEL);
|
2009-07-31 12:28:17 +04:00
|
|
|
if (master_image == NULL) {
|
|
|
|
dev_err(&pdev->dev, "Failed to allocate memory for "
|
|
|
|
"master resource structure\n");
|
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err_master;
|
|
|
|
}
|
|
|
|
master_image->parent = tsi148_bridge;
|
2010-11-12 14:14:07 +03:00
|
|
|
spin_lock_init(&master_image->lock);
|
2009-07-31 12:28:17 +04:00
|
|
|
master_image->locked = 0;
|
|
|
|
master_image->number = i;
|
|
|
|
master_image->address_attr = VME_A16 | VME_A24 | VME_A32 |
|
|
|
|
VME_A64;
|
|
|
|
master_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
|
|
|
|
VME_2eVME | VME_2eSST | VME_2eSSTB | VME_2eSST160 |
|
|
|
|
VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER |
|
|
|
|
VME_PROG | VME_DATA;
|
|
|
|
master_image->width_attr = VME_D16 | VME_D32;
|
2010-11-12 14:14:07 +03:00
|
|
|
memset(&master_image->bus_resource, 0,
|
2009-07-31 12:28:17 +04:00
|
|
|
sizeof(struct resource));
|
|
|
|
master_image->kern_base = NULL;
|
2010-11-12 14:14:07 +03:00
|
|
|
list_add_tail(&master_image->list,
|
|
|
|
&tsi148_bridge->master_resources);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Add slave windows to list */
|
2010-11-12 14:14:07 +03:00
|
|
|
INIT_LIST_HEAD(&tsi148_bridge->slave_resources);
|
2009-07-31 12:28:17 +04:00
|
|
|
for (i = 0; i < TSI148_MAX_SLAVE; i++) {
|
2010-03-22 17:58:57 +03:00
|
|
|
slave_image = kmalloc(sizeof(struct vme_slave_resource),
|
|
|
|
GFP_KERNEL);
|
2009-07-31 12:28:17 +04:00
|
|
|
if (slave_image == NULL) {
|
|
|
|
dev_err(&pdev->dev, "Failed to allocate memory for "
|
|
|
|
"slave resource structure\n");
|
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err_slave;
|
|
|
|
}
|
|
|
|
slave_image->parent = tsi148_bridge;
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_init(&slave_image->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
slave_image->locked = 0;
|
|
|
|
slave_image->number = i;
|
|
|
|
slave_image->address_attr = VME_A16 | VME_A24 | VME_A32 |
|
|
|
|
VME_A64 | VME_CRCSR | VME_USER1 | VME_USER2 |
|
|
|
|
VME_USER3 | VME_USER4;
|
|
|
|
slave_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
|
|
|
|
VME_2eVME | VME_2eSST | VME_2eSSTB | VME_2eSST160 |
|
|
|
|
VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER |
|
|
|
|
VME_PROG | VME_DATA;
|
2010-11-12 14:14:07 +03:00
|
|
|
list_add_tail(&slave_image->list,
|
|
|
|
&tsi148_bridge->slave_resources);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Add dma engines to list */
|
2010-11-12 14:14:07 +03:00
|
|
|
INIT_LIST_HEAD(&tsi148_bridge->dma_resources);
|
2009-07-31 12:28:17 +04:00
|
|
|
for (i = 0; i < TSI148_MAX_DMA; i++) {
|
2010-03-22 17:58:57 +03:00
|
|
|
dma_ctrlr = kmalloc(sizeof(struct vme_dma_resource),
|
|
|
|
GFP_KERNEL);
|
2009-07-31 12:28:17 +04:00
|
|
|
if (dma_ctrlr == NULL) {
|
|
|
|
dev_err(&pdev->dev, "Failed to allocate memory for "
|
|
|
|
"dma resource structure\n");
|
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err_dma;
|
|
|
|
}
|
|
|
|
dma_ctrlr->parent = tsi148_bridge;
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_init(&dma_ctrlr->mtx);
|
2009-07-31 12:28:17 +04:00
|
|
|
dma_ctrlr->locked = 0;
|
|
|
|
dma_ctrlr->number = i;
|
2010-02-18 18:12:58 +03:00
|
|
|
dma_ctrlr->route_attr = VME_DMA_VME_TO_MEM |
|
|
|
|
VME_DMA_MEM_TO_VME | VME_DMA_VME_TO_VME |
|
|
|
|
VME_DMA_MEM_TO_MEM | VME_DMA_PATTERN_TO_VME |
|
|
|
|
VME_DMA_PATTERN_TO_MEM;
|
2010-11-12 14:14:07 +03:00
|
|
|
INIT_LIST_HEAD(&dma_ctrlr->pending);
|
|
|
|
INIT_LIST_HEAD(&dma_ctrlr->running);
|
|
|
|
list_add_tail(&dma_ctrlr->list,
|
|
|
|
&tsi148_bridge->dma_resources);
|
2009-07-31 12:28:17 +04:00
|
|
|
}
|
|
|
|
|
2009-08-11 20:44:56 +04:00
|
|
|
/* Add location monitor to list */
|
2010-11-12 14:14:07 +03:00
|
|
|
INIT_LIST_HEAD(&tsi148_bridge->lm_resources);
|
2009-08-11 20:44:56 +04:00
|
|
|
lm = kmalloc(sizeof(struct vme_lm_resource), GFP_KERNEL);
|
|
|
|
if (lm == NULL) {
|
|
|
|
dev_err(&pdev->dev, "Failed to allocate memory for "
|
|
|
|
"location monitor resource structure\n");
|
|
|
|
retval = -ENOMEM;
|
|
|
|
goto err_lm;
|
|
|
|
}
|
|
|
|
lm->parent = tsi148_bridge;
|
2010-11-12 14:14:07 +03:00
|
|
|
mutex_init(&lm->mtx);
|
2009-08-11 20:44:56 +04:00
|
|
|
lm->locked = 0;
|
|
|
|
lm->number = 1;
|
|
|
|
lm->monitors = 4;
|
2010-11-12 14:14:07 +03:00
|
|
|
list_add_tail(&lm->list, &tsi148_bridge->lm_resources);
|
2009-08-11 20:44:56 +04:00
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
tsi148_bridge->slave_get = tsi148_slave_get;
|
|
|
|
tsi148_bridge->slave_set = tsi148_slave_set;
|
|
|
|
tsi148_bridge->master_get = tsi148_master_get;
|
|
|
|
tsi148_bridge->master_set = tsi148_master_set;
|
|
|
|
tsi148_bridge->master_read = tsi148_master_read;
|
|
|
|
tsi148_bridge->master_write = tsi148_master_write;
|
|
|
|
tsi148_bridge->master_rmw = tsi148_master_rmw;
|
|
|
|
tsi148_bridge->dma_list_add = tsi148_dma_list_add;
|
|
|
|
tsi148_bridge->dma_list_exec = tsi148_dma_list_exec;
|
|
|
|
tsi148_bridge->dma_list_empty = tsi148_dma_list_empty;
|
2009-10-29 19:34:54 +03:00
|
|
|
tsi148_bridge->irq_set = tsi148_irq_set;
|
|
|
|
tsi148_bridge->irq_generate = tsi148_irq_generate;
|
2009-07-31 12:28:17 +04:00
|
|
|
tsi148_bridge->lm_set = tsi148_lm_set;
|
|
|
|
tsi148_bridge->lm_get = tsi148_lm_get;
|
|
|
|
tsi148_bridge->lm_attach = tsi148_lm_attach;
|
|
|
|
tsi148_bridge->lm_detach = tsi148_lm_detach;
|
|
|
|
tsi148_bridge->slot_get = tsi148_slot_get;
|
2011-08-10 13:33:46 +04:00
|
|
|
tsi148_bridge->alloc_consistent = tsi148_alloc_consistent;
|
|
|
|
tsi148_bridge->free_consistent = tsi148_free_consistent;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
data = ioread32be(tsi148_device->base + TSI148_LCSR_VSTAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
dev_info(&pdev->dev, "Board is%s the VME system controller\n",
|
2010-03-22 17:58:57 +03:00
|
|
|
(data & TSI148_LCSR_VSTAT_SCONS) ? "" : " not");
|
2010-02-18 18:13:05 +03:00
|
|
|
if (!geoid)
|
2009-12-15 11:42:49 +03:00
|
|
|
dev_info(&pdev->dev, "VME geographical address is %d\n",
|
|
|
|
data & TSI148_LCSR_VSTAT_GA_M);
|
2010-02-18 18:13:05 +03:00
|
|
|
else
|
2009-12-15 11:42:49 +03:00
|
|
|
dev_info(&pdev->dev, "VME geographical address is set to %d\n",
|
|
|
|
geoid);
|
2010-02-18 18:13:05 +03:00
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
dev_info(&pdev->dev, "VME Write and flush and error check is %s\n",
|
|
|
|
err_chk ? "enabled" : "disabled");
|
|
|
|
|
2013-06-19 06:42:35 +04:00
|
|
|
retval = tsi148_crcsr_init(tsi148_bridge, pdev);
|
|
|
|
if (retval) {
|
2009-07-31 12:28:17 +04:00
|
|
|
dev_err(&pdev->dev, "CR/CSR configuration failed.\n");
|
|
|
|
goto err_crcsr;
|
2010-03-22 17:58:43 +03:00
|
|
|
}
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
retval = vme_register_bridge(tsi148_bridge);
|
|
|
|
if (retval != 0) {
|
|
|
|
dev_err(&pdev->dev, "Chip Registration failed.\n");
|
|
|
|
goto err_reg;
|
|
|
|
}
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
pci_set_drvdata(pdev, tsi148_bridge);
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
/* Clear VME bus "board fail", and "power-up reset" lines */
|
2010-02-18 18:13:05 +03:00
|
|
|
data = ioread32be(tsi148_device->base + TSI148_LCSR_VSTAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
data &= ~TSI148_LCSR_VSTAT_BRDFL;
|
|
|
|
data |= TSI148_LCSR_VSTAT_CPURST;
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(data, tsi148_device->base + TSI148_LCSR_VSTAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_reg:
|
2010-02-18 18:13:05 +03:00
|
|
|
tsi148_crcsr_exit(tsi148_bridge, pdev);
|
2009-07-31 12:28:17 +04:00
|
|
|
err_crcsr:
|
2009-08-11 20:44:56 +04:00
|
|
|
err_lm:
|
|
|
|
/* resources are stored in link list */
|
2012-08-21 08:19:01 +04:00
|
|
|
list_for_each_safe(pos, n, &tsi148_bridge->lm_resources) {
|
2009-08-11 20:44:56 +04:00
|
|
|
lm = list_entry(pos, struct vme_lm_resource, list);
|
|
|
|
list_del(pos);
|
|
|
|
kfree(lm);
|
|
|
|
}
|
2009-07-31 12:28:17 +04:00
|
|
|
err_dma:
|
|
|
|
/* resources are stored in link list */
|
2012-08-21 08:19:01 +04:00
|
|
|
list_for_each_safe(pos, n, &tsi148_bridge->dma_resources) {
|
2009-07-31 12:28:17 +04:00
|
|
|
dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
|
|
|
|
list_del(pos);
|
|
|
|
kfree(dma_ctrlr);
|
|
|
|
}
|
|
|
|
err_slave:
|
|
|
|
/* resources are stored in link list */
|
2012-08-21 08:19:01 +04:00
|
|
|
list_for_each_safe(pos, n, &tsi148_bridge->slave_resources) {
|
2009-07-31 12:28:17 +04:00
|
|
|
slave_image = list_entry(pos, struct vme_slave_resource, list);
|
|
|
|
list_del(pos);
|
|
|
|
kfree(slave_image);
|
|
|
|
}
|
|
|
|
err_master:
|
|
|
|
/* resources are stored in link list */
|
2012-08-21 08:19:01 +04:00
|
|
|
list_for_each_safe(pos, n, &tsi148_bridge->master_resources) {
|
2010-03-22 17:58:57 +03:00
|
|
|
master_image = list_entry(pos, struct vme_master_resource,
|
|
|
|
list);
|
2009-07-31 12:28:17 +04:00
|
|
|
list_del(pos);
|
|
|
|
kfree(master_image);
|
|
|
|
}
|
|
|
|
|
2010-11-12 14:14:47 +03:00
|
|
|
tsi148_irq_exit(tsi148_bridge, pdev);
|
2009-07-31 12:28:17 +04:00
|
|
|
err_irq:
|
|
|
|
err_test:
|
2010-02-18 18:13:05 +03:00
|
|
|
iounmap(tsi148_device->base);
|
2009-07-31 12:28:17 +04:00
|
|
|
err_remap:
|
|
|
|
pci_release_regions(pdev);
|
|
|
|
err_resource:
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
err_enable:
|
2010-02-18 18:13:05 +03:00
|
|
|
kfree(tsi148_device);
|
|
|
|
err_driver:
|
2009-07-31 12:28:17 +04:00
|
|
|
kfree(tsi148_bridge);
|
|
|
|
err_struct:
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void tsi148_remove(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
struct list_head *pos = NULL;
|
2010-11-12 14:14:34 +03:00
|
|
|
struct list_head *tmplist;
|
2009-07-31 12:28:17 +04:00
|
|
|
struct vme_master_resource *master_image;
|
|
|
|
struct vme_slave_resource *slave_image;
|
|
|
|
struct vme_dma_resource *dma_ctrlr;
|
|
|
|
int i;
|
2010-02-18 18:13:05 +03:00
|
|
|
struct tsi148_driver *bridge;
|
|
|
|
struct vme_bridge *tsi148_bridge = pci_get_drvdata(pdev);
|
|
|
|
|
|
|
|
bridge = tsi148_bridge->driver_priv;
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
dev_dbg(&pdev->dev, "Driver is being unloaded.\n");
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Shutdown all inbound and outbound windows.
|
|
|
|
*/
|
|
|
|
for (i = 0; i < 8; i++) {
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(0, bridge->base + TSI148_LCSR_IT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_ITAT);
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(0, bridge->base + TSI148_LCSR_OT[i] +
|
2009-07-31 12:28:17 +04:00
|
|
|
TSI148_LCSR_OFFSET_OTAT);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Shutdown Location monitor.
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(0, bridge->base + TSI148_LCSR_LMAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Shutdown CRG map.
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(0, bridge->base + TSI148_LCSR_CSRAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Clear error status.
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(0xFFFFFFFF, bridge->base + TSI148_LCSR_EDPAT);
|
|
|
|
iowrite32be(0xFFFFFFFF, bridge->base + TSI148_LCSR_VEAT);
|
|
|
|
iowrite32be(0x07000700, bridge->base + TSI148_LCSR_PSTAT);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Remove VIRQ interrupt (if any)
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
if (ioread32be(bridge->base + TSI148_LCSR_VICR) & 0x800)
|
|
|
|
iowrite32be(0x8000, bridge->base + TSI148_LCSR_VICR);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Map all Interrupts to PCI INTA
|
|
|
|
*/
|
2010-02-18 18:13:05 +03:00
|
|
|
iowrite32be(0x0, bridge->base + TSI148_LCSR_INTM1);
|
|
|
|
iowrite32be(0x0, bridge->base + TSI148_LCSR_INTM2);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
2010-11-12 14:14:47 +03:00
|
|
|
tsi148_irq_exit(tsi148_bridge, pdev);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
vme_unregister_bridge(tsi148_bridge);
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
tsi148_crcsr_exit(tsi148_bridge, pdev);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
/* resources are stored in link list */
|
2010-11-12 14:14:34 +03:00
|
|
|
list_for_each_safe(pos, tmplist, &tsi148_bridge->dma_resources) {
|
2009-07-31 12:28:17 +04:00
|
|
|
dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
|
|
|
|
list_del(pos);
|
|
|
|
kfree(dma_ctrlr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* resources are stored in link list */
|
2010-11-12 14:14:34 +03:00
|
|
|
list_for_each_safe(pos, tmplist, &tsi148_bridge->slave_resources) {
|
2009-07-31 12:28:17 +04:00
|
|
|
slave_image = list_entry(pos, struct vme_slave_resource, list);
|
|
|
|
list_del(pos);
|
|
|
|
kfree(slave_image);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* resources are stored in link list */
|
2010-11-12 14:14:34 +03:00
|
|
|
list_for_each_safe(pos, tmplist, &tsi148_bridge->master_resources) {
|
2009-12-15 11:42:49 +03:00
|
|
|
master_image = list_entry(pos, struct vme_master_resource,
|
|
|
|
list);
|
2009-07-31 12:28:17 +04:00
|
|
|
list_del(pos);
|
|
|
|
kfree(master_image);
|
|
|
|
}
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
iounmap(bridge->base);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
pci_release_regions(pdev);
|
|
|
|
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
|
2010-02-18 18:13:05 +03:00
|
|
|
kfree(tsi148_bridge->driver_priv);
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
kfree(tsi148_bridge);
|
|
|
|
}
|
|
|
|
|
2012-10-18 19:12:50 +04:00
|
|
|
module_pci_driver(tsi148_driver);
|
2009-07-31 12:28:17 +04:00
|
|
|
|
|
|
|
MODULE_PARM_DESC(err_chk, "Check for VME errors on reads and writes");
|
|
|
|
module_param(err_chk, bool, 0);
|
|
|
|
|
2009-12-15 11:42:49 +03:00
|
|
|
MODULE_PARM_DESC(geoid, "Override geographical addressing");
|
|
|
|
module_param(geoid, int, 0);
|
|
|
|
|
2009-07-31 12:28:17 +04:00
|
|
|
MODULE_DESCRIPTION("VME driver for the Tundra Tempe VME bridge");
|
|
|
|
MODULE_LICENSE("GPL");
|