Re: [PATCH] spi/ep93xx: clean probe/remove routines

2012-04-18 Thread Hannu Heikkinen
On 19/04/12 09:16 +0300, Mika Westerberg wrote:
> On Wed, Apr 18, 2012 at 03:36:11PM +0300, Hannu Heikkinen wrote:
> > Use devm_* functions for managing devres resources.
> > 
> > Also use local espi_irq and remove irq variable from
> > struct ep93xx_spi.
> > 
> > Cc: mika.westerb...@iki.fi
> > Cc: grant.lik...@secretlab.ca
> > Signed-off-by: Hannu Heikkinen 
> > ---
> >  drivers/spi/spi-ep93xx.c |   36 ++--
> >  1 file changed, 10 insertions(+), 26 deletions(-)
> > 
> > diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
> > index 6db2887..2c5fb81 100644
> > --- a/drivers/spi/spi-ep93xx.c
> > +++ b/drivers/spi/spi-ep93xx.c
> > @@ -114,7 +114,6 @@ struct ep93xx_spi {
> > struct clk  *clk;
> > void __iomem*regs_base;
> > unsigned long   sspdr_phys;
> > -   int irq;
> > unsigned long   min_rate;
> > unsigned long   max_rate;
> > boolrunning;
> > @@ -1035,6 +1034,7 @@ static int __devinit ep93xx_spi_probe(struct 
> > platform_device *pdev)
> > struct ep93xx_spi_info *info;
> > struct ep93xx_spi *espi;
> > struct resource *res;
> > +   int espi_irq;
> 
> Since you are going to make a new version of the patch anyway, can you rename
> 'espi_irq' to just plain 'irq'?

Will do.

> After that you can add my
> 
> Acked-by: Mika Westerberg 

I will do the changes needed addressed by you and Hartley.

Thanks,
Hannu


--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH] spi: pl022: Allow request for higher frequency than maximum possible

2012-04-18 Thread Viresh Kumar
Currently, if we request for frequency greater than maximum possible, spi driver
returns error.

For example, if the spi block src frequency is 333/4 MHz, i.e. 83.33.. MHz,
maximum frequency programmable would be src/2. Which would come around 41.6...

It is difficult to pass frequency in these figures. We normally try to program
in round figures, like 42 MHz and it should get programmed to <=
requested_frequency, i.e. 41.6...

For this to happen, we must not return error even if requested freq is higher
than max possible. But should program it to max possible.

Reported-by: Vinit Kamalaksha Shenoy 
Signed-off-by: Viresh Kumar 
---
 drivers/spi/spi-pl022.c |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 09c925a..99d5f6d 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -1667,9 +1667,15 @@ static int calculate_effective_freq(struct pl022 *pl022, 
int freq, struct
/* cpsdvsr = 254 & scr = 255 */
min_tclk = spi_rate(rate, CPSDVR_MAX, SCR_MAX);
 
-   if (!((freq <= max_tclk) && (freq >= min_tclk))) {
+   if (freq > max_tclk)
+   dev_warn(&pl022->adev->dev,
+   "Max speed that can be programmed is %d Hz, you 
requested %d\n",
+   max_tclk, freq);
+
+   if (freq < min_tclk) {
dev_err(&pl022->adev->dev,
-   "controller data is incorrect: out of range frequency");
+   "Requested frequency: %d Hz is less than minimum 
possible %d Hz\n",
+   freq, min_tclk);
return -EINVAL;
}
 
-- 
1.7.9


--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH] spi/ep93xx: clean probe/remove routines

2012-04-18 Thread Mika Westerberg
On Wed, Apr 18, 2012 at 11:09:18AM -0500, H Hartley Sweeten wrote:
> But, I really don't think we actually gain anything by displaying the
> memory and irq. Maybe this would be more useful:
> 
>   dev_info(&pdev->dev, "EP93xx SPI Controller using %s\n",
>espi->dma_tx ? "DMA" : "PIO");
> 
> That way the user knows at boot time if the spi controller is using DMA or 
> PIO.
> 
> Mika, what do you think?

