Re: [PATCH v6 12/16] spi/spi-atmel: add pinctrl support for atmel spi

2013-03-11 Thread Jean-Christophe PLAGNIOL-VILLARD
On 11:34 Thu 07 Mar , Wenyou Yang wrote:
 Signed-off-by: Wenyou Yang wenyou.y...@atmel.com
 Cc: spi-devel-general@lists.sourceforge.net
 Cc: linux-ker...@vger.kernel.org
 ---
  drivers/spi/spi-atmel.c |8 
  1 file changed, 8 insertions(+)
 
 diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
 index 1e212d1..6b166f4 100644
 --- a/drivers/spi/spi-atmel.c
 +++ b/drivers/spi/spi-atmel.c
 @@ -23,6 +23,7 @@
  #include linux/platform_data/atmel.h
  #include linux/platform_data/dma-atmel.h
  #include linux/of.h
 +#include linux/pinctrl/consumer.h
  
  #include linux/io.h
  #include linux/gpio.h
 @@ -1493,11 +1494,18 @@ static int atmel_spi_probe(struct platform_device 
 *pdev)
   int ret;
   struct spi_master   *master;
   struct atmel_spi*as;
 + struct pinctrl  *pinctrl;
  
   regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (!regs)
   return -ENXIO;
  
 + pinctrl = devm_pinctrl_get_select_default(pdev-dev);
 + if (IS_ERR(pinctrl)) {
 + dev_err(pdev-dev, Failed to request pinctrl\n);
 + return PTR_ERR(pinctrl);
 + }

drop this, this is handled at bus level

Best Regards,
J.
 +
   irq = platform_get_irq(pdev, 0);
   if (irq  0)
   return irq;
 -- 
 1.7.9.5
 

--
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and remains a good choice in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH v5 01/16] spi/spi-atmel: fix master-num_chipselect wrongly set.

2013-03-03 Thread Jean-Christophe PLAGNIOL-VILLARD
On 14:47 Tue 26 Feb , Wenyou Yang wrote:
 if the spi property cs-gpios is set as below:
 
   cs-gpios = 0, pioC 11 0, 0, 0;
 
 the master-num_chipselect will wrongly be set to 0,
 and the spi fail to probe.
 
 Signed-off-by: Wenyou Yang wenyou.y...@atmel.com
 Cc: spi-devel-general@lists.sourceforge.net
 Cc: linux-ker...@vger.kernel.org
 ---
  drivers/spi/spi-atmel.c |2 +-
  drivers/spi/spi.c   |2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
 index ab34497..5bf3786 100644
 --- a/drivers/spi/spi-atmel.c
 +++ b/drivers/spi/spi-atmel.c
 @@ -944,7 +944,7 @@ static int atmel_spi_probe(struct platform_device *pdev)
  
   master-dev.of_node = pdev-dev.of_node;
   master-bus_num = pdev-id;
 - master-num_chipselect = master-dev.of_node ? 0 : 4;
 + master-num_chipselect = 4;
Nack

we use 0 hardware gpio we only use the cs-gpio

and you do not follow the binding

it's
cs-gpios =  0 0 0
pioC 11 0;

so the code work a expected

Best Regards,
J.
   master-setup = atmel_spi_setup;
   master-transfer = atmel_spi_transfer;
   master-cleanup = atmel_spi_cleanup;
 diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
 index 19ee901..d88cbef 100644
 --- a/drivers/spi/spi.c
 +++ b/drivers/spi/spi.c
 @@ -1070,7 +1070,7 @@ static int of_spi_register_master(struct spi_master 
 *master)
   master-num_chipselect = max(nb, master-num_chipselect);
  
   if (nb  1)
 - return 0;
 + nb = master-num_chipselect;
  
   cs = devm_kzalloc(master-dev,
 sizeof(int) * master-num_chipselect,
 -- 
 1.7.9.5
 

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH v5 02/16] spi/spi-atmel: detect the capabilities of SPI core by reading the VERSION register.

