Merge tag 'trace-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[linux/fpc-iii.git] / drivers / ide / ide-4drives.c
blob06c6215e0cbe333ead72df51330131feb9ad3eeb
1 // SPDX-License-Identifier: GPL-2.0-only
3 #include <linux/kernel.h>
4 #include <linux/init.h>
5 #include <linux/module.h>
6 #include <linux/ide.h>
8 #define DRV_NAME "ide-4drives"
10 static bool probe_4drives;
12 module_param_named(probe, probe_4drives, bool, 0);
13 MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port");
15 static void ide_4drives_init_dev(ide_drive_t *drive)
17 if (drive->hwif->channel)
18 drive->select ^= 0x20;
21 static const struct ide_port_ops ide_4drives_port_ops = {
22 .init_dev = ide_4drives_init_dev,
25 static const struct ide_port_info ide_4drives_port_info = {
26 .port_ops = &ide_4drives_port_ops,
27 .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA |
28 IDE_HFLAG_4DRIVES,
29 .chipset = ide_4drives,
32 static int __init ide_4drives_init(void)
34 unsigned long base = 0x1f0, ctl = 0x3f6;
35 struct ide_hw hw, *hws[] = { &hw, &hw };
37 if (probe_4drives == 0)
38 return -ENODEV;
40 if (!request_region(base, 8, DRV_NAME)) {
41 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
42 DRV_NAME, base, base + 7);
43 return -EBUSY;
46 if (!request_region(ctl, 1, DRV_NAME)) {
47 printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
48 DRV_NAME, ctl);
49 release_region(base, 8);
50 return -EBUSY;
53 memset(&hw, 0, sizeof(hw));
55 ide_std_init_ports(&hw, base, ctl);
56 hw.irq = 14;
58 return ide_host_add(&ide_4drives_port_info, hws, 2, NULL);
61 module_init(ide_4drives_init);
63 MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
64 MODULE_DESCRIPTION("generic IDE chipset with 4 drives/port support");
65 MODULE_LICENSE("GPL");