I agree, having the driver to print whether DMA or PIO is used brings more
value than it is currently doing. However, that is a subject of a separate
patch not this one.

--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH] spi/ep93xx: clean probe/remove routines

2012-04-18 Thread Mika Westerberg
On Wed, Apr 18, 2012 at 03:36:11PM +0300, Hannu Heikkinen wrote:
> Use devm_* functions for managing devres resources.
> 
> Also use local espi_irq and remove irq variable from
> struct ep93xx_spi.
> 
> Cc: mika.westerb...@iki.fi
> Cc: grant.lik...@secretlab.ca
> Signed-off-by: Hannu Heikkinen 
> ---
>  drivers/spi/spi-ep93xx.c |   36 ++--
>  1 file changed, 10 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
> index 6db2887..2c5fb81 100644
> --- a/drivers/spi/spi-ep93xx.c
> +++ b/drivers/spi/spi-ep93xx.c
> @@ -114,7 +114,6 @@ struct ep93xx_spi {
>   struct clk  *clk;
>   void __iomem*regs_base;
>   unsigned long   sspdr_phys;
> - int irq;
>   unsigned long   min_rate;
>   unsigned long   max_rate;
>   boolrunning;
> @@ -1035,6 +1034,7 @@ static int __devinit ep93xx_spi_probe(struct 
> platform_device *pdev)
>   struct ep93xx_spi_info *info;
>   struct ep93xx_spi *espi;
>   struct resource *res;
> + int espi_irq;

Since you are going to make a new version of the patch anyway, can you rename
'espi_irq' to just plain 'irq'?

After that you can add my

Acked-by: Mika Westerberg 

--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH] spi/spi-ep93xx.c: use dma_transfer_direction instead of dma_data_direction

2012-04-18 Thread Mika Westerberg
On Tue, Apr 17, 2012 at 06:46:36PM -0700, H Hartley Sweeten wrote:
> A new enum indicating the dma channel direction was introduced by:
> 
> commit 49920bc66984a512f4bcc7735a61642cd0e4d6f2
> dmaengine: add new enum dma_transfer_direction
> 
> The following commit changed spi-ep93xx to use the new enum:
> 
> commit a485df4b4404379786c4bdd258bc528b2617449d
> spi, serial: move to dma_transfer_direction
> 
> In doing so a sparse warning was introduced: 
> 
> warning: mixing different enum types
>int enum dma_data_direction  versus
>int enum dma_transfer_direction
> 
> This is produced because the 'dir' passed in ep93xx_spi_dma_prepare
> is an enum dma_data_direction and is being used to set the
> dma_slave_config 'direction' which is now an enum dma_transfer_direction.
> 
> Fix this by converting spi-ep93xx to use the new enum type in all
> places.
> 
> Signed-off-by: H Hartley Sweeten 
> Cc: Grant Likely 
> Cc: Vinod Koul 

Acked-by: Mika Westerberg 

--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Diane vous a envoyé un message personnel

2012-04-18 Thread Diane, Tarologue


Votre Avenir par les Tarots Si vous ne visualisez pas correctement ce 
message, cliquez ici. : 
 
http://p4tre.emv3.com/HM?a=ENX7CqnmaymC8SA9MKJCNwHnGHxKLY3wu_cStGb5lw8W0bBhOG5mpqVsje_HhdBQ4VLU
 

  La magie céleste des Tarots peut faire des miracles pour vous !
 Ne manquez pas les éléments déclencheurs de bonheur qui pourront vous 
apparaitre grâce aux prodigieux pouvoirs des Astres.

 Tirez gracieusement trois cartes et découvrez comment votre vie peut 
changer d un coup à partir d'aujourd'hui. : 
 
http://p4tre.emv3.com/HS?a=ENX7CqnmaymC8SA9MKJCNwHnGHxKLY3wo_cStGb5lw8W0bBhOG5mpqVsje_HhdBQ4VLM
 


http://p4tre.emv3.com/HS?a=ENX7CqnmaymC8SA9MKJCNwHnGHxKLY3woPcStGb5lw8W0bBhOG5mpqVsje_HhdBQ4VLN
 

