aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2013-04-19 16:50:41 -0400
committerArnd Bergmann <arnd@arndb.de>2013-04-19 16:50:52 -0400
commitf54ae513d3d39b60bcc2ef446f1219f501d859bf (patch)
treea60c22feaee5265fa9b017bc504793ae1b531972 /drivers/ata
parent1b361942b53c33f38d55065c13785aadb5103a18 (diff)
parente34d3865ee4a71195f91b23fd09e2619a5f727d3 (diff)
Merge branch 'spear/dwdma' into late/cleanup
This is a series originally prepared for inclusion in 3.9, which did not work out because of dependencies on the dmaengine driver. All the changes for the dmaengine code are merged in 3.9 now, so we can finally do the switchover and remove the now unnecessary dma definitions for spear13xx from the platform code. The dma platform_data actually made up the majority of the spear13xx platform code overall, so moving that into device tree files makes the code substantially smaller. * spear/dwdma: ata: arasan: remove the need for platform_data ARM: SPEAr13xx: Pass generic DW DMAC platform data from DT serial: pl011: use generic DMA slave configuration if possible spi: pl022: use generic DMA slave configuration if possible Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/pata_arasan_cf.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index 405022d302c3..7638121cb5d1 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -209,8 +209,6 @@ struct arasan_cf_dev {
209 struct dma_chan *dma_chan; 209 struct dma_chan *dma_chan;
210 /* Mask for DMA transfers */ 210 /* Mask for DMA transfers */
211 dma_cap_mask_t mask; 211 dma_cap_mask_t mask;
212 /* dma channel private data */
213 void *dma_priv;
214 /* DMA transfer work */ 212 /* DMA transfer work */
215 struct work_struct work; 213 struct work_struct work;
216 /* DMA delayed finish work */ 214 /* DMA delayed finish work */
@@ -308,6 +306,7 @@ static void cf_card_detect(struct arasan_cf_dev *acdev, bool hotplugged)
308static int cf_init(struct arasan_cf_dev *acdev) 306static int cf_init(struct arasan_cf_dev *acdev)
309{ 307{
310 struct arasan_cf_pdata *pdata = dev_get_platdata(acdev->host->dev); 308 struct arasan_cf_pdata *pdata = dev_get_platdata(acdev->host->dev);
309 unsigned int if_clk;
311 unsigned long flags; 310 unsigned long flags;
312 int ret = 0; 311 int ret = 0;
313 312
@@ -325,8 +324,12 @@ static int cf_init(struct arasan_cf_dev *acdev)
325 324
326 spin_lock_irqsave(&acdev->host->lock, flags); 325 spin_lock_irqsave(&acdev->host->lock, flags);
327 /* configure CF interface clock */ 326 /* configure CF interface clock */
328 writel((pdata->cf_if_clk <= CF_IF_CLK_200M) ? pdata->cf_if_clk : 327 /* TODO: read from device tree */
329 CF_IF_CLK_166M, acdev->vbase + CLK_CFG); 328 if_clk = CF_IF_CLK_166M;
329 if (pdata && pdata->cf_if_clk <= CF_IF_CLK_200M)
330 if_clk = pdata->cf_if_clk;
331
332 writel(if_clk, acdev->vbase + CLK_CFG);
330 333
331 writel(TRUE_IDE_MODE | CFHOST_ENB, acdev->vbase + OP_MODE); 334 writel(TRUE_IDE_MODE | CFHOST_ENB, acdev->vbase + OP_MODE);
332 cf_interrupt_enable(acdev, CARD_DETECT_IRQ, 1); 335 cf_interrupt_enable(acdev, CARD_DETECT_IRQ, 1);
@@ -357,12 +360,6 @@ static void dma_callback(void *dev)
357 complete(&acdev->dma_completion); 360 complete(&acdev->dma_completion);
358} 361}
359 362
360static bool filter(struct dma_chan *chan, void *slave)
361{
362 chan->private = slave;
363 return true;
364}
365
366static inline void dma_complete(struct arasan_cf_dev *acdev) 363static inline void dma_complete(struct arasan_cf_dev *acdev)
367{ 364{
368 struct ata_queued_cmd *qc = acdev->qc; 365 struct ata_queued_cmd *qc = acdev->qc;
@@ -530,8 +527,7 @@ static void data_xfer(struct work_struct *work)
530 527
531 /* request dma channels */ 528 /* request dma channels */
532 /* dma_request_channel may sleep, so calling from process context */ 529 /* dma_request_channel may sleep, so calling from process context */
533 acdev->dma_chan = dma_request_channel(acdev->mask, filter, 530 acdev->dma_chan = dma_request_slave_channel(acdev->host->dev, "data");
534 acdev->dma_priv);
535 if (!acdev->dma_chan) { 531 if (!acdev->dma_chan) {
536 dev_err(acdev->host->dev, "Unable to get dma_chan\n"); 532 dev_err(acdev->host->dev, "Unable to get dma_chan\n");
537 goto chan_request_fail; 533 goto chan_request_fail;
@@ -798,6 +794,7 @@ static int arasan_cf_probe(struct platform_device *pdev)
798 struct ata_host *host; 794 struct ata_host *host;
799 struct ata_port *ap; 795 struct ata_port *ap;
800 struct resource *res; 796 struct resource *res;
797 u32 quirk;
801 irq_handler_t irq_handler = NULL; 798 irq_handler_t irq_handler = NULL;
802 int ret = 0; 799 int ret = 0;
803 800
@@ -817,12 +814,17 @@ static int arasan_cf_probe(struct platform_device *pdev)
817 return -ENOMEM; 814 return -ENOMEM;
818 } 815 }
819 816
817 if (pdata)
818 quirk = pdata->quirk;
819 else
820 quirk = CF_BROKEN_UDMA; /* as it is on spear1340 */
821
820 /* if irq is 0, support only PIO */ 822 /* if irq is 0, support only PIO */
821 acdev->irq = platform_get_irq(pdev, 0); 823 acdev->irq = platform_get_irq(pdev, 0);
822 if (acdev->irq) 824 if (acdev->irq)
823 irq_handler = arasan_cf_interrupt; 825 irq_handler = arasan_cf_interrupt;
824 else 826 else
825 pdata->quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA; 827 quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA;
826 828
827 acdev->pbase = res->start; 829 acdev->pbase = res->start;
828 acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start, 830 acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start,
@@ -859,17 +861,16 @@ static int arasan_cf_probe(struct platform_device *pdev)
859 INIT_WORK(&acdev->work, data_xfer); 861 INIT_WORK(&acdev->work, data_xfer);
860 INIT_DELAYED_WORK(&acdev->dwork, delayed_finish); 862 INIT_DELAYED_WORK(&acdev->dwork, delayed_finish);
861 dma_cap_set(DMA_MEMCPY, acdev->mask); 863 dma_cap_set(DMA_MEMCPY, acdev->mask);
862 acdev->dma_priv = pdata->dma_priv;
863 864
864 /* Handle platform specific quirks */ 865 /* Handle platform specific quirks */
865 if (pdata->quirk) { 866 if (quirk) {
866 if (pdata->quirk & CF_BROKEN_PIO) { 867 if (quirk & CF_BROKEN_PIO) {
867 ap->ops->set_piomode = NULL; 868 ap->ops->set_piomode = NULL;
868 ap->pio_mask = 0; 869 ap->pio_mask = 0;
869 } 870 }
870 if (pdata->quirk & CF_BROKEN_MWDMA) 871 if (quirk & CF_BROKEN_MWDMA)
871 ap->mwdma_mask = 0; 872 ap->mwdma_mask = 0;
872 if (pdata->quirk & CF_BROKEN_UDMA) 873 if (quirk & CF_BROKEN_UDMA)
873 ap->udma_mask = 0; 874 ap->udma_mask = 0;
874 } 875 }
875 ap->flags |= ATA_FLAG_PIO_POLLING | ATA_FLAG_NO_ATAPI; 876 ap->flags |= ATA_FLAG_PIO_POLLING | ATA_FLAG_NO_ATAPI;