]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/ide/legacy/ide-4drives.c
ide: use 'drive->dn & 1' instead of drive->select.b.unit
[mirror_ubuntu-bionic-kernel.git] / drivers / ide / legacy / ide-4drives.c
CommitLineData
ffd4f6f0
BZ
1
2#include <linux/kernel.h>
3#include <linux/init.h>
4#include <linux/module.h>
5#include <linux/ide.h>
6
2c4be251
BZ
7#define DRV_NAME "ide-4drives"
8
ef87f8d0 9static int probe_4drives;
ffd4f6f0
BZ
10
11module_param_named(probe, probe_4drives, bool, 0);
12MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port");
13
e6d95bd1 14static void ide_4drives_init_dev(ide_drive_t *drive)
f333f92b 15{
e6d95bd1
BZ
16 if (drive->hwif->channel)
17 drive->select.all ^= 0x20;
f333f92b
BZ
18}
19
20static const struct ide_port_ops ide_4drives_port_ops = {
e6d95bd1 21 .init_dev = ide_4drives_init_dev,
f333f92b
BZ
22};
23
24static const struct ide_port_info ide_4drives_port_info = {
25 .port_ops = &ide_4drives_port_ops,
26 .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA,
27};
28
ffd4f6f0
BZ
29static int __init ide_4drives_init(void)
30{
2c4be251 31 unsigned long base = 0x1f0, ctl = 0x3f6;
48c3c107 32 hw_regs_t hw, *hws[] = { &hw, &hw, NULL, NULL };
ffd4f6f0
BZ
33
34 if (probe_4drives == 0)
35 return -ENODEV;
36
2c4be251
BZ
37 if (!request_region(base, 8, DRV_NAME)) {
38 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
39 DRV_NAME, base, base + 7);
40 return -EBUSY;
41 }
42
43 if (!request_region(ctl, 1, DRV_NAME)) {
44 printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
45 DRV_NAME, ctl);
46 release_region(base, 8);
47 return -EBUSY;
48 }
49
dfd87842 50 memset(&hw, 0, sizeof(hw));
ffd4f6f0 51
2c4be251 52 ide_std_init_ports(&hw, base, ctl);
dfd87842
BZ
53 hw.irq = 14;
54 hw.chipset = ide_4drives;
ffd4f6f0 55
6f904d01 56 return ide_host_add(&ide_4drives_port_info, hws, NULL);
ffd4f6f0
BZ
57}
58
59module_init(ide_4drives_init);
60
61MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
62MODULE_DESCRIPTION("generic IDE chipset with 4 drives/port support");
63MODULE_LICENSE("GPL");