http://p4tre.emv3.com/HS?a=ENX7CqnmaymC8SA9MKJCNwHnGHxKLY3wofcStGb5lw8W0bBhOG5mpqVsje_HhdBQ4VLS
 

http://p4tre.emv3.com/HS?a=ENX7CqnmaymC8SA9MKJCNwHnGHxKLY3wpvcStGb5lw8W0bBhOG5mpqVsje_HhdBQ4VLT
 

http://p4tre.emv3.com/HS?a=ENX7CqnmaymC8SA9MKJCNwHnGHxKLY3wp_cStGb5lw8W0bBhOG5mpqVsje_HhdBQ4VLQ
 

http://p4tre.emv3.com/HS?a=ENX7CqnmaymC8SA9MKJCNwHnGHxKLY3wpPcStGb5lw8W0bBhOG5mpqVsje_HhdBQ4VLR
 

http://p4tre.emv3.com/HS?a=ENX7CqnmaymC8SA9MKJCNwHnGHxKLY3wpfcStGb5lw8W0bBhOG5mpqVsje_HhdBQ4VLW
 
Une voyance offerte, maintenant ! Peut aider à faire que votre voeu le 
plus cher se réalise  Tirez 3 cartes ici.  : 
 
http://p4tre.emv3.com/HS?a=ENX7CqnmaymC8SA9MKJCNwHnGHxKLY3wuvcStGb5lw8W0bBhOG5mpqVsje_HhdBQ4VLX
 

 Faites tout de suite un tirage tarot. Profitez des ondes célestes des 
Astres et découvrez comment cette voyance peut vous apporter le bonheur.
Pour ne plus recevoir de courriels de notre part, il vous suffit de 
vous rendre sur cette page : 
 
http://p4tre.emv3.com/HU?a=ENX7CqnmaymC8SA9MKJCNwHnGHxKLY3wuPcStGb5lw8W0bBhOG5mpqVsje_HhdBQ4VLV
 
. 

--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 2/2] spi: Add initial support for spi-mxs

2012-04-18 Thread Fabio Estevam
Add initial support for the spi driver on mxs processors.

Currently only PIO mode is supported.

Tested with a sst25vf016b spi flash on a mx28evk board using mtd-utils.

Signed-off-by: Fabio Estevam 
---
It still does not contain DT support, but I wanted to post it as is, so
that people can test it and I would also like to get some initial feedback.

 arch/arm/mach-mxs/include/mach/ssp-regs.h |   32 ++
 drivers/spi/Kconfig   |6 +
 drivers/spi/Makefile  |1 +
 drivers/spi/spi-mxs.c |  457 +
 4 files changed, 496 insertions(+), 0 deletions(-)
 create mode 100644 drivers/spi/spi-mxs.c

diff --git a/arch/arm/mach-mxs/include/mach/ssp-regs.h 
b/arch/arm/mach-mxs/include/mach/ssp-regs.h
index 4bb0b27..fc467fa 100644
--- a/arch/arm/mach-mxs/include/mach/ssp-regs.h
+++ b/arch/arm/mach-mxs/include/mach/ssp-regs.h
@@ -27,6 +27,10 @@
 
 /* SSP registers */
 #define HW_SSP_CTRL0   0x000
+#define HW_SSP_CTRL0_SET   0x0004
+#define HW_SSP_CTRL0_CLR   0x0008
+#define HW_SSP_CTRL0_TOG   0x000c
+#define BM_SSP_CTRL0_LOCK_CS   0x0800
 #define BM_SSP_CTRL0_RUN   (1 << 29)
 #define BM_SSP_CTRL0_SDIO_IRQ_CHECK(1 << 28)
 #define BM_SSP_CTRL0_IGNORE_CRC(1 << 26)
@@ -41,6 +45,10 @@
 #define BP_SSP_CTRL0_XFER_COUNT0
 #define BM_SSP_CTRL0_XFER_COUNT0x
 #define HW_SSP_CMD00x010
