diff options
author | Matthew Wilcox <matthew@wil.cx> | 2006-02-07 09:54:46 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-02-27 23:55:09 -0500 |
commit | 6ea3c0b2dac0d6a857d6bc010e544f4c901fff78 (patch) | |
tree | 0650d6e8b5be747eb192e558dd90e875ca7a13fb /drivers/scsi/53c700.c | |
parent | b0dc1db15225d5801bf3105966c9ce12c5142013 (diff) |
[SCSI] Add spi_populate_*_msg functions
Introduce new helpers:
- spi_populate_width_msg()
- spi_populate_sync_msg()
- spi_populate_ppr_msg()
and use them in drivers which already enable the SPI transport.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/53c700.c')
-rw-r--r-- | drivers/scsi/53c700.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index 4ce7438608ec..6a0f9506ea00 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
@@ -238,14 +238,6 @@ static char *NCR_700_SBCL_to_phase[] = { | |||
238 | "MSG IN", | 238 | "MSG IN", |
239 | }; | 239 | }; |
240 | 240 | ||
241 | static __u8 NCR_700_SDTR_msg[] = { | ||
242 | 0x01, /* Extended message */ | ||
243 | 0x03, /* Extended message Length */ | ||
244 | 0x01, /* SDTR Extended message */ | ||
245 | NCR_700_MIN_PERIOD, | ||
246 | NCR_700_MAX_OFFSET | ||
247 | }; | ||
248 | |||
249 | /* This translates the SDTR message offset and period to a value | 241 | /* This translates the SDTR message offset and period to a value |
250 | * which can be loaded into the SXFER_REG. | 242 | * which can be loaded into the SXFER_REG. |
251 | * | 243 | * |
@@ -266,7 +258,7 @@ NCR_700_offset_period_to_sxfer(struct NCR_700_Host_Parameters *hostdata, | |||
266 | return 0; | 258 | return 0; |
267 | 259 | ||
268 | if(period < hostdata->min_period) { | 260 | if(period < hostdata->min_period) { |
269 | printk(KERN_WARNING "53c700: Period %dns is less than this chip's minimum, setting to %d\n", period*4, NCR_700_SDTR_msg[3]*4); | 261 | printk(KERN_WARNING "53c700: Period %dns is less than this chip's minimum, setting to %d\n", period*4, NCR_700_MIN_PERIOD*4); |
270 | period = hostdata->min_period; | 262 | period = hostdata->min_period; |
271 | } | 263 | } |
272 | XFERP = (period*4 * hostdata->sync_clock)/1000 - 4; | 264 | XFERP = (period*4 * hostdata->sync_clock)/1000 - 4; |
@@ -1434,11 +1426,9 @@ NCR_700_start_command(struct scsi_cmnd *SCp) | |||
1434 | 1426 | ||
1435 | if(hostdata->fast && | 1427 | if(hostdata->fast && |
1436 | NCR_700_is_flag_clear(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC)) { | 1428 | NCR_700_is_flag_clear(SCp->device, NCR_700_DEV_NEGOTIATED_SYNC)) { |
1437 | memcpy(&hostdata->msgout[count], NCR_700_SDTR_msg, | 1429 | count += spi_populate_sync_msg(&hostdata->msgout[count], |
1438 | sizeof(NCR_700_SDTR_msg)); | 1430 | spi_period(SCp->device->sdev_target), |
1439 | hostdata->msgout[count+3] = spi_period(SCp->device->sdev_target); | 1431 | spi_offset(SCp->device->sdev_target)); |
1440 | hostdata->msgout[count+4] = spi_offset(SCp->device->sdev_target); | ||
1441 | count += sizeof(NCR_700_SDTR_msg); | ||
1442 | NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); | 1432 | NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION); |
1443 | } | 1433 | } |
1444 | 1434 | ||