[PATCH] dw_spi: add DMA support

2010-11-18 Thread Alan Cox
From: Feng Tang 

dw_spi driver in upstream only supports PIO mode, and this patch
will support it to cowork with the Designware DMA controller used
on Intel Moorestown platform

It has been tested with a Option GTM501L 3G modem, to use DMA mode,
DMA controller 2 of Moorestown has to be enabled

Signed-off-by: Feng Tang 
[Typo fix and renames to match intel_mid_dma renaming]
Signed-off-by: Vinod Koul 
[Clean up]
Signed-off-by: Feng Tang 
[Fix timing delay, add cpu_relax]
Signed-off-by: Arjan van de Ven 
Signed-off-by: Alan Cox 
---

 drivers/spi/Kconfig|4 +
 drivers/spi/Makefile   |3 -
 drivers/spi/dw_spi.c   |   48 +
 drivers/spi/dw_spi_mid.c   |  246 
 drivers/spi/dw_spi_pci.c   |   14 ++-
 include/linux/spi/dw_spi.h |   15 +++
 6 files changed, 305 insertions(+), 25 deletions(-)
 create mode 100644 drivers/spi/dw_spi_mid.c


diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 82e45cf..6e6a638 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -404,6 +404,10 @@ config SPI_DW_PCI
tristate "PCI interface driver for DW SPI core"
depends on SPI_DESIGNWARE && PCI
 
+config SPI_DW_MID_DMA
+   bool "DMA support for DW SPI controller on Intel Moorestown platform"
+   depends on SPI_DW_PCI && INTEL_MID_DMAC
+
 config SPI_DW_MMIO
tristate "Memory-mapped io interface driver for DW SPI core"
depends on SPI_DESIGNWARE && HAVE_CLK
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index b427c2e..4949370 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -17,7 +17,8 @@ obj-$(CONFIG_SPI_BUTTERFLY)   += spi_butterfly.o
 obj-$(CONFIG_SPI_COLDFIRE_QSPI)+= coldfire_qspi.o
 obj-$(CONFIG_SPI_DAVINCI)  += davinci_spi.o
 obj-$(CONFIG_SPI_DESIGNWARE)   += dw_spi.o
-obj-$(CONFIG_SPI_DW_PCI)   += dw_spi_pci.o
+obj-$(CONFIG_SPI_DW_PCI)   += dw_spi_midpci.o
+dw_spi_midpci-objs := dw_spi_pci.o dw_spi_mid.o
 obj-$(CONFIG_SPI_DW_MMIO)  += dw_spi_mmio.o
 obj-$(CONFIG_SPI_EP93XX)   += ep93xx_spi.o
 obj-$(CONFIG_SPI_GPIO) += spi_gpio.o
diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c
index 9043931..69cc223 100644
--- a/drivers/spi/dw_spi.c
+++ b/drivers/spi/dw_spi.c
@@ -164,20 +164,23 @@ static inline void mrst_spi_debugfs_remove(struct dw_spi 
*dws)
 
 static void wait_till_not_busy(struct dw_spi *dws)
 {
-   unsigned long end = jiffies + 1 + usecs_to_jiffies(1000);
+   unsigned long end = jiffies + 1 + usecs_to_jiffies(5000);
 
while (time_before(jiffies, end)) {
if (!(dw_readw(dws, sr) & SR_BUSY))
return;
+   cpu_relax();
}
dev_err(&dws->master->dev,
-   "DW SPI: Status keeps busy for 1000us after a read/write!\n");
+   "DW SPI: Status keeps busy for 5000us after a read/write!\n");
 }
 
 static void flush(struct dw_spi *dws)
 {
-   while (dw_readw(dws, sr) & SR_RF_NOT_EMPT)
+   while (dw_readw(dws, sr) & SR_RF_NOT_EMPT) {
dw_readw(dws, dr);
+   cpu_relax();
+   }
 
wait_till_not_busy(dws);
 }
@@ -285,8 +288,10 @@ static void *next_transfer(struct dw_spi *dws)
  */
 static int map_dma_buffers(struct dw_spi *dws)
 {
-   if (!dws->cur_msg->is_dma_mapped || !dws->dma_inited
-   || !dws->cur_chip->enable_dma)
+   if (!dws->cur_msg->is_dma_mapped
+   || !dws->dma_inited
+   || !dws->cur_chip->enable_dma
+   || !dws->dma_ops)
return 0;
 
if (dws->cur_transfer->tx_dma)
@@ -338,7 +343,7 @@ static void int_error_stop(struct dw_spi *dws, const char 
*msg)
tasklet_schedule(&dws->pump_transfers);
 }
 