+#define HW_SSP_CMD0_SET0x014
+#define HW_SSP_CMD0_CLR0x018
+#define HW_SSP_CMD0_TOG0x01c
+
 #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)
@@ -63,8 +71,12 @@
 #define BM_SSP_TIMING_TIMEOUT  (0x << 16)
 #define BP_SSP_TIMING_CLOCK_DIVIDE 8
 #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   (ssp_is_old() ? 0x060 : 0x080)
 #define BM_SSP_CTRL1_SDIO_IRQ  (1 << 31)
 #define BM_SSP_CTRL1_SDIO_IRQ_EN   (1 << 30)
@@ -83,11 +95,30 @@
 #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 0x0400
 #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__RESERVED00x0
+#define BV_SSP_CTRL1_WORD_LENGTH__RESERVED10x1
+#define BV_SSP_CTRL1_WORD_LENGTH__RESERVED20x2
+#define BV_SSP_CTRL1_WORD_LENGTH__FOUR_BITS0x3
+#define BV_SSP_CTRL1_WORD_LENGTH__EIGHT_BITS   0x7
+#define BV_SSP_CTRL1_WORD_LENGTH__SIXTEEN_BITS 0xF
+#define BM_SSP_CTRL0_WAIT_FOR_CMD  0x0010
 #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__SPI 0x0
+#define BV_SSP_CTRL1_SSP_MODE__SSI 0x1
+#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 (ssp_is_old() ? 0x080 : 0x0a0)
 #define HW_SSP_SDRESP1 (ssp_is_old() ? 0x090 : 0x0b0)
 #define HW_SSP_SDRESP2 (ssp_is_old() ? 0x0a0 : 0x0c0)
@@ -95,6 +126,7 @@
 #define HW_SSP_STATUS  (ssp_is_old() ? 0x0c0 : 0x100)
 #define BM_SSP_STATUS_CARD_DETECT  (1 << 28)
 #define BM_SSP_STATUS_SDIO_IRQ (1 << 17)
+#define BM_SSP_STATUS_FIFO_EMPTY   0x0020
 #define HW_SSP_VERSION (cpu_is_mx23() ? 0x110 : 0x130)
 #define BP_SSP_VERSION_MAJOR   24
 
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 3ed7483..f951604 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -199,6 +199,12 @@ config SPI_MPC512x_PSC
  This enables using the Freescale MPC5121 Programmable Serial
  Controller in SPI master mode.
 
+config SPI_MXS
+   tristate "Freesca

[PATCH 1/2] ARM: mxs: Provide a common header file for SSP controller

2012-04-18 Thread Fabio Estevam
On mxs SoCs the SSP controller can act as MMC or SPI controller.

Remove the SSP related definitions from the mxs-mmc driver and put it on a 
common header file.

This will facilitate the introduction of the spi-mxs driver.

Cc: Chris Ball 
Signed-off-by: Fabio Estevam 
---
 arch/arm/mach-mxs/include/mach/ssp-regs.h |  114 +
 drivers/mmc/host/mxs-mmc.c|   93 +---
 2 files changed, 116 insertions(+), 91 deletions(-)
 create mode 100644 arch/arm/mach-mxs/include/mach/ssp-regs.h

