diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:18 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:18 -0500 |
commit | 4eed504d140319d6c1c7e0a5b7a9bf41dabf7cea (patch) | |
tree | 45e402d7b7eb8297b3825753f6a0455baf43b873 /drivers/ide | |
parent | 4db90a145292327b95b03f6dcd3352327235cc36 (diff) |
sc1200: move DMA timings to timing tables
Based on pata_sc1200.c.
There should be no functionality changes caused by this patch.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/pci/sc1200.c | 62 |
1 files changed, 17 insertions, 45 deletions
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c index 569a8fe70d3e..fef20bd4aa78 100644 --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c | |||
@@ -135,57 +135,29 @@ static void sc1200_set_dma_mode(ide_drive_t *drive, const u8 mode) | |||
135 | unsigned short pci_clock; | 135 | unsigned short pci_clock; |
136 | unsigned int basereg = hwif->channel ? 0x50 : 0x40; | 136 | unsigned int basereg = hwif->channel ? 0x50 : 0x40; |
137 | 137 | ||
138 | static const u32 udma_timing[3][3] = { | ||
139 | { 0x00921250, 0x00911140, 0x00911030 }, | ||
140 | { 0x00932470, 0x00922260, 0x00922140 }, | ||
141 | { 0x009436a1, 0x00933481, 0x00923261 }, | ||
142 | }; | ||
143 | |||
144 | static const u32 mwdma_timing[3][3] = { | ||
145 | { 0x00077771, 0x00012121, 0x00002020 }, | ||
146 | { 0x000bbbb2, 0x00024241, 0x00013131 }, | ||
147 | { 0x000ffff3, 0x00035352, 0x00015151 }, | ||
148 | }; | ||
149 | |||
138 | pci_clock = sc1200_get_pci_clock(); | 150 | pci_clock = sc1200_get_pci_clock(); |
139 | 151 | ||
140 | /* | 152 | /* |
141 | * Note that each DMA mode has several timings associated with it. | 153 | * Note that each DMA mode has several timings associated with it. |
142 | * The correct timing depends on the fast PCI clock freq. | 154 | * The correct timing depends on the fast PCI clock freq. |
143 | */ | 155 | */ |
144 | timings = 0; | 156 | |
145 | switch (mode) { | 157 | if (mode >= XFER_UDMA_0) |
146 | case XFER_UDMA_0: | 158 | timings = udma_timing[pci_clock][mode - XFER_UDMA_0]; |
147 | switch (pci_clock) { | 159 | else |
148 | case PCI_CLK_33: timings = 0x00921250; break; | 160 | timings = mwdma_timing[pci_clock][mode - XFER_MW_DMA_0]; |
149 | case PCI_CLK_48: timings = 0x00932470; break; | ||
150 | case PCI_CLK_66: timings = 0x009436a1; break; | ||
151 | } | ||
152 | break; | ||
153 | case XFER_UDMA_1: | ||
154 | switch (pci_clock) { | ||
155 | case PCI_CLK_33: timings = 0x00911140; break; | ||
156 | case PCI_CLK_48: timings = 0x00922260; break; | ||
157 | case PCI_CLK_66: timings = 0x00933481; break; | ||
158 | } | ||
159 | break; | ||
160 | case XFER_UDMA_2: | ||
161 | switch (pci_clock) { | ||
162 | case PCI_CLK_33: timings = 0x00911030; break; | ||
163 | case PCI_CLK_48: timings = 0x00922140; break; | ||
164 | case PCI_CLK_66: timings = 0x00923261; break; | ||
165 | } | ||
166 | break; | ||
167 | case XFER_MW_DMA_0: | ||
168 | switch (pci_clock) { | ||
169 | case PCI_CLK_33: timings = 0x00077771; break; | ||
170 | case PCI_CLK_48: timings = 0x000bbbb2; break; | ||
171 | case PCI_CLK_66: timings = 0x000ffff3; break; | ||
172 | } | ||
173 | break; | ||
174 | case XFER_MW_DMA_1: | ||
175 | switch (pci_clock) { | ||
176 | case PCI_CLK_33: timings = 0x00012121; break; | ||
177 | case PCI_CLK_48: timings = 0x00024241; break; | ||
178 | case PCI_CLK_66: timings = 0x00035352; break; | ||
179 | } | ||
180 | break; | ||
181 | case XFER_MW_DMA_2: | ||
182 | switch (pci_clock) { | ||
183 | case PCI_CLK_33: timings = 0x00002020; break; | ||
184 | case PCI_CLK_48: timings = 0x00013131; break; | ||
185 | case PCI_CLK_66: timings = 0x00015151; break; | ||
186 | } | ||
187 | break; | ||
188 | } | ||
189 | 161 | ||
190 | if (unit == 0) { /* are we configuring drive0? */ | 162 | if (unit == 0) { /* are we configuring drive0? */ |
191 | pci_read_config_dword(hwif->pci_dev, basereg+4, ®); | 163 | pci_read_config_dword(hwif->pci_dev, basereg+4, ®); |