summaryrefslogtreecommitdiff
path: root/drivers/vme/bridges/vme_ca91cx42.c
AgeCommit message (Collapse)Author
2022-06-10vme: remove ca91cx42 Universe-II supportArnd Bergmann
This is one of four remaining drivers using the ancient virt_to_bus() interface instead of the dma-mapping interface, making it incompatible with most modern machines. As nobody has cleaned this up, there is a high chance that this driver has no actual users. The chip was introduced in 1997 and only supports 32-bit legacy PCI. It was replaced by TSI148 in 2004, but that chip has since been discontinued, while a version of the older Universe II remains in production after 25 years. The vme_vmivme7805 board uses Universe-II, so this also gets removed in the process, but PCI add-on cards based on TSI148 can still work in theory. If there are users of the Universe-II driver after all, it is of course possible to revert this patch and fix it to use the dma-mapping interface like the tsi148 driver does. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20220606084109.4108188-2-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-09vme: switch from 'pci_' to 'dma_' APIChristophe JAILLET
The wrappers in include/linux/pci-dma-compat.h should go away. The patch has been generated with the coccinelle script below and has been hand modified to replace GFP_ with a correct flag. It has been compile tested. When memory is allocated in 'ca91cx42_alloc_consistent()' and 'tsi148_alloc_consistent()' GFP_KERNEL can be used because both functions are called only from 'vme_alloc_consistent()' (vme.c). This function is only called from the 'vme_user_probe()' probe function and no lock is taken in the between. When memory is allocated in 'ca91cx42_crcsr_init()' and 'tsi148_crcsr_init()' GFP_KERNEL can be used because both functions are called only from their corresponding probe function and no lock is taken in the between. @@ @@ - PCI_DMA_BIDIRECTIONAL + DMA_BIDIRECTIONAL @@ @@ - PCI_DMA_TODEVICE + DMA_TO_DEVICE @@ @@ - PCI_DMA_FROMDEVICE + DMA_FROM_DEVICE @@ @@ - PCI_DMA_NONE + DMA_NONE @@ expression e1, e2, e3; @@ - pci_alloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3; @@ - pci_zalloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3, e4; @@ - pci_free_consistent(e1, e2, e3, e4) + dma_free_coherent(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_single(e1, e2, e3, e4) + dma_map_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_single(e1, e2, e3, e4) + dma_unmap_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4, e5; @@ - pci_map_page(e1, e2, e3, e4, e5) + dma_map_page(&e1->dev, e2, e3, e4, e5) @@ expression e1, e2, e3, e4; @@ - pci_unmap_page(e1, e2, e3, e4) + dma_unmap_page(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_sg(e1, e2, e3, e4) + dma_map_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_sg(e1, e2, e3, e4) + dma_unmap_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_cpu(e1, e2, e3, e4) + dma_sync_single_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_device(e1, e2, e3, e4) + dma_sync_single_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_cpu(e1, e2, e3, e4) + dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_device(e1, e2, e3, e4) + dma_sync_sg_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2; @@ - pci_dma_mapping_error(e1, e2) + dma_mapping_error(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_dma_mask(e1, e2) + dma_set_mask(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_consistent_dma_mask(e1, e2) + dma_set_coherent_mask(&e1->dev, e2) Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/20201206071352.21949-1-christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-06remove ioremap_nocache and devm_ioremap_nocacheChristoph Hellwig
ioremap has provided non-cached semantics by default since the Linux 2.6 days, so remove the additional ioremap_nocache interface. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Arnd Bergmann <arnd@arndb.de>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner
Based on 1 normalized pattern(s): 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-16vme: ca91cx42: remove redundant variable iColin Ian King
Variable i is being assigned but is never used hence it is redundant and can be removed. Cleans up clang warning: warning: variable 'i' set but not used [-Wunused-but-set-variable] Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Martyn Welch <martyn@welchs.me.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-13vme: ca91cx42: Adjust 14 checks for null pointersMarkus Elfring
MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script “checkpatch.pl” pointed information out like the following. Comparison to NULL could be written … Thus fix the affected source code places. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Martyn Welch <martyn@welchs.me.uk>
2017-10-13vme: ca91cx42: Improve 12 size determinationsMarkus Elfring
Replace the specification of data structures by variable references as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Martyn Welch <martyn@welchs.me.uk>
2017-10-13vme: ca91cx42: Delete eight error messages for a failed memory allocationMarkus Elfring
Omit extra messages for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Martyn Welch <martyn@welchs.me.uk>
2017-01-11vme: Fix wrong pointer utilization in ca91cx42_slave_getAugusto Mecking Caringi
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>
2016-08-31vme: Fix module autoloadAlessio Igor Bogani
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-31vme: change LM callback argument to void pointerAaron Sierra
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-05-01vme: add vme_init_bridge for common bridge initAaron Sierra
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-02-07vme: vme_ca91cx42.c: use to_pci_dev()Geliang Tang
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>
2015-10-04vme: change bus error handling schemeDmitry Kalinkin
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-04vme: lower alignment requirement in pci bridge driversDmitry Kalinkin
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-06-12vme: ca91cx42: return error code on DMA errorDmitry Kalinkin
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-12vme: stop DMA transfer on interruptionDmitry Kalinkin
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>
2014-08-08vme: bridges: use pci_zalloc_consistentJoe Perches
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-02-18Merge 3.14-rc3 into char-misc-nextGreg Kroah-Hartman
We need the fixes here for future mei and other patches. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-15VME: Stop using memcpy_[to|from]io() due to unwanted behaviourMartyn Welch
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-07VME: Correct read/write alignment algorithmMartyn Welch
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>
2013-12-03vme: remove DEFINE_PCI_DEVICE_TABLE macroJingoo Han
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-08-27vme: vme_ca91cx42.c: fix to pass correct device identity to free_irq()Wei Yongjun
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-19vme: vme_ca91cx42.c: add missing __iomem annotationJingoo Han
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>
2012-10-25vme: vme_ca91cx42.c: use module_pci_driver to simplify the codeWei Yongjun
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-09-06vme: vme_ca91cx42.c: use list_for_each_safe() when delete list itemsWei Yongjun
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-05-08vme: vme_ca91cx42.c: local functions should not be exposed globallyH Hartley Sweeten
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-04-26Staging: VME: move VME drivers out of stagingGreg Kroah-Hartman
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>