Colin Ian King [Sat, 28 Nov 2015 16:33:56 +0000 (16:33 +0000)]
scsi: ufs: fix spelling mistake in error message
Minor issue, fix spelling mistake, Intialization -> Initialization
Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ching Huang <ching2048@areca.com.tw> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ching Huang [Thu, 26 Nov 2015 11:41:15 +0000 (19:41 +0800)]
arcmsr: Split dma resource allocation to a new function
Split dma resource allocation and io register assignment from get_config
to a new function arcmsr_alloc_io_queue.
Signed-off-by: Ching Huang <ching2048@areca.com.tw> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ching Huang [Thu, 26 Nov 2015 11:33:56 +0000 (19:33 +0800)]
arcmsr: more readability improvements
Signed-off-by: Ching Huang <ching2048@areca.com.tw> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ching Huang [Wed, 25 Nov 2015 11:52:15 +0000 (19:52 +0800)]
arcmsr: changes driver version number
Changes driver version number.
Signed-off-by: Ching Huang <ching2048@areca.com.tw> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ching Huang [Wed, 25 Nov 2015 11:49:33 +0000 (19:49 +0800)]
arcmsr: adds code to support new Areca adapter ARC1203
Support Areca's new PCIe to SATA RAID adapter ARC1203.
Signed-off-by: Ching Huang <ching2048@areca.com.tw> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ching Huang [Wed, 25 Nov 2015 11:45:16 +0000 (19:45 +0800)]
arcmsr: make code more readable
[mkp: Fixed checkpatch whitespace warning]
Signed-off-by: Ching Huang <ching2048@areca.com.tw> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ching Huang [Wed, 25 Nov 2015 11:41:23 +0000 (19:41 +0800)]
arcmsr: fixes not release allocated resource
Releasing allocated resource if get configuration data failed.
Signed-off-by: Ching Huang <ching2048@areca.com.tw> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinicke <hare@suse.de> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ching Huang [Wed, 25 Nov 2015 11:36:02 +0000 (19:36 +0800)]
arcmsr: fixed getting wrong configuration data
Fixed getting wrong configuration data of adapter type B and type D.
Signed-off-by: Ching Huang <ching2048@areca.com.tw> Reviewed-by: Hannes Reinicke <hare@suse.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Use scsi_host_{get,put}() instead of open-coding these functions.
Compile-tested only.
[mkp: Dropped CC:stable and fixed James Smart's email address]
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.de> Cc: James Smart <james.smart@avagotech.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Andy Shevchenko [Thu, 26 Nov 2015 18:22:50 +0000 (20:22 +0200)]
scsi_debug: check for bigger value first
Even for signed types we have to check for bigger positive value first.
Otherwise it will be never happened.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Ewan Milne <emilne@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Hannes Reinecke [Mon, 9 Nov 2015 12:24:28 +0000 (13:24 +0100)]
scsi: rescan VPD attributes
The VPD page information might change, so we need to be able to update
it. This patch implements a VPD page rescan whenever the 'rescan' sysfs
attribute is triggered.
Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Shane Seymour <shane.seymour@hpe.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Arnd Bergmann [Fri, 20 Nov 2015 16:38:28 +0000 (17:38 +0100)]
scsi: use sector_div instead of do_div
do_div is the wrong way to divide a sector_t, as it is less efficient
when sector_t is 32-bit wide. With the upcoming do_div optimizations,
the kernel starts warning about this:
drivers/scsi/scsi_debug.c: In function 'dif_store':
include/asm-generic/div64.h:207:28: warning: comparison of distinct pointer types lacks a cast
This changes the code to use sector_div instead, which always produces
optimal code.
Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinicke <hare@suse.de> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Thu, 19 Nov 2015 12:23:59 +0000 (20:23 +0800)]
hisi_sas: Remove dependency on of_irq_count
Originally the driver would use of_irq_count to calculate how much
memory is required for storing the interrupt names, since the number of
interrupt sources for the controller is variable. Since of_irq_count
cannot be used by the driver, use fixed names.
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:59 +0000 (00:50 +0800)]
MAINTAINERS: Add maintainer for HiSi SAS driver
Add maintainer for HiSilicon SAS driver.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:58 +0000 (00:50 +0800)]
hisi_sas: Add fatal irq handler
Add handlers for fatal interrupts.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:57 +0000 (00:50 +0800)]
hisi_sas: Add control phy handler
Add method for lldd_control_phy. Currently link rate control and spinup
hold is unsupported.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:56 +0000 (00:50 +0800)]
hisi_sas: Add tmf methods
Add function methods for tmf's.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:55 +0000 (00:50 +0800)]
hisi_sas: Add scan finished and start
Add functions for scsi host template scan_finished and scan_start
methods.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:54 +0000 (00:50 +0800)]
hisi_sas: Add smp protocol support
Add support for smp function, which allows devices attached by expander
to be controlled.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:53 +0000 (00:50 +0800)]
hisi_sas: Add bcast interrupt handler
This is for expander broadcast event.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:52 +0000 (00:50 +0800)]
hisi_sas: Add abnormal irq handler
Add abnormal irq handler. This handler is concerned with phy down event.
Also add port formed and port deformed handlers.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:51 +0000 (00:50 +0800)]
hisi_sas: Add dev_found and dev_gone
Add functions to deal with lldd_dev_found and lldd_dev_gone.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:50 +0000 (00:50 +0800)]
hisi_sas: Add cq interrupt handler
Add cq interrupt handler and also slot error handler function.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:49 +0000 (00:50 +0800)]
hisi_sas: Add ssp command function
Add path to send ssp command to HW.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:48 +0000 (00:50 +0800)]
hisi_sas: Add path from phyup irq to SAS framework
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:47 +0000 (00:50 +0800)]
hisi_sas: Add v1 hardware interrupt init
Add code to interrupts, so now we can get a phy up interrupt when a disk
is connected.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:46 +0000 (00:50 +0800)]
hisi_sas: Add v1 hardware initialisation code
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:45 +0000 (00:50 +0800)]
hisi_sas: Add v1 hardware register definitions
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:44 +0000 (00:50 +0800)]
hisi_sas: Add v1 hw module init
Add module init code for v1 hw.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:43 +0000 (00:50 +0800)]
hisi_sas: Add timer and spinlock init
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:42 +0000 (00:50 +0800)]
hisi_sas: Add phy and port init
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:41 +0000 (00:50 +0800)]
hisi_sas: Add hisi sas device type
Include initialisation.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:40 +0000 (00:50 +0800)]
hisi_sas: Add hisi_hba workqueue
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:39 +0000 (00:50 +0800)]
hisi_sas: Set dev DMA mask
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:38 +0000 (00:50 +0800)]
hisi_sas: Add phy SAS ADDR initialization
The SAS address for the HBA comes from the device tree.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:37 +0000 (00:50 +0800)]
hisi_sas: Add cq structure initialization
Each completion queue has a structure. This is mainly for passing to irq
handler so we know which queue the irq occured on.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:36 +0000 (00:50 +0800)]
hisi_sas: Add slot init code
Add functionality to init slot indexing.
Slot indexing is for the host to track which slots (or tags) are free
and which are used.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:35 +0000 (00:50 +0800)]
hisi_sas: Add hisi_sas_remove
This patch also includes relevant memory/pool freeing and sas/scsi host
removal.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:34 +0000 (00:50 +0800)]
hisi_sas: Allocate memories and create pools
Allocate DMA and non-DMA memories for the controller. Also create DMA
pools.
These include:
- Delivery queues
- Completion queues
- Command status buffer
- Command table
- ITCT (For device context)
- Host slot info
- IO status
- Breakpoint
- host slot indexing
- SG data
- FIS
- interrupts names
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:33 +0000 (00:50 +0800)]
hisi_sas: Add HW DMA structures
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:32 +0000 (00:50 +0800)]
hisi_sas: Scan device tree
Scan the device tree for all properties. Also do this:
- do ioremap for SAS registers
- allocate memory for interrupt names
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:31 +0000 (00:50 +0800)]
hisi_sas: Add scsi host registration
Add functionality to register device as a scsi host.
The SAS domain transport ops are empty at this point.
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:29 +0000 (00:50 +0800)]
devicetree: bindings: scsi: HiSi SAS
Add devicetree bindings for HiSilicon SAS driver.
Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org> Acked-by: Rob Herring <robh@kernel.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Tue, 17 Nov 2015 16:50:28 +0000 (00:50 +0800)]
scsi: Centralise ssp frame information units
The xfer_rdy, command, and task frame's iu structures are not available
in <scsi/sas.h>, but only aic94xx driver folder. Add them to
include/scsi/sas.h
Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Ondrej Zary [Tue, 17 Nov 2015 18:24:28 +0000 (19:24 +0100)]
atp870u: Introduce atp870_init()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:27 +0000 (19:24 +0100)]
atp870u: Introduce atp885_init()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:26 +0000 (19:24 +0100)]
atp870u: Introduce atp880_init()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:25 +0000 (19:24 +0100)]
atp870u: Initialize tables earlier
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:24 +0000 (19:24 +0100)]
atp870u: Remove scam_on from struct atp_unit
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:23 +0000 (19:24 +0100)]
atp870u: Request IRQ later, remove weird locking
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:22 +0000 (19:24 +0100)]
atp870u: Use pci_request_regions
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:21 +0000 (19:24 +0100)]
atp870u: Introduce is880(), is885() and remove dev_id
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:20 +0000 (19:24 +0100)]
atp870u: Simplify _probe()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:19 +0000 (19:24 +0100)]
atp870u: Remove chip_ver from struct atp_unit
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:18 +0000 (19:24 +0100)]
atp870u: Improve unsupported chip detection
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:17 +0000 (19:24 +0100)]
atp870u: Improve _probe()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:16 +0000 (19:24 +0100)]
atp870u: Remove unused irq 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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:15 +0000 (19:24 +0100)]
atp870u: Remove useless and broken card counting
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:14 +0000 (19:24 +0100)]
atp870u: Use n_io_port in request_region and release_region
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:13 +0000 (19:24 +0100)]
atp870u: Use module_pci_driver
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:12 +0000 (19:24 +0100)]
atp870u: Remove empty tscam_885()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:11 +0000 (19:24 +0100)]
atp870u: Reduce log spam on module load/unload
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:10 +0000 (19:24 +0100)]
atp870u: Introduce atp_set_host_id
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:09 +0000 (19:24 +0100)]
atp870u: Fix incorrect writeb_io access to register 0x3a
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:08 +0000 (19:24 +0100)]
atp870u: Replace port 0x80 delay by udelay
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:07 +0000 (19:24 +0100)]
atp870u: Convert remaining in[bwl] and out[bwl] to wrappers
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:06 +0000 (19:24 +0100)]
atp870u: Rename is885() to atp_is()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:05 +0000 (19:24 +0100)]
atp870u: Remove is870()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:04 +0000 (19:24 +0100)]
atp870u: Move 870-specific code out of is870()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:03 +0000 (19:24 +0100)]
atp870u: Add remaining 870 support to is885()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:02 +0000 (19:24 +0100)]
atp870u: Add wide_chip parameter to is870() and is885()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:01 +0000 (19:24 +0100)]
atp870u: Remove is880()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:24:00 +0000 (19:24 +0100)]
atp870u: Move chip-specific lines out of is880() and is885()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:59 +0000 (19:23 +0100)]
atp870u: Add channel parameter to is870() and is880()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:58 +0000 (19:23 +0100)]
atp870u: Unify code format in is870(), is880() and is885()
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:57 +0000 (19:23 +0100)]
atp870u: Convert is885() to use wrappers
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:56 +0000 (19:23 +0100)]
atp870u: Convert is880() to use wrappers
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:55 +0000 (19:23 +0100)]
atp870u: Convert is870() to use wrappers
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:54 +0000 (19:23 +0100)]
atp870u: Introduce HW access wrappers
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:53 +0000 (19:23 +0100)]
atp870u: Remove ugly gotos #5
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:52 +0000 (19:23 +0100)]
atp870u: Remove ugly gotos #4
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:51 +0000 (19:23 +0100)]
atp870u: Remove ugly gotos #3
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:50 +0000 (19:23 +0100)]
atp870u: Remove ugly gotos #2
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:49 +0000 (19:23 +0100)]
atp870u: Remove ugly gotos
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:48 +0000 (19:23 +0100)]
atp870u: Untangle tmpcip #2
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:47 +0000 (19:23 +0100)]
atp870u: Untangle tmpcip
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:46 +0000 (19:23 +0100)]
atp870u: Untangle tmport #8
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:45 +0000 (19:23 +0100)]
atp870u: Untangle tmport #7
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:44 +0000 (19:23 +0100)]
atp870u: Untangle tmport #6
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:43 +0000 (19:23 +0100)]
atp870u: Untangle tmport #5
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:42 +0000 (19:23 +0100)]
atp870u: Untangle tmport #4
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:41 +0000 (19:23 +0100)]
atp870u: Untangle tmport #3
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:40 +0000 (19:23 +0100)]
atp870u: Untangle tmport #2
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:39 +0000 (19:23 +0100)]
atp870u: Untangle tmport
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:38 +0000 (19:23 +0100)]
atp870u: Remove tmport1
Remove tmport1 temporary variable to simplify the code.
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>
Ondrej Zary [Tue, 17 Nov 2015 18:23:37 +0000 (19:23 +0100)]
atp870u: Remove workport
Remove workport temporary variable to simplify the code.
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>
The initio driver has for many years had two copies of the
same module device table. One of them is also used for registering
the other driver, the other one is entirely useless after the
large scale cleanup that Alan Cox did back in 2007.
The compiler warns about this whenever the driver is built-in:
drivers/scsi/initio.c:131:29: warning: 'i91u_pci_devices' defined but not used [-Wunused-variable]
This removes the extraneous table and the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 72d39fea901 ("[SCSI] initio: Convert into a real Linux driver and update to modern style") Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>