Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pata_sc1200: Activate secondary channel

Implement serialize and turn on slave channel

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

authored by

Alan Cox and committed by
Jeff Garzik
c0f2ee34 140d6fed

+27 -2
+27 -2
drivers/ata/pata_sc1200.c
··· 2 2 * New ATA layer SC1200 driver Alan Cox <alan@lxorguk.ukuu.org.uk> 3 3 * 4 4 * TODO: Mode selection filtering 5 - * TODO: Can't enable second channel until ATA core has serialize 6 5 * TODO: Needs custom DMA cleanup code 7 6 * 8 7 * Based very heavily on ··· 177 178 return ata_sff_qc_issue(qc); 178 179 } 179 180 181 + /** 182 + * sc1200_qc_defer - implement serialization 183 + * @qc: command 184 + * 185 + * Serialize command issue on this controller. 186 + */ 187 + 188 + static int sc1200_qc_defer(struct ata_queued_cmd *qc) 189 + { 190 + struct ata_host *host = qc->ap->host; 191 + struct ata_port *alt = host->ports[1 ^ qc->ap->port_no]; 192 + int rc; 193 + 194 + /* First apply the usual rules */ 195 + rc = ata_std_qc_defer(qc); 196 + if (rc != 0) 197 + return rc; 198 + 199 + /* Now apply serialization rules. Only allow a command if the 200 + other channel state machine is idle */ 201 + if (alt && alt->qc_active) 202 + return ATA_DEFER_PORT; 203 + return 0; 204 + } 205 + 180 206 static struct scsi_host_template sc1200_sht = { 181 207 ATA_BMDMA_SHT(DRV_NAME), 182 208 .sg_tablesize = LIBATA_DUMB_MAX_PRD, ··· 211 187 .inherits = &ata_bmdma_port_ops, 212 188 .qc_prep = ata_sff_dumb_qc_prep, 213 189 .qc_issue = sc1200_qc_issue, 190 + .qc_defer = sc1200_qc_defer, 214 191 .cable_detect = ata_cable_40wire, 215 192 .set_piomode = sc1200_set_piomode, 216 193 .set_dmamode = sc1200_set_dmamode, ··· 236 211 .port_ops = &sc1200_port_ops 237 212 }; 238 213 /* Can't enable port 2 yet, see top comments */ 239 - const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; 214 + const struct ata_port_info *ppi[] = { &info, }; 240 215 241 216 return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); 242 217 }