Commit 22a37bcb7857541eb2d37806c4744ee2530baa98

Authored by Linus Torvalds

Merge branch 'sbp2-spindown' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6

* 'sbp2-spindown' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
  ieee1394: sbp2: spin disks down on suspend and shutdown
  firewire: fw-sbp2: spin disks down on suspend and shutdown
  ieee1394: sbp2: fix spindown for PL-3507 and TSB42AA9 firmwares
  firewire: fw-sbp2: fix spindown for PL-3507 and TSB42AA9 firmwares
  scsi: sd: optionally set power condition in START STOP UNIT

Showing 5 changed files Side-by-side Diff

drivers/firewire/fw-sbp2.c
... ... @@ -86,6 +86,11 @@
86 86 * - delay inquiry
87 87 * Wait extra SBP2_INQUIRY_DELAY seconds after login before SCSI inquiry.
88 88 *
  89 + * - power condition
  90 + * Set the power condition field in the START STOP UNIT commands sent by
  91 + * sd_mod on suspend, resume, and shutdown (if manage_start_stop is on).
  92 + * Some disks need this to spin down or to resume properly.
  93 + *
89 94 * - override internal blacklist
90 95 * Instead of adding to the built-in blacklist, use only the workarounds
91 96 * specified in the module load parameter.
... ... @@ -97,6 +102,7 @@
97 102 #define SBP2_WORKAROUND_FIX_CAPACITY 0x8
98 103 #define SBP2_WORKAROUND_DELAY_INQUIRY 0x10
99 104 #define SBP2_INQUIRY_DELAY 12
  105 +#define SBP2_WORKAROUND_POWER_CONDITION 0x20
100 106 #define SBP2_WORKAROUND_OVERRIDE 0x100
101 107  
102 108 static int sbp2_param_workarounds;
... ... @@ -107,6 +113,8 @@
107 113 ", skip mode page 8 = " __stringify(SBP2_WORKAROUND_MODE_SENSE_8)
108 114 ", fix capacity = " __stringify(SBP2_WORKAROUND_FIX_CAPACITY)
109 115 ", delay inquiry = " __stringify(SBP2_WORKAROUND_DELAY_INQUIRY)
  116 + ", set power condition in start stop unit = "
  117 + __stringify(SBP2_WORKAROUND_POWER_CONDITION)
110 118 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
111 119 ", or a combination)");
112 120  
113 121  
114 122  
... ... @@ -310,18 +318,25 @@
310 318 .firmware_revision = 0x002800,
311 319 .model = 0x001010,
312 320 .workarounds = SBP2_WORKAROUND_INQUIRY_36 |
313   - SBP2_WORKAROUND_MODE_SENSE_8,
  321 + SBP2_WORKAROUND_MODE_SENSE_8 |
  322 + SBP2_WORKAROUND_POWER_CONDITION,
314 323 },
315 324 /* DViCO Momobay FX-3A with TSB42AA9A bridge */ {
316 325 .firmware_revision = 0x002800,
317 326 .model = 0x000000,
318   - .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY,
  327 + .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY |
  328 + SBP2_WORKAROUND_POWER_CONDITION,
319 329 },
320 330 /* Initio bridges, actually only needed for some older ones */ {
321 331 .firmware_revision = 0x000200,
322 332 .model = ~0,
323 333 .workarounds = SBP2_WORKAROUND_INQUIRY_36,
324 334 },
  335 + /* PL-3507 bridge with Prolific firmware */ {
  336 + .firmware_revision = 0x012800,
  337 + .model = ~0,
  338 + .workarounds = SBP2_WORKAROUND_POWER_CONDITION,
  339 + },
325 340 /* Symbios bridge */ {
326 341 .firmware_revision = 0xa0b800,
327 342 .model = ~0,
... ... @@ -1530,6 +1545,9 @@
1530 1545  
1531 1546 sdev->use_10_for_rw = 1;
1532 1547  
  1548 + if (sbp2_param_exclusive_login)
  1549 + sdev->manage_start_stop = 1;
  1550 +
1533 1551 if (sdev->type == TYPE_ROM)
1534 1552 sdev->use_10_for_ms = 1;
1535 1553  
... ... @@ -1539,6 +1557,9 @@
1539 1557  
1540 1558 if (lu->tgt->workarounds & SBP2_WORKAROUND_FIX_CAPACITY)
1541 1559 sdev->fix_capacity = 1;
  1560 +
  1561 + if (lu->tgt->workarounds & SBP2_WORKAROUND_POWER_CONDITION)
  1562 + sdev->start_stop_pwr_cond = 1;
1542 1563  
1543 1564 if (lu->tgt->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS)
1544 1565 blk_queue_max_sectors(sdev->request_queue, 128 * 1024 / 512);
drivers/ieee1394/sbp2.c
... ... @@ -186,6 +186,11 @@
186 186 * - delay inquiry
187 187 * Wait extra SBP2_INQUIRY_DELAY seconds after login before SCSI inquiry.
188 188 *
  189 + * - power condition
  190 + * Set the power condition field in the START STOP UNIT commands sent by
  191 + * sd_mod on suspend, resume, and shutdown (if manage_start_stop is on).
  192 + * Some disks need this to spin down or to resume properly.
  193 + *
189 194 * - override internal blacklist
190 195 * Instead of adding to the built-in blacklist, use only the workarounds
191 196 * specified in the module load parameter.
... ... @@ -199,6 +204,8 @@
199 204 ", skip mode page 8 = " __stringify(SBP2_WORKAROUND_MODE_SENSE_8)
200 205 ", fix capacity = " __stringify(SBP2_WORKAROUND_FIX_CAPACITY)
201 206 ", delay inquiry = " __stringify(SBP2_WORKAROUND_DELAY_INQUIRY)
  207 + ", set power condition in start stop unit = "
  208 + __stringify(SBP2_WORKAROUND_POWER_CONDITION)
202 209 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
203 210 ", or a combination)");
204 211  
205 212  
206 213  
... ... @@ -359,18 +366,25 @@
359 366 .firmware_revision = 0x002800,
360 367 .model_id = 0x001010,
361 368 .workarounds = SBP2_WORKAROUND_INQUIRY_36 |
362   - SBP2_WORKAROUND_MODE_SENSE_8,
  369 + SBP2_WORKAROUND_MODE_SENSE_8 |
  370 + SBP2_WORKAROUND_POWER_CONDITION,
