diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-16 14:33:37 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-16 14:33:37 -0400 |
commit | f06ab3402aa2d6de060442c1053ea10b24b65076 (patch) | |
tree | 400f7ff5a79e75b82a7ba0daaf669f5d38f7c679 /drivers | |
parent | 2c139e7a7152f66ff93b173f8770c94ea53a691e (diff) |
ide: convert ide-timing.h to ide-timings.c library (take 2)
* Don't include ide-timing.h in cs5535 and sis5513 host drivers
(they don't need it currently).
* Convert ide-timing.h to ide-timings.c library and add CONFIG_IDE_TIMINGS
config option to be selected by host drivers using the library.
While at it:
- fix ide_timing_find_mode() placement
v2:
* Add missing EXPORT_SYMBOLs. (Stephen Rothwell <sfr@canb.auug.org.au>)
There should be no functional changes caused by this patch.
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/Kconfig | 7 | ||||
-rw-r--r-- | drivers/ide/Makefile | 1 | ||||
-rw-r--r-- | drivers/ide/arm/palm_bk3710.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-timings.c (renamed from drivers/ide/ide-timing.h) | 38 | ||||
-rw-r--r-- | drivers/ide/pci/amd74xx.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/cs5535.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/sis5513.c | 3 | ||||
-rw-r--r-- | drivers/ide/pci/via82cxxx.c | 2 | ||||
-rw-r--r-- | drivers/ide/ppc/pmac.c | 2 |
9 files changed, 27 insertions, 32 deletions
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index cd08dba8261b..994b6d39b559 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -98,6 +98,9 @@ if BLK_DEV_IDE | |||
98 | 98 | ||
99 | comment "Please see Documentation/ide/ide.txt for help/info on IDE drives" | 99 | comment "Please see Documentation/ide/ide.txt for help/info on IDE drives" |
100 | 100 | ||
101 | config IDE_TIMINGS | ||
102 | bool | ||
103 | |||
101 | config IDE_ATAPI | 104 | config IDE_ATAPI |
102 | bool | 105 | bool |
103 | 106 | ||
@@ -469,6 +472,7 @@ config BLK_DEV_ALI15X3 | |||
469 | config BLK_DEV_AMD74XX | 472 | config BLK_DEV_AMD74XX |
470 | tristate "AMD and nVidia IDE support" | 473 | tristate "AMD and nVidia IDE support" |
471 | depends on !ARM | 474 | depends on !ARM |
475 | select IDE_TIMINGS | ||
472 | select BLK_DEV_IDEDMA_PCI | 476 | select BLK_DEV_IDEDMA_PCI |
473 | help | 477 | help |
474 | This driver adds explicit support for AMD-7xx and AMD-8111 chips | 478 | This driver adds explicit support for AMD-7xx and AMD-8111 chips |
@@ -725,6 +729,7 @@ config BLK_DEV_TRM290 | |||
725 | 729 | ||
726 | config BLK_DEV_VIA82CXXX | 730 | config BLK_DEV_VIA82CXXX |
727 | tristate "VIA82CXXX chipset support" | 731 | tristate "VIA82CXXX chipset support" |
732 | select IDE_TIMINGS | ||
728 | select BLK_DEV_IDEDMA_PCI | 733 | select BLK_DEV_IDEDMA_PCI |
729 | help | 734 | help |
730 | This driver adds explicit support for VIA BusMastering IDE chips. | 735 | This driver adds explicit support for VIA BusMastering IDE chips. |
@@ -751,6 +756,7 @@ endif | |||
751 | config BLK_DEV_IDE_PMAC | 756 | config BLK_DEV_IDE_PMAC |
752 | tristate "PowerMac on-board IDE support" | 757 | tristate "PowerMac on-board IDE support" |
753 | depends on PPC_PMAC && IDE=y && BLK_DEV_IDE=y | 758 | depends on PPC_PMAC && IDE=y && BLK_DEV_IDE=y |
759 | select IDE_TIMINGS | ||
754 | help | 760 | help |
755 | This driver provides support for the on-board IDE controller on | 761 | This driver provides support for the on-board IDE controller on |
756 | most of the recent Apple Power Macintoshes and PowerBooks. | 762 | most of the recent Apple Power Macintoshes and PowerBooks. |
@@ -912,6 +918,7 @@ config BLK_DEV_Q40IDE | |||
912 | config BLK_DEV_PALMCHIP_BK3710 | 918 | config BLK_DEV_PALMCHIP_BK3710 |
913 | tristate "Palmchip bk3710 IDE controller support" | 919 | tristate "Palmchip bk3710 IDE controller support" |
914 | depends on ARCH_DAVINCI | 920 | depends on ARCH_DAVINCI |
921 | select IDE_TIMINGS | ||
915 | select BLK_DEV_IDEDMA_SFF | 922 | select BLK_DEV_IDEDMA_SFF |
916 | help | 923 | help |
917 | Say Y here if you want to support the onchip IDE controller on the | 924 | Say Y here if you want to support the onchip IDE controller on the |
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index a2b3f84d710d..cb1350684c9a 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile | |||
@@ -14,6 +14,7 @@ EXTRA_CFLAGS += -Idrivers/ide | |||
14 | ide-core-y += ide.o ide-io.o ide-iops.o ide-lib.o ide-probe.o ide-taskfile.o | 14 | ide-core-y += ide.o ide-io.o ide-iops.o ide-lib.o ide-probe.o ide-taskfile.o |
15 | 15 | ||
16 | # core IDE code | 16 | # core IDE code |
17 | ide-core-$(CONFIG_IDE_TIMINGS) += ide-timings.o | ||
17 | ide-core-$(CONFIG_IDE_ATAPI) += ide-atapi.o | 18 | ide-core-$(CONFIG_IDE_ATAPI) += ide-atapi.o |
18 | ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o | 19 | ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o |
19 | ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o | 20 | ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o |
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c index 3839f5722985..9b8a45d2cf17 100644 --- a/drivers/ide/arm/palm_bk3710.c +++ b/drivers/ide/arm/palm_bk3710.c | |||
@@ -74,8 +74,6 @@ struct palm_bk3710_udmatiming { | |||
74 | #define BK3710_IORDYTMP 0x78 | 74 | #define BK3710_IORDYTMP 0x78 |
75 | #define BK3710_IORDYTMS 0x7C | 75 | #define BK3710_IORDYTMS 0x7C |
76 | 76 | ||
77 | #include "../ide-timing.h" | ||
78 | |||
79 | static unsigned ideclk_period; /* in nanoseconds */ | 77 | static unsigned ideclk_period; /* in nanoseconds */ |
80 | 78 | ||
81 | static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { | 79 | static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { |
diff --git a/drivers/ide/ide-timing.h b/drivers/ide/ide-timings.c index 98e05f545450..ebef6d4e3f63 100644 --- a/drivers/ide/ide-timing.h +++ b/drivers/ide/ide-timings.c | |||
@@ -1,6 +1,3 @@ | |||
1 | #ifndef _IDE_TIMING_H | ||
2 | #define _IDE_TIMING_H | ||
3 | |||
4 | /* | 1 | /* |
5 | * Copyright (c) 1999-2001 Vojtech Pavlik | 2 | * Copyright (c) 1999-2001 Vojtech Pavlik |
6 | * | 3 | * |
@@ -25,6 +22,8 @@ | |||
25 | 22 | ||
26 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
27 | #include <linux/hdreg.h> | 24 | #include <linux/hdreg.h> |
25 | #include <linux/ide.h> | ||
26 | #include <linux/module.h> | ||
28 | 27 | ||
29 | /* | 28 | /* |
30 | * PIO 0-5, MWDMA 0-2 and UDMA 0-6 timings (in nanoseconds). | 29 | * PIO 0-5, MWDMA 0-2 and UDMA 0-6 timings (in nanoseconds). |
@@ -65,6 +64,17 @@ static struct ide_timing ide_timing[] = { | |||
65 | { 0xff } | 64 | { 0xff } |
66 | }; | 65 | }; |
67 | 66 | ||
67 | struct ide_timing *ide_timing_find_mode(u8 speed) | ||
68 | { | ||
69 | struct ide_timing *t; | ||
70 | |||
71 | for (t = ide_timing; t->mode != speed; t++) | ||
72 | if (t->mode == 0xff) | ||
73 | return NULL; | ||
74 | return t; | ||
75 | } | ||
76 | EXPORT_SYMBOL_GPL(ide_timing_find_mode); | ||
77 | |||
68 | #define ENOUGH(v, unit) (((v) - 1) / (unit) + 1) | 78 | #define ENOUGH(v, unit) (((v) - 1) / (unit) + 1) |
69 | #define EZ(v, unit) ((v) ? ENOUGH(v, unit) : 0) | 79 | #define EZ(v, unit) ((v) ? ENOUGH(v, unit) : 0) |
70 | 80 | ||
@@ -81,8 +91,8 @@ static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, | |||
81 | q->udma = EZ(t->udma * 1000, UT); | 91 | q->udma = EZ(t->udma * 1000, UT); |
82 | } | 92 | } |
83 | 93 | ||
84 | static void ide_timing_merge(struct ide_timing *a, struct ide_timing *b, | 94 | void ide_timing_merge(struct ide_timing *a, struct ide_timing *b, |
85 | struct ide_timing *m, unsigned int what) | 95 | struct ide_timing *m, unsigned int what) |
86 | { | 96 | { |
87 | if (what & IDE_TIMING_SETUP) | 97 | if (what & IDE_TIMING_SETUP) |
88 | m->setup = max(a->setup, b->setup); | 98 | m->setup = max(a->setup, b->setup); |
@@ -101,19 +111,10 @@ static void ide_timing_merge(struct ide_timing *a, struct ide_timing *b, | |||
101 | if (what & IDE_TIMING_UDMA) | 111 | if (what & IDE_TIMING_UDMA) |
102 | m->udma = max(a->udma, b->udma); | 112 | m->udma = max(a->udma, b->udma); |
103 | } | 113 | } |
114 | EXPORT_SYMBOL_GPL(ide_timing_merge); | ||
104 | 115 | ||
105 | static struct ide_timing *ide_timing_find_mode(u8 speed) | 116 | int ide_timing_compute(ide_drive_t *drive, u8 speed, |
106 | { | 117 | struct ide_timing *t, int T, int UT) |
107 | struct ide_timing *t; | ||
108 | |||
109 | for (t = ide_timing; t->mode != speed; t++) | ||
110 | if (t->mode == 0xff) | ||
111 | return NULL; | ||
112 | return t; | ||
113 | } | ||
114 | |||
115 | static int ide_timing_compute(ide_drive_t *drive, u8 speed, | ||
116 | struct ide_timing *t, int T, int UT) | ||
117 | { | 118 | { |
118 | struct hd_driveid *id = drive->id; | 119 | struct hd_driveid *id = drive->id; |
119 | struct ide_timing *s, p; | 120 | struct ide_timing *s, p; |
@@ -179,5 +180,4 @@ static int ide_timing_compute(ide_drive_t *drive, u8 speed, | |||
179 | 180 | ||
180 | return 0; | 181 | return 0; |
181 | } | 182 | } |
182 | 183 | EXPORT_SYMBOL_GPL(ide_timing_compute); | |
183 | #endif | ||
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c index ad222206a429..0bfcdd0e77b3 100644 --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c | |||
@@ -21,8 +21,6 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/ide.h> | 22 | #include <linux/ide.h> |
23 | 23 | ||
24 | #include "ide-timing.h" | ||
25 | |||
26 | enum { | 24 | enum { |
27 | AMD_IDE_CONFIG = 0x41, | 25 | AMD_IDE_CONFIG = 0x41, |
28 | AMD_CABLE_DETECT = 0x42, | 26 | AMD_CABLE_DETECT = 0x42, |
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index 2a2cb4911905..dc97c48623f3 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c | |||
@@ -26,8 +26,6 @@ | |||
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/ide.h> | 27 | #include <linux/ide.h> |
28 | 28 | ||
29 | #include "ide-timing.h" | ||
30 | |||
31 | #define MSR_ATAC_BASE 0x51300000 | 29 | #define MSR_ATAC_BASE 0x51300000 |
32 | #define ATAC_GLD_MSR_CAP (MSR_ATAC_BASE+0) | 30 | #define ATAC_GLD_MSR_CAP (MSR_ATAC_BASE+0) |
33 | #define ATAC_GLD_MSR_CONFIG (MSR_ATAC_BASE+0x01) | 31 | #define ATAC_GLD_MSR_CONFIG (MSR_ATAC_BASE+0x01) |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index e127eb25ab63..2389945ca95d 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -52,8 +52,6 @@ | |||
52 | #include <linux/init.h> | 52 | #include <linux/init.h> |
53 | #include <linux/ide.h> | 53 | #include <linux/ide.h> |
54 | 54 | ||
55 | #include "ide-timing.h" | ||
56 | |||
57 | /* registers layout and init values are chipset family dependant */ | 55 | /* registers layout and init values are chipset family dependant */ |
58 | 56 | ||
59 | #define ATA_16 0x01 | 57 | #define ATA_16 0x01 |
@@ -616,7 +614,6 @@ MODULE_LICENSE("GPL"); | |||
616 | /* | 614 | /* |
617 | * TODO: | 615 | * TODO: |
618 | * - CLEANUP | 616 | * - CLEANUP |
619 | * - Use drivers/ide/ide-timing.h ! | ||
620 | * - More checks in the config registers (force values instead of | 617 | * - More checks in the config registers (force values instead of |
621 | * relying on the BIOS setting them correctly). | 618 | * relying on the BIOS setting them correctly). |
622 | * - Further optimisations ? | 619 | * - Further optimisations ? |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 3ed9728abd24..e47384c70c40 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -35,8 +35,6 @@ | |||
35 | #include <asm/processor.h> | 35 | #include <asm/processor.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include "ide-timing.h" | ||
39 | |||
40 | #define VIA_IDE_ENABLE 0x40 | 38 | #define VIA_IDE_ENABLE 0x40 |
41 | #define VIA_IDE_CONFIG 0x41 | 39 | #define VIA_IDE_CONFIG 0x41 |
42 | #define VIA_FIFO_CONFIG 0x43 | 40 | #define VIA_FIFO_CONFIG 0x43 |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index dcb2c466bb97..5b91d23269d3 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -48,8 +48,6 @@ | |||
48 | #include <asm/mediabay.h> | 48 | #include <asm/mediabay.h> |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #include "../ide-timing.h" | ||
52 | |||
53 | #undef IDE_PMAC_DEBUG | 51 | #undef IDE_PMAC_DEBUG |
54 | 52 | ||
55 | #define DMA_WAIT_TIMEOUT 50 | 53 | #define DMA_WAIT_TIMEOUT 50 |