aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-27 09:38:23 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-27 09:38:23 -0400
commit9fd91d959f1a19d1bfa46d97cbbbb55641ce26a6 (patch)
tree9938cfef8cce9dd87f48fe40b6bca51a1c737fc5
parent9c391bae6a65bd39962877ad7dc000b600757bbe (diff)
ide: add "ignore_cable" parameter (take 2)
Add "ignore_cable" parameter: * "ide_core.ignore_cable=[interface_number]" boot option if IDE is built-in (i.e. "ide_core.ignore_cable=1" to force ignoring cable for "ide1") * "ignore_cable=[interface_number]" module parameter (for ide_core module) if IDE is compiled as module v2: * Add ide_port_apply_params() helper - use it in ide_device_add_all() and ide_scan_port(). * Make it possible to later disable ignoring cable detection by passing "[interface_number]:0" to /sys/module/ide_core/parameters/ignore_cable (however sysfs interface is not enabled yet since it needs some other IDE changes to make it work reliable). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--Documentation/ide/ide.txt15
-rw-r--r--drivers/ide/ide-probe.c10
-rw-r--r--drivers/ide/ide.c32
-rw-r--r--include/linux/ide.h2
4 files changed, 53 insertions, 6 deletions
diff --git a/Documentation/ide/ide.txt b/Documentation/ide/ide.txt
index 486c699f4aea..829a618c3e93 100644
--- a/Documentation/ide/ide.txt
+++ b/Documentation/ide/ide.txt
@@ -224,11 +224,6 @@ Summary of ide driver parameters for kernel command line
224 224
225 "idex=reset" : reset interface after probe 225 "idex=reset" : reset interface after probe
226 226
227 "idex=ata66" : informs the interface that it has an 80c cable
228 for chipsets that are ATA-66 capable, but the
229 ability to bit test for detection is currently
230 unknown.
231
232 "ide=doubler" : probe/support IDE doublers on Amiga 227 "ide=doubler" : probe/support IDE doublers on Amiga
233 228
234There may be more options than shown -- use the source, Luke! 229There may be more options than shown -- use the source, Luke!
@@ -251,6 +246,16 @@ are detected automatically).
251You also need to use "probe" kernel parameter for ide-4drives driver 246You also need to use "probe" kernel parameter for ide-4drives driver
252(support for IDE generic chipset with four drives on one port). 247(support for IDE generic chipset with four drives on one port).
253 248
249To force ignoring cable detection (this should be needed only if you're using
250short 40-wires cable which cannot be automatically detected - if this is not
251a case please report it as a bug instead) use "ignore_cable" kernel parameter:
252
253* "ide_core.ignore_cable=[interface_number]" boot option if IDE is built-in
254 (i.e. "ide_core.ignore_cable=1" to force ignoring cable for "ide1")
255
256* "ignore_cable=[interface_number]" module parameter (for ide_core module)
257 if IDE is compiled as module
258
254================================================================================ 259================================================================================
255 260
256Some Terminology 261Some Terminology
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index a4b65b321f51..4a33100a2314 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1518,13 +1518,20 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
1518 int i, rc = 0; 1518 int i, rc = 0;
1519 1519
1520 for (i = 0; i < MAX_HWIFS; i++) { 1520 for (i = 0; i < MAX_HWIFS; i++) {
1521 if (d == NULL || idx[i] == 0xff) { 1521 if (idx[i] == 0xff) {
1522 mate = NULL; 1522 mate = NULL;
1523 continue; 1523 continue;
1524 } 1524 }
1525 1525
1526 hwif = &ide_hwifs[idx[i]]; 1526 hwif = &ide_hwifs[idx[i]];
1527 1527
1528 ide_port_apply_params(hwif);
1529
1530 if (d == NULL) {
1531 mate = NULL;
1532 continue;
1533 }
1534
1528 if (d->chipset != ide_etrax100 && (i & 1) && mate) { 1535 if (d->chipset != ide_etrax100 && (i & 1) && mate) {
1529 hwif->mate = mate; 1536 hwif->mate = mate;
1530 mate->mate = hwif; 1537 mate->mate = hwif;
@@ -1621,6 +1628,7 @@ EXPORT_SYMBOL_GPL(ide_device_add);
1621 1628
1622void ide_port_scan(ide_hwif_t *hwif) 1629void ide_port_scan(ide_hwif_t *hwif)
1623{ 1630{
1631 ide_port_apply_params(hwif);
1624 ide_port_cable_detect(hwif); 1632 ide_port_cable_detect(hwif);
1625 ide_port_init_devices(hwif); 1633 ide_port_init_devices(hwif);
1626 1634
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index bced02f9f2c3..6cd112cc4af3 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1239,6 +1239,38 @@ static void ide_port_class_release(struct device *portdev)
1239 put_device(&hwif->gendev); 1239 put_device(&hwif->gendev);
1240} 1240}
1241 1241
1242static unsigned int ide_ignore_cable;
1243
1244static int ide_set_ignore_cable(const char *s, struct kernel_param *kp)
1245{
1246 int i, j = 1;
1247
1248 if (sscanf(s, "%d:%d", &i, &j) != 2 && sscanf(s, "%d", &i) != 1)
1249 return -EINVAL;
1250
1251 if (i >= MAX_HWIFS || j < 0 || j > 1)
1252 return -EINVAL;
1253
1254 if (j)
1255 ide_ignore_cable |= (1 << i);
1256 else
1257 ide_ignore_cable &= (1 << i);
1258
1259 return 0;
1260}
1261
1262module_param_call(ignore_cable, ide_set_ignore_cable, NULL, NULL, 0);
1263MODULE_PARM_DESC(ignore_cable, "ignore cable detection");
1264
1265void ide_port_apply_params(ide_hwif_t *hwif)
1266{
1267 if (ide_ignore_cable & (1 << hwif->index)) {
1268 printk(KERN_INFO "ide: ignoring cable detection for %s\n",
1269 hwif->name);
1270 hwif->cbl = ATA_CBL_PATA40_SHORT;
1271 }
1272}
1273
1242/* 1274/*
1243 * This is gets invoked once during initialization, to set *everything* up 1275 * This is gets invoked once during initialization, to set *everything* up
1244 */ 1276 */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index f0af504dfa42..f80d303e5dcd 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1222,6 +1222,8 @@ void ide_unregister_region(struct gendisk *);
1222 1222
1223void ide_undecoded_slave(ide_drive_t *); 1223void ide_undecoded_slave(ide_drive_t *);
1224 1224
1225void ide_port_apply_params(ide_hwif_t *);
1226
1225int ide_device_add_all(u8 *idx, const struct ide_port_info *); 1227int ide_device_add_all(u8 *idx, const struct ide_port_info *);
1226int ide_device_add(u8 idx[4], const struct ide_port_info *); 1228int ide_device_add(u8 idx[4], const struct ide_port_info *);
1227int ide_legacy_device_add(const struct ide_port_info *, unsigned long); 1229int ide_legacy_device_add(const struct ide_port_info *, unsigned long);