diff options
-rw-r--r-- | drivers/ide/Kconfig | 8 | ||||
-rw-r--r-- | drivers/ide/Makefile | 1 | ||||
-rw-r--r-- | drivers/ide/ide-legacy.c | 58 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 56 |
4 files changed, 67 insertions, 56 deletions
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index e6857e01d1ba..7a0a84b042c9 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -62,6 +62,9 @@ config IDE_TIMINGS | |||
62 | config IDE_ATAPI | 62 | config IDE_ATAPI |
63 | bool | 63 | bool |
64 | 64 | ||
65 | config IDE_LEGACY | ||
66 | bool | ||
67 | |||
65 | config BLK_DEV_IDE_SATA | 68 | config BLK_DEV_IDE_SATA |
66 | bool "Support for SATA (deprecated; conflicts with libata SATA driver)" | 69 | bool "Support for SATA (deprecated; conflicts with libata SATA driver)" |
67 | default n | 70 | default n |
@@ -856,6 +859,7 @@ config BLK_DEV_4DRIVES | |||
856 | config BLK_DEV_ALI14XX | 859 | config BLK_DEV_ALI14XX |
857 | tristate "ALI M14xx support" | 860 | tristate "ALI M14xx support" |
858 | select IDE_TIMINGS | 861 | select IDE_TIMINGS |
862 | select IDE_LEGACY | ||
859 | help | 863 | help |
860 | This driver is enabled at runtime using the "ali14xx.probe" kernel | 864 | This driver is enabled at runtime using the "ali14xx.probe" kernel |
861 | boot parameter. It enables support for the secondary IDE interface | 865 | boot parameter. It enables support for the secondary IDE interface |
@@ -866,6 +870,7 @@ config BLK_DEV_ALI14XX | |||
866 | 870 | ||
867 | config BLK_DEV_DTC2278 | 871 | config BLK_DEV_DTC2278 |
868 | tristate "DTC-2278 support" | 872 | tristate "DTC-2278 support" |
873 | select IDE_LEGACY | ||
869 | help | 874 | help |
870 | This driver is enabled at runtime using the "dtc2278.probe" kernel | 875 | This driver is enabled at runtime using the "dtc2278.probe" kernel |
871 | boot parameter. It enables support for the secondary IDE interface | 876 | boot parameter. It enables support for the secondary IDE interface |
@@ -876,6 +881,7 @@ config BLK_DEV_DTC2278 | |||
876 | config BLK_DEV_HT6560B | 881 | config BLK_DEV_HT6560B |
877 | tristate "Holtek HT6560B support" | 882 | tristate "Holtek HT6560B support" |
878 | select IDE_TIMINGS | 883 | select IDE_TIMINGS |
884 | select IDE_LEGACY | ||
879 | help | 885 | help |
880 | This driver is enabled at runtime using the "ht6560b.probe" kernel | 886 | This driver is enabled at runtime using the "ht6560b.probe" kernel |
881 | boot parameter. It enables support for the secondary IDE interface | 887 | boot parameter. It enables support for the secondary IDE interface |
@@ -886,6 +892,7 @@ config BLK_DEV_HT6560B | |||
886 | config BLK_DEV_QD65XX | 892 | config BLK_DEV_QD65XX |
887 | tristate "QDI QD65xx support" | 893 | tristate "QDI QD65xx support" |
888 | select IDE_TIMINGS | 894 | select IDE_TIMINGS |
895 | select IDE_LEGACY | ||
889 | help | 896 | help |
890 | This driver is enabled at runtime using the "qd65xx.probe" kernel | 897 | This driver is enabled at runtime using the "qd65xx.probe" kernel |
891 | boot parameter. It permits faster I/O speeds to be set. See the | 898 | boot parameter. It permits faster I/O speeds to be set. See the |
@@ -894,6 +901,7 @@ config BLK_DEV_QD65XX | |||
894 | 901 | ||
895 | config BLK_DEV_UMC8672 | 902 | config BLK_DEV_UMC8672 |
896 | tristate "UMC-8672 support" | 903 | tristate "UMC-8672 support" |
904 | select IDE_LEGACY | ||
897 | help | 905 | help |
898 | This driver is enabled at runtime using the "umc8672.probe" kernel | 906 | This driver is enabled at runtime using the "umc8672.probe" kernel |
899 | boot parameter. It enables support for the secondary IDE interface | 907 | boot parameter. It enables support for the secondary IDE interface |
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index bdc7b81bc044..177e3f8523ed 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile | |||
@@ -15,6 +15,7 @@ ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o | |||
15 | ide-core-$(CONFIG_BLK_DEV_IDEDMA_SFF) += ide-dma-sff.o | 15 | ide-core-$(CONFIG_BLK_DEV_IDEDMA_SFF) += ide-dma-sff.o |
16 | ide-core-$(CONFIG_IDE_PROC_FS) += ide-proc.o | 16 | ide-core-$(CONFIG_IDE_PROC_FS) += ide-proc.o |
17 | ide-core-$(CONFIG_BLK_DEV_IDEACPI) += ide-acpi.o | 17 | ide-core-$(CONFIG_BLK_DEV_IDEACPI) += ide-acpi.o |
18 | ide-core-$(CONFIG_IDE_LEGACY) += ide-legacy.o | ||
18 | 19 | ||
19 | obj-$(CONFIG_IDE) += ide-core.o | 20 | obj-$(CONFIG_IDE) += ide-core.o |
20 | 21 | ||
diff --git a/drivers/ide/ide-legacy.c b/drivers/ide/ide-legacy.c new file mode 100644 index 000000000000..8c5dcbf22547 --- /dev/null +++ b/drivers/ide/ide-legacy.c | |||
@@ -0,0 +1,58 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <linux/ide.h> | ||
3 | |||
4 | static void ide_legacy_init_one(hw_regs_t **hws, hw_regs_t *hw, | ||
5 | u8 port_no, const struct ide_port_info *d, | ||
6 | unsigned long config) | ||
7 | { | ||
8 | unsigned long base, ctl; | ||
9 | int irq; | ||
10 | |||
11 | if (port_no == 0) { | ||
12 | base = 0x1f0; | ||
13 | ctl = 0x3f6; | ||
14 | irq = 14; | ||
15 | } else { | ||
16 | base = 0x170; | ||
17 | ctl = 0x376; | ||
18 | irq = 15; | ||
19 | } | ||
20 | |||
21 | if (!request_region(base, 8, d->name)) { | ||
22 | printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", | ||
23 | d->name, base, base + 7); | ||
24 | return; | ||
25 | } | ||
26 | |||
27 | if (!request_region(ctl, 1, d->name)) { | ||
28 | printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n", | ||
29 | d->name, ctl); | ||
30 | release_region(base, 8); | ||
31 | return; | ||
32 | } | ||
33 | |||
34 | ide_std_init_ports(hw, base, ctl); | ||
35 | hw->irq = irq; | ||
36 | hw->chipset = d->chipset; | ||
37 | hw->config = config; | ||
38 | |||
39 | hws[port_no] = hw; | ||
40 | } | ||
41 | |||
42 | int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config) | ||
43 | { | ||
44 | hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL }; | ||
45 | |||
46 | memset(&hw, 0, sizeof(hw)); | ||
47 | |||
48 | if ((d->host_flags & IDE_HFLAG_QD_2ND_PORT) == 0) | ||
49 | ide_legacy_init_one(hws, &hw[0], 0, d, config); | ||
50 | ide_legacy_init_one(hws, &hw[1], 1, d, config); | ||
51 | |||
52 | if (hws[0] == NULL && hws[1] == NULL && | ||
53 | (d->host_flags & IDE_HFLAG_SINGLE)) | ||
54 | return -ENOENT; | ||
55 | |||
56 | return ide_host_add(d, hws, NULL); | ||
57 | } | ||
58 | EXPORT_SYMBOL_GPL(ide_legacy_device_add); | ||
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 6d11f180bd1f..2333a5a83519 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -1755,59 +1755,3 @@ void ide_port_scan(ide_hwif_t *hwif) | |||
1755 | ide_proc_port_register_devices(hwif); | 1755 | ide_proc_port_register_devices(hwif); |
1756 | } | 1756 | } |
1757 | EXPORT_SYMBOL_GPL(ide_port_scan); | 1757 | EXPORT_SYMBOL_GPL(ide_port_scan); |
1758 | |||
1759 | static void ide_legacy_init_one(hw_regs_t **hws, hw_regs_t *hw, | ||
1760 | u8 port_no, const struct ide_port_info *d, | ||
1761 | unsigned long config) | ||
1762 | { | ||
1763 | unsigned long base, ctl; | ||
1764 | int irq; | ||
1765 | |||
1766 | if (port_no == 0) { | ||
1767 | base = 0x1f0; | ||
1768 | ctl = 0x3f6; | ||
1769 | irq = 14; | ||
1770 | } else { | ||
1771 | base = 0x170; | ||
1772 | ctl = 0x376; | ||
1773 | irq = 15; | ||
1774 | } | ||
1775 | |||
1776 | if (!request_region(base, 8, d->name)) { | ||
1777 | printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", | ||
1778 | d->name, base, base + 7); | ||
1779 | return; | ||
1780 | } | ||
1781 | |||
1782 | if (!request_region(ctl, 1, d->name)) { | ||
1783 | printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n", | ||
1784 | d->name, ctl); | ||
1785 | release_region(base, 8); | ||
1786 | return; | ||
1787 | } | ||
1788 | |||
1789 | ide_std_init_ports(hw, base, ctl); | ||
1790 | hw->irq = irq; | ||
1791 | hw->chipset = d->chipset; | ||
1792 | hw->config = config; | ||
1793 | |||
1794 | hws[port_no] = hw; | ||
1795 | } | ||
1796 | |||
1797 | int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config) | ||
1798 | { | ||
1799 | hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL }; | ||
1800 | |||
1801 | memset(&hw, 0, sizeof(hw)); | ||
1802 | |||
1803 | if ((d->host_flags & IDE_HFLAG_QD_2ND_PORT) == 0) | ||
1804 | ide_legacy_init_one(hws, &hw[0], 0, d, config); | ||
1805 | ide_legacy_init_one(hws, &hw[1], 1, d, config); | ||
1806 | |||
1807 | if (hws[0] == NULL && hws[1] == NULL && | ||
1808 | (d->host_flags & IDE_HFLAG_SINGLE)) | ||
1809 | return -ENOENT; | ||
1810 | |||
1811 | return ide_host_add(d, hws, NULL); | ||
1812 | } | ||
1813 | EXPORT_SYMBOL_GPL(ide_legacy_device_add); | ||