2013-03-03 Thread Jean-Christophe PLAGNIOL-VILLARD
On 14:47 Tue 26 Feb , Wenyou Yang wrote:
 the has_dma_support needed for future use with dmaengine driver.
 
 Signed-off-by: Wenyou Yang wenyou.y...@atmel.com
 Cc: spi-devel-general@lists.sourceforge.net
 Cc: linux-ker...@vger.kernel.org
 ---
  drivers/spi/spi-atmel.c |   70 
 ++-
  1 file changed, 57 insertions(+), 13 deletions(-)
 
 diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
 index 5bf3786..a8e091b 100644
 --- a/drivers/spi/spi-atmel.c
 +++ b/drivers/spi/spi-atmel.c
 @@ -39,6 +39,7 @@
  #define SPI_CSR1 0x0034
  #define SPI_CSR2 0x0038
  #define SPI_CSR3 0x003c
 +#define SPI_VERSION  0x00fc
  #define SPI_RPR  0x0100
  #define SPI_RCR  0x0104
  #define SPI_TPR  0x0108
 @@ -71,6 +72,8 @@
  #define SPI_FDIV_SIZE1
  #define SPI_MODFDIS_OFFSET   4
  #define SPI_MODFDIS_SIZE 1
 +#define SPI_WDRBT_OFFSET 5
 +#define SPI_WDRBT_SIZE   1
  #define SPI_LLB_OFFSET   7
  #define SPI_LLB_SIZE 1
  #define SPI_PCS_OFFSET   16
 @@ -180,6 +183,11 @@
  #define spi_writel(port,reg,value) \
   __raw_writel((value), (port)-regs + SPI_##reg)
  
 +struct atmel_spi_caps {
 + boolis_spi2;
 + boolhas_wdrbt;
 + boolhas_dma_support;
 +};
  
  /*
   * The core SPI transfer engine just talks to a register bank to set up
 @@ -204,6 +212,8 @@ struct atmel_spi {
  
   void*buffer;
   dma_addr_t  buffer_dma;
 +
 + struct atmel_spi_caps   caps;
  };
  
  /* Controller-specific per-slave state */
 @@ -222,14 +232,10 @@ struct atmel_spi_device {
   *  - SPI_SR.TXEMPTY, SPI_SR.NSSR (and corresponding irqs)
   *  - SPI_CSRx.CSAAT
   *  - SPI_CSRx.SBCR allows faster clocking
 - *
 - * We can determine the controller version by reading the VERSION
 - * register, but I haven't checked that it exists on all chips, and
 - * this is cheaper anyway.
   */
 -static bool atmel_spi_is_v2(void)
 +static bool atmel_spi_is_v2(struct atmel_spi *as)
  {
 - return !cpu_is_at91rm9200();
 + return as-caps.is_spi2;
  }
  
  /*
 @@ -263,15 +269,20 @@ static void cs_activate(struct atmel_spi *as, struct 
 spi_device *spi)
   unsigned active = spi-mode  SPI_CS_HIGH;
   u32 mr;
  
 - if (atmel_spi_is_v2()) {
 + if (atmel_spi_is_v2(as)) {
   /*
* Always use CSR0. This ensures that the clock
* switches to the correct idle polarity before we
* toggle the CS.
*/
   spi_writel(as, CSR0, asd-csr);
 - spi_writel(as, MR, SPI_BF(PCS, 0x0e) | SPI_BIT(MODFDIS)
 + if (as-caps.has_wdrbt) {
 + spi_writel(as, MR, SPI_BF(PCS, 0x0e) | SPI_BIT(WDRBT)
 + | SPI_BIT(MODFDIS) | SPI_BIT(MSTR));
 + } else {
 + spi_writel(as, MR, SPI_BF(PCS, 0x0e) | SPI_BIT(MODFDIS)
   | SPI_BIT(MSTR));
 + }
   mr = spi_readl(as, MR);
   gpio_set_value(asd-npcs_pin, active);
   } else {
 @@ -318,7 +329,7 @@ static void cs_deactivate(struct atmel_spi *as, struct 
 spi_device *spi)
   asd-npcs_pin, active ?  (low) : ,
   mr);
  
 - if (atmel_spi_is_v2() || spi-chip_select != 0)
 + if (atmel_spi_is_v2(as) || spi-chip_select != 0)
   gpio_set_value(asd-npcs_pin, !active);
  }
  
 @@ -719,7 +730,7 @@ static int atmel_spi_setup(struct spi_device *spi)
   }
  
   /* see notes above re chipselect */
 - if (!atmel_spi_is_v2()
 + if (!atmel_spi_is_v2(as)
spi-chip_select == 0
(spi-mode  SPI_CS_HIGH)) {
   dev_dbg(spi-dev, setup: can't be active-high\n);
 @@ -728,7 +739,7 @@ static int atmel_spi_setup(struct spi_device *spi)
  
   /* v1 chips start out at half the peripheral bus speed. */
   bus_hz = clk_get_rate(as-clk);
 - if (!atmel_spi_is_v2())
 + if (!atmel_spi_is_v2(as))
   bus_hz /= 2;
  
   if (spi-max_speed_hz) {
 @@ -804,7 +815,7 @@ static int atmel_spi_setup(struct spi_device *spi)
   setup: %lu Hz bpw %u mode 0x%x - csr%d %08x\n,
   bus_hz / scbr, bits, spi-mode, spi-chip_select, csr);
  
 - if (!atmel_spi_is_v2())
 + if (!atmel_spi_is_v2(as))
   spi_writel(as, CSR0 + 4 * spi-chip_select, csr);
  
   return 0;
 @@ -910,6 +921,32 @@ static void atmel_spi_cleanup(struct spi_device *spi)
   kfree(asd);
  }
  
 +static inline unsigned int atmel_get_version(struct atmel_spi 

Re: [PATCH 1/1] spi/atmel: add DT support

2012-12-17 Thread Jean-Christophe PLAGNIOL-VILLARD
On 01:03 Sat 15 Dec , Grant Likely wrote:
 On Wed, 12 Dec 2012 16:13:08 +0100, Jean-Christophe PLAGNIOL-VILLARD 
 plagn...@jcrosoft.com wrote:
  On 14:37 Fri 23 Nov , Nicolas Ferre wrote:
   On 11/23/2012 01:44 PM, Jean-Christophe PLAGNIOL-VILLARD :
the atmel_spi use only gpio for chip select

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
   
   Seems simple and nice:
   
   Acked-by: Nicolas Ferre nicolas.fe...@atmel.com
  grant is ok to have this for 3.8?
 
 Not sure how I missed this one. It's pretty straight forward and not
 risky, so no problem. However;
 
the atmel_spi use only gpio for chip select
 
 I know you know how to write a proper commit message. I'll need
 something better than the above before I commit it. I won't make you
 resubmit the patch, but do send me a better description.
 
ok replace with this please

spi/atmel: add DT support

Use the newly introduce cs-gpios dt support on atmel.
We do not use the hardware cs as it's wired and have buges and limitations.
As the the controller's belief that only active-low devices/systems exists.

As done on non-dt system.

Best Regards,
J.
 g.
 

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 1/1] spi/atmel: add DT support

2012-12-12 Thread Jean-Christophe PLAGNIOL-VILLARD
On 14:37 Fri 23 Nov , Nicolas Ferre wrote:
 On 11/23/2012 01:44 PM, Jean-Christophe PLAGNIOL-VILLARD :
  the atmel_spi use only gpio for chip select
  
  Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
 
 Seems simple and nice:
 
 Acked-by: Nicolas Ferre nicolas.fe...@atmel.com
grant is ok to have this for 3.8?

Best Regards,
J.
 
  Cc: spi-devel-general@lists.sourceforge.net
  Cc: Grant Likely grant.lik...@secretlab.ca
  ---
  Hi Grant,
  
  can we have this for 3.8
  This patch is presetnt on the ML sing Feb 2012 and was depinding on
  the cs-gpio dt that you just apply
  
  Best Regards,
  J.
   .../devicetree/bindings/spi/spi_atmel.txt  |   26 
  
   drivers/spi/spi-atmel.c|   17 -
   2 files changed, 42 insertions(+), 1 deletion(-)
   create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt
  
  diff --git a/Documentation/devicetree/bindings/spi/spi_atmel.txt 
  b/Documentation/devicetree/bindings/spi/spi_atmel.txt
  new file mode 100644
  index 000..07e04cd
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/spi/spi_atmel.txt
  @@ -0,0 +1,26 @@
  +Atmel SPI device
  +
  +Required properties:
  +- compatible : should be atmel,at91rm9200-spi.
  +- reg: Address and length of the register set for the device
  +- interrupts: Should contain spi interrupt
  +- cs-gpios: chipselects
  +
  +Example:
  +
  +spi1: spi@fffcc000 {
  +   compatible = atmel,at91rm9200-spi;
  +   reg = 0xfffcc000 0x4000;
  +   interrupts = 13 4 5;
  +   #address-cells = 1;
  +   #size-cells = 0;
  +   cs-gpios = pioB 3 0;
  +   status = okay;
  +
  +   mmc-slot@0 {
  +   compatible = mmc-spi-slot;
  +   reg = 0;
  +   gpios = pioC 4 0;/* CD */
  +   spi-max-frequency = 2500;
  +   };
  +};
  diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
  index 61fb0ec..1615222 100644
  --- a/drivers/spi/spi-atmel.c
  +++ b/drivers/spi/spi-atmel.c
  @@ -20,6 +20,7 @@
   #include linux/spi/spi.h
   #include linux/slab.h
   #include linux/platform_data/atmel.h
  +#include linux/of.h
   
   #include asm/io.h
   #include asm/gpio.h
  @@ -768,6 +769,10 @@ static int atmel_spi_setup(struct spi_device *spi)
   
  /* chipselect must have been muxed as GPIO (e.g. in board setup) */
  npcs_pin = (unsigned int)spi-controller_data;
  +
  +   if (gpio_is_valid(spi-cs_gpio))
  +   npcs_pin = spi-cs_gpio;
  +
  asd = spi-controller_state;
  if (!asd) {
  asd = kzalloc(sizeof(struct atmel_spi_device), GFP_KERNEL);
  @@ -937,8 +942,9 @@ static int __devinit atmel_spi_probe(struct 
  platform_device *pdev)
  /* the spi-mode bits understood by this driver: */
  master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
   
  +   master-dev.of_node = pdev-dev.of_node;
  master-bus_num = pdev-id;
  -   master-num_chipselect = 4;
  +   master-num_chipselect = master-dev.of_node ? 0 : 4;
  master-setup = atmel_spi_setup;
  master-transfer = atmel_spi_transfer;
  master-cleanup = atmel_spi_cleanup;
  @@ -1064,11 +1070,20 @@ static int atmel_spi_resume(struct platform_device 
  *pdev)
   #defineatmel_spi_resumeNULL
   #endif
   
  +#if defined(CONFIG_OF)
  +static const struct of_device_id atmel_spi_dt_ids[] = {
  +   { .compatible = atmel,at91rm9200-spi },
  +   { /* sentinel */ }
  +};
  +
  +MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
  +#endif
   
   static struct platform_driver atmel_spi_driver = {
  .driver = {
  .name   = atmel_spi,
  .owner  = THIS_MODULE,
  +   .of_match_table = of_match_ptr(atmel_spi_dt_ids),
  },
  .suspend= atmel_spi_suspend,
  .resume = atmel_spi_resume,
  
 
 
 -- 
 Nicolas Ferre

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [v2 PATCH 07/14] spi/atmel_spi: add DT support

2012-12-07 Thread Jean-Christophe PLAGNIOL-VILLARD
On 15:53 Tue 04 Dec , Wenyou Yang wrote:
 From: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
 
 The atmel_spi use only gpio for chip select.
no this patch need go on the TOP of mine

that is plan for 3.8

Best Regards,
J.
 
 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
 [wenyou.y...@atmel.com: Add driver data and compatible 
 atmel,at91sam9260-spi, atmel,at91sam9x5-spi]
 Signed-off-by: Wenyou Yang wenyou.y...@atmel.com
 Cc: devicetree-disc...@lists.ozlabs.org
 Cc: spi-devel-general@lists.sourceforge.net
 Cc: grant.lik...@secretlab.ca
 Cc: rob.herr...@calxeda.com
 Cc: r...@landley.net
 Cc: linux-...@vger.kernel.org
 Cc: richard.gen...@gmail.com
 ---
 Hi, Richard,
 
 This patches is based on the original patch from Jean-Christophe
   [PATCH] spi/atmel: add DT support
 and merge the patch from Richard Genoud
   [PATCH] spi-atmel OF: complete documentation
 ane wenyou yang add more compatible atmel,at91sam9260-spi, 
 atmel,at91sam9x5-spi, 
   add driver data to get IP version and dma support.
 
 Could you sign your signature in this patch?
 
 Best Regards,
 Wenyou Yang
 
  .../devicetree/bindings/spi/spi_atmel.txt  |   23 +
  drivers/spi/spi-atmel.c|  102 
 +---
  2 files changed, 113 insertions(+), 12 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt
 
 diff --git a/Documentation/devicetree/bindings/spi/spi_atmel.txt 
 b/Documentation/devicetree/bindings/spi/spi_atmel.txt
 new file mode 100644
 index 000..20cdc91
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/spi/spi_atmel.txt
 @@ -0,0 +1,23 @@
 +Atmel SPI device
 +
 +Required properties:
 +- compatible : should be atmel,at91rm9200-spi.
 +- reg: Address and length of the register set for the device
 +- interrupts: Should contain macb interrupt
 +- cs-gpio: Should contain the GPIOs used for chipselect.
 +- dma-mask: device coherent dma mask.
 +
 +spi0: spi@f000 {
 + #address-cells = 1;
 + #size-cells = 0;
 + compatible = atmel,at91rm9200-spi;
 + reg = 0xf000 0x100;
 + interrupts = 13 4;
 + cs-gpios = pioA 14 0
 + pioA 7 0 /* conflicts with TXD2 */
 + pioA 1 0 /* conflicts with RXD0 */
 + pioB 3 0 /* conflicts with ERXDV */
 +;
 + dma-mask = 0x;
 + status = disabled;
 +};
 diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
 index 37f54c3..e032e3d 100644
 --- a/drivers/spi/spi-atmel.c
 +++ b/drivers/spi/spi-atmel.c
 @@ -19,6 +19,7 @@
  #include linux/interrupt.h
  #include linux/spi/spi.h
  #include linux/slab.h
 +#include linux/of.h
  
  #include asm/io.h
  #include mach/board.h
 @@ -185,6 +186,10 @@
   * DMA transfers; transfer queue progress is driven by IRQs.  The clock
   * framework provides the base clock, subdivided for each spi_device.
   */
 +struct atmel_spi_pdata {
 + u8  version;
 +};
 +
  struct atmel_spi {
   spinlock_t  lock;
   unsigned long   flags;
 @@ -203,6 +208,7 @@ struct atmel_spi {
   struct spi_transfer *next_transfer;
   unsigned long   next_remaining_bytes;
   int done_status;
 + struct atmel_spi_pdata  *pdata;
  
   void*buffer;
   dma_addr_t  buffer_dma;
 @@ -217,6 +223,51 @@ struct atmel_spi_device {
  #define BUFFER_SIZE  PAGE_SIZE
  #define INVALID_DMA_ADDRESS  0x
  
 +static struct atmel_spi_pdata at91rm9200_config = {
 + .version = 1,
 +};
 +
 +static struct atmel_spi_pdata at91sam9260_config = {
 + .version = 2,
 +};
 +
 +static struct atmel_spi_pdata at91sam9x5_config = {
 + .version = 2,
 +};
 +
 +static const struct platform_device_id atmel_spi_devtypes[] = {
 + {
 + .name = spi-at91rm9200,
 + .driver_data = (unsigned long) at91rm9200_config,
 + }, {
 + .name = spi-at91sam9260,
 + .driver_data = (unsigned long) at91sam9260_config,
 + }, {
 + .name = spi-at91sam9x5,
 + .driver_data = (unsigned long) at91sam9x5_config,
 + }, {
 + /* sentinel */
 + }
 +};
 +
 +#if defined(CONFIG_OF)
 +static const struct of_device_id atmel_spi_dt_ids[] = {
 + {
 + .compatible = atmel,at91rm9200-spi,
 + .data = at91rm9200_config,
 + } , {
 + .compatible = atmel,at91sam9260-spi,
 + .data = at91sam9260_config,
 + } , {
 + .compatible = atmel,at91sam9x5-spi,
 + .data = at91sam9x5_config,
 + }, {
 + /* sentinel */
 + }
 +};
 +MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
 +#endif
 +
  /*
   * Version 2 of the SPI controller has
   *  - CR.LASTXFER
 @@ -229,11 +280,15 @@ struct atmel_spi_device {
   * register, but I haven't checked that it exists on all chips, and
   * this is cheaper anyway.
   */
 -static

[PATCH 1/1] spi/atmel: add DT support

2012-11-23 Thread Jean-Christophe PLAGNIOL-VILLARD
the atmel_spi use only gpio for chip select

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: spi-devel-general@lists.sourceforge.net
Cc: Grant Likely grant.lik...@secretlab.ca
---
Hi Grant,

can we have this for 3.8
This patch is presetnt on the ML sing Feb 2012 and was depinding on
the cs-gpio dt that you just apply

Best Regards,
J.
 .../devicetree/bindings/spi/spi_atmel.txt  |   26 
 drivers/spi/spi-atmel.c|   17 -
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt

diff --git a/Documentation/devicetree/bindings/spi/spi_atmel.txt 
b/Documentation/devicetree/bindings/spi/spi_atmel.txt
new file mode 100644
index 000..07e04cd
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi_atmel.txt
@@ -0,0 +1,26 @@
+Atmel SPI device
+
+Required properties:
+- compatible : should be atmel,at91rm9200-spi.
+- reg: Address and length of the register set for the device
+- interrupts: Should contain spi interrupt
+- cs-gpios: chipselects
+
+Example:
+
+spi1: spi@fffcc000 {
+   compatible = atmel,at91rm9200-spi;
+   reg = 0xfffcc000 0x4000;
+   interrupts = 13 4 5;
+   #address-cells = 1;
+   #size-cells = 0;
+   cs-gpios = pioB 3 0;
+   status = okay;
+
+   mmc-slot@0 {
+   compatible = mmc-spi-slot;
+   reg = 0;
+   gpios = pioC 4 0;/* CD */
+   spi-max-frequency = 2500;
+   };
+};
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 61fb0ec..1615222 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -20,6 +20,7 @@
 #include linux/spi/spi.h
 #include linux/slab.h
 #include linux/platform_data/atmel.h
+#include linux/of.h
 
 #include asm/io.h
 #include asm/gpio.h
@@ -768,6 +769,10 @@ static int atmel_spi_setup(struct spi_device *spi)
 
/* chipselect must have been muxed as GPIO (e.g. in board setup) */
npcs_pin = (unsigned int)spi-controller_data;
+
+   if (gpio_is_valid(spi-cs_gpio))
+   npcs_pin = spi-cs_gpio;
+
asd = spi-controller_state;
if (!asd) {
asd = kzalloc(sizeof(struct atmel_spi_device), GFP_KERNEL);
@@ -937,8 +942,9 @@ static int __devinit atmel_spi_probe(struct platform_device 
*pdev)
/* the spi-mode bits understood by this driver: */
master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
 
+   master-dev.of_node = pdev-dev.of_node;
master-bus_num = pdev-id;
-   master-num_chipselect = 4;
+   master-num_chipselect = master-dev.of_node ? 0 : 4;
master-setup = atmel_spi_setup;
master-transfer = atmel_spi_transfer;
master-cleanup = atmel_spi_cleanup;
@@ -1064,11 +1070,20 @@ static int atmel_spi_resume(struct platform_device 
*pdev)
 #defineatmel_spi_resumeNULL
 #endif
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_spi_dt_ids[] = {
+   { .compatible = atmel,at91rm9200-spi },
+   { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
+#endif
 
 static struct platform_driver atmel_spi_driver = {
.driver = {
.name   = atmel_spi,
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(atmel_spi_dt_ids),
},
.suspend= atmel_spi_suspend,
.resume = atmel_spi_resume,
-- 
1.7.10.4


--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 1/1 v2] of_spi: add generic binding support to specify cs gpio

2012-11-15 Thread Jean-Christophe PLAGNIOL-VILLARD
This will allow to use gpio for chip select with no modification in the
driver binding

When use the cs-gpios, the gpio number will be passed via the cs_gpio field
and the number of chip select will automatically increased with max(hw cs, gpio 
cs).

So if for example the controller has 2 CS lines, and the cs-gpios
property looks like this:

cs-gpios = gpio1 0 0 0 gpio1 1 0 gpio1 2 0;

Then it should be configured so that num_chipselect = 4 with the
following mapping:

cs0 : gpio1 0 0
cs1 : native
cs2 : gpio1 1 0
cs3 : gpio1 2 0

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
Signed-off-by: Richard Genoud richard.gen...@gmail.com
---
v2:
update to allow to overwrite hw gpio via cs-gpio
as sugested by Grant

Best Regards,
J.
 Documentation/devicetree/bindings/spi/spi-bus.txt |   20 
 drivers/spi/spi.c |   54 +++--
 include/linux/spi/spi.h   |3 ++
 3 files changed, 74 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
b/Documentation/devicetree/bindings/spi/spi-bus.txt
index d2c33d0..77a8b0d 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -12,6 +12,7 @@ The SPI master node requires the following properties:
 - #size-cells - should be zero.
 - compatible  - name of SPI bus controller following generic names
recommended practice.
+- cs-gpios   - (optional) gpios chip select.
 No other properties are required in the SPI bus node.  It is assumed
 that a driver for an SPI bus device will understand that it is an SPI bus.
 However, the binding does not attempt to define the specific method for
@@ -24,6 +25,22 @@ support describing the chip select layout.
 Optional property:
 - num-cs : total number of chipselects
 
+If cs-gpios is used the number of chip select will automatically increased
+with max(cs-gpios  hw cs)
+
+So if for example the controller has 2 CS lines, and the cs-gpios
+property looks like this:
+
+cs-gpios = gpio1 0 0 0 gpio1 1 0 gpio1 2 0;
+
+Then it should be configured so that num_chipselect = 4 with the
+following mapping:
+
+cs0 : gpio1 0 0
+cs1 : native
+cs2 : gpio1 1 0
+cs3 : gpio1 2 0
+
 SPI slave nodes must be children of the SPI master node and can
 contain the following properties.
 - reg - (required) chip select address of device.
@@ -37,6 +54,9 @@ contain the following properties.
 - spi-cs-high - (optional) Empty property indicating device requires
chip select active high
 
+If a gpio chipselect is used for the SPI slave the gpio number will be passed
+via the cs_gpio
+
 SPI example for an MPC5200 SPI bus:
spi@f00 {
#address-cells = 1;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index fc0da39..efb635f 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -30,6 +30,7 @@
 #include linux/slab.h
 #include linux/mod_devicetable.h
 #include linux/spi/spi.h
+#include linux/of_gpio.h
 #include linux/pm_runtime.h
 #include linux/export.h
 #include linux/sched.h
@@ -327,6 +328,7 @@ struct spi_device *spi_alloc_device(struct spi_master 
*master)
spi-dev.parent = master-dev;
spi-dev.bus = spi_bus_type;
spi-dev.release = spidev_release;
+   spi-cs_gpio = -EINVAL;
device_initialize(spi-dev);
return spi;
 }
@@ -344,15 +346,16 @@ EXPORT_SYMBOL_GPL(spi_alloc_device);
 int spi_add_device(struct spi_device *spi)
 {
static DEFINE_MUTEX(spi_add_lock);
-   struct device *dev = spi-master-dev.parent;
+   struct spi_master *master = spi-master;
+   struct device *dev = master-dev.parent;
struct device *d;
int status;
 
/* Chipselects are numbered 0..max; validate. */
-   if (spi-chip_select = spi-master-num_chipselect) {
+   if (spi-chip_select = master-num_chipselect) {
dev_err(dev, cs%d = max %d\n,
spi-chip_select,
-   spi-master-num_chipselect);
+   master-num_chipselect);
return -EINVAL;
}
 
@@ -376,6 +379,9 @@ int spi_add_device(struct spi_device *spi)
goto done;
}
 
+   if (master-cs_gpios)
+   spi-cs_gpio = master-cs_gpios[spi-chip_select];
+
/* Drivers may modify this initial i/o setup, but will
 * normally rely on the device being setup.  Devices
 * using SPI_CS_HIGH can't coexist well otherwise...
@@ -949,6 +955,44 @@ struct spi_master *spi_alloc_master(struct device *dev, 
unsigned size)
 }
 EXPORT_SYMBOL_GPL(spi_alloc_master);
 
+#ifdef CONFIG_OF
+static int of_spi_register_master(struct spi_master *master)
+{
+   int nb, i;
+   int *cs;
+   struct device_node *np = master-dev.of_node;
+
+   if (!np

Re: [PATCH 02/10] arm: at91: move platfarm_data to include/linux/platform_data/atmel.h

2012-11-12 Thread Jean-Christophe PLAGNIOL-VILLARD
On 11:54 Sat 10 Nov , Joachim Eastwood wrote:
 Hi Jean-Christophe,
 
 On 7 November 2012 12:22, Jean-Christophe PLAGNIOL-VILLARD
 plagn...@jcrosoft.com wrote:
  Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
  Cc: Nicolas Ferre nicolas.fe...@atmel.com
  Cc: linux-...@vger.kernel.org
  Cc: linux-in...@vger.kernel.org
  Cc: linux-...@vger.kernel.org
  Cc: linux-...@vger.kernel.org
  Cc: net...@vger.kernel.org
  Cc: linux-pcm...@lists.infradead.org
  Cc: rtc-li...@googlegroups.com
  Cc: spi-devel-general@lists.sourceforge.net
  Cc: linux-ser...@vger.kernel.org
  Cc: linux-...@vger.kernel.org
  Cc: linux-fb...@vger.kernel.org
  ---
  HI all,
 
  If it's ok with everyone this will go via at91
  with the patch serie than clean up the include/mach
 
  For preparation to switch to arm multiarch kernel
 
  Best Regards,
  J.
   arch/arm/mach-at91/include/mach/board.h |   55 --
   arch/avr32/mach-at32ap/include/mach/board.h |7 ---
   drivers/ata/pata_at91.c |2 +-
   drivers/input/touchscreen/atmel_tsadcc.c|2 +-
   drivers/mmc/host/atmel-mci.c|2 +-
   drivers/net/can/at91_can.c  |3 +-
   drivers/net/ethernet/cadence/at91_ether.c   |2 +-
   drivers/pcmcia/at91_cf.c|2 +-
   drivers/rtc/rtc-at91sam9.c  |2 +-
   drivers/spi/spi-atmel.c |2 +-
   drivers/tty/serial/atmel_serial.c   |2 +-
   drivers/usb/gadget/at91_udc.c   |2 +-
   drivers/usb/gadget/atmel_usba_udc.c |2 +-
   drivers/usb/host/ohci-at91.c|2 +-
   drivers/video/atmel_lcdfb.c |2 +-
   include/linux/platform_data/atmel.h |   67 
  +++
   16 files changed, 80 insertions(+), 76 deletions(-)
 
 snip
 
  diff --git a/drivers/net/ethernet/cadence/at91_ether.c 
  b/drivers/net/ethernet/cadence/at91_ether.c
  index 4e980a7..35fc6edb 100644
  --- a/drivers/net/ethernet/cadence/at91_ether.c
  +++ b/drivers/net/ethernet/cadence/at91_ether.c
  @@ -31,6 +31,7 @@
   #include linux/clk.h
   #include linux/gfp.h
   #include linux/phy.h
  +#include linux/platform_data/atmel.h
 
   #include asm/io.h
   #include asm/uaccess.h
  @@ -38,7 +39,6 @@
 
   #include mach/at91rm9200_emac.h
   #include asm/gpio.h
  -#include mach/board.h
 
   #include at91_ether.h
 
 The at91_ether driver in net-next does not need to be change since it
 all mach includes has already been removed by other patches and it
 includes linux/platform_data/macb.h directly.
 
 What tree was these patches based on?
 The at91_ether driver changes has been in linux-next for a long while now.
the conflict is minor easy to handle and the cleanup need to go first on arm 
soc so this is
based on rc3

Best Regards,
J.

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 02/10] arm: at91: move platfarm_data to include/linux/platform_data/atmel.h

2012-11-07 Thread Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: Nicolas Ferre nicolas.fe...@atmel.com
Cc: linux-...@vger.kernel.org
Cc: linux-in...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: net...@vger.kernel.org
Cc: linux-pcm...@lists.infradead.org
Cc: rtc-li...@googlegroups.com
Cc: spi-devel-general@lists.sourceforge.net
Cc: linux-ser...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux-fb...@vger.kernel.org
---
HI all,

If it's ok with everyone this will go via at91
with the patch serie than clean up the include/mach

For preparation to switch to arm multiarch kernel

Best Regards,
J.
 arch/arm/mach-at91/include/mach/board.h |   55 --
 arch/avr32/mach-at32ap/include/mach/board.h |7 ---
 drivers/ata/pata_at91.c |2 +-
 drivers/input/touchscreen/atmel_tsadcc.c|2 +-
 drivers/mmc/host/atmel-mci.c|2 +-
 drivers/net/can/at91_can.c  |3 +-
 drivers/net/ethernet/cadence/at91_ether.c   |2 +-
 drivers/pcmcia/at91_cf.c|2 +-
 drivers/rtc/rtc-at91sam9.c  |2 +-
 drivers/spi/spi-atmel.c |2 +-
 drivers/tty/serial/atmel_serial.c   |2 +-
 drivers/usb/gadget/at91_udc.c   |2 +-
 drivers/usb/gadget/atmel_usba_udc.c |2 +-
 drivers/usb/host/ohci-at91.c|2 +-
 drivers/video/atmel_lcdfb.c |2 +-
 include/linux/platform_data/atmel.h |   67 +++
 16 files changed, 80 insertions(+), 76 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/board.h 
b/arch/arm/mach-at91/include/mach/board.h
index c55a436..662451d 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -31,42 +31,15 @@
 #ifndef __ASM_ARCH_BOARD_H
 #define __ASM_ARCH_BOARD_H
 
-#include linux/mtd/partitions.h
-#include linux/device.h
-#include linux/i2c.h
-#include linux/leds.h
-#include linux/spi/spi.h
-#include linux/usb/atmel_usba_udc.h
-#include linux/atmel-mci.h
-#include sound/atmel-ac97c.h
-#include linux/serial.h
-#include linux/platform_data/macb.h
 #include linux/platform_data/atmel.h
 
  /* USB Device */
-struct at91_udc_data {
-   int vbus_pin;   /* high == host powering us */
-   u8  vbus_active_low;/* vbus polarity */
-   u8  vbus_polled;/* Use polling, not interrupt */
-   int pullup_pin; /* active == D+ pulled up */
-   u8  pullup_active_low;  /* true == pullup_pin is active low */
-};
 extern void __init at91_add_device_udc(struct at91_udc_data *data);
 
  /* USB High Speed Device */
 extern void __init at91_add_device_usba(struct usba_platform_data *data);
 
  /* Compact Flash */
-struct at91_cf_data {
-   int irq_pin;/* I/O IRQ */
-   int det_pin;/* Card detect */
-   int vcc_pin;/* power switching */
-   int rst_pin;/* card reset */
-   u8  chipselect; /* EBI Chip Select number */
-   u8  flags;
-#define AT91_CF_TRUE_IDE   0x01
-#define AT91_IDE_SWAP_A0_A20x02
-};
 extern void __init at91_add_device_cf(struct at91_cf_data *data);
 
  /* MMC / SD */
@@ -86,16 +59,6 @@ extern void __init at91_add_device_mci(short mmc_id, struct 
mci_platform_data *d
 extern void __init at91_add_device_eth(struct macb_platform_data *data);
 
  /* USB Host */
-#define AT91_MAX_USBH_PORTS3
-struct at91_usbh_data {
-   int vbus_pin[AT91_MAX_USBH_PORTS];  /* port power-control 
pin */
-   int overcurrent_pin[AT91_MAX_USBH_PORTS];
-   u8  ports;  /* number of ports on 
root hub */
-   u8  overcurrent_supported;
-   u8  vbus_pin_active_low[AT91_MAX_USBH_PORTS];
-   u8  overcurrent_status[AT91_MAX_USBH_PORTS];
-   u8  overcurrent_changed[AT91_MAX_USBH_PORTS];
-};
 extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
 extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
 extern void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data);
@@ -124,13 +87,6 @@ extern void __init at91_register_uart(unsigned id, unsigned 
portnr, unsigned pin
 
 extern struct platform_device *atmel_default_console_device;
 
-struct atmel_uart_data {
-   int num;/* port num */
-   short   use_dma_tx; /* use transmit DMA? */
-   short   use_dma_rx; /* use receive DMA? */
-   void __iomem*regs;  /* virt. base address, if any */
-   struct serial_rs485 rs485;  /* rs485 settings */
-};
 extern void __init at91_add_device_serial(void);
 
 /*
@@ -173,24 +129,13 @@ extern void __init

Re: [PATCH 1/4 v5] of_spi: add generic binding support to specify cs gpio

2012-03-12 Thread Jean-Christophe PLAGNIOL-VILLARD
On 09:40 Mon 12 Mar , Grant Likely wrote:
 On Sun, 11 Mar 2012 19:25:37 +0100, Jean-Christophe PLAGNIOL-VILLARD 
 plagn...@jcrosoft.com wrote:
  On 08:07 Sun 11 Mar , Grant Likely wrote:
   On Fri,  9 Mar 2012 19:25:44 +0100, Jean-Christophe PLAGNIOL-VILLARD 
   plagn...@jcrosoft.com wrote:
This will allow to use gpio for chip select with no modification in the
driver binding

When use the cs-gpios, the gpio number will be passed via the cs_gpio 
field
and the number of chip select will automatically increased.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
---
v5:
update grant comment to simplify the cs_gpio management

Best Regards,
J.
 Documentation/devicetree/bindings/spi/spi-bus.txt |6 ++
 drivers/spi/spi.c |   55 
+++-
 include/linux/spi/spi.h   |4 ++
 3 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
b/Documentation/devicetree/bindings/spi/spi-bus.txt
index e782add..c253379 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -12,6 +12,7 @@ The SPI master node requires the following properties:
 - #size-cells - should be zero.
 - compatible  - name of SPI bus controller following generic names
recommended practice.
+- cs-gpios   - (optional) gpios chip select.
 No other properties are required in the SPI bus node.  It is assumed
 that a driver for an SPI bus device will understand that it is an SPI 
bus.
 However, the binding does not attempt to define the specific method for
@@ -21,6 +22,8 @@ assumption that board specific platform code will be 
used to manage
 chip selects.  Individual drivers can define additional properties to
 support describing the chip select layout.
 
+If cs-gpios is used the number of chip select will automatically 
increased.
+
 SPI slave nodes must be children of the SPI master node and can
 contain the following properties.
 - reg - (required) chip select address of device.
@@ -34,6 +37,9 @@ contain the following properties.
 - spi-cs-high - (optional) Empty property indicating device 
requires
chip select active high
 
+If a gpio chipselect is used for the SPI slave the gpio number will be 
passed
+via the cs_gpio
+
 SPI example for an MPC5200 SPI bus:
spi@f00 {
#address-cells = 1;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b2ccdea..446eee5 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -28,6 +28,7 @@
 #include linux/mod_devicetable.h
 #include linux/spi/spi.h
 #include linux/of_spi.h
+#include linux/of_gpio.h
 #include linux/pm_runtime.h
 #include linux/export.h
 
@@ -322,6 +323,7 @@ struct spi_device *spi_alloc_device(struct 
spi_master *master)
spi-dev.parent = master-dev;
spi-dev.bus = spi_bus_type;
spi-dev.release = spidev_release;
+   spi-cs_gpio = -EINVAL;
device_initialize(spi-dev);
return spi;
 }
@@ -339,15 +341,16 @@ EXPORT_SYMBOL_GPL(spi_alloc_device);
 int spi_add_device(struct spi_device *spi)
 {
static DEFINE_MUTEX(spi_add_lock);
-   struct device *dev = spi-master-dev.parent;
+   struct spi_master *master = spi-master;
+   struct device *dev = master-dev.parent;
struct device *d;
int status;
 
/* Chipselects are numbered 0..max; validate. */
-   if (spi-chip_select = spi-master-num_chipselect) {
+   if (spi-chip_select = master-num_chipselect) {
dev_err(dev, cs%d = max %d\n,
spi-chip_select,
-   spi-master-num_chipselect);
+   master-num_chipselect);
return -EINVAL;
}
 
@@ -371,6 +374,9 @@ int spi_add_device(struct spi_device *spi)
goto done;
}
 
+   if (master-cs_gpios)
+   spi-cs_gpio = master-cs_gpios[spi-chip_select];
+
   
   I still don't understand the need for this.  Only the master driver will 
   need
   this data, and it is already stored in the master-cs_gpios array.  Why
   does it need to get duplicated into the spi_device?
  yeah can drop it
   
/* Drivers may modify this initial i/o setup, but will
 * normally rely on the device being setup.  Devices
 * using SPI_CS_HIGH can't coexist well otherwise

[PATCH 1/4 v5] of_spi: add generic binding support to specify cs gpio

2012-03-09 Thread Jean-Christophe PLAGNIOL-VILLARD
This will allow to use gpio for chip select with no modification in the
driver binding

When use the cs-gpios, the gpio number will be passed via the cs_gpio field
and the number of chip select will automatically increased.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
---
v5:
update grant comment to simplify the cs_gpio management

Best Regards,
J.
 Documentation/devicetree/bindings/spi/spi-bus.txt |6 ++
 drivers/spi/spi.c |   55 +++-
 include/linux/spi/spi.h   |4 ++
 3 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
b/Documentation/devicetree/bindings/spi/spi-bus.txt
index e782add..c253379 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -12,6 +12,7 @@ The SPI master node requires the following properties:
 - #size-cells - should be zero.
 - compatible  - name of SPI bus controller following generic names
recommended practice.
+- cs-gpios   - (optional) gpios chip select.
 No other properties are required in the SPI bus node.  It is assumed
 that a driver for an SPI bus device will understand that it is an SPI bus.
 However, the binding does not attempt to define the specific method for
@@ -21,6 +22,8 @@ assumption that board specific platform code will be used to 
manage
 chip selects.  Individual drivers can define additional properties to
 support describing the chip select layout.
 
+If cs-gpios is used the number of chip select will automatically increased.
+
 SPI slave nodes must be children of the SPI master node and can
 contain the following properties.
 - reg - (required) chip select address of device.
@@ -34,6 +37,9 @@ contain the following properties.
 - spi-cs-high - (optional) Empty property indicating device requires
chip select active high
 
+If a gpio chipselect is used for the SPI slave the gpio number will be passed
+via the cs_gpio
+
 SPI example for an MPC5200 SPI bus:
spi@f00 {
#address-cells = 1;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b2ccdea..446eee5 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -28,6 +28,7 @@
 #include linux/mod_devicetable.h
 #include linux/spi/spi.h
 #include linux/of_spi.h
+#include linux/of_gpio.h
 #include linux/pm_runtime.h
 #include linux/export.h
 
@@ -322,6 +323,7 @@ struct spi_device *spi_alloc_device(struct spi_master 
*master)
spi-dev.parent = master-dev;
spi-dev.bus = spi_bus_type;
spi-dev.release = spidev_release;
+   spi-cs_gpio = -EINVAL;
device_initialize(spi-dev);
return spi;
 }
@@ -339,15 +341,16 @@ EXPORT_SYMBOL_GPL(spi_alloc_device);
 int spi_add_device(struct spi_device *spi)
 {
static DEFINE_MUTEX(spi_add_lock);
-   struct device *dev = spi-master-dev.parent;
+   struct spi_master *master = spi-master;
+   struct device *dev = master-dev.parent;
struct device *d;
int status;
 
/* Chipselects are numbered 0..max; validate. */
-   if (spi-chip_select = spi-master-num_chipselect) {
+   if (spi-chip_select = master-num_chipselect) {
dev_err(dev, cs%d = max %d\n,
spi-chip_select,
-   spi-master-num_chipselect);
+   master-num_chipselect);
return -EINVAL;
}
 
@@ -371,6 +374,9 @@ int spi_add_device(struct spi_device *spi)
goto done;
}
 
+   if (master-cs_gpios)
+   spi-cs_gpio = master-cs_gpios[spi-chip_select];
+
/* Drivers may modify this initial i/o setup, but will
 * normally rely on the device being setup.  Devices
 * using SPI_CS_HIGH can't coexist well otherwise...
@@ -561,6 +567,45 @@ struct spi_master *spi_alloc_master(struct device *dev, 
unsigned size)
 }
 EXPORT_SYMBOL_GPL(spi_alloc_master);
 
+#ifdef CONFIG_OF
+static int of_spi_register_master(struct spi_master *master)
+{
+   int nb, i;
+   int *cs;
+   struct device_node *np = master-dev.of_node;
+
+   if (!np)
+   return 0;
+
+   nb = of_gpio_named_count(np, cs-gpios);
+
+   if (nb  1)
+   return 0;
+
+   cs = devm_kzalloc(master-dev,
+ sizeof(int) * (master-num_chipselect + nb),
+ GFP_KERNEL);
+   master-cs_gpios = cs;
+
+   if (!master-cs_gpios)
+   return -ENOMEM;
+
+   memset(cs, -EINVAL, master-num_chipselect);
+   master-num_chipselect += nb;
+   cs += master-num_chipselect;
+
+   for (i = 0; i  nb; i++)
+   cs[i] = of_get_named_gpio(np, cs-gpios, i);
+
+   return 0;
+}
+#else
+static int of_spi_register_master(struct

[PATCH 2/4 v4] spi/atmel: add DT support

2012-03-07 Thread Jean-Christophe PLAGNIOL-VILLARD
The atmel_spi use only gpio for chip select.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
---
 .../devicetree/bindings/spi/spi_atmel.txt  |6 +
 drivers/spi/spi-atmel.c|   21 ---
 2 files changed, 23 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt

diff --git a/Documentation/devicetree/bindings/spi/spi_atmel.txt 
b/Documentation/devicetree/bindings/spi/spi_atmel.txt
new file mode 100644
index 000..7ec3d8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi_atmel.txt
@@ -0,0 +1,6 @@
+Atmel SPI device
+
+Required properties:
+- compatible : should be atmel,at91rm9200-spi.
+- reg: Address and length of the register set for the device
+- interrupts: Should contain macb interrupt
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 16d6a83..efbc5f8 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -19,6 +19,7 @@
 #include linux/interrupt.h
 #include linux/spi/spi.h
 #include linux/slab.h
+#include linux/of.h
 
 #include asm/io.h
 #include mach/board.h
@@ -695,7 +696,7 @@ static int atmel_spi_setup(struct spi_device *spi)
u32 scbr, csr;
unsigned intbits = spi-bits_per_word;
unsigned long   bus_hz;
-   unsigned intnpcs_pin;
+   int npcs_pin;
int ret;
 
as = spi_master_get_devdata(spi-master);
@@ -767,7 +768,9 @@ static int atmel_spi_setup(struct spi_device *spi)
csr |= SPI_BF(DLYBCT, 0);
 
/* chipselect must have been muxed as GPIO (e.g. in board setup) */
-   npcs_pin = (unsigned int)spi-controller_data;
+   if (!gpio_is_valid(spi-cs_gpio))
+   spi-cs_gpio = (int)spi-controller_data;
+   npcs_pin = spi-cs_gpio;
asd = spi-controller_state;
if (!asd) {
asd = kzalloc(sizeof(struct atmel_spi_device), GFP_KERNEL);
@@ -887,7 +890,7 @@ static void atmel_spi_cleanup(struct spi_device *spi)
 {
struct atmel_spi*as = spi_master_get_devdata(spi-master);
struct atmel_spi_device *asd = spi-controller_state;
-   unsignedgpio = (unsigned) spi-controller_data;
+   unsignedgpio = spi-cs_gpio;
unsigned long   flags;
 
if (!asd)
@@ -938,7 +941,8 @@ static int __devinit atmel_spi_probe(struct platform_device 
*pdev)
master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
 
master-bus_num = pdev-id;
-   master-num_chipselect = 4;
+   master-dev.of_node = pdev-dev.of_node;
+   master-num_chipselect = master-dev.of_node ? 0 : 4;
master-setup = atmel_spi_setup;
master-transfer = atmel_spi_transfer;
master-cleanup = atmel_spi_cleanup;
@@ -1064,11 +1068,20 @@ static int atmel_spi_resume(struct platform_device 
*pdev)
 #defineatmel_spi_resumeNULL
 #endif
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_spi_dt_ids[] = {
+   { .compatible = atmel,at91rm9200-spi },
+   { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
+#endif
 
 static struct platform_driver atmel_spi_driver = {
.driver = {
.name   = atmel_spi,
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(atmel_spi_dt_ids),
},
.suspend= atmel_spi_suspend,
.resume = atmel_spi_resume,
-- 
1.7.7


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 1/4 v4] of_spi: add generic binding support to specify cs gpio

2012-03-07 Thread Jean-Christophe PLAGNIOL-VILLARD
This will allow to use gpio for chip select with no modification in the
driver binding

When use the cs-gpios, the gpio number will be passed via the cs_gpio field
and the number of chip select will automatically increased.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
---
v4:
use cs_gpio to pass the gpio number

Best Regards,
J.
 Documentation/devicetree/bindings/spi/spi-bus.txt |6 ++
 drivers/spi/spi.c |   57 +++-
 include/linux/spi/spi.h   |6 ++
 3 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
b/Documentation/devicetree/bindings/spi/spi-bus.txt
index e782add..c253379 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -12,6 +12,7 @@ The SPI master node requires the following properties:
 - #size-cells - should be zero.
 - compatible  - name of SPI bus controller following generic names
recommended practice.
+- cs-gpios   - (optional) gpios chip select.
 No other properties are required in the SPI bus node.  It is assumed
 that a driver for an SPI bus device will understand that it is an SPI bus.
 However, the binding does not attempt to define the specific method for
@@ -21,6 +22,8 @@ assumption that board specific platform code will be used to 
manage
 chip selects.  Individual drivers can define additional properties to
 support describing the chip select layout.
 
+If cs-gpios is used the number of chip select will automatically increased.
+
 SPI slave nodes must be children of the SPI master node and can
 contain the following properties.
 - reg - (required) chip select address of device.
@@ -34,6 +37,9 @@ contain the following properties.
 - spi-cs-high - (optional) Empty property indicating device requires
chip select active high
 
+If a gpio chipselect is used for the SPI slave the gpio number will be passed
+via the controller_data
+
 SPI example for an MPC5200 SPI bus:
spi@f00 {
#address-cells = 1;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b2ccdea..c1d0955 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -28,6 +28,7 @@
 #include linux/mod_devicetable.h
 #include linux/spi/spi.h
 #include linux/of_spi.h
+#include linux/of_gpio.h
 #include linux/pm_runtime.h
 #include linux/export.h
 
@@ -322,6 +323,7 @@ struct spi_device *spi_alloc_device(struct spi_master 
*master)
spi-dev.parent = master-dev;
spi-dev.bus = spi_bus_type;
spi-dev.release = spidev_release;
+   spi-cs_gpio = -EINVAL;
device_initialize(spi-dev);
return spi;
 }
@@ -339,15 +341,16 @@ EXPORT_SYMBOL_GPL(spi_alloc_device);
 int spi_add_device(struct spi_device *spi)
 {
static DEFINE_MUTEX(spi_add_lock);
-   struct device *dev = spi-master-dev.parent;
+   struct spi_master *master = spi-master;
+   struct device *dev = master-dev.parent;
struct device *d;
int status;
 
/* Chipselects are numbered 0..max; validate. */
-   if (spi-chip_select = spi-master-num_chipselect) {
+   if (spi-chip_select = master-num_chipselect) {
dev_err(dev, cs%d = max %d\n,
spi-chip_select,
-   spi-master-num_chipselect);
+   master-num_chipselect);
return -EINVAL;
}
 
@@ -371,6 +374,13 @@ int spi_add_device(struct spi_device *spi)
goto done;
}
 
+   if (master-num_gpio_cs 
+   spi-chip_select = master-first_gpio_cs) {
+   int num = spi-chip_select - master-first_gpio_cs;
+
+   spi-cs_gpio = master-cs_gpios[num];
+   }
+
/* Drivers may modify this initial i/o setup, but will
 * normally rely on the device being setup.  Devices
 * using SPI_CS_HIGH can't coexist well otherwise...
@@ -561,6 +571,43 @@ struct spi_master *spi_alloc_master(struct device *dev, 
unsigned size)
 }
 EXPORT_SYMBOL_GPL(spi_alloc_master);
 
+#ifdef CONFIG_OF
+static int of_spi_register_master(struct spi_master *master)
+{
+   int nb, i;
+   int *cs;
+   struct device_node *np = master-dev.of_node;
+
+   if (!np)
+   return 0;
+
+   nb = of_gpio_named_count(np, cs-gpios);
+
+   if (nb  1)
+   return 0;
+
+   cs = devm_kzalloc(master-dev, sizeof(int) * nb, GFP_KERNEL);
+   master-cs_gpios = cs;
+
+   if (!master-cs_gpios)
+   return -ENOMEM;
+
+   master-first_gpio_cs = master-num_chipselect;
+   master-num_chipselect += nb;
+   master-num_gpio_cs = nb;
+
+   for (i = 0; i  nb; i++)
+   cs[i] = of_get_named_gpio(np, cs-gpios, i);
+
+   return 0;
+}
+#else
+static int

[PATCH 1/3 v3] spi: move master of_node init to spi_alloc_master

2012-03-02 Thread Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
Cc: Grant Likely grant.lik...@secretlab.ca
---
 drivers/spi/spi-altera.c  |3 ---
 drivers/spi/spi-fsl-lib.c |1 -
 drivers/spi/spi-imx.c |1 -
 drivers/spi/spi-mpc512x-psc.c |1 -
 drivers/spi/spi-mpc52xx-psc.c |1 -
 drivers/spi/spi-mpc52xx.c |1 -
 drivers/spi/spi-oc-tiny.c |1 -
 drivers/spi/spi-ppc4xx.c  |1 -
 drivers/spi/spi-pxa2xx-pci.c  |1 -
 drivers/spi/spi-pxa2xx.c  |1 -
 drivers/spi/spi-tegra.c   |1 -
 drivers/spi/spi-xilinx.c  |1 -
 drivers/spi/spi.c |1 +
 13 files changed, 1 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
index c00d00e..ac6badc 100644
--- a/drivers/spi/spi-altera.c
+++ b/drivers/spi/spi-altera.c
@@ -270,9 +270,6 @@ static int __devinit altera_spi_probe(struct 
platform_device *pdev)
if (err)
goto exit;
}
-   /* find platform data */
-   if (!platp)
-   hw-bitbang.master-dev.of_node = pdev-dev.of_node;
 
/* register our spi controller */
err = spi_bitbang_start(hw-bitbang);
diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c
index 2674fad..810aa01 100644
--- a/drivers/spi/spi-fsl-lib.c
+++ b/drivers/spi/spi-fsl-lib.c
@@ -133,7 +133,6 @@ int mpc8xxx_spi_probe(struct device *dev, struct resource 
*mem,
 
master-transfer = mpc8xxx_spi_transfer;
master-cleanup = mpc8xxx_spi_cleanup;
-   master-dev.of_node = dev-of_node;
 
mpc8xxx_spi = spi_master_get_devdata(master);
mpc8xxx_spi-dev = dev;
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index c6e697f..bebcd01 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -860,7 +860,6 @@ static int __devinit spi_imx_probe(struct platform_device 
*pdev)
 
spi_imx-devtype_data-intctrl(spi_imx, 0);
 
-   master-dev.of_node = pdev-dev.of_node;
ret = spi_bitbang_start(spi_imx-bitbang);
if (ret) {
dev_err(pdev-dev, bitbang start failed with %d\n, ret);
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index 4c63f77..583d0c5 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -441,7 +441,6 @@ static int __devinit mpc512x_psc_spi_do_probe(struct device 
*dev, u32 regaddr,
master-setup = mpc512x_psc_spi_setup;
master-transfer = mpc512x_psc_spi_transfer;
master-cleanup = mpc512x_psc_spi_cleanup;
-   master-dev.of_node = dev-of_node;
 
tempp = ioremap(regaddr, size);
if (!tempp) {
diff --git a/drivers/spi/spi-mpc52xx-psc.c b/drivers/spi/spi-mpc52xx-psc.c
index 6604715..502c953 100644
--- a/drivers/spi/spi-mpc52xx-psc.c
+++ b/drivers/spi/spi-mpc52xx-psc.c
@@ -398,7 +398,6 @@ static int __devinit mpc52xx_psc_spi_do_probe(struct device 
*dev, u32 regaddr,
master-setup = mpc52xx_psc_spi_setup;
master-transfer = mpc52xx_psc_spi_transfer;
master-cleanup = mpc52xx_psc_spi_cleanup;
-   master-dev.of_node = dev-of_node;
 
mps-psc = ioremap(regaddr, size);
if (!mps-psc) {
diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c
index 57633d9..1a099f8 100644
--- a/drivers/spi/spi-mpc52xx.c
+++ b/drivers/spi/spi-mpc52xx.c
@@ -437,7 +437,6 @@ static int __devinit mpc52xx_spi_probe(struct 
platform_device *op)
master-setup = mpc52xx_spi_setup;
master-transfer = mpc52xx_spi_transfer;
master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
-   master-dev.of_node = op-dev.of_node;
 
dev_set_drvdata(op-dev, master);
 
diff --git a/drivers/spi/spi-oc-tiny.c b/drivers/spi/spi-oc-tiny.c
index 698018f..d030857 100644
--- a/drivers/spi/spi-oc-tiny.c
+++ b/drivers/spi/spi-oc-tiny.c
@@ -266,7 +266,6 @@ static int __devinit tiny_spi_of_probe(struct 
platform_device *pdev)
if (hw-gpio_cs[i]  0)
return -ENODEV;
}
-   hw-bitbang.master-dev.of_node = pdev-dev.of_node;
val = of_get_property(pdev-dev.of_node,
  clock-frequency, len);
if (val  len = sizeof(__be32))
diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index 98ec532..1aa8b33 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -406,7 +406,6 @@ static int __init spi_ppc4xx_of_probe(struct 
platform_device *op)
master = spi_alloc_master(dev, sizeof *hw);
if (master == NULL)
return -ENOMEM;
-   master-dev.of_node = np;
dev_set_drvdata(dev, master);
hw = spi_master_get_devdata(master);
hw-master = spi_master_get(master);
diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
index 8caa07d..5012979 100644
--- a/drivers/spi/spi-pxa2xx-pci.c

[PATCH 3/3 v3] spi/atmel: add DT support

2012-03-02 Thread Jean-Christophe PLAGNIOL-VILLARD
The atmel_spi use only gpio for chip select.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
---
 .../devicetree/bindings/spi/spi_atmel.txt  |6 ++
 drivers/spi/spi-atmel.c|   12 +++-
 2 files changed, 17 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt

diff --git a/Documentation/devicetree/bindings/spi/spi_atmel.txt 
b/Documentation/devicetree/bindings/spi/spi_atmel.txt
new file mode 100644
index 000..7ec3d8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi_atmel.txt
@@ -0,0 +1,6 @@
+Atmel SPI device
+
+Required properties:
+- compatible : should be atmel,at91rm9200-spi.
+- reg: Address and length of the register set for the device
+- interrupts: Should contain macb interrupt
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 16d6a83..7bcd11f 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -19,6 +19,7 @@
 #include linux/interrupt.h
 #include linux/spi/spi.h
 #include linux/slab.h
+#include linux/of.h
 
 #include asm/io.h
 #include mach/board.h
@@ -938,7 +939,7 @@ static int __devinit atmel_spi_probe(struct platform_device 
*pdev)
master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
 
master-bus_num = pdev-id;
-   master-num_chipselect = 4;
+   master-num_chipselect = master-dev.of_node ? 0 : 4;
master-setup = atmel_spi_setup;
master-transfer = atmel_spi_transfer;
master-cleanup = atmel_spi_cleanup;
@@ -1064,11 +1065,20 @@ static int atmel_spi_resume(struct platform_device 
*pdev)
 #defineatmel_spi_resumeNULL
 #endif
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_spi_dt_ids[] = {
+   { .compatible = atmel,at91rm9200-spi },
+   { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
+#endif
 
 static struct platform_driver atmel_spi_driver = {
.driver = {
.name   = atmel_spi,
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(atmel_spi_dt_ids),
},
.suspend= atmel_spi_suspend,
.resume = atmel_spi_resume,
-- 
1.7.7


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 2/3 v3] of_spi: add generic binding support to specify ncs gpio

2012-03-02 Thread Jean-Christophe PLAGNIOL-VILLARD
This will allow to use gpio for chip select with no modification in the
driver binding

When use the ncs-gpios, the gpio number will be passed via the controller_data
and the number of chip select will automatically increased.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
Cc: Grant Likely grant.lik...@secretlab.ca
---
v3:
use devm_kzalloc

v2:
specify the gpio array at controller level

Best Regards,
J.
 Documentation/devicetree/bindings/spi/spi-bus.txt |6 +++
 drivers/spi/spi.c |   49 +++-
 include/linux/spi/spi.h   |5 ++
 3 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
b/Documentation/devicetree/bindings/spi/spi-bus.txt
index e782add..5a24729 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -12,6 +12,7 @@ The SPI master node requires the following properties:
 - #size-cells - should be zero.
 - compatible  - name of SPI bus controller following generic names
recommended practice.
+- ncs-gpios   - (optional) gpios chip select.
 No other properties are required in the SPI bus node.  It is assumed
 that a driver for an SPI bus device will understand that it is an SPI bus.
 However, the binding does not attempt to define the specific method for
@@ -21,6 +22,8 @@ assumption that board specific platform code will be used to 
manage
 chip selects.  Individual drivers can define additional properties to
 support describing the chip select layout.
 
+If ncs-gpios is used the number of chip select will automatically increased.
+
 SPI slave nodes must be children of the SPI master node and can
 contain the following properties.
 - reg - (required) chip select address of device.
@@ -34,6 +37,9 @@ contain the following properties.
 - spi-cs-high - (optional) Empty property indicating device requires
chip select active high
 
+If a gpio chipselect is used for the SPI slave the gpio number will be passed
+via the controller_data
+
 SPI example for an MPC5200 SPI bus:
spi@f00 {
#address-cells = 1;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index e2f4ca0..f3df51f 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -28,6 +28,7 @@
 #include linux/mod_devicetable.h
 #include linux/spi/spi.h
 #include linux/of_spi.h
+#include linux/of_gpio.h
 #include linux/pm_runtime.h
 #include linux/export.h
 
@@ -339,15 +340,16 @@ EXPORT_SYMBOL_GPL(spi_alloc_device);
 int spi_add_device(struct spi_device *spi)
 {
static DEFINE_MUTEX(spi_add_lock);
-   struct device *dev = spi-master-dev.parent;
+   struct spi_master *master = spi-master;
+   struct device *dev = master-dev.parent;
struct device *d;
int status;
 
/* Chipselects are numbered 0..max; validate. */
-   if (spi-chip_select = spi-master-num_chipselect) {
+   if (spi-chip_select = master-num_chipselect) {
dev_err(dev, cs%d = max %d\n,
spi-chip_select,
-   spi-master-num_chipselect);
+   master-num_chipselect);
return -EINVAL;
}
 
@@ -371,6 +373,13 @@ int spi_add_device(struct spi_device *spi)
goto done;
}
 
+   if (master-num_gpio_chipselect 
+   spi-chip_select = master-first_gpio_chipselect) {
+   int num = spi-chip_select - master-first_gpio_chipselect;
+
+   spi-controller_data = (void*)master-chipselect_gpios[num];
+   }
+
/* Drivers may modify this initial i/o setup, but will
 * normally rely on the device being setup.  Devices
 * using SPI_CS_HIGH can't coexist well otherwise...
@@ -562,6 +571,36 @@ struct spi_master *spi_alloc_master(struct device *dev, 
unsigned size)
 }
 EXPORT_SYMBOL_GPL(spi_alloc_master);
 
+static int of_spi_register_master(struct spi_master *master)
+{
+   int nb, i;
+   int *cs;
+   struct device_node *np = master-dev.of_node;
+
+   if (!np)
+   return 0;
+
+   nb = of_gpio_named_count(np, ncs-gpios);
+
+   if (nb  1)
+   return 0;
+
+   cs = devm_kzalloc(master-dev, sizeof(int) * nb, GFP_KERNEL);
+   master-chipselect_gpios = cs;
+
+   if (!master-chipselect_gpios)
+   return -ENOMEM;
+
+   master-first_gpio_chipselect = master-num_chipselect;
+   master-num_chipselect += nb;
+   master-num_gpio_chipselect = nb;
+
+   for (i = 0; i  nb; i++)
+   cs[i] = of_get_named_gpio(np, ncs-gpios, i);
+
+   return 0;
+}
+
 /**
  * spi_register_master - register SPI master controller
  * @master: initialized master, originally from spi_alloc_master()
@@ -593,6 +632,10 @@ int

Re: [PATCH 2/3 v3] of_spi: add generic binding support to specify ncs gpio

2012-03-02 Thread Jean-Christophe PLAGNIOL-VILLARD
On 19:32 Fri 02 Mar , Grant Likely wrote:
 On Fri,  2 Mar 2012 11:03:06 +0100, Jean-Christophe PLAGNIOL-VILLARD 
 plagn...@jcrosoft.com wrote:
  This will allow to use gpio for chip select with no modification in the
  driver binding
  
  When use the ncs-gpios, the gpio number will be passed via the 
  controller_data
  and the number of chip select will automatically increased.
  
  Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
  Cc: devicetree-disc...@lists.ozlabs.org
  Cc: spi-devel-general@lists.sourceforge.net
  Cc: Grant Likely grant.lik...@secretlab.ca
  ---
  v3:
  use devm_kzalloc
  
  v2:
  specify the gpio array at controller level
  
  Best Regards,
  J.
   Documentation/devicetree/bindings/spi/spi-bus.txt |6 +++
   drivers/spi/spi.c |   49 
  +++-
   include/linux/spi/spi.h   |5 ++
   3 files changed, 57 insertions(+), 3 deletions(-)
  
  diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
  b/Documentation/devicetree/bindings/spi/spi-bus.txt
  index e782add..5a24729 100644
  --- a/Documentation/devicetree/bindings/spi/spi-bus.txt
  +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
  @@ -12,6 +12,7 @@ The SPI master node requires the following properties:
   - #size-cells - should be zero.
   - compatible  - name of SPI bus controller following generic names
  recommended practice.
  +- ncs-gpios   - (optional) gpios chip select.
 
 ncs?  What does the 'n' stand for?
for not chipslelect will remove
 
   No other properties are required in the SPI bus node.  It is assumed
   that a driver for an SPI bus device will understand that it is an SPI bus.
   However, the binding does not attempt to define the specific method for
  @@ -21,6 +22,8 @@ assumption that board specific platform code will be used 
  to manage
   chip selects.  Individual drivers can define additional properties to
   support describing the chip select layout.
   
  +If ncs-gpios is used the number of chip select will automatically 
  increased.
  +
   SPI slave nodes must be children of the SPI master node and can
   contain the following properties.
   - reg - (required) chip select address of device.
  @@ -34,6 +37,9 @@ contain the following properties.
   - spi-cs-high - (optional) Empty property indicating device requires
  chip select active high
   
  +If a gpio chipselect is used for the SPI slave the gpio number will be 
  passed
  +via the controller_data
  +
   SPI example for an MPC5200 SPI bus:
  spi@f00 {
  #address-cells = 1;
  diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
  index e2f4ca0..f3df51f 100644
  --- a/drivers/spi/spi.c
  +++ b/drivers/spi/spi.c
  @@ -28,6 +28,7 @@
   #include linux/mod_devicetable.h
   #include linux/spi/spi.h
   #include linux/of_spi.h
  +#include linux/of_gpio.h
   #include linux/pm_runtime.h
   #include linux/export.h
   
  @@ -339,15 +340,16 @@ EXPORT_SYMBOL_GPL(spi_alloc_device);
   int spi_add_device(struct spi_device *spi)
   {
  static DEFINE_MUTEX(spi_add_lock);
  -   struct device *dev = spi-master-dev.parent;
  +   struct spi_master *master = spi-master;
  +   struct device *dev = master-dev.parent;
  struct device *d;
  int status;
   
  /* Chipselects are numbered 0..max; validate. */
  -   if (spi-chip_select = spi-master-num_chipselect) {
  +   if (spi-chip_select = master-num_chipselect) {
  dev_err(dev, cs%d = max %d\n,
  spi-chip_select,
  -   spi-master-num_chipselect);
  +   master-num_chipselect);
  return -EINVAL;
  }
   
  @@ -371,6 +373,13 @@ int spi_add_device(struct spi_device *spi)
  goto done;
  }
   
  +   if (master-num_gpio_chipselect 
  +   spi-chip_select = master-first_gpio_chipselect) {
  +   int num = spi-chip_select - master-first_gpio_chipselect;
 
 I'd rather see an unconditional array of gpios; which only get used if a
 valid gpio number is assigned.

I want to have this transparent for the driver

I don't want it to manage this. The driver just need to known it's cs-gpio
and wich one
 
  +
  +   spi-controller_data = (void*)master-chipselect_gpios[num];
 
 Controller_data cannot be used here since it is provided for use
 by the controller driver.
a new entry cs_gpio in the spi_device

 
  +   }
  +
  /* Drivers may modify this initial i/o setup, but will
   * normally rely on the device being setup.  Devices
   * using SPI_CS_HIGH can't coexist well otherwise...
  @@ -562,6 +571,36 @@ struct spi_master *spi_alloc_master(struct device 
  *dev, unsigned size)
   }
   EXPORT_SYMBOL_GPL(spi_alloc_master);
   
  +static int of_spi_register_master(struct spi_master *master)
  +{
  +   int nb, i;
  +   int *cs;
  +   struct device_node *np = master-dev.of_node;
  +
  +   if (!np

Re: [PATCH 3/3] spi/atmel: add DT support

2012-03-02 Thread Jean-Christophe PLAGNIOL-VILLARD
On 19:39 Fri 02 Mar , Grant Likely wrote:
 On Thu,  9 Feb 2012 17:14:37 +0100, Jean-Christophe PLAGNIOL-VILLARD 
 plagn...@jcrosoft.com wrote:
  the atmel_spi use only gpio for chip select
  
  Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
  Cc: devicetree-disc...@lists.ozlabs.org
  Cc: spi-devel-general@lists.sourceforge.net
 
 Looks good to me; applied.
please wait it's need to patch that manage the cs-gpio

will resend a new version soon

Best Regards,
J.

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 2/3] of_spi: add generic binding support to specify ncs gpio

2012-02-20 Thread Jean-Christophe PLAGNIOL-VILLARD
Hi Grant,

can I have a feedback

the Atmel SPI depend on it

Best Regards,
J.
On 05:24 Tue 14 Feb , Jean-Christophe PLAGNIOL-VILLARD wrote:
 Hi Grant,
 
   ping
 
 Best Regards,
 J.
 On 17:14 Thu 09 Feb , Jean-Christophe PLAGNIOL-VILLARD wrote:
  This will allow to use gpio for chip select with no modification in the
  driver binding
  
  When use the ncs-gpios, the gpio number will be passed via the 
  controller_data
  and the number of chip select will automatically increased.
  
  Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
  Cc: devicetree-disc...@lists.ozlabs.org
  Cc: spi-devel-general@lists.sourceforge.net
  ---
   Documentation/devicetree/bindings/spi/spi-bus.txt |6 +++
   drivers/of/of_spi.c   |   27 ---
   drivers/spi/spi.c |   51 
  +++-
   include/linux/spi/spi.h   |5 ++
   4 files changed, 78 insertions(+), 11 deletions(-)
  
  diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
  b/Documentation/devicetree/bindings/spi/spi-bus.txt
  index e782add..5a24729 100644
  --- a/Documentation/devicetree/bindings/spi/spi-bus.txt
  +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
  @@ -12,6 +12,7 @@ The SPI master node requires the following properties:
   - #size-cells - should be zero.
   - compatible  - name of SPI bus controller following generic names
  recommended practice.
  +- ncs-gpios   - (optional) gpios chip select.
   No other properties are required in the SPI bus node.  It is assumed
   that a driver for an SPI bus device will understand that it is an SPI bus.
   However, the binding does not attempt to define the specific method for
  @@ -21,6 +22,8 @@ assumption that board specific platform code will be used 
  to manage
   chip selects.  Individual drivers can define additional properties to
   support describing the chip select layout.
   
  +If ncs-gpios is used the number of chip select will automatically 
  increased.
  +
   SPI slave nodes must be children of the SPI master node and can
   contain the following properties.
   - reg - (required) chip select address of device.
  @@ -34,6 +37,9 @@ contain the following properties.
   - spi-cs-high - (optional) Empty property indicating device requires
  chip select active high
   
  +If a gpio chipselect is used for the SPI slave the gpio number will be 
  passed
  +via the controller_data
  +
   SPI example for an MPC5200 SPI bus:
  spi@f00 {
  #address-cells = 1;
  diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
  index 6dbc074..0d41407 100644
  --- a/drivers/of/of_spi.c
  +++ b/drivers/of/of_spi.c
  @@ -12,6 +12,7 @@
   #include linux/spi/spi.h
   #include linux/of_irq.h
   #include linux/of_spi.h
  +#include linux/of_gpio.h
   
   /**
* of_register_spi_devices - Register child devices onto the SPI bus
  @@ -27,6 +28,7 @@ void of_register_spi_devices(struct spi_master *master)
  const __be32 *prop;
  int rc;
  int len;
  +   int ncs_pin;
   
  if (!master-dev.of_node)
  return;
  @@ -50,15 +52,24 @@ void of_register_spi_devices(struct spi_master *master)
  continue;
  }
   
  -   /* Device address */
  -   prop = of_get_property(nc, reg, len);
  -   if (!prop || len  sizeof(*prop)) {
  -   dev_err(master-dev, %s has no 'reg' property\n,
  -   nc-full_name);
  -   spi_dev_put(spi);
  -   continue;
  +   /* ncs gpio */
  +   ncs_pin = of_get_named_gpio(nc, ncs-gpio, 0);
  +
  +   if (gpio_is_valid(ncs_pin)) {
  +   spi-controller_data = (void *)ncs_pin;
  +   spi-chip_select = master-num_chipselect;
  +   master-num_chipselect++;
  +   } else {
  +   /* Device address */
  +   prop = of_get_property(nc, reg, len);
  +   if (!prop || len  sizeof(*prop)) {
  +   dev_err(master-dev, %s has no 'reg' 
  property\n,
  +   nc-full_name);
  +   spi_dev_put(spi);
  +   continue;
  +   }
  +   spi-chip_select = be32_to_cpup(prop);
  }
  -   spi-chip_select = be32_to_cpup(prop);
   
  /* Mode (clock phase/polarity/etc.) */
  if (of_find_property(nc, spi-cpha, NULL))
  diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
  index e2f4ca0..1f5ffa6 100644
  --- a/drivers/spi/spi.c
  +++ b/drivers/spi/spi.c
  @@ -28,6 +28,7 @@
   #include linux/mod_devicetable.h
   #include linux/spi/spi.h
   #include linux/of_spi.h
  +#include linux/of_gpio.h
   #include linux/pm_runtime.h
   #include linux/export.h

Re: [PATCH 2/3] of_spi: add generic binding support to specify ncs gpio

2012-02-14 Thread Jean-Christophe PLAGNIOL-VILLARD
Hi Grant,

ping

Best Regards,
J.
On 17:14 Thu 09 Feb , Jean-Christophe PLAGNIOL-VILLARD wrote:
 This will allow to use gpio for chip select with no modification in the
 driver binding
 
 When use the ncs-gpios, the gpio number will be passed via the controller_data
 and the number of chip select will automatically increased.
 
 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
 Cc: devicetree-disc...@lists.ozlabs.org
 Cc: spi-devel-general@lists.sourceforge.net
 ---
  Documentation/devicetree/bindings/spi/spi-bus.txt |6 +++
  drivers/of/of_spi.c   |   27 ---
  drivers/spi/spi.c |   51 +++-
  include/linux/spi/spi.h   |5 ++
  4 files changed, 78 insertions(+), 11 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
 b/Documentation/devicetree/bindings/spi/spi-bus.txt
 index e782add..5a24729 100644
 --- a/Documentation/devicetree/bindings/spi/spi-bus.txt
 +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
 @@ -12,6 +12,7 @@ The SPI master node requires the following properties:
  - #size-cells - should be zero.
  - compatible  - name of SPI bus controller following generic names
   recommended practice.
 +- ncs-gpios   - (optional) gpios chip select.
  No other properties are required in the SPI bus node.  It is assumed
  that a driver for an SPI bus device will understand that it is an SPI bus.
  However, the binding does not attempt to define the specific method for
 @@ -21,6 +22,8 @@ assumption that board specific platform code will be used 
 to manage
  chip selects.  Individual drivers can define additional properties to
  support describing the chip select layout.
  
 +If ncs-gpios is used the number of chip select will automatically increased.
 +
  SPI slave nodes must be children of the SPI master node and can
  contain the following properties.
  - reg - (required) chip select address of device.
 @@ -34,6 +37,9 @@ contain the following properties.
  - spi-cs-high - (optional) Empty property indicating device requires
   chip select active high
  
 +If a gpio chipselect is used for the SPI slave the gpio number will be passed
 +via the controller_data
 +
  SPI example for an MPC5200 SPI bus:
   spi@f00 {
   #address-cells = 1;
 diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
 index 6dbc074..0d41407 100644
 --- a/drivers/of/of_spi.c
 +++ b/drivers/of/of_spi.c
 @@ -12,6 +12,7 @@
  #include linux/spi/spi.h
  #include linux/of_irq.h
  #include linux/of_spi.h
 +#include linux/of_gpio.h
  
  /**
   * of_register_spi_devices - Register child devices onto the SPI bus
 @@ -27,6 +28,7 @@ void of_register_spi_devices(struct spi_master *master)
   const __be32 *prop;
   int rc;
   int len;
 + int ncs_pin;
  
   if (!master-dev.of_node)
   return;
 @@ -50,15 +52,24 @@ void of_register_spi_devices(struct spi_master *master)
   continue;
   }
  
 - /* Device address */
 - prop = of_get_property(nc, reg, len);
 - if (!prop || len  sizeof(*prop)) {
 - dev_err(master-dev, %s has no 'reg' property\n,
 - nc-full_name);
 - spi_dev_put(spi);
 - continue;
 + /* ncs gpio */
 + ncs_pin = of_get_named_gpio(nc, ncs-gpio, 0);
 +
 + if (gpio_is_valid(ncs_pin)) {
 + spi-controller_data = (void *)ncs_pin;
 + spi-chip_select = master-num_chipselect;
 + master-num_chipselect++;
 + } else {
 + /* Device address */
 + prop = of_get_property(nc, reg, len);
 + if (!prop || len  sizeof(*prop)) {
 + dev_err(master-dev, %s has no 'reg' 
 property\n,
 + nc-full_name);
 + spi_dev_put(spi);
 + continue;
 + }
 + spi-chip_select = be32_to_cpup(prop);
   }
 - spi-chip_select = be32_to_cpup(prop);
  
   /* Mode (clock phase/polarity/etc.) */
   if (of_find_property(nc, spi-cpha, NULL))
 diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
 index e2f4ca0..1f5ffa6 100644
 --- a/drivers/spi/spi.c
 +++ b/drivers/spi/spi.c
 @@ -28,6 +28,7 @@
  #include linux/mod_devicetable.h
  #include linux/spi/spi.h
  #include linux/of_spi.h
 +#include linux/of_gpio.h
  #include linux/pm_runtime.h
  #include linux/export.h
  
 @@ -339,15 +340,16 @@ EXPORT_SYMBOL_GPL(spi_alloc_device);
  int spi_add_device(struct spi_device *spi)
  {
   static DEFINE_MUTEX(spi_add_lock);
 - struct device *dev = spi-master-dev.parent;
 + struct spi_master *master = spi

[PATCH 3/3] spi/atmel: add DT support

2012-02-09 Thread Jean-Christophe PLAGNIOL-VILLARD
the atmel_spi use only gpio for chip select

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
---
 .../devicetree/bindings/spi/spi_atmel.txt  |6 ++
 drivers/spi/spi-atmel.c|   12 +++-
 2 files changed, 17 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt

diff --git a/Documentation/devicetree/bindings/spi/spi_atmel.txt 
b/Documentation/devicetree/bindings/spi/spi_atmel.txt
new file mode 100644
index 000..7ec3d8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi_atmel.txt
@@ -0,0 +1,6 @@
+Atmel SPI device
+
+Required properties:
+- compatible : should be atmel,at91rm9200-spi.
+- reg: Address and length of the register set for the device
+- interrupts: Should contain macb interrupt
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 16d6a83..7bcd11f 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -19,6 +19,7 @@
 #include linux/interrupt.h
 #include linux/spi/spi.h
 #include linux/slab.h
+#include linux/of.h
 
 #include asm/io.h
 #include mach/board.h
@@ -938,7 +939,7 @@ static int __devinit atmel_spi_probe(struct platform_device 
*pdev)
master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
 
master-bus_num = pdev-id;
-   master-num_chipselect = 4;
+   master-num_chipselect = master-dev.of_node ? 0 : 4;
master-setup = atmel_spi_setup;
master-transfer = atmel_spi_transfer;
master-cleanup = atmel_spi_cleanup;
@@ -1064,11 +1065,20 @@ static int atmel_spi_resume(struct platform_device 
*pdev)
 #defineatmel_spi_resumeNULL
 #endif
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_spi_dt_ids[] = {
+   { .compatible = atmel,at91rm9200-spi },
+   { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
+#endif
 
 static struct platform_driver atmel_spi_driver = {
.driver = {
.name   = atmel_spi,
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(atmel_spi_dt_ids),
},
.suspend= atmel_spi_suspend,
.resume = atmel_spi_resume,
-- 
1.7.7


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 1/3] spi: move master of_node init to spi_alloc_master

2012-02-09 Thread Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
---
 drivers/spi/spi-altera.c  |3 ---
 drivers/spi/spi-fsl-lib.c |1 -
 drivers/spi/spi-imx.c |1 -
 drivers/spi/spi-mpc512x-psc.c |1 -
 drivers/spi/spi-mpc52xx-psc.c |1 -
 drivers/spi/spi-mpc52xx.c |1 -
 drivers/spi/spi-oc-tiny.c |1 -
 drivers/spi/spi-ppc4xx.c  |1 -
 drivers/spi/spi-pxa2xx-pci.c  |1 -
 drivers/spi/spi-pxa2xx.c  |1 -
 drivers/spi/spi-tegra.c   |1 -
 drivers/spi/spi-xilinx.c  |1 -
 drivers/spi/spi.c |1 +
 13 files changed, 1 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c
index c00d00e..ac6badc 100644
--- a/drivers/spi/spi-altera.c
+++ b/drivers/spi/spi-altera.c
@@ -270,9 +270,6 @@ static int __devinit altera_spi_probe(struct 
platform_device *pdev)
if (err)
goto exit;
}
-   /* find platform data */
-   if (!platp)
-   hw-bitbang.master-dev.of_node = pdev-dev.of_node;
 
/* register our spi controller */
err = spi_bitbang_start(hw-bitbang);
diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c
index 2674fad..810aa01 100644
--- a/drivers/spi/spi-fsl-lib.c
+++ b/drivers/spi/spi-fsl-lib.c
@@ -133,7 +133,6 @@ int mpc8xxx_spi_probe(struct device *dev, struct resource 
*mem,
 
master-transfer = mpc8xxx_spi_transfer;
master-cleanup = mpc8xxx_spi_cleanup;
-   master-dev.of_node = dev-of_node;
 
mpc8xxx_spi = spi_master_get_devdata(master);
mpc8xxx_spi-dev = dev;
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index c6e697f..bebcd01 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -860,7 +860,6 @@ static int __devinit spi_imx_probe(struct platform_device 
*pdev)
 
spi_imx-devtype_data-intctrl(spi_imx, 0);
 
-   master-dev.of_node = pdev-dev.of_node;
ret = spi_bitbang_start(spi_imx-bitbang);
if (ret) {
dev_err(pdev-dev, bitbang start failed with %d\n, ret);
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index 4c63f77..583d0c5 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -441,7 +441,6 @@ static int __devinit mpc512x_psc_spi_do_probe(struct device 
*dev, u32 regaddr,
master-setup = mpc512x_psc_spi_setup;
master-transfer = mpc512x_psc_spi_transfer;
master-cleanup = mpc512x_psc_spi_cleanup;
-   master-dev.of_node = dev-of_node;
 
tempp = ioremap(regaddr, size);
if (!tempp) {
diff --git a/drivers/spi/spi-mpc52xx-psc.c b/drivers/spi/spi-mpc52xx-psc.c
index 6604715..502c953 100644
--- a/drivers/spi/spi-mpc52xx-psc.c
+++ b/drivers/spi/spi-mpc52xx-psc.c
@@ -398,7 +398,6 @@ static int __devinit mpc52xx_psc_spi_do_probe(struct device 
*dev, u32 regaddr,
master-setup = mpc52xx_psc_spi_setup;
master-transfer = mpc52xx_psc_spi_transfer;
master-cleanup = mpc52xx_psc_spi_cleanup;
-   master-dev.of_node = dev-of_node;
 
mps-psc = ioremap(regaddr, size);
if (!mps-psc) {
diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c
index 57633d9..1a099f8 100644
--- a/drivers/spi/spi-mpc52xx.c
+++ b/drivers/spi/spi-mpc52xx.c
@@ -437,7 +437,6 @@ static int __devinit mpc52xx_spi_probe(struct 
platform_device *op)
master-setup = mpc52xx_spi_setup;
master-transfer = mpc52xx_spi_transfer;
master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
-   master-dev.of_node = op-dev.of_node;
 
dev_set_drvdata(op-dev, master);
 
diff --git a/drivers/spi/spi-oc-tiny.c b/drivers/spi/spi-oc-tiny.c
index 698018f..d030857 100644
--- a/drivers/spi/spi-oc-tiny.c
+++ b/drivers/spi/spi-oc-tiny.c
@@ -266,7 +266,6 @@ static int __devinit tiny_spi_of_probe(struct 
platform_device *pdev)
if (hw-gpio_cs[i]  0)
return -ENODEV;
}
-   hw-bitbang.master-dev.of_node = pdev-dev.of_node;
val = of_get_property(pdev-dev.of_node,
  clock-frequency, len);
if (val  len = sizeof(__be32))
diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index 98ec532..1aa8b33 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -406,7 +406,6 @@ static int __init spi_ppc4xx_of_probe(struct 
platform_device *op)
master = spi_alloc_master(dev, sizeof *hw);
if (master == NULL)
return -ENOMEM;
-   master-dev.of_node = np;
dev_set_drvdata(dev, master);
hw = spi_master_get_devdata(master);
hw-master = spi_master_get(master);
diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
index 8caa07d..5012979 100644
--- a/drivers/spi/spi-pxa2xx-pci.c
+++ b/drivers/spi/spi-pxa2xx-pci.c
@@ -90,7

[PATCH 2/3] of_spi: add generic binding support to specify ncs gpio

2012-02-09 Thread Jean-Christophe PLAGNIOL-VILLARD
This will allow to use gpio for chip select with no modification in the
driver binding

When use the ncs-gpios, the gpio number will be passed via the controller_data
and the number of chip select will automatically increased.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
---
 Documentation/devicetree/bindings/spi/spi-bus.txt |6 +++
 drivers/of/of_spi.c   |   27 ---
 drivers/spi/spi.c |   51 +++-
 include/linux/spi/spi.h   |5 ++
 4 files changed, 78 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
b/Documentation/devicetree/bindings/spi/spi-bus.txt
index e782add..5a24729 100644
--- a/Documentation/devicetree/bindings/spi/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
@@ -12,6 +12,7 @@ The SPI master node requires the following properties:
 - #size-cells - should be zero.
 - compatible  - name of SPI bus controller following generic names
recommended practice.
+- ncs-gpios   - (optional) gpios chip select.
 No other properties are required in the SPI bus node.  It is assumed
 that a driver for an SPI bus device will understand that it is an SPI bus.
 However, the binding does not attempt to define the specific method for
@@ -21,6 +22,8 @@ assumption that board specific platform code will be used to 
manage
 chip selects.  Individual drivers can define additional properties to
 support describing the chip select layout.
 
+If ncs-gpios is used the number of chip select will automatically increased.
+
 SPI slave nodes must be children of the SPI master node and can
 contain the following properties.
 - reg - (required) chip select address of device.
@@ -34,6 +37,9 @@ contain the following properties.
 - spi-cs-high - (optional) Empty property indicating device requires
chip select active high
 
+If a gpio chipselect is used for the SPI slave the gpio number will be passed
+via the controller_data
+
 SPI example for an MPC5200 SPI bus:
spi@f00 {
#address-cells = 1;
diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
index 6dbc074..0d41407 100644
--- a/drivers/of/of_spi.c
+++ b/drivers/of/of_spi.c
@@ -12,6 +12,7 @@
 #include linux/spi/spi.h
 #include linux/of_irq.h
 #include linux/of_spi.h
+#include linux/of_gpio.h
 
 /**
  * of_register_spi_devices - Register child devices onto the SPI bus
@@ -27,6 +28,7 @@ void of_register_spi_devices(struct spi_master *master)
const __be32 *prop;
int rc;
int len;
+   int ncs_pin;
 
if (!master-dev.of_node)
return;
@@ -50,15 +52,24 @@ void of_register_spi_devices(struct spi_master *master)
continue;
}
 
-   /* Device address */
-   prop = of_get_property(nc, reg, len);
-   if (!prop || len  sizeof(*prop)) {
-   dev_err(master-dev, %s has no 'reg' property\n,
-   nc-full_name);
-   spi_dev_put(spi);
-   continue;
+   /* ncs gpio */
+   ncs_pin = of_get_named_gpio(nc, ncs-gpio, 0);
+
+   if (gpio_is_valid(ncs_pin)) {
+   spi-controller_data = (void *)ncs_pin;
+   spi-chip_select = master-num_chipselect;
+   master-num_chipselect++;
+   } else {
+   /* Device address */
+   prop = of_get_property(nc, reg, len);
+   if (!prop || len  sizeof(*prop)) {
+   dev_err(master-dev, %s has no 'reg' 
property\n,
+   nc-full_name);
+   spi_dev_put(spi);
+   continue;
+   }
+   spi-chip_select = be32_to_cpup(prop);
}
-   spi-chip_select = be32_to_cpup(prop);
 
/* Mode (clock phase/polarity/etc.) */
if (of_find_property(nc, spi-cpha, NULL))
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index e2f4ca0..1f5ffa6 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -28,6 +28,7 @@
 #include linux/mod_devicetable.h
 #include linux/spi/spi.h
 #include linux/of_spi.h
+#include linux/of_gpio.h
 #include linux/pm_runtime.h
 #include linux/export.h
 
@@ -339,15 +340,16 @@ EXPORT_SYMBOL_GPL(spi_alloc_device);
 int spi_add_device(struct spi_device *spi)
 {
static DEFINE_MUTEX(spi_add_lock);
-   struct device *dev = spi-master-dev.parent;
+   struct spi_master *master = spi-master;
+   struct device *dev = master-dev.parent;
struct device *d;
int status;
 
/* Chipselects are numbered 0

Re: [PATCH v3] SPI: add CSR SiRFprimaII SPI controller driver

2012-02-08 Thread Jean-Christophe PLAGNIOL-VILLARD
 +
 +static int spi_sirfsoc_setup(struct spi_device *spi)
 +{
 + struct spi_bitbang *bitbang;
 + struct sirfsoc_spi *sspi;
 +
 + if (!spi-max_speed_hz)
 + return -EINVAL;
 +
 + sspi = spi_master_get_devdata(spi-master);
 + bitbang = sspi-bitbang;
why do you need this?
 +
 + if (!spi-bits_per_word)
 + spi-bits_per_word = 8;
 +
 + return spi_sirfsoc_setup_transfer(spi, NULL);
 +}

Best Regards,
J.

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 1/3] of_spi: add generic binding support to specify ncs gpio in the slave

2012-01-31 Thread Jean-Christophe PLAGNIOL-VILLARD
On 11:54 Mon 30 Jan , Grant Likely wrote:
 On Mon, Jan 30, 2012 at 04:27:49PM +0100, Jean-Christophe PLAGNIOL-VILLARD 
 wrote:
  This will allow to use gpio for chip select with no modification in the
  driver binding
  
  When use the ncs-gpio, the gpio number will be passed via the 
  controller_data
  and the number of chip select will automatically increased.
  
  When a spi master have only gpio chip select and is probe via dt check the
  number of chip select only when adding slave.
  
  Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
  Cc: devicetree-disc...@lists.ozlabs.org
  Cc: spi-devel-general@lists.sourceforge.net
  ---
   Documentation/devicetree/bindings/spi/spi-bus.txt |9 ++-
   drivers/of/of_spi.c   |   27 
  ++--
   drivers/spi/spi.c |2 +-
   3 files changed, 28 insertions(+), 10 deletions(-)
  
  diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt 
  b/Documentation/devicetree/bindings/spi/spi-bus.txt
  index e782add..1dccf35 100644
  --- a/Documentation/devicetree/bindings/spi/spi-bus.txt
  +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
  @@ -21,9 +21,16 @@ assumption that board specific platform code will be 
  used to manage
   chip selects.  Individual drivers can define additional properties to
   support describing the chip select layout.
   
  +If a gpio a specified to the SPI slave and no hardware chip select is 
  present
  +the reg property #address-cells and #size-cells are not needed.
  +
  +When use the ncs-gpio the gpio number will be passed via the 
  controller_data
  +and the number of chip select will automatically increased.
  +
   SPI slave nodes must be children of the SPI master node and can
   contain the following properties.
  -- reg - (required) chip select address of device.
  +- reg - (required if no ncs-gpio) chip select address of 
  device.
  +- ncs-gpio- (required if no reg) chip select gpio of device.
 
 There is already precedence for using gpios for chip selects.  The slave 
 device
 nodes remain as they are and it is the responsibility of the spi bus node
 to have a gpios property with a list of SS gpios.  The order of the gpios
 property should match the 'reg' address numbering of the child node.
 
 I don't like the idea of having multiple bindings for the slave address of
 the spi device (reg or ncs-gpio)
 
 What I want to see is generic SS helper code that spi bus drivers
 default to and correctly implement parsing of chip select gpios.
 
 I'm not going to apply this patch.
I do not want to see any of managment in the driver, I want a generic way to
specify only gpio cs and hw and gpio cs

spi1: spi@fffcc000 {
ncs-gpios = pioB 3 0;
status = okay;
mmc-slot@0 {
reg = 0;
compatible = mmc-spi-slot;
gpios = pioC 4 0   /* CD */
;
voltage-ranges = 3200 3400;
spi-max-frequency = 2000;
};
};

as on atmel spi we have no HW spi the cs is 0
if there is 3 hw cs the reg will be 3

we have 4 hw chipselect 3 enabled and one gpio chipselect

spi1: spi@fffcc000 {
ncs-hw =  0 1 1 1;
ncs-gpios = pioB 3 0;
status = okay;
mmc-slot@0 {
reg = 3;
compatible = mmc-spi-slot;
gpios = pioC 4 0   /* CD */
;
voltage-ranges = 3200 3400;
spi-max-frequency = 2000;
};
};

the idea is to pass the ncs_pin in the spi_device so the driver just have
to check if the chipselect is hw or gpio and then use it the right way

Best Regards,
J.

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 2/3] spi/atmel: add DT support

2012-01-30 Thread Jean-Christophe PLAGNIOL-VILLARD
the atmel_spi use only gpio for chip select

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: devicetree-disc...@lists.ozlabs.org
Cc: spi-devel-general@lists.sourceforge.net
---
 .../devicetree/bindings/spi/spi_atmel.txt  |6 ++
 drivers/spi/spi-atmel.c|   13 -
 2 files changed, 18 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi_atmel.txt

diff --git a/Documentation/devicetree/bindings/spi/spi_atmel.txt 
b/Documentation/devicetree/bindings/spi/spi_atmel.txt
new file mode 100644
index 000..7ec3d8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi_atmel.txt
@@ -0,0 +1,6 @@
+Atmel SPI device
+
+Required properties:
+- compatible : should be atmel,at91rm9200-spi.
+- reg: Address and length of the register set for the device
+- interrupts: Should contain macb interrupt
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 16d6a83..beeaa26 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -19,6 +19,7 @@
 #include linux/interrupt.h
 #include linux/spi/spi.h
 #include linux/slab.h
+#include linux/of.h
 
 #include asm/io.h
 #include mach/board.h
@@ -937,8 +938,9 @@ static int __devinit atmel_spi_probe(struct platform_device 
*pdev)
/* the spi-mode bits understood by this driver: */
master-mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
 
+   master-dev.of_node = pdev-dev.of_node;
master-bus_num = pdev-id;
-   master-num_chipselect = 4;
+   master-num_chipselect = master-dev.of_node ? 0 : 4;
master-setup = atmel_spi_setup;
master-transfer = atmel_spi_transfer;
master-cleanup = atmel_spi_cleanup;
@@ -1064,11 +1066,20 @@ static int atmel_spi_resume(struct platform_device 
*pdev)
 #defineatmel_spi_resumeNULL
 #endif
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_spi_dt_ids[] = {
+   { .compatible = atmel,at91rm9200-spi },
+   { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_spi_dt_ids);
+#endif
 
 static struct platform_driver atmel_spi_driver = {
.driver = {
.name   = atmel_spi,
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(atmel_spi_dt_ids),
},
.suspend= atmel_spi_suspend,
.resume = atmel_spi_resume,
-- 
1.7.7


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 1/1] atmel/spi: fix missing probe during the switch to module_platform_driver

2011-11-03 Thread Jean-Christophe PLAGNIOL-VILLARD
in commit 940ab889

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: Greg Kroah-Hartman gre...@suse.de
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Nicolas Ferre nicolas.fe...@atmel.com
---
 arch/arm/mach-at91/include/mach/at91_aic.h |2 +-
 drivers/spi/spi-atmel.c|1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/at91_aic.h 
b/arch/arm/mach-at91/include/mach/at91_aic.h
index 4b0a57e..f163bb6 100644
--- a/arch/arm/mach-at91/include/mach/at91_aic.h
+++ b/arch/arm/mach-at91/include/mach/at91_aic.h
@@ -20,7 +20,7 @@
 extern void __iomem *at91_aic_base;
 
 #define at91_aic_read(field) \
-   __raw_read(at91_aic_base + field)
+   __raw_readl(at91_aic_base + field)
 
 #define at91_aic_write(field, value) \
__raw_writel(value, at91_aic_base + field);
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 79665e2..a691240 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1072,6 +1072,7 @@ static struct platform_driver atmel_spi_driver = {
},
.suspend= atmel_spi_suspend,
.resume = atmel_spi_resume,
+   .probe  = atmel_spi_probe,
.remove = __exit_p(atmel_spi_remove),
 };
 module_platform_driver(atmel_spi_driver);
-- 
1.7.7


--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH v2] atmel/spi: fix missing probe during the switch to module_platform_driver

2011-11-03 Thread Jean-Christophe PLAGNIOL-VILLARD
in commit 940ab889

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: Greg Kroah-Hartman gre...@suse.de
Cc: Grant Likely grant.lik...@secretlab.ca
---
v2:

remove local work

Best Regards,
J.
 drivers/spi/spi-atmel.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 79665e2..a691240 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1072,6 +1072,7 @@ static struct platform_driver atmel_spi_driver = {
},
.suspend= atmel_spi_suspend,
.resume = atmel_spi_resume,
+   .probe  = atmel_spi_probe,
.remove = __exit_p(atmel_spi_remove),
 };
 module_platform_driver(atmel_spi_driver);
-- 
1.7.7


--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH v2] atmel/spi: fix missing probe during the switch to module_platform_driver

2011-11-03 Thread Jean-Christophe PLAGNIOL-VILLARD
On 15:18 Thu 03 Nov , Russell King - ARM Linux wrote:
 On Thu, Nov 03, 2011 at 11:10:42PM +0800, Jean-Christophe PLAGNIOL-VILLARD 
 wrote:
  in commit 940ab889
 
 This kind of commit message is, frankly, utter crap.
 
 With all the complaints that have been on this mailing list about raw
 commit IDs without saying what the commit was, it completely astounds
 me that someone in your position (allegedly a co-maintainer of a SoC)
 would make such an error.
 
 Please generate a much better commit message.  Maybe something like:
 
 
 Commit 940ab889 (blah blah blah) converted this driver to use
 module_platform_driver, but due to the use of platform_driver_probe(),
 this resulted in the call to atmel_spi_probe being lost.  Place the
 call to this function into the driver structure.
 
 As atmel_spi_probe is marked __init, this will cause a section mismatch
 error, so ... fill this in for the point below
 
 
 And, you're forgetting to fix this properly (maybe you don't care about
 section mismatch errors - are you going to create another patch for that
 as well?)  Did you even build-test this patch and pay attention to any
 warnings issued, or were you just pleased to get a zImage at the end?
 
 static int __init atmel_spi_probe(struct platform_device *pdev)
 
 __init is not compatible with having a pointer in the platform driver
 structure.  It needs to be __devinit.
this is an other fix I do not want to fix 2 issue in one commit and I do care
of mismatch erros I fix them all the time I send patch for some rm9200 few
weeks ago

Best Regards,
J.

--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 2/2] atmel/spi: fix section missmatch

2011-11-03 Thread Jean-Christophe PLAGNIOL-VILLARD
atmel_spi_probe is marked __init where it's supposed to be __devinit

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: Russell King - ARM Linux li...@arm.linux.org.uk
---
 drivers/spi/spi-atmel.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 3cd4f49..1525262 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -907,7 +907,7 @@ static void atmel_spi_cleanup(struct spi_device *spi)
 
 /*-*/
 
-static int __init atmel_spi_probe(struct platform_device *pdev)
+static int __devinit atmel_spi_probe(struct platform_device *pdev)
 {
struct resource *regs;
int irq;
-- 
1.7.7


--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 1/2 v4] atmel/spi: fix missing probe

2011-11-03 Thread Jean-Christophe PLAGNIOL-VILLARD
Commit 940ab889 drivercore: Add helper macro for platform_driver boilerplate
converted this driver to use module_platform_driver, but due to the use
of platform_driver_probe(), this resulted in the call to atmel_spi_probe being
lost. Place the call to this function into the driver structure.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: Greg Kroah-Hartman gre...@suse.de
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Russell King - ARM Linux li...@arm.linux.org.uk
---
v4:

fix typo when editing commit message
 drivers/spi/spi-atmel.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 79665e2..3cd4f49 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1072,6 +1072,7 @@ static struct platform_driver atmel_spi_driver = {
},
.suspend= atmel_spi_suspend,
.resume = atmel_spi_resume,
+   .probe  = atmel_spi_probe,
.remove = __exit_p(atmel_spi_remove),
 };
 module_platform_driver(atmel_spi_driver);
-- 
1.7.7


--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH v2] atmel/spi: fix missing probe during the switch to module_platform_driver

2011-11-03 Thread Jean-Christophe PLAGNIOL-VILLARD
On 17:43 Thu 03 Nov , Russell King - ARM Linux wrote:
 On Thu, Nov 03, 2011 at 05:51:13PM +0100, Jean-Christophe PLAGNIOL-VILLARD 
 wrote:
  this is an other fix I do not want to fix 2 issue in one commit and I do 
  care
  of mismatch erros I fix them all the time I send patch for some rm9200 few
  weeks ago
 
 It should not be a separate patch - it's all to do with fixing the
 original problem.

yes when we was supposed to swtch to module_platform_driver we use the .probe
which is suposed to be __devinit in this case but I was prefering to do it in
2 steps

as you wish and I found that the remove is __exit and supposed to be __devexit

Best Regards,
J.

--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 1/2] atmel/spi: fix missing probe

2011-11-03 Thread Jean-Christophe PLAGNIOL-VILLARD
On 18:50 Thu 03 Nov , Daniel Mack wrote:
 On 11/03/2011 06:41 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
 Commit 940ab889 drivercore: Add helper macro for platform_driver 
 boilerplate
 converted this driver to use module_platform_driver, but due to the use
 of platform_driver_probe(), this resulted in the call to atmel_spi_probe 
 being
 lost. Place the call to this function into the driver structure.
 
 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARDplagn...@jcrosoft.com
 Cc: Greg Kroah-Hartmangre...@suse.de
 Cc: Grant Likelygrant.lik...@secretlab.ca
 Cc: Russell King - ARM Linuxli...@arm.linux.org.uk
 ---
 v3:
 
  update commit message
   drivers/spi/spi-atmel.c |1 +
   1 files changed, 1 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
 index 79665e2..3cd4f49 100644
 --- a/drivers/spi/spi-atmel.c
 +++ b/drivers/spi/spi-atmel.c
 @@ -1072,6 +1072,7 @@ static struct platform_driver atmel_spi_driver = {
  },
  .suspend= atmel_spi_suspend,
  .resume = atmel_spi_resume,
 +.prove  = atmel_spi_probe,
  ^
 
 This is certainly a typo. Didn't you even compile-test this?
I did I make the typo when editing the commit message before sending the
patch
Dame

Best Regards,
J.

--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH 1/2] atmel/spi: fix missing probe

2011-11-03 Thread Jean-Christophe PLAGNIOL-VILLARD
Commit 940ab889 drivercore: Add helper macro for platform_driver boilerplate
converted this driver to use module_platform_driver, but due to the use
of platform_driver_probe(), this resulted in the call to atmel_spi_probe being
lost. Place the call to this function into the driver structure.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: Greg Kroah-Hartman gre...@suse.de
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Russell King - ARM Linux li...@arm.linux.org.uk
---
v3:

update commit message
 drivers/spi/spi-atmel.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 79665e2..3cd4f49 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1072,6 +1072,7 @@ static struct platform_driver atmel_spi_driver = {
},
.suspend= atmel_spi_suspend,
.resume = atmel_spi_resume,
+   .prove  = atmel_spi_probe,
.remove = __exit_p(atmel_spi_remove),
 };
 module_platform_driver(atmel_spi_driver);
-- 
1.7.7


--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH v5] atmel/spi: fix missing probe

2011-11-03 Thread Jean-Christophe PLAGNIOL-VILLARD
Commit 940ab889 drivercore: Add helper macro for platform_driver boilerplate
converted this driver to use module_platform_driver, but due to the use
of platform_driver_probe(), this resulted in the call to atmel_spi_probe being
lost. Place the call to this function into the driver structure.

fix section missmatch

atmel_spi_probe is marked __init where it's supposed to be __devinit
atmel_spi_remove is marked __exit where it's supposed to be __devexit

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
Cc: Greg Kroah-Hartman gre...@suse.de
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Russell King - ARM Linux li...@arm.linux.org.uk
---
V5:

do it in in patch

Best Regards,
J.
 drivers/spi/spi-atmel.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 79665e2..16d6a83 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -907,7 +907,7 @@ static void atmel_spi_cleanup(struct spi_device *spi)
 
 /*-*/
 
-static int __init atmel_spi_probe(struct platform_device *pdev)
+static int __devinit atmel_spi_probe(struct platform_device *pdev)
 {
struct resource *regs;
int irq;
@@ -1003,7 +1003,7 @@ out_free:
return ret;
 }
 
-static int __exit atmel_spi_remove(struct platform_device *pdev)
+static int __devexit atmel_spi_remove(struct platform_device *pdev)
 {
struct spi_master   *master = platform_get_drvdata(pdev);
struct atmel_spi*as = spi_master_get_devdata(master);
@@ -1072,6 +1072,7 @@ static struct platform_driver atmel_spi_driver = {
},
.suspend= atmel_spi_suspend,
.resume = atmel_spi_resume,
+   .probe  = atmel_spi_probe,
.remove = __exit_p(atmel_spi_remove),
 };
 module_platform_driver(atmel_spi_driver);
-- 
1.7.7


--
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 4/7] at91: remove non used at91_spi.h

2011-07-17 Thread Jean-Christophe PLAGNIOL-VILLARD
On 16:00 Sat 16 Jul , Detlef Vollmann wrote:
 On 07/16/11 13:56, Wolfram Sang wrote:
 
 About the SPI driver:
  From Documentation/spi/spi-summary:
 At this writing, Linux has no slave side programming interface.
 So there's no SPI framwork that covers the slave side.
 This what I mean use the SPI framework and add the SPI Slave support there
 
 [CCing spi-devel]
 
 If you talk about SPI slaves, be sure to have read Grant's comments in
 
 http://thread.gmane.org/gmane.linux.kernel.spi.devel/7401
 
 to see what would be needed for slave support.
 I completely agree with Gran't comments here.
 
 Short note: Would be
 seperate subsystem, master subsystem is of limited use. I think a few
 slave-drivers would be nice to evaluate, so one can get a feeling if a
 subsystem makes sense and if so, how it could look like.
 
 Detlef, have you posted your slave driver so far?
 No, and I didn't plan to do so.
 Not because I don't want to publish it, if you want to look at it,
 I'm happy to send the driver.
 But I don't think it makes much sense to put my driver into mainline
 Linux.
 The reason for this is very simple: the protocol is specific for this
 hardware, and the driver needs this specific protocol.
 The Atmel hardware is not able to maintain information about frame
 ends when running in DMA mode, so we need to put the length of the
 frame to the beginning of the frame, and also need to put in some
 extra information to be able to re-sync in case of transmission errors.
 
 So this driver is very specific for this hardware, and I wrote SPI
 slave drivers in the past for other hardware that were also very
 specific.  I really doubt that an SPI slave framework really makes
 sense.
 
 And that's the reason why I'm keen that the hardware description
 headers are available to out-of-tree drivers.
So I'm sorry but this is clear I'm not going to keep the header
out-of-tree drivers are not an enough reason to keep it

Best Regards,
J.

--
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on Lean Startup 
Secrets Revealed. This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH 6/6] atmel_spi: fix warning In function 'atmel_spi_dma_map_xfer'

2010-11-20 Thread Jean-Christophe PLAGNIOL-VILLARD
On 14:59 Sat 20 Nov , David Brownell wrote:
 
 
 --- On Sat, 11/20/10, Uwe Kleine-König u.kleine-koe...@pengutronix.de wrote:
 
   +        void
  *nonconst_tx = (void *)xfer-tx_buf; /* shut up gcc */
 
 Reads like a bad patch to me. Fix the bug,
 don't just silence GCC.  Or at least use
 a better comment mentioning a constness
 cast problems).

ok I change the comment

Best Regards,
J.

--
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