Commit graph

45 commits

Author SHA1 Message Date
Augusto Mecking Caringi
c8a6a09c1c vme: Fix wrong pointer utilization in ca91cx42_slave_get
In ca91cx42_slave_get function, the value pointed by vme_base pointer is
set through:

*vme_base = ioread32(bridge->base + CA91CX42_VSI_BS[i]);

So it must be dereferenced to be used in calculation of pci_base:

*pci_base = (dma_addr_t)*vme_base + pci_offset;

This bug was caught thanks to the following gcc warning:

drivers/vme/bridges/vme_ca91cx42.c: In function ‘ca91cx42_slave_get’:
drivers/vme/bridges/vme_ca91cx42.c:467:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
*pci_base = (dma_addr_t)vme_base + pci_offset;

Signed-off-by: Augusto Mecking Caringi <augustocaringi@gmail.com>
Acked-By: Martyn Welch <martyn@welchs.me.uk>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-11 10:42:16 +01:00
Wei Yongjun
db08948b97 vme: fake: remove unexpected unlock in fake_master_set()
image->lock is unlocked in some error handling path without take the
lock, so remove those unexpected unlock.

Fixes: 658bcdae9c ("vme: Adding Fake VME driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27 12:43:35 +02:00
Baoyou Xie
58ccaae303 vme: fake: mark symbols static where possible
We get 4 warnings when building kernel with W=1:
drivers/vme/bridges/vme_fake.c:384:6: warning: no previous prototype for 'fake_lm_check' [-Wmissing-prototypes]
drivers/vme/bridges/vme_fake.c:619:6: warning: no previous prototype for 'fake_vmewrite8' [-Wmissing-prototypes]
drivers/vme/bridges/vme_fake.c:649:6: warning: no previous prototype for 'fake_vmewrite16' [-Wmissing-prototypes]
drivers/vme/bridges/vme_fake.c:679:6: warning: no previous prototype for 'fake_vmewrite32' [-Wmissing-prototypes]

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
so this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27 12:43:34 +02:00
Arnd Bergmann
4b7b948b1f vme: fake: fix build for 64-bit dma_addr_t
casting between dma_addr_t and a pointer is generally tricky,
as they might not be the same size and almost never point into
the same address space. With 32-bit ARM systems and LPAE, we
get this warning for the vme_fake driver that stores a pointer
in a dma_addr_t variable:

drivers/vme/bridges/vme_fake.c: In function 'fake_slave_set':
drivers/vme/bridges/vme_fake.c:204:29: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]

To make this clearer while fixing the warning, I'm adding
a set of helper functions for the type conversion.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-13 17:30:17 +02:00
Martyn Welch
658bcdae9c vme: Adding Fake VME driver
This patch introduces a fake VME bridge driver. This driver currently
emulates a subset of the VME bridge functionality. This allows some VME
subsystem development and even some VME device driver development to be
carried out in the absence of a proper VME bus.

Signed-off-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-31 13:21:12 +02:00
Alessio Igor Bogani
553ebb8e40 vme: Fix module autoload
These drivers have a PCI device ID table but the PCI module
alias information is not created so module autoloading won't work.

Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-31 13:20:16 +02:00
Aaron Sierra
fa54b32680 vme: change LM callback argument to void pointer
Make the location monitor callback function prototype more useful by
changing the argument from an integer to a void pointer.

All VME bridge drivers were simply passing the location monitor index
(e.g. 0-3) as the argument to these callbacks. It is much more useful
to pass back a pointer to data that the callback-registering driver
cares about.

There appear to be no in-kernel callers of vme_lm_attach (or
vme_lme_request for that matter), so this change only affects the VME
subsystem and bridge drivers.

This has been tested with Tsi148 hardware, but the CA91Cx42 changes
have only been compiled.

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-31 13:20:15 +02:00
Aaron Sierra
326071b3c9 vme: add vme_init_bridge for common bridge init
Consolidate vme_bridge structure setup that every bridge was required
to do itself. This came about because .irq_mtx is only used within the
VME core, but was required to be setup externally.

This returns the structure passed in to support shorthand like this:

    bridge = vme_init_bridge(&priv->bridge);

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-01 14:00:00 -07:00
Geliang Tang
445f82492f vme: vme_ca91cx42.c: use to_pci_dev()
Use to_pci_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 23:17:59 -08:00
Dmitry Kalinkin
d3337eb1e1 vme: tsi148: silence uninitialized variable warning
The warning is a false positive.

