Re: [PATCH 04/10 RESEND] mmc: spi: Pull out parts shared between MMC and SPI

2012-07-16 Thread Attila Kinali
Moin,

I just wanted to try out this patchset as i have a use for proper spi
support on i.mx23. But this patch (4/10) fails to apply at line 635

On Fri,  6 Jul 2012 08:17:23 +0200
Marek Vasut ma...@denx.de wrote:

 diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
 index f9509e8..1ea1cba 100644
 --- a/drivers/mmc/host/mxs-mmc.c
 +++ b/drivers/mmc/host/mxs-mmc.c
 @@ -635,6 +640,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
   dma_cap_mask_t mask;
   struct regulator *reg_vmmc;
   enum of_gpio_flags flags;
 + struct mxs_ssp *ssp;
  
   iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);

The function variables do not match.

Also a 3way merge didnt work as the comit on which this patchset was
based on wasnt found. I tried linux, linux-next, and the imx repos
from pengutronix and Shawn, to no avail.

Is there any other repo around that i'm not aware of?

Attila Kinali

-- 
The trouble with you, Shev, is you don't say anything until you've saved
up a whole truckload of damned heavy brick arguments and then you dump
them all out and never look at the bleeding body mangled beneath the heap
-- Tirin, The Dispossessed, U. Le Guin

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Votre devis alarme est disponible

2012-07-16 Thread Expert protection par Planduweb
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTE2MDU0JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNiAwNjozMDowMSZlPTEmaD0xNjA1MyZmPTE2MDU0Jmc9MTYwNTQ=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTE2MDU0JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNiAwNjozMDowMSZlPTEmaD0xNjA1MyZmPTE2MDU0Jmc9MTYwNTQ=


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 04/10 RESEND] mmc: spi: Pull out parts shared between MMC and SPI

2012-07-16 Thread Marek Vasut
Dear Attila Kinali,

 Moin,
 
 I just wanted to try out this patchset as i have a use for proper spi
 support on i.mx23. But this patch (4/10) fails to apply at line 635
 
[...]

  +   struct mxs_ssp *ssp;
  
  iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
 
 The function variables do not match.
 
 Also a 3way merge didnt work as the comit on which this patchset was
 based on wasnt found. I tried linux, linux-next, and the imx repos
 from pengutronix and Shawn, to no avail.
 
 Is there any other repo around that i'm not aware of?
 
   Attila Kinali

Well I have it rebased on top of current -next, but ... will some of the SPI 
maintainers possibly apply it to their -next tree any soon? Or why are these 
patches stuck as they are without much review ?

It seems Shawn is OK with the latest version, so can these be applied? I'll 
post 
the rebased version again if necessary.

Best regards,
Marek Vasut

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 04/10 RESEND] mmc: spi: Pull out parts shared between MMC and SPI

2012-07-16 Thread Attila Kinali
Moin Marek,

On Mon, 16 Jul 2012 12:59:14 +0200
Marek Vasut ma...@denx.de wrote:

 Well I have it rebased on top of current -next, but ... will some of the SPI 
 maintainers possibly apply it to their -next tree any soon? Or why are these 
 patches stuck as they are without much review ?

Do you have somewhere a public git repo with the patches?
I'd like to give them a try.

Attila Kinali

-- 
The trouble with you, Shev, is you don't say anything until you've saved
up a whole truckload of damned heavy brick arguments and then you dump
them all out and never look at the bleeding body mangled beneath the heap
-- Tirin, The Dispossessed, U. Le Guin

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Comme tu peux le constater, c'est le moment

2012-07-16 Thread Ethylostest par Duano
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTE2MDQ4JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNiAwNTozMDowMSZlPTEmaD0xNjA0NyZmPTE2MDQ4Jmc9MTYwNDg=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTE2MDQ4JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNiAwNTozMDowMSZlPTEmaD0xNjA0NyZmPTE2MDQ4Jmc9MTYwNDg=


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 02/10] mmc: spi: Rename IMX2[38]_MMC to IMX2[38]_SSP

2012-07-16 Thread Marek Vasut
Since the SSP controller can act as both SPI and MMC host,
renaming the enum to properly reflect the naming seems
appropriate.

Based on previous attempt by:
Fabio Estevam fabio.este...@freescale.com

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
Signed-off-by: Marek Vasut ma...@denx.de
Cc: Chris Ball c...@laptop.org
Cc: Detlev Zundel d...@denx.de
CC: Dong Aisheng b29...@freescale.com
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Linux ARM kernel linux-arm-ker...@lists.infradead.org
Cc: Rob Herring rob.herr...@calxeda.com
CC: Shawn Guo shawn@linaro.org
Cc: Stefano Babic sba...@denx.de
Cc: Wolfgang Denk w...@denx.de
---
 drivers/mmc/host/mxs-mmc.c  |   18 +-
 include/linux/spi/mxs-spi.h |8 
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 584f982..f9509e8 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -78,7 +78,7 @@ struct mxs_mmc_host {
enum dma_transfer_direction slave_dirn;
u32 ssp_pio_words[SSP_PIO_NUM];
 
-   enum mxs_mmc_id devid;
+   enum mxs_ssp_id devid;
unsigned char   bus_width;
spinlock_t  lock;
int sdio_irq_en;
@@ -601,22 +601,22 @@ static bool mxs_mmc_dma_filter(struct dma_chan *chan, 
void *param)
return true;
 }
 
-static struct platform_device_id mxs_mmc_ids[] = {
+static struct platform_device_id mxs_ssp_ids[] = {
{
.name = imx23-mmc,
-   .driver_data = IMX23_MMC,
+   .driver_data = IMX23_SSP,
}, {
.name = imx28-mmc,
-   .driver_data = IMX28_MMC,
+   .driver_data = IMX28_SSP,
}, {
/* sentinel */
}
 };
-MODULE_DEVICE_TABLE(platform, mxs_mmc_ids);
+MODULE_DEVICE_TABLE(platform, mxs_ssp_ids);
 
 static const struct of_device_id mxs_mmc_dt_ids[] = {
-   { .compatible = fsl,imx23-mmc, .data = (void *) IMX23_MMC, },
-   { .compatible = fsl,imx28-mmc, .data = (void *) IMX28_MMC, },
+   { .compatible = fsl,imx23-mmc, .data = (void *) IMX23_SSP, },
+   { .compatible = fsl,imx28-mmc, .data = (void *) IMX28_SSP, },
{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mxs_mmc_dt_ids);
@@ -655,7 +655,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
}
 
if (np) {
-   host-devid = (enum mxs_mmc_id) of_id-data;
+   host-devid = (enum mxs_ssp_id) of_id-data;
/*
 * TODO: This is a temporary solution and should be changed
 * to use generic DMA binding later when the helpers get in.
@@ -829,7 +829,7 @@ static const struct dev_pm_ops mxs_mmc_pm_ops = {
 static struct platform_driver mxs_mmc_driver = {
.probe  = mxs_mmc_probe,
.remove = mxs_mmc_remove,
-   .id_table   = mxs_mmc_ids,
+   .id_table   = mxs_ssp_ids,
.driver = {
.name   = DRIVER_NAME,
.owner  = THIS_MODULE,
diff --git a/include/linux/spi/mxs-spi.h b/include/linux/spi/mxs-spi.h
index b7ccd57..c08aef5 100644
--- a/include/linux/spi/mxs-spi.h
+++ b/include/linux/spi/mxs-spi.h
@@ -24,7 +24,7 @@
 #ifndef __LINUX_SPI_MXS_SPI_H__
 #define __LINUX_SPI_MXS_SPI_H__
 
-#define ssp_is_old(host)   ((host)-devid == IMX23_MMC)
+#define ssp_is_old(host)   ((host)-devid == IMX23_SSP)
 
 /* SSP registers */
 #define HW_SSP_CTRL0   0x000
@@ -101,9 +101,9 @@
 
 #define SSP_PIO_NUM3
 
-enum mxs_mmc_id {
-   IMX23_MMC,
-   IMX28_MMC,
+enum mxs_ssp_id {
+   IMX23_SSP,
+   IMX28_SSP,
 };
 
 #endif /* __LINUX_SPI_MXS_SPI_H__ */
-- 
1.7.10.4


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 01/10] mmc: spi: Move SSP register definitions into separate file

2012-07-16 Thread Marek Vasut
Move the definitions into separate file so separate SPI driver can be
implemented. The SSP controller in MXS can act both as a MMC host and
as a SPI host.

Based on previous attempt by:
Fabio Estevam fabio.este...@freescale.com

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
Signed-off-by: Marek Vasut ma...@denx.de
Cc: Chris Ball c...@laptop.org
Cc: Detlev Zundel d...@denx.de
CC: Dong Aisheng b29...@freescale.com
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Linux ARM kernel linux-arm-ker...@lists.infradead.org
Cc: Rob Herring rob.herr...@calxeda.com
CC: Shawn Guo shawn@linaro.org
Cc: Stefano Babic sba...@denx.de
Cc: Wolfgang Denk w...@denx.de
---
 drivers/mmc/host/mxs-mmc.c  |   87 ++
 include/linux/spi/mxs-spi.h |  109 +++
 2 files changed, 112 insertions(+), 84 deletions(-)
 create mode 100644 include/linux/spi/mxs-spi.h

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 93b661d..584f982 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -45,87 +45,10 @@
 #include linux/pinctrl/consumer.h
 #include linux/stmp_device.h
 #include linux/mmc/mxs-mmc.h
+#include linux/spi/mxs-spi.h
 
 #define DRIVER_NAMEmxs-mmc
 
-/* card detect polling timeout */
-#define MXS_MMC_DETECT_TIMEOUT (HZ/2)
-
-#define ssp_is_old(host)   ((host)-devid == IMX23_MMC)
-
-/* SSP registers */
-#define HW_SSP_CTRL0   0x000
-#define  BM_SSP_CTRL0_RUN  (1  29)
-#define  BM_SSP_CTRL0_SDIO_IRQ_CHECK   (1  28)
-#define  BM_SSP_CTRL0_IGNORE_CRC   (1  26)
-#define  BM_SSP_CTRL0_READ (1  25)
-#define  BM_SSP_CTRL0_DATA_XFER(1  24)
-#define  BP_SSP_CTRL0_BUS_WIDTH(22)
-#define  BM_SSP_CTRL0_BUS_WIDTH(0x3  22)
-#define  BM_SSP_CTRL0_WAIT_FOR_IRQ (1  21)
-#define  BM_SSP_CTRL0_LONG_RESP(1  19)
-#define  BM_SSP_CTRL0_GET_RESP (1  17)
-#define  BM_SSP_CTRL0_ENABLE   (1  16)
-#define  BP_SSP_CTRL0_XFER_COUNT   (0)
-#define  BM_SSP_CTRL0_XFER_COUNT   (0x)
-#define HW_SSP_CMD00x010
-#define  BM_SSP_CMD0_DBL_DATA_RATE_EN  (1  25)
-#define  BM_SSP_CMD0_SLOW_CLKING_EN(1  22)
-#define  BM_SSP_CMD0_CONT_CLKING_EN(1  21)
-#define  BM_SSP_CMD0_APPEND_8CYC   (1  20)
-#define  BP_SSP_CMD0_BLOCK_SIZE(16)
-#define  BM_SSP_CMD0_BLOCK_SIZE(0xf  16)
-#define  BP_SSP_CMD0_BLOCK_COUNT   (8)
-#define  BM_SSP_CMD0_BLOCK_COUNT   (0xff  8)
-#define  BP_SSP_CMD0_CMD   (0)
-#define  BM_SSP_CMD0_CMD   (0xff)
-#define HW_SSP_CMD10x020
-#define HW_SSP_XFER_SIZE   0x030
-#define HW_SSP_BLOCK_SIZE  0x040
-#define  BP_SSP_BLOCK_SIZE_BLOCK_COUNT (4)
-#define  BM_SSP_BLOCK_SIZE_BLOCK_COUNT (0xff  4)
-#define  BP_SSP_BLOCK_SIZE_BLOCK_SIZE  (0)
-#define  BM_SSP_BLOCK_SIZE_BLOCK_SIZE  (0xf)
-#define HW_SSP_TIMING(h)   (ssp_is_old(h) ? 0x050 : 0x070)
-#define  BP_SSP_TIMING_TIMEOUT (16)
-#define  BM_SSP_TIMING_TIMEOUT (0x  16)
-#define  BP_SSP_TIMING_CLOCK_DIVIDE(8)
-#define  BM_SSP_TIMING_CLOCK_DIVIDE(0xff  8)
-#define  BP_SSP_TIMING_CLOCK_RATE  (0)
-#define  BM_SSP_TIMING_CLOCK_RATE  (0xff)
-#define HW_SSP_CTRL1(h)(ssp_is_old(h) ? 0x060 
: 0x080)
-#define  BM_SSP_CTRL1_SDIO_IRQ (1  31)
-#define  BM_SSP_CTRL1_SDIO_IRQ_EN  (1  30)
-#define  BM_SSP_CTRL1_RESP_ERR_IRQ (1  29)
-#define  BM_SSP_CTRL1_RESP_ERR_IRQ_EN  (1  28)
-#define  BM_SSP_CTRL1_RESP_TIMEOUT_IRQ (1  27)
-#define  BM_SSP_CTRL1_RESP_TIMEOUT_IRQ_EN  (1  26)
-#define  BM_SSP_CTRL1_DATA_TIMEOUT_IRQ (1  25)
-#define  BM_SSP_CTRL1_DATA_TIMEOUT_IRQ_EN  (1  24)
-#define  BM_SSP_CTRL1_DATA_CRC_IRQ (1  23)
-#define  BM_SSP_CTRL1_DATA_CRC_IRQ_EN  (1  22)
-#define  BM_SSP_CTRL1_FIFO_UNDERRUN_IRQ(1  21)
-#define  BM_SSP_CTRL1_FIFO_UNDERRUN_IRQ_EN (1  20)
-#define  BM_SSP_CTRL1_RECV_TIMEOUT_IRQ (1  17)
-#define  BM_SSP_CTRL1_RECV_TIMEOUT_IRQ_EN  (1  16)
-#define  BM_SSP_CTRL1_FIFO_OVERRUN_IRQ (1  15)
-#define  BM_SSP_CTRL1_FIFO_OVERRUN_IRQ_EN  (1  14)
-#define  BM_SSP_CTRL1_DMA_ENABLE   (1  13)
-#define  BM_SSP_CTRL1_POLARITY (1  9)
-#define  BP_SSP_CTRL1_WORD_LENGTH  (4)
-#define  BM_SSP_CTRL1_WORD_LENGTH  (0xf  4)
-#define  BP_SSP_CTRL1_SSP_MODE (0)
-#define  BM_SSP_CTRL1_SSP_MODE (0xf)
-#define 

[PATCH 09/10] spi: Add SSP/SPI device tree documentation

2012-07-16 Thread Marek Vasut
Signed-off-by: Marek Vasut ma...@denx.de
Cc: Chris Ball c...@laptop.org
Cc: Detlev Zundel d...@denx.de
CC: Dong Aisheng b29...@freescale.com
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Linux ARM kernel linux-arm-ker...@lists.infradead.org
Cc: Rob Herring rob.herr...@calxeda.com
CC: Shawn Guo shawn@linaro.org
Cc: Stefano Babic sba...@denx.de
Cc: Wolfgang Denk w...@denx.de
---
 Documentation/devicetree/bindings/spi/mxs-spi.txt |   18 ++
 1 file changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/mxs-spi.txt

diff --git a/Documentation/devicetree/bindings/spi/mxs-spi.txt 
b/Documentation/devicetree/bindings/spi/mxs-spi.txt
new file mode 100644
index 000..f1263a9
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/mxs-spi.txt
@@ -0,0 +1,18 @@
+* Freescale MX233/MX28 SSP/SPI
+
+Required properties:
+- compatible: Should be fsl,soc-spi, where soc is imx23 or imx28
+- reg: Offset and length of the register set for the device
+- interrupts: Should contain SSP interrupts (error irq first, dma irq second)
+- fsl,ssp-dma-channel: APBX DMA channel for the SSP
+
+Example:
+
+ssp0: ssp@8001 {
+   #address-cells = 1;
+   #size-cells = 0;
+   compatible = fsl,imx28-spi;
+   reg = 0x8001 2000;
+   interrupts = 96 82;
+   fsl,ssp-dma-channel = 0;
+};
-- 
1.7.10.4


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 03/10] mmc: spi: Add necessary bits into mxs-spi.h

2012-07-16 Thread Marek Vasut
Add missing register bits and registers into mxs-spi.h .
These will be used by the SPI driver.

Based on previous attempt by:
Fabio Estevam fabio.este...@freescale.com

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
Signed-off-by: Marek Vasut ma...@denx.de
Cc: Chris Ball c...@laptop.org
Cc: Detlev Zundel d...@denx.de
CC: Dong Aisheng b29...@freescale.com
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Linux ARM kernel linux-arm-ker...@lists.infradead.org
Cc: Rob Herring rob.herr...@calxeda.com
CC: Shawn Guo shawn@linaro.org
Cc: Stefano Babic sba...@denx.de
Cc: Wolfgang Denk w...@denx.de
---
 include/linux/spi/mxs-spi.h |   22 ++
 1 file changed, 22 insertions(+)

diff --git a/include/linux/spi/mxs-spi.h b/include/linux/spi/mxs-spi.h
index c08aef5..b0a0335 100644
--- a/include/linux/spi/mxs-spi.h
+++ b/include/linux/spi/mxs-spi.h
@@ -30,12 +30,14 @@
 #define HW_SSP_CTRL0   0x000
 #define  BM_SSP_CTRL0_RUN  (1  29)
 #define  BM_SSP_CTRL0_SDIO_IRQ_CHECK   (1  28)
+#define  BM_SSP_CTRL0_LOCK_CS  (1  27)
 #define  BM_SSP_CTRL0_IGNORE_CRC   (1  26)
 #define  BM_SSP_CTRL0_READ (1  25)
 #define  BM_SSP_CTRL0_DATA_XFER(1  24)
 #define  BP_SSP_CTRL0_BUS_WIDTH22
 #define  BM_SSP_CTRL0_BUS_WIDTH(0x3  22)
 #define  BM_SSP_CTRL0_WAIT_FOR_IRQ (1  21)
+#define  BM_SSP_CTRL0_WAIT_FOR_CMD (1  20)
 #define  BM_SSP_CTRL0_LONG_RESP(1  19)
 #define  BM_SSP_CTRL0_GET_RESP (1  17)
 #define  BM_SSP_CTRL0_ENABLE   (1  16)
@@ -64,8 +66,12 @@
 #define  BM_SSP_TIMING_TIMEOUT (0x  16)
 #define  BP_SSP_TIMING_CLOCK_DIVIDE8
 #define  BM_SSP_TIMING_CLOCK_DIVIDE(0xff  8)
+#define  BF_SSP_TIMING_CLOCK_DIVIDE(v) \
+   (((v)  8)  BM_SSP_TIMING_CLOCK_DIVIDE)
 #define  BP_SSP_TIMING_CLOCK_RATE  0
 #define  BM_SSP_TIMING_CLOCK_RATE  0xff
+#define BF_SSP_TIMING_CLOCK_RATE(v)\
+   (((v)  0)  BM_SSP_TIMING_CLOCK_RATE)
 #define HW_SSP_CTRL1(h)(ssp_is_old(h) ? 0x060 
: 0x080)
 #define  BM_SSP_CTRL1_SDIO_IRQ (1  31)
 #define  BM_SSP_CTRL1_SDIO_IRQ_EN  (1  30)
@@ -84,11 +90,26 @@
 #define  BM_SSP_CTRL1_FIFO_OVERRUN_IRQ (1  15)
 #define  BM_SSP_CTRL1_FIFO_OVERRUN_IRQ_EN  (1  14)
 #define  BM_SSP_CTRL1_DMA_ENABLE   (1  13)
+#define  BM_SSP_CTRL1_PHASE(1  10)
 #define  BM_SSP_CTRL1_POLARITY (1  9)
 #define  BP_SSP_CTRL1_WORD_LENGTH  4
 #define  BM_SSP_CTRL1_WORD_LENGTH  (0xf  4)
+#define  BF_SSP_CTRL1_WORD_LENGTH(v)   \
+   (((v)  4)  BM_SSP_CTRL1_WORD_LENGTH)
+#define  BV_SSP_CTRL1_WORD_LENGTH__FOUR_BITS   0x3
+#define  BV_SSP_CTRL1_WORD_LENGTH__EIGHT_BITS  0x7
+#define  BV_SSP_CTRL1_WORD_LENGTH__SIXTEEN_BITS0xF
 #define  BP_SSP_CTRL1_SSP_MODE 0
 #define  BM_SSP_CTRL1_SSP_MODE 0xf
+#define  BF_SSP_CTRL1_SSP_MODE(v)  \
+   (((v)  0)  BM_SSP_CTRL1_SSP_MODE)
+#define  BV_SSP_CTRL1_SSP_MODE__SPI0x0
+#define  BV_SSP_CTRL1_SSP_MODE__SSI0x1
+#define  BV_SSP_CTRL1_SSP_MODE__SD_MMC 0x3
+#define  BV_SSP_CTRL1_SSP_MODE__MS 0x4
+
+#define HW_SSP_DATA0x090
+
 #define HW_SSP_SDRESP0(h)  (ssp_is_old(h) ? 0x080 : 0x0a0)
 #define HW_SSP_SDRESP1(h)  (ssp_is_old(h) ? 0x090 : 0x0b0)
 #define HW_SSP_SDRESP2(h)  (ssp_is_old(h) ? 0x0a0 : 0x0c0)
@@ -96,6 +117,7 @@
 #define HW_SSP_STATUS(h)   (ssp_is_old(h) ? 0x0c0 : 0x100)
 #define  BM_SSP_STATUS_CARD_DETECT (1  28)
 #define  BM_SSP_STATUS_SDIO_IRQ(1  17)
+#define  BM_SSP_STATUS_FIFO_EMPTY  (1  5)
 
 #define BF_SSP(value, field)   (((value)  BP_SSP_##field)  BM_SSP_##field)
 
-- 
1.7.10.4


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 08/10] spi: Add DMA support into SPI driver

2012-07-16 Thread Marek Vasut
Signed-off-by: Marek Vasut ma...@denx.de
Cc: Chris Ball c...@laptop.org
Cc: Detlev Zundel d...@denx.de
CC: Dong Aisheng b29...@freescale.com
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Linux ARM kernel linux-arm-ker...@lists.infradead.org
Cc: Rob Herring rob.herr...@calxeda.com
CC: Shawn Guo shawn@linaro.org
Cc: Stefano Babic sba...@denx.de
Cc: Wolfgang Denk w...@denx.de
---
 drivers/spi/spi-mxs.c |  230 +
 1 file changed, 215 insertions(+), 15 deletions(-)

diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index a7d2ebc..e90200f 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -55,8 +55,12 @@
 
 #define SSP_TIMEOUT1000/* 1000 ms */
 
+#define SG_NUM 4
+#define SG_MAXLEN  0xff00
+
 struct mxs_spi {
struct mxs_ssp  ssp;
+   struct completion   c;
 };
 
 static int mxs_spi_setup_transfer(struct spi_device *dev,
@@ -192,6 +196,115 @@ static int mxs_ssp_wait(struct mxs_spi *spi, int offset, 
int mask, bool set)
return 0;
 }
 
+static void mxs_ssp_dma_irq_callback(void *param)
+{
+   struct mxs_spi *spi = param;
+   complete(spi-c);
+}
+
+static irqreturn_t mxs_ssp_irq_handler(int irq, void *dev_id)
+{
+   struct mxs_ssp *ssp = dev_id;
+   dev_err(ssp-dev, %s[%i] CTRL1=%08x STATUS=%08x\n,
+   __func__, __LINE__,
+   readl(ssp-base + HW_SSP_CTRL1(ssp)),
+   readl(ssp-base + HW_SSP_STATUS(ssp)));
+   return IRQ_HANDLED;
+}
+
+static int mxs_spi_txrx_dma(struct mxs_spi *spi, int cs,
+   unsigned char *buf, int len,
+   int *first, int *last, int write)
+{
+   struct mxs_ssp *ssp = spi-ssp;
+   struct dma_async_tx_descriptor *desc;
+   struct scatterlist sg[SG_NUM];
+   int sg_count;
+   uint32_t pio = BM_SSP_CTRL0_DATA_XFER | mxs_spi_cs_to_reg(cs);
+   int ret;
+
+   if (len  SG_NUM * SG_MAXLEN) {
+   dev_err(ssp-dev, Data chunk too big for DMA\n);
+   return -EINVAL;
+   }
+
+   init_completion(spi-c);
+
+   if (*first)
+   pio |= BM_SSP_CTRL0_LOCK_CS;
+   if (*last)
+   pio |= BM_SSP_CTRL0_IGNORE_CRC;
+   if (!write)
+   pio |= BM_SSP_CTRL0_READ;
+
+   if (ssp-devid == IMX23_SSP)
+   pio |= len;
+   else
+   writel(len, ssp-base + HW_SSP_XFER_SIZE);
+
+   /* Queue the PIO register write transfer. */
+   desc = dmaengine_prep_slave_sg(ssp-dmach,
+   (struct scatterlist *)pio,
+   1, DMA_TRANS_NONE, 0);
+   if (!desc) {
+   dev_err(ssp-dev,
+   Failed to get PIO reg. write descriptor.\n);
+   return -EINVAL;
+   }
+
+   /* Queue the DMA data transfer. */
+   sg_init_table(sg, (len / SG_MAXLEN) + 1);
+   sg_count = 0;
+   while (len) {
+   sg_set_buf(sg[sg_count++], buf, min(len, SG_MAXLEN));
+   len -= min(len, SG_MAXLEN);
+   buf += min(len, SG_MAXLEN);
+   }
+   dma_map_sg(ssp-dev, sg, sg_count,
+   write ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+
+   desc = dmaengine_prep_slave_sg(ssp-dmach, sg, sg_count,
+   write ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM,
+   DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+
+   if (!desc) {
+   dev_err(ssp-dev,
+   Failed to get DMA data write descriptor.\n);
+   ret = -EINVAL;
+   goto err;
+   }
+
+   /*
+* The last descriptor must have this callback,
+* to finish the DMA transaction.
+*/
+   desc-callback = mxs_ssp_dma_irq_callback;
+   desc-callback_param = spi;
+
+   /* Start the transfer. */
+   dmaengine_submit(desc);
+   dma_async_issue_pending(ssp-dmach);
+
+   ret = wait_for_completion_timeout(spi-c,
+   msecs_to_jiffies(SSP_TIMEOUT));
+
+   if (!ret) {
+   dev_err(ssp-dev, DMA transfer timeout\n);
+   ret = -ETIMEDOUT;
+   goto err;
+   }
+
+   ret = 0;
+
+err:
+   for (--sg_count; sg_count = 0; sg_count--) {
+   dma_unmap_sg(ssp-dev, sg[sg_count], 1,
+   write ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+   }
+
+   return ret;
+}
+
 static int mxs_spi_txrx_pio(struct mxs_spi *spi, int cs,
unsigned char *buf, int len,
int *first, int *last, int write)
@@ -276,18 +389,48 @@ static int mxs_spi_transfer_one(struct spi_master *host, 
struct spi_message *m)
first = 1;
if (t-transfer_list == m-transfers.prev)
last = 1;
-   if (t-rx_buf  t-tx_buf) {
+   if ((t-rx_buf  t-tx_buf) 

[PATCH 00/10] MXS SPI driver

2012-07-16 Thread Marek Vasut
This patchset adds SPI master support for Freescale i.MX233/i.MX28.
This is rebased on top of next-20120713. Please consider applying,
bugs shall now be squashed during the previous two review rounds.


This is a repost (rebased) of the patchset from Jul 6, 2012.

Marek Vasut (10):
  mmc: spi: Move SSP register definitions into separate file
  mmc: spi: Rename IMX2[38]_MMC to IMX2[38]_SSP
  mmc: spi: Add necessary bits into mxs-spi.h
  mmc: spi: Pull out parts shared between MMC and SPI
  mmc: spi: Pull out the SSP clock configuration function
  spi: Add SPI driver for mx233/mx28
  mmc: spi: Pull out common DMA parts from MXS MMC
  spi: Add DMA support into SPI driver
  spi: Add SSP/SPI device tree documentation
  ARM: mx28: Add SPI pinmux into imx28.dtsi

 Documentation/devicetree/bindings/spi/mxs-spi.txt |   18 +
 arch/arm/boot/dts/imx28.dtsi  |   39 ++
 drivers/clk/mxs/Makefile  |2 +-
 drivers/clk/mxs/clk-ssp.c |   61 ++
 drivers/mmc/host/mxs-mmc.c|  325 ---
 drivers/spi/Kconfig   |7 +
 drivers/spi/Makefile  |1 +
 drivers/spi/spi-mxs.c |  626 +
 include/linux/spi/mxs-spi.h   |  150 +
 9 files changed, 1010 insertions(+), 219 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/mxs-spi.txt
 create mode 100644 drivers/clk/mxs/clk-ssp.c
 create mode 100644 drivers/spi/spi-mxs.c
 create mode 100644 include/linux/spi/mxs-spi.h

-- 
1.7.10.4


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 05/10] mmc: spi: Pull out the SSP clock configuration function

2012-07-16 Thread Marek Vasut
Pull out the MMC clock configuration function and make it
into SSP clock configuration function, so it can be used by
the SPI driver too.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Chris Ball c...@laptop.org
Cc: Detlev Zundel d...@denx.de
CC: Dong Aisheng b29...@freescale.com
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Linux ARM kernel linux-arm-ker...@lists.infradead.org
Cc: Rob Herring rob.herr...@calxeda.com
CC: Shawn Guo shawn@linaro.org
Cc: Stefano Babic sba...@denx.de
Cc: Wolfgang Denk w...@denx.de
---
 drivers/clk/mxs/Makefile|2 +-
 drivers/clk/mxs/clk-ssp.c   |   61 +++
 drivers/mmc/host/mxs-mmc.c  |   39 +--
 include/linux/spi/mxs-spi.h |2 ++
 4 files changed, 65 insertions(+), 39 deletions(-)
 create mode 100644 drivers/clk/mxs/clk-ssp.c

diff --git a/drivers/clk/mxs/Makefile b/drivers/clk/mxs/Makefile
index 7bedeec..a6a2223 100644
--- a/drivers/clk/mxs/Makefile
+++ b/drivers/clk/mxs/Makefile
@@ -2,7 +2,7 @@
 # Makefile for mxs specific clk
 #
 
-obj-y += clk.o clk-pll.o clk-ref.o clk-div.o clk-frac.o
+obj-y += clk.o clk-pll.o clk-ref.o clk-div.o clk-frac.o clk-ssp.o
 
 obj-$(CONFIG_SOC_IMX23) += clk-imx23.o
 obj-$(CONFIG_SOC_IMX28) += clk-imx28.o
diff --git a/drivers/clk/mxs/clk-ssp.c b/drivers/clk/mxs/clk-ssp.c
new file mode 100644
index 000..b3c1e16
--- /dev/null
+++ b/drivers/clk/mxs/clk-ssp.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2012 DENX Software Engineering, GmbH
+ *
+ * Pulled from code:
+ * Portions copyright (C) 2003 Russell King, PXA MMCI Driver
+ * Portions copyright (C) 2004-2005 Pierre Ossman, W83L51xD SD/MMC driver
+ *
+ * Copyright 2008 Embedded Alley Solutions, Inc.
+ * Copyright 2009-2011 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include linux/kernel.h
+#include linux/init.h
+#include linux/clk.h
+#include linux/module.h
+#include linux/device.h
+#include linux/io.h
+#include linux/spi/mxs-spi.h
+
+void mxs_ssp_set_clk_rate(struct mxs_ssp *ssp, unsigned int rate)
+{
+   unsigned int ssp_clk, ssp_sck;
+   u32 clock_divide, clock_rate;
+   u32 val;
+
+   ssp_clk = clk_get_rate(ssp-clk);
+
+   for (clock_divide = 2; clock_divide = 254; clock_divide += 2) {
+   clock_rate = DIV_ROUND_UP(ssp_clk, rate * clock_divide);
+   clock_rate = (clock_rate  0) ? clock_rate - 1 : 0;
+   if (clock_rate = 255)
+   break;
+   }
+
+   if (clock_divide  254) {
+   dev_err(ssp-dev,
+   %s: cannot set clock to %d\n, __func__, rate);
+   return;
+   }
+
+   ssp_sck = ssp_clk / clock_divide / (1 + clock_rate);
+
+   val = readl(ssp-base + HW_SSP_TIMING(ssp));
+   val = ~(BM_SSP_TIMING_CLOCK_DIVIDE | BM_SSP_TIMING_CLOCK_RATE);
+   val |= BF_SSP(clock_divide, TIMING_CLOCK_DIVIDE);
+   val |= BF_SSP(clock_rate, TIMING_CLOCK_RATE);
+   writel(val, ssp-base + HW_SSP_TIMING(ssp));
+
+   ssp-clk_rate = ssp_sck;
+
+   dev_dbg(ssp-dev,
+   %s: clock_divide %d, clock_rate %d, ssp_clk %d, rate_actual 
%d, rate_requested %d\n,
+   __func__, clock_divide, clock_rate, ssp_clk, ssp_sck, rate);
+}
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 1ea1cba..3b1c99b 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -501,43 +501,6 @@ static void mxs_mmc_request(struct mmc_host *mmc, struct 
mmc_request *mrq)
mxs_mmc_start_cmd(host, mrq-cmd);
 }
 
-static void mxs_mmc_set_clk_rate(struct mxs_mmc_host *host, unsigned int rate)
-{
-   struct mxs_ssp *ssp = host-ssp;
-   unsigned int ssp_clk, ssp_sck;
-   u32 clock_divide, clock_rate;
-   u32 val;
-
-   ssp_clk = clk_get_rate(ssp-clk);
-
-   for (clock_divide = 2; clock_divide = 254; clock_divide += 2) {
-   clock_rate = DIV_ROUND_UP(ssp_clk, rate * clock_divide);
-   clock_rate = (clock_rate  0) ? clock_rate - 1 : 0;
-   if (clock_rate = 255)
-   break;
-   }
-
-   if (clock_divide  254) {
-   dev_err(mmc_dev(host-mmc),
-   %s: cannot set clock to %d\n, __func__, rate);
-   return;
-   }
-
-   ssp_sck = ssp_clk / clock_divide / (1 + clock_rate);
-
-   val = readl(ssp-base + HW_SSP_TIMING(ssp));
-   val = ~(BM_SSP_TIMING_CLOCK_DIVIDE | BM_SSP_TIMING_CLOCK_RATE);
-   val |= BF_SSP(clock_divide, TIMING_CLOCK_DIVIDE);
-   val |= BF_SSP(clock_rate, TIMING_CLOCK_RATE);
-   writel(val, ssp-base + HW_SSP_TIMING(ssp));
-
-   ssp-clk_rate = ssp_sck;
-
-   

[PATCH 04/10] mmc: spi: Pull out parts shared between MMC and SPI

2012-07-16 Thread Marek Vasut
Abstract out the common part of private data shared between MMC
and SPI. These shall later allow to use common clock configuration
function.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Chris Ball c...@laptop.org
Cc: Detlev Zundel d...@denx.de
CC: Dong Aisheng b29...@freescale.com
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Linux ARM kernel linux-arm-ker...@lists.infradead.org
Cc: Rob Herring rob.herr...@calxeda.com
CC: Shawn Guo shawn@linaro.org
Cc: Stefano Babic sba...@denx.de
Cc: Wolfgang Denk w...@denx.de
---
 drivers/mmc/host/mxs-mmc.c  |  107 ---
 include/linux/spi/mxs-spi.h |8 
 2 files changed, 67 insertions(+), 48 deletions(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index f9509e8..1ea1cba 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -62,23 +62,20 @@
 #define MXS_MMC_DETECT_TIMEOUT (HZ/2)
 
 struct mxs_mmc_host {
+   struct mxs_ssp  ssp;
+
struct mmc_host *mmc;
struct mmc_request  *mrq;
struct mmc_command  *cmd;
struct mmc_data *data;
 
-   void __iomem*base;
int dma_channel;
-   struct clk  *clk;
-   unsigned intclk_rate;
-
struct dma_chan *dmach;
struct mxs_dma_data dma_data;
unsigned intdma_dir;
enum dma_transfer_direction slave_dirn;
u32 ssp_pio_words[SSP_PIO_NUM];
 
-   enum mxs_ssp_id devid;
unsigned char   bus_width;
spinlock_t  lock;
int sdio_irq_en;
@@ -105,16 +102,18 @@ static int mxs_mmc_get_ro(struct mmc_host *mmc)
 static int mxs_mmc_get_cd(struct mmc_host *mmc)
 {
struct mxs_mmc_host *host = mmc_priv(mmc);
+   struct mxs_ssp *ssp = host-ssp;
 
-   return !(readl(host-base + HW_SSP_STATUS(host)) 
+   return !(readl(ssp-base + HW_SSP_STATUS(ssp)) 
 BM_SSP_STATUS_CARD_DETECT);
 }
 
 static void mxs_mmc_reset(struct mxs_mmc_host *host)
 {
+   struct mxs_ssp *ssp = host-ssp;
u32 ctrl0, ctrl1;
 
-   stmp_reset_block(host-base);
+   stmp_reset_block(ssp-base);
 
ctrl0 = BM_SSP_CTRL0_IGNORE_CRC;
ctrl1 = BF_SSP(0x3, CTRL1_SSP_MODE) |
@@ -130,15 +129,15 @@ static void mxs_mmc_reset(struct mxs_mmc_host *host)
writel(BF_SSP(0x, TIMING_TIMEOUT) |
   BF_SSP(2, TIMING_CLOCK_DIVIDE) |
   BF_SSP(0, TIMING_CLOCK_RATE),
-  host-base + HW_SSP_TIMING(host));
+  ssp-base + HW_SSP_TIMING(ssp));
 
if (host-sdio_irq_en) {
ctrl0 |= BM_SSP_CTRL0_SDIO_IRQ_CHECK;
ctrl1 |= BM_SSP_CTRL1_SDIO_IRQ_EN;
}
 
-   writel(ctrl0, host-base + HW_SSP_CTRL0);
-   writel(ctrl1, host-base + HW_SSP_CTRL1(host));
+   writel(ctrl0, ssp-base + HW_SSP_CTRL0);
+   writel(ctrl1, ssp-base + HW_SSP_CTRL1(ssp));
 }
 
 static void mxs_mmc_start_cmd(struct mxs_mmc_host *host,
@@ -149,15 +148,16 @@ static void mxs_mmc_request_done(struct mxs_mmc_host 
*host)
struct mmc_command *cmd = host-cmd;
struct mmc_data *data = host-data;
struct mmc_request *mrq = host-mrq;
+   struct mxs_ssp *ssp = host-ssp;
 
if (mmc_resp_type(cmd)  MMC_RSP_PRESENT) {
if (mmc_resp_type(cmd)  MMC_RSP_136) {
-   cmd-resp[3] = readl(host-base + HW_SSP_SDRESP0(host));
-   cmd-resp[2] = readl(host-base + HW_SSP_SDRESP1(host));
-   cmd-resp[1] = readl(host-base + HW_SSP_SDRESP2(host));
-   cmd-resp[0] = readl(host-base + HW_SSP_SDRESP3(host));
+   cmd-resp[3] = readl(ssp-base + HW_SSP_SDRESP0(ssp));
+   cmd-resp[2] = readl(ssp-base + HW_SSP_SDRESP1(ssp));
+   cmd-resp[1] = readl(ssp-base + HW_SSP_SDRESP2(ssp));
+   cmd-resp[0] = readl(ssp-base + HW_SSP_SDRESP3(ssp));
} else {
-   cmd-resp[0] = readl(host-base + HW_SSP_SDRESP0(host));
+   cmd-resp[0] = readl(ssp-base + HW_SSP_SDRESP0(ssp));
}
}
 
@@ -196,13 +196,14 @@ static irqreturn_t mxs_mmc_irq_handler(int irq, void 
*dev_id)
struct mxs_mmc_host *host = dev_id;
struct mmc_command *cmd = host-cmd;
struct mmc_data *data = host-data;
+   struct mxs_ssp *ssp = host-ssp;
u32 stat;
 
spin_lock(host-lock);
 
-   stat = readl(host-base + HW_SSP_CTRL1(host));
+   stat = readl(ssp-base + HW_SSP_CTRL1(ssp));
writel(stat  MXS_MMC_IRQ_BITS,
-  host-base + 

[PATCH 06/10] spi: Add SPI driver for mx233/mx28

2012-07-16 Thread Marek Vasut
This is slightly reworked version of the SPI driver.
Support for DT has been added and it's been converted
to queued API.

Based on previous attempt by:
Fabio Estevam fabio.este...@freescale.com

Signed-off-by: Fabio Estevam fabio.este...@freescale.com
Signed-off-by: Marek Vasut ma...@denx.de
Cc: Chris Ball c...@laptop.org
Cc: Detlev Zundel d...@denx.de
CC: Dong Aisheng b29...@freescale.com
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Linux ARM kernel linux-arm-ker...@lists.infradead.org
Cc: Rob Herring rob.herr...@calxeda.com
CC: Shawn Guo shawn@linaro.org
Cc: Stefano Babic sba...@denx.de
Cc: Wolfgang Denk w...@denx.de
---
 drivers/spi/Kconfig   |7 +
 drivers/spi/Makefile  |1 +
 drivers/spi/spi-mxs.c |  427 +
 3 files changed, 435 insertions(+)
 create mode 100644 drivers/spi/spi-mxs.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index b7b99e7..bf131bc 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -364,6 +364,13 @@ config SPI_STMP3XXX
help
  SPI driver for Freescale STMP37xx/378x SoC SSP interface
 
+config SPI_MXS
+   tristate Freescale MXS SPI controller
+   depends on ARCH_MXS
+   select STMP_DEVICE
+   help
+ SPI driver for Freescale MXS devices.
+
 config SPI_TEGRA
tristate Nvidia Tegra SPI controller
depends on ARCH_TEGRA  (TEGRA_SYSTEM_DMA || TEGRA20_APB_DMA)
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index b5cbab2..e6a2ee4 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_SPI_LM70_LLP)+= spi-lm70llp.o
 obj-$(CONFIG_SPI_MPC512x_PSC)  += spi-mpc512x-psc.o
 obj-$(CONFIG_SPI_MPC52xx_PSC)  += spi-mpc52xx-psc.o
 obj-$(CONFIG_SPI_MPC52xx)  += spi-mpc52xx.o
+obj-$(CONFIG_SPI_MXS)  += spi-mxs.o
 obj-$(CONFIG_SPI_NUC900)   += spi-nuc900.o
 obj-$(CONFIG_SPI_OC_TINY)  += spi-oc-tiny.o
 obj-$(CONFIG_SPI_OMAP_UWIRE)   += spi-omap-uwire.o
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
new file mode 100644
index 000..3c0b1ac
--- /dev/null
+++ b/drivers/spi/spi-mxs.c
@@ -0,0 +1,427 @@
+/*
+ * Freescale MXS SPI master driver
+ *
+ * Copyright 2012 DENX Software Engineering, GmbH.
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
+ *
+ * Rework and transition to new API by:
+ * Marek Vasut ma...@denx.de
+ *
+ * Based on previous attempt by:
+ * Fabio Estevam fabio.este...@freescale.com
+ *
+ * Based on code from U-Boot bootloader by:
+ * Marek Vasut ma...@denx.de
+ *
+ * Based on spi-stmp.c, which is:
+ * Author: Dmitry Pervushin di...@embeddedalley.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/kernel.h
+#include linux/init.h
+#include linux/ioport.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/of_gpio.h
+#include linux/platform_device.h
+#include linux/delay.h
+#include linux/interrupt.h
+#include linux/dma-mapping.h
+#include linux/dmaengine.h
+#include linux/highmem.h
+#include linux/clk.h
+#include linux/err.h
+#include linux/completion.h
+#include linux/gpio.h
+#include linux/regulator/consumer.h
+#include linux/module.h
+#include linux/fsl/mxs-dma.h
+#include linux/pinctrl/consumer.h
+#include linux/stmp_device.h
+#include linux/spi/spi.h
+#include linux/spi/mxs-spi.h
+
+#define DRIVER_NAMEmxs-spi
+
+#define SSP_TIMEOUT1000/* 1000 ms */
+
+struct mxs_spi {
+   struct mxs_ssp  ssp;
+};
+
+static int mxs_spi_setup_transfer(struct spi_device *dev,
+   struct spi_transfer *t)
+{
+   struct mxs_spi *spi = spi_master_get_devdata(dev-master);
+   struct mxs_ssp *ssp = spi-ssp;
+   uint8_t bits_per_word;
+   uint32_t hz = 0;
+
+   bits_per_word = dev-bits_per_word;
+   if (t  t-bits_per_word)
+   bits_per_word = t-bits_per_word;
+
+   if (bits_per_word != 8) {
+   dev_err(dev-dev, %s, unsupported bits_per_word=%d\n,
+   __func__, bits_per_word);
+   return -EINVAL;
+   }
+
+   if (dev-max_speed_hz)
+   hz = dev-max_speed_hz;
+   if (t  t-speed_hz)
+   hz = t-speed_hz;
+   if (hz == 0) {
+   dev_err(dev-dev, Cannot continue with zero clock\n);
+   return -EINVAL;
+   }
+
+   mxs_ssp_set_clk_rate(ssp, hz);
+
+

[PATCH 07/10] mmc: spi: Pull out common DMA parts from MXS MMC

2012-07-16 Thread Marek Vasut
These parts will be used by the MXS SPI driver too.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Chris Ball c...@laptop.org
Cc: Detlev Zundel d...@denx.de
CC: Dong Aisheng b29...@freescale.com
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Linux ARM kernel linux-arm-ker...@lists.infradead.org
Cc: Rob Herring rob.herr...@calxeda.com
CC: Shawn Guo shawn@linaro.org
Cc: Stefano Babic sba...@denx.de
Cc: Wolfgang Denk w...@denx.de
---
 drivers/mmc/host/mxs-mmc.c  |   88 +--
 drivers/spi/spi-mxs.c   |1 -
 include/linux/spi/mxs-spi.h |9 +
 3 files changed, 51 insertions(+), 47 deletions(-)

diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 3b1c99b..c4be207 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -41,7 +41,6 @@
 #include linux/gpio.h
 #include linux/regulator/consumer.h
 #include linux/module.h
-#include linux/fsl/mxs-dma.h
 #include linux/pinctrl/consumer.h
 #include linux/stmp_device.h
 #include linux/mmc/mxs-mmc.h
@@ -69,13 +68,6 @@ struct mxs_mmc_host {
struct mmc_command  *cmd;
struct mmc_data *data;
 
-   int dma_channel;
-   struct dma_chan *dmach;
-   struct mxs_dma_data dma_data;
-   unsigned intdma_dir;
-   enum dma_transfer_direction slave_dirn;
-   u32 ssp_pio_words[SSP_PIO_NUM];
-
unsigned char   bus_width;
spinlock_t  lock;
int sdio_irq_en;
@@ -163,7 +155,7 @@ static void mxs_mmc_request_done(struct mxs_mmc_host *host)
 
if (data) {
dma_unmap_sg(mmc_dev(host-mmc), data-sg,
-data-sg_len, host-dma_dir);
+data-sg_len, ssp-dma_dir);
/*
 * If there was an error on any block, we mark all
 * data blocks as being in error.
@@ -232,6 +224,7 @@ static irqreturn_t mxs_mmc_irq_handler(int irq, void 
*dev_id)
 static struct dma_async_tx_descriptor *mxs_mmc_prep_dma(
struct mxs_mmc_host *host, unsigned long flags)
 {
+   struct mxs_ssp *ssp = host-ssp;
struct dma_async_tx_descriptor *desc;
struct mmc_data *data = host-data;
struct scatterlist * sgl;
@@ -240,24 +233,24 @@ static struct dma_async_tx_descriptor *mxs_mmc_prep_dma(
if (data) {
/* data */
dma_map_sg(mmc_dev(host-mmc), data-sg,
-  data-sg_len, host-dma_dir);
+  data-sg_len, ssp-dma_dir);
sgl = data-sg;
sg_len = data-sg_len;
} else {
/* pio */
-   sgl = (struct scatterlist *) host-ssp_pio_words;
+   sgl = (struct scatterlist *) ssp-ssp_pio_words;
sg_len = SSP_PIO_NUM;
}
 
-   desc = dmaengine_prep_slave_sg(host-dmach,
-   sgl, sg_len, host-slave_dirn, flags);
+   desc = dmaengine_prep_slave_sg(ssp-dmach,
+   sgl, sg_len, ssp-slave_dirn, flags);
if (desc) {
desc-callback = mxs_mmc_dma_irq_callback;
desc-callback_param = host;
} else {
if (data)
dma_unmap_sg(mmc_dev(host-mmc), data-sg,
-data-sg_len, host-dma_dir);
+data-sg_len, ssp-dma_dir);
}
 
return desc;
@@ -265,6 +258,7 @@ static struct dma_async_tx_descriptor *mxs_mmc_prep_dma(
 
 static void mxs_mmc_bc(struct mxs_mmc_host *host)
 {
+   struct mxs_ssp *ssp = host-ssp;
struct mmc_command *cmd = host-cmd;
struct dma_async_tx_descriptor *desc;
u32 ctrl0, cmd0, cmd1;
@@ -278,17 +272,17 @@ static void mxs_mmc_bc(struct mxs_mmc_host *host)
cmd0 |= BM_SSP_CMD0_CONT_CLKING_EN | BM_SSP_CMD0_SLOW_CLKING_EN;
}
 
-   host-ssp_pio_words[0] = ctrl0;
-   host-ssp_pio_words[1] = cmd0;
-   host-ssp_pio_words[2] = cmd1;
-   host-dma_dir = DMA_NONE;
-   host-slave_dirn = DMA_TRANS_NONE;
+   ssp-ssp_pio_words[0] = ctrl0;
+   ssp-ssp_pio_words[1] = cmd0;
+   ssp-ssp_pio_words[2] = cmd1;
+   ssp-dma_dir = DMA_NONE;
+   ssp-slave_dirn = DMA_TRANS_NONE;
desc = mxs_mmc_prep_dma(host, DMA_CTRL_ACK);
if (!desc)
goto out;
 
dmaengine_submit(desc);
-   dma_async_issue_pending(host-dmach);
+   dma_async_issue_pending(ssp-dmach);
return;
 
 out:
@@ -298,6 +292,7 @@ out:
 
 static void mxs_mmc_ac(struct mxs_mmc_host *host)
 {
+   struct mxs_ssp *ssp = host-ssp;
struct mmc_command *cmd = host-cmd;
struct dma_async_tx_descriptor *desc;
u32 ignore_crc, 

[PATCH 10/10] ARM: mx28: Add SPI pinmux into imx28.dtsi

2012-07-16 Thread Marek Vasut
Signed-off-by: Marek Vasut ma...@denx.de
Cc: Chris Ball c...@laptop.org
Cc: Detlev Zundel d...@denx.de
CC: Dong Aisheng b29...@freescale.com
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Linux ARM kernel linux-arm-ker...@lists.infradead.org
Cc: Rob Herring rob.herr...@calxeda.com
CC: Shawn Guo shawn@linaro.org
Cc: Stefano Babic sba...@denx.de
Cc: Wolfgang Denk w...@denx.de
---
 arch/arm/boot/dts/imx28.dtsi |   39 +++
 1 file changed, 39 insertions(+)

diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index badc76a..4a0f12c 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -507,6 +507,45 @@
fsl,voltage = 1;
fsl,pull-up = 0;
};
+
+   spi0_pins_a: spi0@0 {
+   reg = 0;
+   fsl,pinmux-ids =
+   0x2000 0x2010 0x2020 0x2030
+   0x2040 0x2050 0x2060 0x2070
+   0x2080 0x2090 0x20a0;
+   fsl,drive-strength = 1;
+   fsl,voltage = 1;
+   fsl,pull-up = 1;
+   };
+
+   spi1_pins_a: spi1@0 {
+   reg = 0;
+   fsl,pinmux-ids =
+   0x20c0 0x20d0 0x20e0 0x20f0;
+   fsl,drive-strength = 1;
+   fsl,voltage = 1;
+   fsl,pull-up = 1;
+   };
+
+   spi2_pins_a: spi2@0 {
+   reg = 0;
+   fsl,pinmux-ids =
+   0x2100 0x2110 0x2120
+   0x2130 0x2140 0x2150;
+   fsl,drive-strength = 1;
+   fsl,voltage = 1;
+   fsl,pull-up = 1;
+   };
+
+   spi3_pins_a: spi3@0 {
+   reg = 0;
+   fsl,pinmux-ids =
+   0x2180 0x2190 0x21a0 0x21b0;
+   fsl,drive-strength = 1;
+   fsl,voltage = 1;
+   fsl,pull-up = 1;
+   };
};
 
digctl@8001c000 {
-- 
1.7.10.4


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Fais des rencontres sans sortir ta carte bancaire

2012-07-16 Thread Service rencontre par Duano
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTE2MDQ1JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNiAwNjozMDowMSZlPTEmaD0xNjA0NCZmPTE2MDQ1Jmc9MTYwNDU=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTE2MDQ1JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNiAwNjozMDowMSZlPTEmaD0xNjA0NCZmPTE2MDQ1Jmc9MTYwNDU=


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Perdez 5 Kilos avec 5 comprimes

2012-07-16 Thread Zacti Plus par Duano
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTE2MDI5JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNiAwNDoyMDowMSZlPTEmaD0xNjAyOCZmPTE2MDI5Jmc9MTYwMjk=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTE2MDI5JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNiAwNDoyMDowMSZlPTEmaD0xNjAyOCZmPTE2MDI5Jmc9MTYwMjk=


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Téléchargez le guide des radiateurs à inertie

2012-07-16 Thread Meilleur Choix par Duano
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTE2MDk5JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNiAyMzo1MDowMSZlPTEmaD0xNjA5OCZmPTE2MDk5Jmc9MTYwOTk=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTE2MDk5JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNiAyMzo1MDowMSZlPTEmaD0xNjA5OCZmPTE2MDk5Jmc9MTYwOTk=


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


RE: [PATCH 2/2] spi/s3c64xx: Expand S3C64XX_SPI_{DE,}ACT macros at call sites

2012-07-16 Thread Kukjin Kim
Linus Walleij wrote:
 
 On Thu, Jun 28, 2012 at 3:23 PM, Mark Brown
 broo...@opensource.wolfsonmicro.com wrote:
 
  They have very few users and they're both just doing a single register
  write so the advantage of having the macro is a bit limited. An inline
  function might make sense but it's as easy to just do the writes
 directly.
 
  Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com
 
 Much clearer.
 Acked-by: Linus Walleij linus.wall...@linaro.org
 
Yeah, I agree, looks good to me.

But I think, nobody takes this series...?

So may I take then send this series via samsung tree? Because for samsung
spi dt, the file has been touched in samsung tree so it helps to avoid bad
conflicts.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim kgene@samsung.com, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


2ème démarque jusqu'à -70%

2012-07-16 Thread Lee Cooper par Duano
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTE2MDA2JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNyAwMjoyMDowMSZlPTEmaD0xNjAwNSZmPTE2MDA2Jmc9MTYwMDY=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTE2MDA2JmM9NDgzNjEyJmQ9MjAxMi0wNy0xNyAwMjoyMDowMSZlPTEmaD0xNjAwNSZmPTE2MDA2Jmc9MTYwMDY=


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general