aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/au1xxx-ide.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/ide/au1xxx-ide.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/ide/au1xxx-ide.c')
-rw-r--r--drivers/ide/au1xxx-ide.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c
index 58121bd6c115..b26c23416fa7 100644
--- a/drivers/ide/au1xxx-ide.c
+++ b/drivers/ide/au1xxx-ide.c
@@ -56,8 +56,8 @@ static inline void auide_insw(unsigned long port, void *addr, u32 count)
56 chan_tab_t *ctp; 56 chan_tab_t *ctp;
57 au1x_ddma_desc_t *dp; 57 au1x_ddma_desc_t *dp;
58 58
59 if(!put_dest_flags(ahwif->rx_chan, (void*)addr, count << 1, 59 if (!au1xxx_dbdma_put_dest(ahwif->rx_chan, virt_to_phys(addr),
60 DDMA_FLAGS_NOIE)) { 60 count << 1, DDMA_FLAGS_NOIE)) {
61 printk(KERN_ERR "%s failed %d\n", __func__, __LINE__); 61 printk(KERN_ERR "%s failed %d\n", __func__, __LINE__);
62 return; 62 return;
63 } 63 }
@@ -74,8 +74,8 @@ static inline void auide_outsw(unsigned long port, void *addr, u32 count)
74 chan_tab_t *ctp; 74 chan_tab_t *ctp;
75 au1x_ddma_desc_t *dp; 75 au1x_ddma_desc_t *dp;
76 76
77 if(!put_source_flags(ahwif->tx_chan, (void*)addr, 77 if (!au1xxx_dbdma_put_source(ahwif->tx_chan, virt_to_phys(addr),
78 count << 1, DDMA_FLAGS_NOIE)) { 78 count << 1, DDMA_FLAGS_NOIE)) {
79 printk(KERN_ERR "%s failed %d\n", __func__, __LINE__); 79 printk(KERN_ERR "%s failed %d\n", __func__, __LINE__);
80 return; 80 return;
81 } 81 }
@@ -99,12 +99,11 @@ static void au1xxx_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
99} 99}
100#endif 100#endif
101 101
102static void au1xxx_set_pio_mode(ide_drive_t *drive, const u8 pio) 102static void au1xxx_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
103{ 103{
104 int mem_sttime = 0, mem_stcfg = au_readl(MEM_STCFG2); 104 int mem_sttime = 0, mem_stcfg = au_readl(MEM_STCFG2);
105 105
106 /* set pio mode! */ 106 switch (drive->pio_mode - XFER_PIO_0) {
107 switch(pio) {
108 case 0: 107 case 0:
109 mem_sttime = SBC_IDE_TIMING(PIO0); 108 mem_sttime = SBC_IDE_TIMING(PIO0);
110 109
@@ -161,11 +160,11 @@ static void au1xxx_set_pio_mode(ide_drive_t *drive, const u8 pio)
161 au_writel(mem_stcfg,MEM_STCFG2); 160 au_writel(mem_stcfg,MEM_STCFG2);
162} 161}
163 162
164static void auide_set_dma_mode(ide_drive_t *drive, const u8 speed) 163static void auide_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive)
165{ 164{
166 int mem_sttime = 0, mem_stcfg = au_readl(MEM_STCFG2); 165 int mem_sttime = 0, mem_stcfg = au_readl(MEM_STCFG2);
167 166
168 switch(speed) { 167 switch (drive->dma_mode) {
169#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 168#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
170 case XFER_MW_DMA_2: 169 case XFER_MW_DMA_2:
171 mem_sttime = SBC_IDE_TIMING(MDMA2); 170 mem_sttime = SBC_IDE_TIMING(MDMA2);
@@ -246,17 +245,14 @@ static int auide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
246 flags = DDMA_FLAGS_NOIE; 245 flags = DDMA_FLAGS_NOIE;
247 246
248 if (iswrite) { 247 if (iswrite) {
249 if(!put_source_flags(ahwif->tx_chan, 248 if (!au1xxx_dbdma_put_source(ahwif->tx_chan,
250 (void*) sg_virt(sg), 249 sg_phys(sg), tc, flags)) {
251 tc, flags)) {
252 printk(KERN_ERR "%s failed %d\n", 250 printk(KERN_ERR "%s failed %d\n",
253 __func__, __LINE__); 251 __func__, __LINE__);
254 } 252 }
255 } else 253 } else {
256 { 254 if (!au1xxx_dbdma_put_dest(ahwif->rx_chan,
257 if(!put_dest_flags(ahwif->rx_chan, 255 sg_phys(sg), tc, flags)) {
258 (void*) sg_virt(sg),
259 tc, flags)) {
260 printk(KERN_ERR "%s failed %d\n", 256 printk(KERN_ERR "%s failed %d\n",
261 __func__, __LINE__); 257 __func__, __LINE__);
262 } 258 }
@@ -300,8 +296,8 @@ static int auide_dma_test_irq(ide_drive_t *drive)
300 */ 296 */
301 drive->waiting_for_dma++; 297 drive->waiting_for_dma++;
302 if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) { 298 if (drive->waiting_for_dma >= DMA_WAIT_TIMEOUT) {
303 printk(KERN_WARNING "%s: timeout waiting for ddma to \ 299 printk(KERN_WARNING "%s: timeout waiting for ddma to complete\n",
304 complete\n", drive->name); 300 drive->name);
305 return 1; 301 return 1;
306 } 302 }
307 udelay(10); 303 udelay(10);
@@ -532,14 +528,13 @@ static int au_ide_probe(struct platform_device *dev)
532 goto out; 528 goto out;
533 } 529 }
534 530
535 if (!request_mem_region(res->start, res->end - res->start + 1, 531 if (!request_mem_region(res->start, resource_size(res), dev->name)) {
536 dev->name)) {
537 pr_debug("%s: request_mem_region failed\n", DRV_NAME); 532 pr_debug("%s: request_mem_region failed\n", DRV_NAME);
538 ret = -EBUSY; 533 ret = -EBUSY;
539 goto out; 534 goto out;
540 } 535 }
541 536
542 ahwif->regbase = (u32)ioremap(res->start, res->end - res->start + 1); 537 ahwif->regbase = (u32)ioremap(res->start, resource_size(res));
543 if (ahwif->regbase == 0) { 538 if (ahwif->regbase == 0) {
544 ret = -ENOMEM; 539 ret = -ENOMEM;
545 goto out; 540 goto out;
@@ -575,7 +570,7 @@ static int au_ide_remove(struct platform_device *dev)
575 iounmap((void *)ahwif->regbase); 570 iounmap((void *)ahwif->regbase);
576 571
577 res = platform_get_resource(dev, IORESOURCE_MEM, 0); 572 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
578 release_mem_region(res->start, res->end - res->start + 1); 573 release_mem_region(res->start, resource_size(res));
579 574
580 return 0; 575 return 0;
581} 576}