drivers/vme/bridges/vme_tsi148.c: In function 'tsi148_master_write':
drivers/vme/bridges/vme_tsi148.c:1358:31: warning: 'handler' may be used uninitialized in this function [-Wmaybe-uninitialized]
   vme_unregister_error_handler(handler);
                               ^
drivers/vme/bridges/vme_tsi148.c: In function 'tsi148_master_read':
drivers/vme/bridges/vme_tsi148.c:1260:31: warning: 'handler' may be used uninitialized in this function [-Wmaybe-uninitialized]
   vme_unregister_error_handler(handler);
                               ^

Fixes: 0b04966257 ("vme: change bus error handling scheme")
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-05 10:59:34 +01:00
Dmitry Kalinkin
0b04966257 vme: change bus error handling scheme
The current VME bus error handler adds errors to the bridge error list.
vme_master_{read,write} then traverses that list to look for relevant
errors.

Such scheme didn't work well for accesses going through vme_master_mmap
because they would also allocate a vme_bus_error, but have no way to do
vme_clear_errors call to free that memory.

This changes the error handling process to be other way around: now
vme_master_{read,write} defines a window in VME address space that will
catch possible errors.  VME bus error interrupt only traverses these
windows and marks those that had errors in them.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04 19:50:57 +01:00
Dmitry Kalinkin
472f16f33c vme: include address space in error filtering
Also changes vme_bus_error_handler to take generic address modifier code
instead of raw contents of a device-specific attribute register.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04 19:50:57 +01:00
Dmitry Kalinkin
e2c6393fda vme: move tsi148 error handling into VME subsystem
Error handling code found in tsi148 is not device specific. In fact it
already relies on shared vme_bus_error struct and vme_bridge.vme_errors
field. The other bridge driver could reuse this code if it is shared.

This introduces a slight behavior change: vme error message won't be
triggered in a rare case when err_chk=1 and kmalloc fails.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04 19:50:57 +01:00
Dmitry Kalinkin
da5ae8a991 vme: lower alignment requirement in pci bridge drivers
Universe II allows PCI address grannularity of 4K or 64K depending on
the window id. tsi148 only supports 64K. Existing driver implementations
are validating window size against this grannularity and then use that
very size as alignment parameter to pci_bus_alloc_resource.  This
constraint is excessive, alignment by granularity should be enough.

This changes alignment constraint from size to a fixed constraint of
64K.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04 19:50:05 +01:00
Dmitry Kalinkin
5c10439849 vme: tsi148: depend on HAS_DMA for Kconfig
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-12 17:31:05 -07:00
Dmitry Kalinkin
5a2f883124 vme: ca91cx42: fix LM_CTL address mask
Universe II datasheet defines following address space values
for LM_CTL[16:18]

000=A16
001=A24
010=A32
011,100,101=Reserved
110=User1
111=User2

Mask 5<<16 is not the right one for matching [16:18], instead we should
use 7<<16.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-12 17:29:37 -07:00
Dmitry Kalinkin
1cfb645c8b vme: ca91cx42: return error code on DMA error
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-12 17:29:37 -07:00
Dmitry Kalinkin
75c66b6db7 vme: stop DMA transfer on interruption
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-12 17:26:57 -07:00
Dmitry Kalinkin
b2383c90a9 vme: tsi148: fix first DMA item mapping
This moves DMA mapping of the first list element to vme_list_add, the
same place where other elements mappings occur. This prevents extra
mapping or over-unmapping in the cases when vme_list_exec is called more
or less than one time respectively.

Also adds dma_mapping_error check.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-12 17:26:57 -07:00
Dmitry Kalinkin
f656eaee63 vme: tsi148: fix DMA lists longer that one item
DMA lists on tsi148 weren't processed further than the first item
because of the broken logic. This regression was introduced in:

ac1a4f2caf "Staging: VME: Ensure TSI148 link list descriptors..."

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-12 17:26:56 -07:00
Martyn Welch
08e03c268e vme: tsi148: Master windows support USERx and CR/CSR accesses, not slaves
The tsi148 driver is registering the slave images as supporting the "USER"
access modes and CR/CSR access mode rather than the master images as it
should.

