summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/atp870u.c
Commit message (Collapse)AuthorAgeFilesLines
* treewide: Add SPDX license identifier for more missed filesThomas Gleixner2019-05-211-0/+1
| | | | | | | | | | | | | | | | | Add SPDX license identifiers to all files which: - Have no license information of any form - Have MODULE_LICENCE("GPL*") inside which was used in the initial scan/conversion to ignore the file These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* scsi: atp870u: clean up code style and indentation issuesColin Ian King2019-03-191-4/+3Star
| | | | | | | | Clean up { brace to fix cppcheck warning. Remove some trailing spaces at end of a statement. Also clean up an indentation issue. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: flip the default on use_clusteringChristoph Hellwig2018-12-191-1/+0Star
| | | | | | | | | | Most SCSI drivers want to enable "clustering", that is merging of segments so that they might span more than a single page. Remove the ENABLE_CLUSTERING define, and require drivers to explicitly set DISABLE_CLUSTERING to disable this feature. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: atp870u: switch to generic DMA APIChristoph Hellwig2018-10-181-3/+3
| | | | | | | | Switch from the legacy PCI DMA API to the generic DMA API. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: atp870u: Replace mdelay() with msleep()Jia-Ju Bai2018-07-311-8/+8
| | | | | | | | | | | | tscam(), atp870_init(), atp880_init() and atp885_init() are never called in atomic context. They call mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: atp870u: 64 bit bug in atp885_init()Dan Carpenter2018-03-021-2/+2
| | | | | | | | | | On 64 bit CPUs there is a memory corruption bug on probe(). It should be a u32 pointer instead of an unsigned long pointer or we write past the end of the setupdata[] array. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Introduce atp870_init()Ondrej Zary2015-11-261-50/+54
| | | | | | | | | Move 870-specific init code to a separate function atp870_init() Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Introduce atp885_init()Ondrej Zary2015-11-261-118/+113Star
| | | | | | | | | Move 885-specific init code to a separate function atp885_init() Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Introduce atp880_init()Ondrej Zary2015-11-261-86/+88
| | | | | | | | | Move 880-specific init code to a separate function atp880_init() Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Initialize tables earlierOndrej Zary2015-11-261-16/+6Star
| | | | | | | | | | | Call _init_tables before chip-specific initialization. This avoids code duplication and fixes a bug(?) in 880 init where the values read from flash into atpdev->sp are then overwritten by calling init_tables. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Remove scam_on from struct atp_unitOndrej Zary2015-11-261-7/+7
| | | | | | | | | scam_on is used only during probe, no need to keep it later. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Request IRQ later, remove weird lockingOndrej Zary2015-11-261-35/+12Star
| | | | | | | | | | | Allocate IRQ later during probe to avoid code duplication and also remove the need for weird locking in _probe. (It was probably there to prevent race with the IRQ handler?) Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Use pci_request_regionsOndrej Zary2015-11-261-11/+10Star
| | | | | | | | | | Use pci_request_regions and do it before accessing the I/O ports. Also add missing pci_disable_device() call to atp870u_remove(). Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Introduce is880(), is885() and remove dev_idOndrej Zary2015-11-261-32/+38
| | | | | | | | | | Introduce chip type inline functions to simplify code, allowing to delete dev_id from struct atp_unit. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Simplify _probe()Ondrej Zary2015-11-261-37/+28Star
| | | | | | | | | Move shpnt common code to the top, remove base_io, use pci_resource_len. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Remove chip_ver from struct atp_unitOndrej Zary2015-11-261-25/+14Star
| | | | | | | | | | chip_ver is used for wide chip detection only. Remove it and use a local variable instead (for 870; 880 and 885 are always wide). Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Improve unsupported chip detectionOndrej Zary2015-11-261-12/+8Star
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Improve _probe()Ondrej Zary2015-11-261-123/+113Star
| | | | | | | | | | | | Move scsi_host_alloc() to the top of _probe() to remove code duplication, *p and unneeded atpdev (de)allocation and copying. While at it, fix the error paths to return real error codes and also add missing pci_disble_device() call. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Remove useless and broken card countingOndrej Zary2015-11-261-6/+4Star
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Use n_io_port in request_region and release_regionOndrej Zary2015-11-261-17/+3Star
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Use module_pci_driverOndrej Zary2015-11-261-19/+1Star
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Remove empty tscam_885()Ondrej Zary2015-11-261-14/+1Star
| | | | | | | | | tscam_885() is empty (except a delay) so remove it. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Reduce log spam on module load/unloadOndrej Zary2015-11-261-6/+1Star
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Introduce atp_set_host_idOndrej Zary2015-11-261-39/+18Star
| | | | | | | | | | The code for setting host adapter ID is the same for all chips. Move it to a common function. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Fix incorrect writeb_io access to register 0x3aOndrej Zary2015-11-261-4/+4
| | | | | | | | | | | The ioport region is 0x20 bytes long so accessing 0x3a register using writeb_io is incorrect. Use writeb_base instead. There's no change in behavior as 870 chips have ioport = baseport. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Replace port 0x80 delay by udelayOndrej Zary2015-11-261-9/+9
| | | | | | | | | | tscam() is using port 0x80 access for delays but that's x86-only. Use udelay(2) instead. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Convert remaining in[bwl] and out[bwl] to wrappersOndrej Zary2015-11-261-104/+118
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Rename is885() to atp_is()Ondrej Zary2015-11-261-6/+6
| | | | | | | | | | Now that all the is* functions except is885() are gone, rename is885() to atp_is() to avoid confusion. Don't know what "is" means, though... Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Remove is870()Ondrej Zary2015-11-261-426/+1Star
| | | | | | | | | | Now that is885() supports everything from is870() and the rest of the code is almost identical, remove is870() and use is885() instead. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Move 870-specific code out of is870()Ondrej Zary2015-11-261-3/+2Star
| | | | | | | | | Move few remaining 870-specific code lines out of is870() Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Add remaining 870 support to is885()Ondrej Zary2015-11-261-14/+31
| | | | | | | | | | | | | | | | Add remaining 870 support to is885(): - different synw, no synuw - synu[4] = 0x0c - atp_writeb_io(dev, c, 0x04, 0x00); instead of atp_writeb_io(dev, c, 0x14, 0x00); (isn't that a bug?) - atp_writeb_io(dev, c, 0x14, 0xff); instead of atp_writeb_io(dev, c, 0x14, 0x06); - different mbuf[3] and mbuf[4] checks Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Add wide_chip parameter to is870() and is885()Ondrej Zary2015-11-261-21/+25
| | | | | | | | | | Don't check chip_ver in is870() but add wide_chip parameter for that. Then add the non-wide support to is885(). Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Remove is880()Ondrej Zary2015-11-261-571/+1Star
| | | | | | | | | | Now that is880() and is885() are almost identical (except for some cpu_relax() calls and debug printks), remove is880() and use is885() instead. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Move chip-specific lines out of is880() and is885()Ondrej Zary2015-11-261-14/+10Star
| | | | | | | | | | Move few chip-specifis lines out of is880() and is885() so they become almost identical. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Add channel parameter to is870() and is880()Ondrej Zary2015-11-261-342/+342
| | | | | | | | | | Add channel parameter to is870() and is880() functions to simplify comparing them with is885(). Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Unify code format in is870(), is880() and is885()Ondrej Zary2015-11-261-69/+101
| | | | | | | | | | Unify code formatting in is870(), is880() and is885() functions to simplify comparing them. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Convert is885() to use wrappersOndrej Zary2015-11-261-179/+179
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Convert is880() to use wrappersOndrej Zary2015-11-261-176/+176
| | | | | | | | | | Subtract 0x40 to use _io access wrappers. Now it's obvious that is870() and is880() are very similar. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Convert is870() to use wrappersOndrej Zary2015-11-261-138/+138
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Introduce HW access wrappersOndrej Zary2015-11-261-220/+252
| | | | | | | | | | Introduce *_read? and *_write? wrappers to improve code readability. Also make sure that baseport is always initialized, not only for ATP880. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Remove ugly gotos #5Ondrej Zary2015-11-261-72/+62Star
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Remove ugly gotos #4Ondrej Zary2015-11-261-17/+15Star
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Remove ugly gotos #3Ondrej Zary2015-11-261-12/+6Star
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Remove ugly gotos #2Ondrej Zary2015-11-261-38/+30Star
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Remove ugly gotosOndrej Zary2015-11-261-54/+30Star
| | | | | | | Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Untangle tmpcip #2Ondrej Zary2015-11-261-16/+9Star
| | | | | | | | | Untangle the tmpcip crap so it becomes obvious what ports are accessed. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Untangle tmpcipOndrej Zary2015-11-261-41/+23Star
| | | | | | | | | Untangle the tmpcip crap so it becomes obvious what ports are accessed. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Untangle tmport #8Ondrej Zary2015-11-261-301/+177Star
| | | | | | | | | Untangle the tmport crap so it becomes obvious what ports are accessed. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Untangle tmport #7Ondrej Zary2015-11-261-11/+5Star
| | | | | | | | | Untangle the tmport crap so it becomes obvious what ports are accessed. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* atp870u: Untangle tmport #6Ondrej Zary2015-11-261-87/+49Star
| | | | | | | | | Untangle the tmport crap so it becomes obvious what ports are accessed. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>