diff --git a/arch/arm/mach-mxs/include/mach/ssp-regs.h 
b/arch/arm/mach-mxs/include/mach/ssp-regs.h
new file mode 100644
index 000..4bb0b27
--- /dev/null
+++ b/arch/arm/mach-mxs/include/mach/ssp-regs.h
@@ -0,0 +1,114 @@
+/*
+ * Freescale MXS SSP Registers
+ *
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
+ *
+ * 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.
+ */
+
+#ifndef __SSP_REGS_H
+#define __SSP_REGS_H
+
+
+/* card detect polling timeout */
+#define MXS_MMC_DETECT_TIMEOUT (HZ/2)
+
+#define SSP_VERSION_LATEST 4
+#define ssp_is_old()   (rev_struct < SSP_VERSION_LATEST)
+
+/* 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_COUNT0
+#define BM_SSP_CTRL0_XFER_COUNT0x
+#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_COUNT8
+#define BM_SSP_CMD0_BLOCK_COUNT(0xff << 8)
+#define BP_SSP_CMD0_CMD0
+#define BM_SSP_CMD0_CMD0xff
+#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  (ssp_is_old() ? 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   (ssp_is_old() ? 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_ENA

RE: [PATCH] spi/ep93xx: clean probe/remove routines

2012-04-18 Thread H Hartley Sweeten
On Wednesday, April 18, 2012 5:36 AM, Hannu Heikkinen wrote:
> 
> Use devm_* functions for managing devres resources.
>
> Also use local espi_irq and remove irq variable from
> struct ep93xx_spi.
>
> Cc: mika.westerb...@iki.fi
> Cc: grant.lik...@secretlab.ca
> Signed-off-by: Hannu Heikkinen 
> ---
>  drivers/spi/spi-ep93xx.c |   36 ++--
>  1 file changed, 10 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
> index 6db2887..2c5fb81 100644
> --- a/drivers/spi/spi-ep93xx.c
> +++ b/drivers/spi/spi-ep93xx.c
> @@ -114,7 +114,6 @@ struct ep93xx_spi {
>   struct clk  *clk;
>   void __iomem*regs_base;
>   unsigned long   sspdr_phys;
> - int irq;

You should also remove the @irq entry in the kernel doc comment above the 
struct.

>   unsigned long   min_rate;
>   unsigned long   max_rate;
>   boolrunning;
> @@ -1035,6 +1034,7 @@ static int __devinit ep93xx_spi_probe(struct 
> platform_device *pdev)
>   struct ep93xx_spi_info *info;
>   struct ep93xx_spi *espi;
>   struct resource *res;
> + int espi_irq;
>   int error;
>
>   info = pdev->dev.platform_data;
> @@ -1074,8 +1074,8 @@ static int __devinit ep93xx_spi_probe(struct 
> platform_device *pdev)
>   espi->min_rate = clk_get_rate(espi->clk) / (254 * 256);
>   espi->pdev = pdev;
>  
> - espi->irq = platform_get_irq(pdev, 0);
> - if (espi->irq < 0) {
> + espi_irq = platform_get_irq(pdev, 0);
> + if (espi_irq < 0) {
>   error = -EBUSY;
>   dev_err(&pdev->dev, "failed to get irq resources\n");
>   goto fail_put_clock;
> @@ -1088,26 +1088,20 @@ static int __devinit ep93xx_spi_probe(struct 
> platform_device *pdev)
>   goto fail_put_clock;
>   }
>  
> - res = request_mem_region(res->start, resource_size(res), pdev->name);
> - if (!res) {
> - dev_err(&pdev->dev, "unable to request iomem resources\n");
> - error = -EBUSY;
> - goto fail_put_clock;
> - }
> -
>   espi->sspdr_phys = res->start + SSPDR;
> - espi->regs_base = ioremap(res->start, resource_size(res));
> +
> + espi->regs_base = devm_request_and_ioremap(&pdev->dev, res);
>   if (!espi->regs_base) {
>   dev_err(&pdev->dev, "failed to map resources\n");
>   error = -ENODEV;
> - goto fail_free_mem;
> + goto fail_put_clock;
>   }
>  
> - error = request_irq(espi->irq, ep93xx_spi_interrupt, 0,
> - "ep93xx-spi", espi);
> + error = devm_request_irq(&pdev->dev, espi_irq, ep93xx_spi_interrupt, 0,
> + "ep93xx-spi", espi);

Please pull the '0' argument down to the second line to keep the line < 80 
chars.

>   if (error) {
>   dev_err(&pdev->dev, "failed to request irq\n");
> - goto fail_unmap_regs;
> + goto fail_put_clock;
>   }
>  
>   if (info->use_dma && ep93xx_spi_setup_dma(espi))
> @@ -1132,7 +1126,7 @@ static int __devinit ep93xx_spi_probe(struct 
> platform_device *pdev)
>   }
>  
>   dev_info(&pdev->dev, "EP93xx SPI Controller at 0x%08lx irq %d\n",
> -  (unsigned long)res->start, espi->irq);
> +  (unsigned long)res->start, espi_irq);

This isn't relevant to your patch but, this could be changed to:

dev_info(&pdev->dev, "EP93xx SPI Controller at %pr irq %d\n",
 res, espi_irq);

This removes the cast but it does change the message from:

ep93xx-spi ep93xx-spi.0: EP93xx SPI Controller at 0x808a irq 53

to

ep93xx-spi ep93xx-spi.0: EP93xx SPI Controller at [mem 0x808a-0x808a0017 
flags 0x200] irq 53

But, I really don't think we actually gain anything by displaying the
memory and irq. Maybe this would be more useful:

dev_info(&pdev->dev, "EP93xx SPI Controller using %s\n",
 espi->dma_tx ? "DMA" : "PIO");

That way the user knows at boot time if the spi controller is using DMA or PIO.

Mika, what do you think?

>  
>   return 0;
>  
> @@ -1140,11 +1134,6 @@ fail_free_queue:
>   destroy_workqueue(espi->wq);
>  fail_free_dma:
>   ep93xx_spi_release_dma(espi);
> - free_irq(espi->irq, espi);
> -fail_unmap_regs:
> - iounmap(espi->regs_base);
> -fail_free_mem:
> - release_mem_region(res->start, resource_size(res));
>  fail_put_clock:
>   clk_put(espi->clk);
>  fail_release_master:
> @@ -1158,7 +1147,6 @@ static int __devexit ep93xx_spi_remove(struct 
> platform_device *pdev)
>  {
>   struct spi_master *master = platform_get_drvdata(pdev);
>   struct ep93xx_spi *espi = spi_master_get_devdata(master);
> - struct resource *res;
>  
>   spin_lock_irq(&espi->lock);
>   espi->running = false;
> @@ -1184,10 +1172,6 @@ static int __

[PATCH] spi/ep93xx: clean probe/remove routines

2012-04-18 Thread Hannu Heikkinen
Use devm_* functions for managing devres resources.

Also use local espi_irq and remove irq variable from
struct ep93xx_spi.

Cc: mika.westerb...@iki.fi
Cc: grant.lik...@secretlab.ca
Signed-off-by: Hannu Heikkinen 
---
 drivers/spi/spi-ep93xx.c |   36 ++--
 1 file changed, 10 insertions(+), 26 deletions(-)

diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
index 6db2887..2c5fb81 100644
--- a/drivers/spi/spi-ep93xx.c
+++ b/drivers/spi/spi-ep93xx.c
@@ -114,7 +114,6 @@ struct ep93xx_spi {
struct clk  *clk;
void __iomem*regs_base;
unsigned long   sspdr_phys;
-   int irq;
unsigned long   min_rate;
unsigned long   max_rate;
boolrunning;
@@ -1035,6 +1034,7 @@ static int __devinit ep93xx_spi_probe(struct 
platform_device *pdev)
struct ep93xx_spi_info *info;
struct ep93xx_spi *espi;
struct resource *res;
+   int espi_irq;
int error;
 
info = pdev->dev.platform_data;
@@ -1074,8 +1074,8 @@ static int __devinit ep93xx_spi_probe(struct 
platform_device *pdev)
espi->min_rate = clk_get_rate(espi->clk) / (254 * 256);
espi->pdev = pdev;
 
-   espi->irq = platform_get_irq(pdev, 0);
-   if (espi->irq < 0) {
+   espi_irq = platform_get_irq(pdev, 0);
+   if (espi_irq < 0) {
error = -EBUSY;
dev_err(&pdev->dev, "failed to get irq resources\n");
goto fail_put_clock;
@@ -1088,26 +1088,20 @@ static int __devinit ep93xx_spi_probe(struct 
platform_device *pdev)
goto fail_put_clock;
}
 
-   res = request_mem_region(res->start, resource_size(res), pdev->name);
-   if (!res) {
-   dev_err(&pdev->dev, "unable to request iomem resources\n");
-   error = -EBUSY;
-   goto fail_put_clock;
-   }
-
espi->sspdr_phys = res->start + SSPDR;
-   espi->regs_base = ioremap(res->start, resource_size(res));
+
+   espi->regs_base = devm_request_and_ioremap(&pdev->dev, res);
if (!espi->regs_base) {
dev_err(&pdev->dev, "failed to map resources\n");
error = -ENODEV;
-   goto fail_free_mem;
+   goto fail_put_clock;
}
 
-   error = request_irq(espi->irq, ep93xx_spi_interrupt, 0,
-   "ep93xx-spi", espi);
+   error = devm_request_irq(&pdev->dev, espi_irq, ep93xx_spi_interrupt, 0,
+   "ep93xx-spi", espi);
if (error) {
dev_err(&pdev->dev, "failed to request irq\n");
-   goto fail_unmap_regs;
+   goto fail_put_clock;
}
 
if (info->use_dma && ep93xx_spi_setup_dma(espi))
@@ -1132,7 +1126,7 @@ static int __devinit ep93xx_spi_probe(struct 
platform_device *pdev)
}
 
dev_info(&pdev->dev, "EP93xx SPI Controller at 0x%08lx irq %d\n",
-(unsigned long)res->start, espi->irq);
+(unsigned long)res->start, espi_irq);
 
return 0;
 
@@ -1140,11 +1134,6 @@ fail_free_queue:
destroy_workqueue(espi->wq);
 fail_free_dma:
ep93xx_spi_release_dma(espi);
-   free_irq(espi->irq, espi);
-fail_unmap_regs:
-   iounmap(espi->regs_base);
-fail_free_mem:
-   release_mem_region(res->start, resource_size(res));
 fail_put_clock:
clk_put(espi->clk);
 fail_release_master:
@@ -1158,7 +1147,6 @@ static int __devexit ep93xx_spi_remove(struct 
platform_device *pdev)
 {
struct spi_master *master = platform_get_drvdata(pdev);
struct ep93xx_spi *espi = spi_master_get_devdata(master);
-   struct resource *res;
 
spin_lock_irq(&espi->lock);
espi->running = false;
@@ -1184,10 +1172,6 @@ static int __devexit ep93xx_spi_remove(struct 
platform_device *pdev)
spin_unlock_irq(&espi->lock);
 
ep93xx_spi_release_dma(espi);
-   free_irq(espi->irq, espi);
-   iounmap(espi->regs_base);
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   release_mem_region(res->start, resource_size(res));
clk_put(espi->clk);
platform_set_drvdata(pdev, NULL);
 
-- 
1.7.9.5


--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH] spi: bitbang: convert to using core message queue

2012-04-18 Thread Linus Walleij
On Wed, Apr 11, 2012 at 10:56 PM, Guennadi Liakhovetski
 wrote:
> Hi Grant
> On Tue, 20 Mar 2012, Grant Likely wrote:
>
>> On Mon, 19 Mar 2012 00:33:14 +0100, Linus Walleij  
>> wrote:
>> > On Sat, Mar 17, 2012 at 12:39 AM, Guennadi Liakhovetski
>> >  wrote:
>> >
>> > > The SPI subsystem core now manages message queues internally. Remove the
>> > > local message queue implementation from the spi-bitbang driver and
>> > > migrate to the common one.
>> > >
>> > > Signed-off-by: Guennadi Liakhovetski 
>> >
>> > This is great stuff!
>> > Acked-by: Linus Walleij 
>> >
>> > (Since I've never really used the bitbang driver I wouldn't trust me to
>> > do any deeper review.)
>>
>> In hindsite; I should have asked you to make the pl driver use bitbang
>> queueing since that was already used for generic queuing by a number
>> of drivers; and then refactored that to perform better.  Doing that
>> would have been refactoring better tested code, but oh well.
>>
>> I'm going to ignore this series for the moment; please remind me to
>> look at it after the merge window has closed.
>
> Seems to be time:-)

Yeah lets ping Grant on this :)

Yours,
Linus Walleij

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general