Remove the incorrect case entries for these modes from the
tsi148_slave_set() function, stop registering slave_images as supporting
these modes and instead register master windows as supporting these modes.

Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Acked-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 17:03:22 -08:00
Joe Perches
88b2608c49 vme: bridges: use pci_zalloc_consistent
Remove the now unnecessary memset too.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Martyn Welch <martyn.welch@ge.com>
Cc: Manohar Vanga <manohar.vanga@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-08-08 15:57:30 -07:00
Dan Carpenter
3915fc87de VME: remove duplicate CA91CX42_DCTL_VDW_M define
The CA91CX42_DCTL_VDW_M define is cut and pasted twice so we can delete
the second instance.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 16:33:42 -07:00
Aaron Sierra
177581faf2 vme_tsi148: Utilize to_pci_dev() macro
Save some characters by using to_pci_dev() instead of container_of().

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-16 14:08:37 -07:00
Joe Schultz
226572b110 vme_tsi148: Fix PCI address mapping assumption
Previously, tsi148_master_set() assumed the address contained in its
PCI bus resource represented the actual PCI bus address. This is a fine
assumption on some platforms. However, on platforms that don't use a
1:1 (CPU:PCI) mapping this results in the tsi148 driver configuring an
invalid master window translation.

This patch updates the vme_tsi148 driver to first convert the address
contained in the PCI bus resource into a PCI bus address before using
it.

[asierra: account for pcibios_resource_to_bus() prototype change]
Signed-off-by: Joe Schultz <jschultz@xes-inc.com>
Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-16 14:08:37 -07:00
Joe Schultz
098ced8fef vme_tsi148: Fix typo in tsi148_slave_get()
This patch corrects a typo where "vme_base" was used instead of
"*vme_base". The typo resulted in an incorrect value being returned
to userspace (via vme_user).

It also removes the following compile warning on some platforms:

warning: cast from pointer to integer of different size

[asierra: commit title/log rewording]
Signed-off-by: Joe Schultz <jschultz@xes-inc.com>
Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-16 14:08:37 -07:00
Greg Kroah-Hartman
ba4b60e85d Merge 3.14-rc3 into char-misc-next
We need the fixes here for future mei and other patches.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-18 08:09:40 -08:00
Martyn Welch
a2a720e15f VME: Stop using memcpy_[to|from]io() due to unwanted behaviour
The ca91cx42 and tsi148 VME bridges use the width of reads and writes on the
PCI bus in part to control the width of the cycles on the VME bus. It is
important that we can control the width of cycles on the VME bus as some VME
hardware requires cycles of a specific width. The memcpy_toio() and
memcpy_fromio() functions do not provide sufficient control, so instead loop
using ioread functions.

Reported-by: Michael Kenney <mfkenney@gmail.com>
Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-15 11:53:39 -08:00
Martyn Welch
f0342e66b3 VME: Correct read/write alignment algorithm
In order to ensure the correct width cycles on the VME bus, the VME bridge
drivers implement an algorithm to utilise the largest possible width reads and
writes whilst maintaining natural alignment constraints. The algorithm
currently looks at the start address rather than the current read/write address
when determining whether a 16-bit width cycle is required to get to 32-bit
alignment.  This results in incorrect alignment,

Reported-by: Jim Strouth <james.strouth@ge.com>
Tested-by: Jim Strouth <james.strouth@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-07 08:16:14 -08:00
Jingoo Han
c3a09c18ed vme: remove DEFINE_PCI_DEVICE_TABLE macro
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
is not preferred.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-03 11:15:58 -08:00
Wei Yongjun
ef22d576dd vme: vme_ca91cx42.c: fix to pass correct device identity to free_irq()
free_irq() expects the same device identity that was passed to
corresponding request_irq(), otherwise the IRQ is not freed.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-27 21:49:26 -07:00
Jingoo Han
d90f32c25f vme: vme_ca91cx42.c: add missing __iomem annotation
Added missing __iomem annotation in order to fix the following
sparse warnings:

