diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2015-11-17 13:24:19 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2015-11-25 22:08:50 -0500 |
commit | dd5a5f7951e253b81ac480a63dfd8b826a9ef61e (patch) | |
tree | 3d9a43bfaa5dd58394f907d3af052ba6d7853bd9 | |
parent | b1e850630b746e347f80cb3f70bdaa791c10b4f6 (diff) |
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>
-rw-r--r-- | drivers/scsi/atp870u.c | 39 | ||||
-rw-r--r-- | drivers/scsi/atp870u.h | 1 |
2 files changed, 14 insertions, 26 deletions
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 128613e88dfb..f92eb008cb8c 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c | |||
@@ -954,7 +954,7 @@ static unsigned char fun_scam(struct atp_unit *dev, unsigned short int *val) | |||
954 | return j; | 954 | return j; |
955 | } | 955 | } |
956 | 956 | ||
957 | static void tscam(struct Scsi_Host *host) | 957 | static void tscam(struct Scsi_Host *host, bool wide_chip) |
958 | { | 958 | { |
959 | 959 | ||
960 | unsigned char i, j, k; | 960 | unsigned char i, j, k; |
@@ -983,7 +983,7 @@ static void tscam(struct Scsi_Host *host) | |||
983 | m = 1; | 983 | m = 1; |
984 | m <<= dev->host_id[0]; | 984 | m <<= dev->host_id[0]; |
985 | j = 16; | 985 | j = 16; |
986 | if (dev->chip_ver < 4) { | 986 | if (!wide_chip) { |
987 | m |= 0xff00; | 987 | m |= 0xff00; |
988 | j = 8; | 988 | j = 8; |
989 | } | 989 | } |
@@ -1012,7 +1012,7 @@ static void tscam(struct Scsi_Host *host) | |||
1012 | k = i; | 1012 | k = i; |
1013 | } | 1013 | } |
1014 | atp_writeb_io(dev, 0, 0x15, k); | 1014 | atp_writeb_io(dev, 0, 0x15, k); |
1015 | if (dev->chip_ver == 4) | 1015 | if (wide_chip) |
1016 | atp_writeb_io(dev, 0, 0x1b, 0x01); | 1016 | atp_writeb_io(dev, 0, 0x1b, 0x01); |
1017 | else | 1017 | else |
1018 | atp_writeb_io(dev, 0, 0x1b, 0x00); | 1018 | atp_writeb_io(dev, 0, 0x1b, 0x00); |
@@ -1278,25 +1278,11 @@ static int atp870u_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1278 | atpdev->pdev = pdev; | 1278 | atpdev->pdev = pdev; |
1279 | pci_set_drvdata(pdev, atpdev); | 1279 | pci_set_drvdata(pdev, atpdev); |
1280 | 1280 | ||
1281 | switch (ent->device) { | ||
1282 | case PCI_DEVICE_ID_ARTOP_AEC7610: | ||
1283 | atpdev->chip_ver = pdev->revision; | ||
1284 | break; | ||
1285 | case PCI_DEVICE_ID_ARTOP_AEC7612UW: | ||
1286 | case PCI_DEVICE_ID_ARTOP_AEC7612SUW: | ||
1287 | case ATP880_DEVID1: | ||
1288 | case ATP880_DEVID2: | ||
1289 | case ATP885_DEVID: | ||
1290 | atpdev->chip_ver = 0x04; | ||
1291 | default: | ||
1292 | break; | ||
1293 | } | ||
1294 | base_io = pci_resource_start(pdev, 0); | 1281 | base_io = pci_resource_start(pdev, 0); |
1295 | base_io &= 0xfffffff8; | 1282 | base_io &= 0xfffffff8; |
1296 | atpdev->baseport = base_io; | 1283 | atpdev->baseport = base_io; |
1297 | 1284 | ||
1298 | if ((ent->device == ATP880_DEVID1)||(ent->device == ATP880_DEVID2)) { | 1285 | if ((ent->device == ATP880_DEVID1)||(ent->device == ATP880_DEVID2)) { |
1299 | atpdev->chip_ver = pdev->revision; | ||
1300 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x80);//JCC082803 | 1286 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x80);//JCC082803 |
1301 | 1287 | ||
1302 | atpdev->ioport[0] = base_io + 0x40; | 1288 | atpdev->ioport[0] = base_io + 0x40; |
@@ -1390,7 +1376,7 @@ flash_ok_880: | |||
1390 | 1376 | ||
1391 | atp_set_host_id(atpdev, 0, host_id); | 1377 | atp_set_host_id(atpdev, 0, host_id); |
1392 | 1378 | ||
1393 | tscam(shpnt); | 1379 | tscam(shpnt, true); |
1394 | atp_is(atpdev, 0, true, atp_readb_base(atpdev, 0x3f) & 0x40); | 1380 | atp_is(atpdev, 0, true, atp_readb_base(atpdev, 0x3f) & 0x40); |
1395 | atp_writeb_base(atpdev, 0x38, 0xb0); | 1381 | atp_writeb_base(atpdev, 0x38, 0xb0); |
1396 | shpnt->max_id = 16; | 1382 | shpnt->max_id = 16; |
@@ -1536,6 +1522,11 @@ flash_ok_885: | |||
1536 | shpnt->irq = pdev->irq; | 1522 | shpnt->irq = pdev->irq; |
1537 | 1523 | ||
1538 | } else { | 1524 | } else { |
1525 | bool wide_chip = | ||
1526 | (ent->device == PCI_DEVICE_ID_ARTOP_AEC7610 && | ||
1527 | pdev->revision == 4) || | ||
1528 | (ent->device == PCI_DEVICE_ID_ARTOP_AEC7612UW) || | ||
1529 | (ent->device == PCI_DEVICE_ID_ARTOP_AEC7612SUW); | ||
1539 | error = pci_read_config_byte(pdev, 0x49, &host_id); | 1530 | error = pci_read_config_byte(pdev, 0x49, &host_id); |
1540 | 1531 | ||
1541 | printk(KERN_INFO " ACARD AEC-671X PCI Ultra/W SCSI-2/3 Host Adapter: " | 1532 | printk(KERN_INFO " ACARD AEC-671X PCI Ultra/W SCSI-2/3 Host Adapter: " |
@@ -1569,7 +1560,7 @@ flash_ok_885: | |||
1569 | } | 1560 | } |
1570 | 1561 | ||
1571 | spin_lock_irqsave(shpnt->host_lock, flags); | 1562 | spin_lock_irqsave(shpnt->host_lock, flags); |
1572 | if (atpdev->chip_ver > 0x07) /* check if atp876 chip then enable terminator */ | 1563 | if (pdev->revision > 0x07) /* check if atp876 chip then enable terminator */ |
1573 | atp_writeb_base(atpdev, 0x3e, 0x00); | 1564 | atp_writeb_base(atpdev, 0x3e, 0x00); |
1574 | 1565 | ||
1575 | k = (atp_readb_base(atpdev, 0x3a) & 0xf3) | 0x10; | 1566 | k = (atp_readb_base(atpdev, 0x3a) & 0xf3) | 0x10; |
@@ -1580,15 +1571,13 @@ flash_ok_885: | |||
1580 | mdelay(32); | 1571 | mdelay(32); |
1581 | atp_set_host_id(atpdev, 0, host_id); | 1572 | atp_set_host_id(atpdev, 0, host_id); |
1582 | 1573 | ||
1583 | tscam(shpnt); | 1574 | |
1575 | tscam(shpnt, wide_chip); | ||
1584 | atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) | 0x10); | 1576 | atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) | 0x10); |
1585 | atp_is(atpdev, 0, atpdev->chip_ver == 4, 0); | 1577 | atp_is(atpdev, 0, wide_chip, 0); |
1586 | atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) & 0xef); | 1578 | atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) & 0xef); |
1587 | atp_writeb_base(atpdev, 0x3b, atp_readb_base(atpdev, 0x3b) | 0x20); | 1579 | atp_writeb_base(atpdev, 0x3b, atp_readb_base(atpdev, 0x3b) | 0x20); |
1588 | if (atpdev->chip_ver == 4) | 1580 | shpnt->max_id = wide_chip ? 16 : 8; |
1589 | shpnt->max_id = 16; | ||
1590 | else | ||
1591 | shpnt->max_id = 8; | ||
1592 | shpnt->this_id = host_id; | 1581 | shpnt->this_id = host_id; |
1593 | shpnt->unique_id = base_io; | 1582 | shpnt->unique_id = base_io; |
1594 | shpnt->io_port = base_io; | 1583 | shpnt->io_port = base_io; |
diff --git a/drivers/scsi/atp870u.h b/drivers/scsi/atp870u.h index c3c6c13685d4..8c47c53aee7f 100644 --- a/drivers/scsi/atp870u.h +++ b/drivers/scsi/atp870u.h | |||
@@ -32,7 +32,6 @@ struct atp_unit | |||
32 | unsigned char quhd[2]; | 32 | unsigned char quhd[2]; |
33 | unsigned char quend[2]; | 33 | unsigned char quend[2]; |
34 | unsigned char global_map[2]; | 34 | unsigned char global_map[2]; |
35 | unsigned char chip_ver; | ||
36 | unsigned char scam_on; | 35 | unsigned char scam_on; |
37 | unsigned char host_id[2]; | 36 | unsigned char host_id[2]; |
38 | unsigned int working[2]; | 37 | unsigned int working[2]; |