-static void transfer_complete(struct dw_spi *dws)
+void dw_spi_xfer_done(struct dw_spi *dws)
 {
/* Update total byte transfered return count actual bytes read */
dws->cur_msg->actual_length += dws->len;
@@ -353,6 +358,7 @@ static void transfer_complete(struct dw_spi *dws)
} else
tasklet_schedule(&dws->pump_transfers);
 }
+EXPORT_SYMBOL_GPL(dw_spi_xfer_done);
 
 static irqreturn_t interrupt_transfer(struct dw_spi *dws)
 {
@@ -384,7 +390,7 @@ static irqreturn_t interrupt_transfer(struct dw_spi *dws)
if (dws->tx_end > dws->tx)
spi_umask_intr(dws, SPI_INT_TXEI);
else
-   transfer_complete(dws);
+   dw_spi_xfer_done(dws);
}
 
return IRQ_HANDLED;
@@ -414,11 +420,7 @@ static void poll_transfer(struct dw_spi *dws)
while (dws->write(dws))
dws->read(dws);
 
-   transfer_complete(dws);
-}
-
-static void dma_transfer(struct dw_spi *dws, int cs_change)
-{
+   dw_spi_xfer_done(dws);
 }
 
 static void pump_transfers(unsigned long data)
@@ -600,7 +602,7 @@ stat

[SPAM] Reservez vite votre essai !

2010-11-18 Thread Ma Voiture Par Internet par Team Leaders
Essayez gratuitement les voitures neuves de votre choix!
Près de chez vous et sans engagement!
•   Choisissez vos voitures préférées
•   Inscrivez-vous gratuitement
•   Essayes les près de chez vous!
Plus d'informations: 
http://www.weedoit.fr/tracking/tracking_aff.php?id=Y2FtcGFnbmU9VGVhbSBMZWFkZXJzX01hLVZvaXR1cmUtUGFyLUludGVybmV0X1Zpc3VlbA==

Conformément à la loi informatique & libertés du 6 janvier 1978, je
dispose d'un droit d'accès, de rectification et d'opposition aux
données personnelles me concernant. 
Ce message commercial vous est envoyé par “Team Leaders”.. Vous
recevez ce message parce que vous vous êtes inscrit sur l'un des
sites partenaires de “Team Leaders”. Vos données nominatives
n'ont pas été transmises à l'annonceur. Si vous ne souhaitez plus
recevoir notre lettre d'information Remplissez ce formulaire: 
http://77.89.247.130/unsubscribe/index.php?q=spi-devel-gene...@lists.sourceforge.net



--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


RE: [PATCH 00/49] spi: davinci: re-write existing driver

2010-11-18 Thread Nori, Sekhar
Hi Grant,

On Thu, Nov 18, 2010 at 17:01:24, Nori, Sekhar wrote:
> On Thu, Nov 18, 2010 at 12:23:24, Nori, Sekhar wrote:
> >
> > Here is the pull request:
> >
> > The following changes since commit 0a5b871ea4c6bfb2723ac2ffc7ef5c32452abb89:
> >   Linus Torvalds (1):
> > hardirq.h: remove now-empty #ifdef/#endif pair
> >
> > are available in the git repository at:
> >
> >   git://arago-project.org/git/projects/linux-davinci.git for-grant
> >
> > 
>
> Oops, I just realized that because my sign-off is added when
> git-format-patch -s is run, the patches in the pull request
> do not have my sign-off. I will recreate the branch with my
> sign-off added to these patches.

I fixed this now. You can go ahead and do the pull.

Thanks,
Sekhar


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


RE: [PATCH 00/49] spi: davinci: re-write existing driver

2010-11-18 Thread Nori, Sekhar
On Thu, Nov 18, 2010 at 12:23:24, Nori, Sekhar wrote:
>
> Here is the pull request:
>
> The following changes since commit 0a5b871ea4c6bfb2723ac2ffc7ef5c32452abb89:
>   Linus Torvalds (1):
> hardirq.h: remove now-empty #ifdef/#endif pair
>
> are available in the git repository at:
>
>   git://arago-project.org/git/projects/linux-davinci.git for-grant
>
> 

Oops, I just realized that because my sign-off is added when
git-format-patch -s is run, the patches in the pull request
do not have my sign-off. I will recreate the branch with my
sign-off added to these patches.

Thanks,
Sekhar


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general