drivers/vme/bridges/vme_ca91cx42.c:859:39: warning: incorrect type in initializer (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:859:39:    expected void *addr
drivers/vme/bridges/vme_ca91cx42.c:859:39:    got void [noderef] <asn:2>*
drivers/vme/bridges/vme_ca91cx42.c:878:30: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:878:30:    expected void const volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_ca91cx42.c:878:30:    got void *addr
drivers/vme/bridges/vme_ca91cx42.c:885:47: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:885:47:    expected void const volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_ca91cx42.c:885:47:    got void *
drivers/vme/bridges/vme_ca91cx42.c:889:48: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:889:48:    expected void const volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_ca91cx42.c:889:48:    got void *
drivers/vme/bridges/vme_ca91cx42.c:896:17: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:896:17:    expected void const volatile [noderef] <asn:2>*<noident>
drivers/vme/bridges/vme_ca91cx42.c:896:17:    got void *
drivers/vme/bridges/vme_ca91cx42.c:901:40: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:901:40:    expected void const volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_ca91cx42.c:901:40:    got void *
drivers/vme/bridges/vme_ca91cx42.c:905:39: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:905:39:    expected void const volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_ca91cx42.c:905:39:    got void *
drivers/vme/bridges/vme_ca91cx42.c:919:39: warning: incorrect type in initializer (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:919:39:    expected void *addr
drivers/vme/bridges/vme_ca91cx42.c:919:39:    got void [noderef] <asn:2>*
drivers/vme/bridges/vme_ca91cx42.c:932:17: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:932:17:    expected void volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_ca91cx42.c:932:17:    got void *addr
drivers/vme/bridges/vme_ca91cx42.c:939:25: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:939:25:    expected void volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_ca91cx42.c:939:25:    got void *
drivers/vme/bridges/vme_ca91cx42.c:943:25: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:943:25:    expected void volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_ca91cx42.c:943:25:    got void *
drivers/vme/bridges/vme_ca91cx42.c:950:17: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:950:17:    expected void volatile [noderef] <asn:2>*<noident>
drivers/vme/bridges/vme_ca91cx42.c:950:17:    got void *
drivers/vme/bridges/vme_ca91cx42.c:955:17: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:955:17:    expected void volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_ca91cx42.c:955:17:    got void *
drivers/vme/bridges/vme_ca91cx42.c:959:17: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_ca91cx42.c:959:17:    expected void volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_ca91cx42.c:959:17:    got void *

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-19 17:07:01 -07:00
Jingoo Han
4e8764d95d vme: vme_tsi148.c: add missing __iomem annotation
Added missing __iomem annotation in order to fix the following
sparse warnings:

drivers/vme/bridges/vme_tsi148.c:1270:39: warning: incorrect type in initializer (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1270:39:    expected void *addr
drivers/vme/bridges/vme_tsi148.c:1270:39:    got void [noderef] <asn:2>*
drivers/vme/bridges/vme_tsi148.c:1287:30: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1287:30:    expected void const volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_tsi148.c:1287:30:    got void *addr
drivers/vme/bridges/vme_tsi148.c:1294:47: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1294:47:    expected void const volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_tsi148.c:1294:47:    got void *
drivers/vme/bridges/vme_tsi148.c:1298:48: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1298:48:    expected void const volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_tsi148.c:1298:48:    got void *
drivers/vme/bridges/vme_tsi148.c:1305:17: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1305:17:    expected void const volatile [noderef] <asn:2>*<noident>
drivers/vme/bridges/vme_tsi148.c:1305:17:    got void *
drivers/vme/bridges/vme_tsi148.c:1310:40: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1310:40:    expected void const volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_tsi148.c:1310:40:    got void *
drivers/vme/bridges/vme_tsi148.c:1314:39: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1314:39:    expected void const volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_tsi148.c:1314:39:    got void *
drivers/vme/bridges/vme_tsi148.c:1351:39: warning: incorrect type in initializer (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1351:39:    expected void *addr
drivers/vme/bridges/vme_tsi148.c:1351:39:    got void [noderef] <asn:2>*
drivers/vme/bridges/vme_tsi148.c:1369:17: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1369:17:    expected void volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_tsi148.c:1369:17:    got void *addr
drivers/vme/bridges/vme_tsi148.c:1376:25: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1376:25:    expected void volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_tsi148.c:1376:25:    got void *
drivers/vme/bridges/vme_tsi148.c:1380:25: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1380:25:    expected void volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_tsi148.c:1380:25:    got void *
drivers/vme/bridges/vme_tsi148.c:1387:17: warning: incorrect type in argument 1 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1387:17:    expected void volatile [noderef] <asn:2>*<noident>
drivers/vme/bridges/vme_tsi148.c:1387:17:    got void *
drivers/vme/bridges/vme_tsi148.c:1392:17: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1392:17:    expected void volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_tsi148.c:1392:17:    got void *
drivers/vme/bridges/vme_tsi148.c:1396:17: warning: incorrect type in argument 2 (different address spaces)
drivers/vme/bridges/vme_tsi148.c:1396:17:    expected void volatile [noderef] <asn:2>*addr
drivers/vme/bridges/vme_tsi148.c:1396:17:    got void *

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-19 17:07:01 -07:00
Wei Yongjun
0686ab7a7d vme: vme_tsi148.c: fix error return code in tsi148_probe()
Fix to return a negative error code in the tsi148_crcsr_init() error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-24 16:23:25 -07:00
Martyn Welch
c36c5736be vme: tsi148: Window reserved for accessing CR/CSR does not need attributes set
The tsi148 driver can be configured to reserve a window for internal
use (as part of the error checking routine). The intialisation of this
window currently configures a set of attributes that are never used
as these are only ever used by the VME core and this window is not
advertised to the core.

Remove configuration of these attributes.

Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 16:43:08 -07:00
Martyn Welch
2981795cc0 vme: tsi148: CR/CSR logic arround the wrong way
The logic in the init routine for the TSI148 is inverted. It isn't switching
on the CR/CSR space when it should be and is reporting it's on when its not.

Correct the logic to do the right thing.

Reported-by: De Roo, Steven <steven.deroo@arcelormittal.com>
Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 16:41:50 -07:00
Martyn Welch
e31c51e4a1 vme: tsi148: Only store VME bus errors if they will be checked
The TSI148 driver provides an optional mechanism for ensuring that errors
resulting from posted transfers are caught whilst still relevant. To do this
errors are stored in a link list. If bus errors are not checked, this list
would grow until available memory had been exhausted.

Only store the errors in a link list if error detection is switched on.

Reported-by: De Roo, Steven <steven.deroo@arcelormittal.com>
Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 16:41:50 -07:00
Wei Yongjun
01c0714397 vme: vme_tsi148.c: use module_pci_driver to simplify the code
Use the module_pci_driver() macro to make the code simpler
by eliminating module_init and module_exit calls.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 12:02:11 -07:00
Wei Yongjun
c7b50a2a29 vme: vme_ca91cx42.c: use module_pci_driver to simplify the code
Use the module_pci_driver() macro to make the code simpler
by eliminating module_init and module_exit calls.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 12:02:10 -07:00
Wei Yongjun
43f5e46c8e vme: vme_ca91cx42.c: use list_for_each_safe() when delete list items
Since we will be removing items off the list using list_del() we need
to use a safer version of the list_for_each() macro aptly named
list_for_each_safe(). We should use the safe macro if the loop
involves deletions of items.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-06 13:29:11 -07:00
Wei Yongjun
b49c32ba2c vme: vme_tsi148.c: fix to use list_for_each_safe() when delete list items
Since we will be removing items off the list using list_del() we need
to use a safer version of the list_for_each() macro aptly named
list_for_each_safe().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-06 13:29:11 -07:00
Martyn Welch
363e2e6f9e VME: Prevent D16 cycles being split into 8-bit blocks
The memcpy_fromio() and memcpy_toio() functions use the __memcpy() function,
at least on x86. This function carries out transfers smaller than 32 bits as
multiple 8 bit transfers, causing a single (aligned) 16 bit transfer to be
split into 2 8 bit transfers which may not be supported by the target VME
device.

The commit 53059aa059 fixed this for the
ca91cx42, however this was not fixed for the tsi148 at the time. This patch
uses the same algorithm to fix the tsi148.

Reported-by: Daniel Lambert <daniel.lambert@clermont.in2p3.fr>
Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-19 15:39:39 -07:00
H Hartley Sweeten
a11cfdf458 vme: vme_ca91cx42.c: local functions should not be exposed globally
Functions not referenced outside of a source file should be marked
static to prevent them from being exposed globally.

Quiets the sparse warnings:

warning: symbol 'ca91cx42_alloc_consistent' was not declared. Should it be static?
warning: symbol 'ca91cx42_free_consistent' was not declared. Should it be static?

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-08 16:01:33 -07:00
H Hartley Sweeten lin
8a508ff407 vme: vme_tsi148.c: local functions should not be exposed globally
Functions not referenced outside of a source file should be marked
static to prevent them from being exposed globally.

Quiets the sparse warnings:

warning: symbol 'tsi148_alloc_consistent' was not declared. Should it be static?
warning: symbol 'tsi148_free_consistent' was not declared. Should it be static?

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-08 16:01:33 -07:00
Greg Kroah-Hartman
db3b9e990e Staging: VME: move VME drivers out of staging
This moves the VME core, VME board drivers, and VME bridge drivers out
of the drivers/staging/vme/ area to drivers/vme/.

The VME device drivers have not moved out yet due to some API questions
they are still working through, that should happen soon, hopefully.

Cc: Martyn Welch <martyn.welch@ge.com>
Cc: Manohar Vanga <manohar.vanga@cern.ch>
Cc: Vincent Bossier <vincent.bossier@gmail.com>
Cc: "Emilio G. Cota" <cota@braap.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-26 12:34:58 -07:00