Blame view

drivers/ide/ide-4drives.c 1.48 KB
ffd4f6f0e   Bartlomiej Zolnierkiewicz   ide: add ide-4dri...
1
2
3
4
5
  
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/module.h>
  #include <linux/ide.h>
2c4be251b   Bartlomiej Zolnierkiewicz   ide-4drives: mana...
6
  #define DRV_NAME "ide-4drives"
90ab5ee94   Rusty Russell   module_param: mak...
7
  static bool probe_4drives;
ffd4f6f0e   Bartlomiej Zolnierkiewicz   ide: add ide-4dri...
8
9
10
  
  module_param_named(probe, probe_4drives, bool, 0);
  MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port");
e6d95bd14   Bartlomiej Zolnierkiewicz   ide: ->port_init_...
11
  static void ide_4drives_init_dev(ide_drive_t *drive)
f333f92bf   Bartlomiej Zolnierkiewicz   ide_4drives: use ...
12
  {
e6d95bd14   Bartlomiej Zolnierkiewicz   ide: ->port_init_...
13
  	if (drive->hwif->channel)
7f612f272   Bartlomiej Zolnierkiewicz   ide: remove [ata_...
14
  		drive->select ^= 0x20;
f333f92bf   Bartlomiej Zolnierkiewicz   ide_4drives: use ...
15
16
17
  }
  
  static const struct ide_port_ops ide_4drives_port_ops = {
e6d95bd14   Bartlomiej Zolnierkiewicz   ide: ->port_init_...
18
  	.init_dev		= ide_4drives_init_dev,
f333f92bf   Bartlomiej Zolnierkiewicz   ide_4drives: use ...
19
20
21
22
  };
  
  static const struct ide_port_info ide_4drives_port_info = {
  	.port_ops		= &ide_4drives_port_ops,
c094ea077   Bartlomiej Zolnierkiewicz   ide: add IDE_HFLA...
23
24
  	.host_flags		= IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA |
  				  IDE_HFLAG_4DRIVES,
29e52cf79   Bartlomiej Zolnierkiewicz   ide: remove chips...
25
  	.chipset		= ide_4drives,
f333f92bf   Bartlomiej Zolnierkiewicz   ide_4drives: use ...
26
  };
ffd4f6f0e   Bartlomiej Zolnierkiewicz   ide: add ide-4dri...
27
28
  static int __init ide_4drives_init(void)
  {
2c4be251b   Bartlomiej Zolnierkiewicz   ide-4drives: mana...
29
  	unsigned long base = 0x1f0, ctl = 0x3f6;
9f36d3143   Bartlomiej Zolnierkiewicz   ide: remove hw_re...
30
  	struct ide_hw hw, *hws[] = { &hw, &hw };
ffd4f6f0e   Bartlomiej Zolnierkiewicz   ide: add ide-4dri...
31
32
33
  
  	if (probe_4drives == 0)
  		return -ENODEV;
2c4be251b   Bartlomiej Zolnierkiewicz   ide-4drives: mana...
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  	if (!request_region(base, 8, DRV_NAME)) {
  		printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.
  ",
  				DRV_NAME, base, base + 7);
  		return -EBUSY;
  	}
  
  	if (!request_region(ctl, 1, DRV_NAME)) {
  		printk(KERN_ERR "%s: I/O resource 0x%lX not free.
  ",
  				DRV_NAME, ctl);
  		release_region(base, 8);
  		return -EBUSY;
  	}
dfd87842a   Bartlomiej Zolnierkiewicz   ide: init hwif->{...
48
  	memset(&hw, 0, sizeof(hw));
ffd4f6f0e   Bartlomiej Zolnierkiewicz   ide: add ide-4dri...
49

2c4be251b   Bartlomiej Zolnierkiewicz   ide-4drives: mana...
50
  	ide_std_init_ports(&hw, base, ctl);
dfd87842a   Bartlomiej Zolnierkiewicz   ide: init hwif->{...
51
  	hw.irq = 14;
ffd4f6f0e   Bartlomiej Zolnierkiewicz   ide: add ide-4dri...
52

dca398305   Bartlomiej Zolnierkiewicz   ide: pass number ...
53
  	return ide_host_add(&ide_4drives_port_info, hws, 2, NULL);
ffd4f6f0e   Bartlomiej Zolnierkiewicz   ide: add ide-4dri...
54
55
56
57
58
59
60
  }
  
  module_init(ide_4drives_init);
  
  MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
  MODULE_DESCRIPTION("generic IDE chipset with 4 drives/port support");
  MODULE_LICENSE("GPL");