aboutsummaryrefslogtreecommitdiff
path: root/drivers/mcb
AgeCommit message (Collapse)Author
2016-11-15mcb: fix compiler warning logical-op in mcb-parse.cMichael Moese
The expression was clearly wrong, the logical AND of expressions must be changed to a logical OR. Reported-by: David Binderman <dcb314@hotmail.com> Signed-off-by: Michael Moese <michael.moese@men.de> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27mcb: Add a dma_device to mcb_deviceMichael Moese
When performing DMA operations on a MCB device, the device needed for using the DMA API is "mcb_device->bus_carrier". This is rather lengthy, so a shortcut is introduced to struct mcb_device in order to ensure the MCB device driver uses the correct device for DMA operations. Signed-off-by: Michael Moese <michael.moese@men.de> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27mcb: Enable PCI bus mastering by defaultMichael Moese
In order to successfully perform DMA operations on PCI devices, it is necessary to enble PCI bus mastering, so enable it by default. Signed-off-by: Michael Moese <michael.moese@men.de> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-31mcb: remove sub-device handling codeJohannes Thumshirn
The MEN Chameleon specification states that a chameleon FPGA can include a bridge descriptor, which then opens up a new bus behind this bridge. MCB included subdevice handling code in the core, but no support for bus descriptors in the parser, due to a lack of hardware access. As this is technically dead code, but it gets executed on a device add, I've decided to remove it. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-31mcb: Added bar descriptor support for non PCI bus MCB carrierAndreas Werner
Added support for the bar descriptor. This type is used for FPGAs connect to the LPC or to a non PCI bus. The Bar descriptor could have a maximum of 6 BARs. Each of the devices within the FPGA could be mapped to a different BAR. The BAR descriptor is comparable to the PCI header. Signed-off-by: Andreas Werner <andreas.werner@men.de> [ free bar descriptor in the non-error case ] Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-31mcb: Added support for LPC or non PCI based MCB carrierAndreas Werner
Add support for MCB bases FPGAs connected to the LPC or non PCI Bus. This driver currently supports the SC24 board. The FPGA is connected to the LPC bus and is identified using the BIOS DMI string. Signed-off-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-13mcb: Acquire reference to carrier module in coreJohannes Thumshirn
Acquire a reference to the carrier's kernel module in bus code, so it can't be removed from the kernel while it still has a bus and thus possibly devices attached to it. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reported-by: Andreas Werner <andreas.werner@men.de> Tested-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-13mcb: Acquire reference to device in probeJohannes Thumshirn
mcb_probe() does not aqcuire a reference to the probed device but drops one when removing the device. As it is actually using the device, it should grab a reference via get_device(). This could lead to a panic found with a rmmod/modprobe stress test Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reported-by: Andreas Werner <andreas.werner@men.de> Tested-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-03mcb: Delete num_cells variable which is not requiredAndreas Werner
The num_cells variable is only used in the dev_dbg print, but we can directly use the ret variable which also includes the same value. Signed-off-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-03mcb: Fixed bar number assignment for the gddAndreas Werner
The bar number is found in reg2 within the gdd. Therefore we need to change the assigment from reg1 to reg2 which is the correct location. Signed-off-by: Andreas Werner <andreas.werner@men.de> Fixes: '3764e82e5' drivers: Introduce MEN Chameleon Bus Cc: stable@vger.kernel.org # v3.15+ Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-03mcb: Replace ioremap and request_region with the devm versionAndreas Werner
Replaced ioremap with devm_ioremap and request_mem_region with devm_request_mem_region. This makes the code much more cleaner. Signed-off-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-03mcb: Implement bus->dev.release callbackJohannes Thumshirn
The mcb_bus structure previously was released in mcb_release_bus. This lead to the following warning on module unload: ------------[ cut here ]------------ WARNING: CPU: 1 PID: 2032 at drivers/base/core.c:251 device_release+0x73/0x90 Device 'mcb:0' does not have a release() function, it is broken and must be fixed. Modules linked in: men_z135_uart mcb_pci(-) mcb CPU: 1 PID: 2032 Comm: rmmod Not tainted 4.6.0-rc4+ #3 Hardware name: N/A N/A/COMe-mBTi10, BIOS MVV1R921 X64 10/14/2015 00000286 00000286 c0117de4 c12d6f16 c0117e2c c18be0d3 c0117dfc c104f6e1 000000fb f5ccbe08 f5ccbe00 f5c64600 c0117e18 c104f728 00000009 00000000 c0117e10 c18db674 c0117e2c c0117e3c c13ce5c3 c18be0d3 000000fb c18db674 Call Trace: [<c12d6f16>] dump_stack+0x47/0x61 [<c104f6e1>] __warn+0xc1/0xe0 [<c104f728>] warn_slowpath_fmt+0x28/0x30 [<c13ce5c3>] device_release+0x73/0x90 [<c12d92e4>] kobject_release+0x34/0x80 [<c12d929d>] ? kobject_del+0x2d/0x40 [<c12d9205>] kobject_put+0x25/0x50 [<c13ce77f>] put_device+0xf/0x20 [<c13d114b>] klist_devices_put+0xb/0x10 [<c1752673>] klist_next+0x73/0xf0 [<c13d1140>] ? unbind_store+0x100/0x100 [<f8a23370>] ? mcb_bus_add_devices+0x30/0x30 [mcb] [<c13d0a81>] bus_for_each_dev+0x51/0x80 [<f8a23319>] mcb_release_bus+0x19/0x40 [mcb] [<f8a23370>] ? mcb_bus_add_devices+0x30/0x30 [mcb] [<f8a2b033>] mcb_pci_remove+0x13/0x20 [mcb_pci] [<c130d358>] pci_device_remove+0x28/0xb0 [<c13d201b>] __device_release_driver+0x7b/0x110 [<c13d2847>] driver_detach+0x87/0x90 [<c13d1b9b>] bus_remove_driver+0x3b/0x80 [<c13d2ed0>] driver_unregister+0x20/0x50 [<c130be53>] pci_unregister_driver+0x13/0x60 [<f8a2b1f4>] mcb_pci_driver_exit+0xd/0xf [mcb_pci] [<c10be588>] SyS_delete_module+0x138/0x200 [<c1159208>] ? ____fput+0x8/0x10 [<c1068054>] ? task_work_run+0x74/0x90 [<c1001879>] do_fast_syscall_32+0x69/0x120 [<c1757597>] sysenter_past_esp+0x40/0x6a ---[ end trace 1ed34c2aa3019875 ]--- Release a mcb_bus' memory on the device's release callback, to avoid above warning. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reported-by: Andreas Werner <andreas.werner@men.de> Tested-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-03mcb: export bus information via sysfsJohannes Thumshirn
Export information about the bus stored in the FPGA's header to userspace via sysfs, instead of hiding it in pr_debug()s from everyone. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Andreas Werner <andreas.werner@men.de> Tested-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-03mcb: Correctly initialize the bus's deviceJohannes Thumshirn
The mcb bus' device member wasn't correctly initialized and thus wasn't placed correctly into the driver model. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Andreas Werner <andreas.werner@men.de> Tested-by: Andreas Werner <andreas.werner@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-29mcb: Destroy IDA on module unloadJohannes Thumshirn
Destroy mcb_ida on module_unload Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-29mcb: Do not return zero on error path in mcb_pci_probe()Alexey Khoroshilov
There is an error path in mcb_pci_probe() where it returns zero instead of error code. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-05mcb: Fix error handling in mcb_pci_probe()Alexey Khoroshilov
If a MCB PCI Carrier device is IO mapped insted of memory-mapped, the memory of the PCI device is still not unmapped. Also the patch adds deallocation of the bus if chameleon_parse_cells() fails. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03mcb: request_mem_region() returns NULL on errorDan Carpenter
The code here is checking for IS_ERR() when request_mem_region() only returns NULL on error and never an ERR_PTR. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-03mcb: Fix error path of mcb_pci_probeJohannes Thumshirn
If a MCB PCI Carrier device is IO mapped insted of memory-mapped (which is currently unsupported by the upstream driver) the probe function bails out with -ENOTSUPP. In this case the memory of the PCI device was not unmapped. Also rename error label to reflect what will happen at the destination (suggested by Julia Lawall <julia.lawall@lip6.fr>. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-09mcb: mcb-pci: Only remap the 1st 0x200 bytes of BAR 0Johannes Thumshirn
Currently it is not possible to have a kernel with built-in MCB attached devices. This results out of the fact that mcb-pci requests PCI BAR 0, then parses the chameleon table and calls the driver's probe function before releasing BAR 0 again. When building the kernel with modules this is not a problem (and therefore it wasn't detected by my tests yet). A solution is to only remap the 1st 0x200 bytes of a Chameleon PCI device. 0x200 bytes is the maximum size of a Chameleon v2 Table. Also this patch stops disabling the PCI device on successful registration of MCB devices. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de> Suggested-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27mcb: Add support for shared PCI IRQsJohannes Thumshirn
Add support for shared PCI IRQs to mcb and mcb-pci. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-16drivers: mcb: fix memory leak in chameleon_parse_cells() error pathChristoph Jaeger
chameleon_parse_cells() bails out if chameleon descriptor type is invalid but does not free the storage 'header' points to. Signed-off-by: Christoph Jaeger <christophjaeger@linux.com> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-09drivers: mcb: Fix build error discovered by 0-day botJohannes Thumshirn
Make mcb depend on HAS_IOMEM and mcb-pci depend on PCI. This fixes build errors discovered by the 0-day kernel build testing system. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08drivers/mcb: do not set default Kconfig variable to modularPaul Gortmaker
Coverage builds found this build fail in ARM ebsa110_defconfig: drivers/mcb/mcb-parse.c: In function 'chameleon_parse_cells': drivers/mcb/mcb-parse.c:105:2: error: implicit declaration of function 'memcpy_fromio' [-Werror=implicit-function-declaration] cc1: some warnings being treated as errors make[2]: *** [drivers/mcb/mcb-parse.o] Error 1 A simple bisect will output this: 3764e82e5150d87b205c10cd78a9c9ab86fbfa51 is the first bad commit commit 3764e82e5150d87b205c10cd78a9c9ab86fbfa51 Author: Johannes Thumshirn <johannes.thumshirn@men.de> Date: Wed Feb 26 17:29:05 2014 +0100 drivers: Introduce MEN Chameleon Bus The above commit used "default m" which is wrong. New drivers should never be globally enabled with "default y/m". Whether this driver makes sense to build on ARM is an independent issue. Here we delete the "default m" line, which is the equivalent of "default n". Cc: Johannes Thumshirn <johannes.thumshirn@men.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-28mcb: Add PCI carrier for MEN Chameleon BusJohannes Thumshirn
Add support for MCB over PCI devices. Both PCI attached on-board Chameleon FPGAs as well as CompactPCI based MCB carrier cards are supported with this driver. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-28drivers: Introduce MEN Chameleon BusJohannes Thumshirn
The MCB (MEN Chameleon Bus) is a Bus specific to MEN Mikroelektronik FPGA based devices. It is used to identify MCB based IP-Cores within an FPGA and provide the necessary framework for instantiating drivers for these devices. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>