return j;
}
-static void tscam(struct Scsi_Host *host)
+static void tscam(struct Scsi_Host *host, bool wide_chip)
{
unsigned char i, j, k;
m = 1;
m <<= dev->host_id[0];
j = 16;
- if (dev->chip_ver < 4) {
+ if (!wide_chip) {
m |= 0xff00;
j = 8;
}
k = i;
}
atp_writeb_io(dev, 0, 0x15, k);
- if (dev->chip_ver == 4)
+ if (wide_chip)
atp_writeb_io(dev, 0, 0x1b, 0x01);
else
atp_writeb_io(dev, 0, 0x1b, 0x00);
atpdev->pdev = pdev;
pci_set_drvdata(pdev, atpdev);
- switch (ent->device) {
- case PCI_DEVICE_ID_ARTOP_AEC7610:
- atpdev->chip_ver = pdev->revision;
- break;
- case PCI_DEVICE_ID_ARTOP_AEC7612UW:
- case PCI_DEVICE_ID_ARTOP_AEC7612SUW:
- case ATP880_DEVID1:
- case ATP880_DEVID2:
- case ATP885_DEVID:
- atpdev->chip_ver = 0x04;
- default:
- break;
- }
base_io = pci_resource_start(pdev, 0);
base_io &= 0xfffffff8;
atpdev->baseport = base_io;
if ((ent->device == ATP880_DEVID1)||(ent->device == ATP880_DEVID2)) {
- atpdev->chip_ver = pdev->revision;
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x80);//JCC082803
atpdev->ioport[0] = base_io + 0x40;
atp_set_host_id(atpdev, 0, host_id);
- tscam(shpnt);
+ tscam(shpnt, true);
atp_is(atpdev, 0, true, atp_readb_base(atpdev, 0x3f) & 0x40);
atp_writeb_base(atpdev, 0x38, 0xb0);
shpnt->max_id = 16;
shpnt->irq = pdev->irq;
} else {
+ bool wide_chip =
+ (ent->device == PCI_DEVICE_ID_ARTOP_AEC7610 &&
+ pdev->revision == 4) ||
+ (ent->device == PCI_DEVICE_ID_ARTOP_AEC7612UW) ||
+ (ent->device == PCI_DEVICE_ID_ARTOP_AEC7612SUW);
error = pci_read_config_byte(pdev, 0x49, &host_id);
printk(KERN_INFO " ACARD AEC-671X PCI Ultra/W SCSI-2/3 Host Adapter: "
}
spin_lock_irqsave(shpnt->host_lock, flags);
- if (atpdev->chip_ver > 0x07) /* check if atp876 chip then enable terminator */
+ if (pdev->revision > 0x07) /* check if atp876 chip then enable terminator */
atp_writeb_base(atpdev, 0x3e, 0x00);
k = (atp_readb_base(atpdev, 0x3a) & 0xf3) | 0x10;
mdelay(32);
atp_set_host_id(atpdev, 0, host_id);
- tscam(shpnt);
+
+ tscam(shpnt, wide_chip);
atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) | 0x10);
- atp_is(atpdev, 0, atpdev->chip_ver == 4, 0);
+ atp_is(atpdev, 0, wide_chip, 0);
atp_writeb_base(atpdev, 0x3a, atp_readb_base(atpdev, 0x3a) & 0xef);
atp_writeb_base(atpdev, 0x3b, atp_readb_base(atpdev, 0x3b) | 0x20);
- if (atpdev->chip_ver == 4)
- shpnt->max_id = 16;
- else
- shpnt->max_id = 8;
+ shpnt->max_id = wide_chip ? 16 : 8;
shpnt->this_id = host_id;
shpnt->unique_id = base_io;
shpnt->io_port = base_io;