363 371 },
364 372 /* DViCO Momobay FX-3A with TSB42AA9A bridge */ {
365 373 .firmware_revision = 0x002800,
366 374 .model_id = 0x000000,
367   - .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY,
  375 + .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY |
  376 + SBP2_WORKAROUND_POWER_CONDITION,
368 377 },
369 378 /* Initio bridges, actually only needed for some older ones */ {
370 379 .firmware_revision = 0x000200,
371 380 .model_id = SBP2_ROM_VALUE_WILDCARD,
372 381 .workarounds = SBP2_WORKAROUND_INQUIRY_36,
373 382 },
  383 + /* PL-3507 bridge with Prolific firmware */ {
  384 + .firmware_revision = 0x012800,
  385 + .model_id = SBP2_ROM_VALUE_WILDCARD,
  386 + .workarounds = SBP2_WORKAROUND_POWER_CONDITION,
  387 + },
374 388 /* Symbios bridge */ {
375 389 .firmware_revision = 0xa0b800,
376 390 .model_id = SBP2_ROM_VALUE_WILDCARD,
... ... @@ -1995,6 +2009,8 @@
1995 2009  
1996 2010 sdev->use_10_for_rw = 1;
1997 2011  
  2012 + if (sbp2_exclusive_login)
  2013 + sdev->manage_start_stop = 1;
1998 2014 if (sdev->type == TYPE_ROM)
1999 2015 sdev->use_10_for_ms = 1;
2000 2016 if (sdev->type == TYPE_DISK &&
... ... @@ -2002,6 +2018,8 @@
2002 2018 sdev->skip_ms_page_8 = 1;
2003 2019 if (lu->workarounds & SBP2_WORKAROUND_FIX_CAPACITY)
2004 2020 sdev->fix_capacity = 1;
  2021 + if (lu->workarounds & SBP2_WORKAROUND_POWER_CONDITION)
  2022 + sdev->start_stop_pwr_cond = 1;
2005 2023 if (lu->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS)
2006 2024 blk_queue_max_sectors(sdev->request_queue, 128 * 1024 / 512);
2007 2025 return 0;
drivers/ieee1394/sbp2.h
... ... @@ -345,6 +345,7 @@
345 345 #define SBP2_WORKAROUND_FIX_CAPACITY 0x8
346 346 #define SBP2_WORKAROUND_DELAY_INQUIRY 0x10
347 347 #define SBP2_INQUIRY_DELAY 12
  348 +#define SBP2_WORKAROUND_POWER_CONDITION 0x20
348 349 #define SBP2_WORKAROUND_OVERRIDE 0x100
349 350  
350 351 #endif /* SBP2_H */
... ... @@ -1124,6 +1124,8 @@
1124 1124 cmd[1] = 1; /* Return immediately */
1125 1125 memset((void *) &cmd[2], 0, 8);
1126 1126 cmd[4] = 1; /* Start spin cycle */
  1127 + if (sdkp->device->start_stop_pwr_cond)
  1128 + cmd[4] |= 1 << 4;
1127 1129 scsi_execute_req(sdkp->device, cmd, DMA_NONE,
1128 1130 NULL, 0, &sshdr,
1129 1131 SD_TIMEOUT, SD_MAX_RETRIES);
... ... @@ -1789,6 +1791,9 @@
1789 1791  
1790 1792 if (start)
1791 1793 cmd[4] |= 1; /* START */
  1794 +
  1795 + if (sdp->start_stop_pwr_cond)
  1796 + cmd[4] |= start ? 1 << 4 : 3 << 4; /* Active or Standby */
1792 1797  
1793 1798 if (!scsi_device_online(sdp))
1794 1799 return -ENODEV;
include/scsi/scsi_device.h
... ... @@ -134,6 +134,7 @@
134 134 unsigned no_start_on_add:1; /* do not issue start on add */
135 135 unsigned allow_restart:1; /* issue START_UNIT in error handler */
136 136 unsigned manage_start_stop:1; /* Let HLD (sd) manage start/stop */
  137 + unsigned start_stop_pwr_cond:1; /* Set power cond. in START_STOP_UNIT */
137 138 unsigned no_uld_attach:1; /* disable connecting to upper level drivers */
138 139 unsigned select_no_atn:1;
139 140 unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */