Re: [PATCH V6 04/10] spi: s3c64xx: Modify SPI driver to use generic DMA DT support

2013-01-29 Thread Padma Venkat
On Tue, Jan 29, 2013 at 10:49 AM, Mark Brown
broo...@opensource.wolfsonmicro.com wrote:
 On Fri, Jan 18, 2013 at 05:17:03PM +0530, Padmavathi Venna wrote:
 This patch modifies the SPI driver to use generic dma dt bindings
 support. This passes all the required arguments to dma dev request
 functon which in turn calls the dma_request_slave_channel or dma__
 request_channel based on DT or non-DT respectively.

 This loooks OK and I'm actually applying SPI patches so I could apply it
 but I'm not sure I see the relevance of this patch to the rest of the
 series (which is about ASoC).  Is there some reason why it's included in
 this patch series or can it be applied to the SPI tree?  The SMDKs use
 I2C for their CODEC control rather than SPI.

 Also is there a binding document update or device tree file update to go
 with this?

 + if (!sdd-pdev-dev.of_node) {
 + res = platform_get_resource(pdev, IORESOURCE_DMA,  0);
 + if (!res) {
 + dev_err(pdev-dev, Unable to get SPI tx dma 
 + resource\n);

 I appreciate that this is cut'n'paste from the code you're refactoring
 but please don't split error messages over lines, it makes it hard to
 grep for them in the kernel source.

OK.

Thanks for reviewing.
Padma
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH V6 04/10] spi: s3c64xx: Modify SPI driver to use generic DMA DT support

2013-01-28 Thread Mark Brown
On Fri, Jan 18, 2013 at 05:17:03PM +0530, Padmavathi Venna wrote:
 This patch modifies the SPI driver to use generic dma dt bindings
 support. This passes all the required arguments to dma dev request
 functon which in turn calls the dma_request_slave_channel or dma__
 request_channel based on DT or non-DT respectively.

This loooks OK and I'm actually applying SPI patches so I could apply it
but I'm not sure I see the relevance of this patch to the rest of the
series (which is about ASoC).  Is there some reason why it's included in
this patch series or can it be applied to the SPI tree?  The SMDKs use
I2C for their CODEC control rather than SPI.

Also is there a binding document update or device tree file update to go
with this?

 + if (!sdd-pdev-dev.of_node) {
 + res = platform_get_resource(pdev, IORESOURCE_DMA,  0);
 + if (!res) {
 + dev_err(pdev-dev, Unable to get SPI tx dma 
 + resource\n);

I appreciate that this is cut'n'paste from the code you're refactoring
but please don't split error messages over lines, it makes it hard to
grep for them in the kernel source.


signature.asc
Description: Digital signature
___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss


[PATCH V6 04/10] spi: s3c64xx: Modify SPI driver to use generic DMA DT support

2013-01-18 Thread Padmavathi Venna
This patch modifies the SPI driver to use generic dma dt bindings
support. This passes all the required arguments to dma dev request
functon which in turn calls the dma_request_slave_channel or dma__
request_channel based on DT or non-DT respectively.

Signed-off-by: Padmavathi Venna padm...@samsung.com
---
 drivers/spi/spi-s3c64xx.c |   77 +---
 1 files changed, 23 insertions(+), 54 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index ad93231..51a8c42 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -134,7 +134,6 @@ struct s3c64xx_spi_dma_data {
unsignedch;
enum dma_transfer_direction direction;
enum dma_ch dmach;
-   struct property *dma_prop;
 };
 
 /**
@@ -319,16 +318,15 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
 static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
 {
struct samsung_dma_req req;
+   struct device *dev = sdd-pdev-dev;
 
sdd-ops = samsung_dma_get_ops();
 
req.cap = DMA_SLAVE;
req.client = s3c64xx_spi_dma_client;
 
-   req.dt_dmach_prop = sdd-rx_dma.dma_prop;
-   sdd-rx_dma.ch = sdd-ops-request(sdd-rx_dma.dmach, req);
-   req.dt_dmach_prop = sdd-tx_dma.dma_prop;
-   sdd-tx_dma.ch = sdd-ops-request(sdd-tx_dma.dmach, req);
+   sdd-rx_dma.ch = sdd-ops-request(sdd-rx_dma.dmach, req, dev, rx);
+   sdd-tx_dma.ch = sdd-ops-request(sdd-tx_dma.dmach, req, dev, tx);
 
return 1;
 }
@@ -1054,49 +1052,6 @@ static void s3c64xx_spi_hwinit(struct 
s3c64xx_spi_driver_data *sdd, int channel)
flush_fifo(sdd);
 }
 
-static int s3c64xx_spi_get_dmares(
-   struct s3c64xx_spi_driver_data *sdd, bool tx)
-{
-   struct platform_device *pdev = sdd-pdev;
-   struct s3c64xx_spi_dma_data *dma_data;
-   struct property *prop;
-   struct resource *res;
-   char prop_name[15], *chan_str;
-
-   if (tx) {
-   dma_data = sdd-tx_dma;
-   dma_data-direction = DMA_MEM_TO_DEV;
-   chan_str = tx;
-   } else {
-   dma_data = sdd-rx_dma;
-   dma_data-direction = DMA_DEV_TO_MEM;
-   chan_str = rx;
-   }
-
-   if (!sdd-pdev-dev.of_node) {
-   res = platform_get_resource(pdev, IORESOURCE_DMA, tx ? 0 : 1);
-   if (!res) {
-   dev_err(pdev-dev, Unable to get SPI-%s dma 
-   resource\n, chan_str);
-   return -ENXIO;
-   }
-   dma_data-dmach = res-start;
-   return 0;
-   }
-
-   sprintf(prop_name, %s-dma-channel, chan_str);
-   prop = of_find_property(pdev-dev.of_node, prop_name, NULL);
-   if (!prop) {
-   dev_err(pdev-dev, %s dma channel property not specified\n,
-   chan_str);
-   return -ENXIO;
-   }
-
-   dma_data-dmach = DMACH_DT_PROP;
-   dma_data-dma_prop = prop;
-   return 0;
-}
-
 #ifdef CONFIG_OF
 static int s3c64xx_spi_parse_dt_gpio(struct s3c64xx_spi_driver_data *sdd)
 {
@@ -1198,6 +1153,7 @@ static inline struct s3c64xx_spi_port_config 
*s3c64xx_spi_get_port_config(
 static int __init s3c64xx_spi_probe(struct platform_device *pdev)
 {
struct resource *mem_res;
+   struct resource *res;
struct s3c64xx_spi_driver_data *sdd;
struct s3c64xx_spi_info *sci = pdev-dev.platform_data;
struct spi_master *master;
@@ -1256,13 +1212,26 @@ static int __init s3c64xx_spi_probe(struct 
platform_device *pdev)
 
sdd-cur_bpw = 8;
 
-   ret = s3c64xx_spi_get_dmares(sdd, true);
-   if (ret)
-   goto err0;
+   if (!sdd-pdev-dev.of_node) {
+   res = platform_get_resource(pdev, IORESOURCE_DMA,  0);
+   if (!res) {
+   dev_err(pdev-dev, Unable to get SPI tx dma 
+   resource\n);
+   return -ENXIO;
+   }
+   sdd-tx_dma.dmach = res-start;
+
+   res = platform_get_resource(pdev, IORESOURCE_DMA,  1);
+   if (!res) {
+   dev_err(pdev-dev, Unable to get SPI rx dma 
+   resource\n);
+   return -ENXIO;
+   }
+   sdd-rx_dma.dmach = res-start;
+   }
 
-   ret = s3c64xx_spi_get_dmares(sdd, false);
-   if (ret)
-   goto err0;
+   sdd-tx_dma.direction = DMA_MEM_TO_DEV;
+   sdd-rx_dma.direction = DMA_DEV_TO_MEM;
 
master-dev.of_node = pdev-dev.of_node;
master-bus_num = sdd-port_id;
-- 
1.7.4.4

___
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss