aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_transport_spi.c')
-rw-r--r--drivers/scsi/scsi_transport_spi.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 718a2bc4ed5e..38a53b5f9e9a 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -812,12 +812,10 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
812 if (!scsi_device_sync(sdev) && !scsi_device_dt(sdev)) 812 if (!scsi_device_sync(sdev) && !scsi_device_dt(sdev))
813 return; 813 return;
814 814
815 /* see if the device has an echo buffer. If it does we can 815 /* len == -1 is the signal that we need to ascertain the
816 * do the SPI pattern write tests */ 816 * presence of an echo buffer before trying to use it. len ==
817 817 * 0 means we don't have an echo buffer */
818 len = 0; 818 len = -1;
819 if (scsi_device_dt(sdev))
820 len = spi_dv_device_get_echo_buffer(sdev, buffer);
821 819
822 retry: 820 retry:
823 821
@@ -840,11 +838,23 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
840 if (spi_min_period(starget) == 8) 838 if (spi_min_period(starget) == 8)
841 DV_SET(pcomp_en, 1); 839 DV_SET(pcomp_en, 1);
842 } 840 }
841 /* Do the read only INQUIRY tests */
842 spi_dv_retrain(sdev, buffer, buffer + sdev->inquiry_len,
843 spi_dv_device_compare_inquiry);
844 /* See if we actually managed to negotiate and sustain DT */
845 if (i->f->get_dt)
846 i->f->get_dt(starget);
847
848 /* see if the device has an echo buffer. If it does we can do
849 * the SPI pattern write tests. Because of some broken
850 * devices, we *only* try this on a device that has actually
851 * negotiated DT */
852
853 if (len == -1 && spi_dt(starget))
854 len = spi_dv_device_get_echo_buffer(sdev, buffer);
843 855
844 if (len == 0) { 856 if (len <= 0) {
845 starget_printk(KERN_INFO, starget, "Domain Validation skipping write tests\n"); 857 starget_printk(KERN_INFO, starget, "Domain Validation skipping write tests\n");
846 spi_dv_retrain(sdev, buffer, buffer + len,
847 spi_dv_device_compare_inquiry);
848 return; 858 return;
849 } 859 }
850 860