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

2012-08-03 Thread Marek Vasut
Dear Fabio Estevam, > On Fri, Aug 3, 2012 at 10:38 AM, Thomas Petazzoni > > wrote: > > It sounds really strange to manipulate WAIT_FOR_CMD and WAIT_FOR_IRQ > > bits to adjust the chip select, and when reading the driver, it seemed > > suspicious to me. After going through the datasheet, indeed t

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

2012-08-03 Thread Marek Vasut
Dear Fabio Estevam, > On Fri, Aug 3, 2012 at 10:38 AM, Thomas Petazzoni > > wrote: > > It sounds really strange to manipulate WAIT_FOR_CMD and WAIT_FOR_IRQ > > bits to adjust the chip select, and when reading the driver, it seemed > > suspicious to me. After going through the datasheet, indeed t

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

2012-08-03 Thread Fabio Estevam
On Fri, Aug 3, 2012 at 10:38 AM, Thomas Petazzoni wrote: > > It sounds really strange to manipulate WAIT_FOR_CMD and WAIT_FOR_IRQ > bits to adjust the chip select, and when reading the driver, it seemed > suspicious to me. After going through the datasheet, indeed those bits > are the appropriate

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

2012-08-03 Thread Thomas Petazzoni
Marek, Le Mon, 23 Jul 2012 22:40:48 +0200, Marek Vasut a écrit : > +static uint32_t mxs_spi_cs_to_reg(unsigned cs) > +{ > + uint32_t select = 0; > + > + if (cs & 1) > + select |= BM_SSP_CTRL0_WAIT_FOR_CMD; > + if (cs & 2) > + select |= BM_SSP_CTRL0_WAIT_FOR_IR

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

2012-08-02 Thread Shawn Guo
On Thu, Aug 02, 2012 at 04:58:38PM +0200, Marek Vasut wrote: > Hm, this is spread across mxs. Shawn, is there any plan for PM implementation > for MXS ? > Near term, no. Long term, yes. -- Regards, Shawn -- Live Secu

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

2012-08-02 Thread Marek Vasut
Dear Mark Brown, > On Thu, Aug 02, 2012 at 04:58:38PM +0200, Marek Vasut wrote: > > > It'd be nice to only keep the clocks enabled while doing transfers but > > > again totally non-essential. > > > > Hm, this is spread across mxs. Shawn, is there any plan for PM > > implementation for MXS ? > >

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

2012-08-02 Thread Mark Brown
On Thu, Aug 02, 2012 at 04:58:38PM +0200, Marek Vasut wrote: > > It'd be nice to only keep the clocks enabled while doing transfers but > > again totally non-essential. > Hm, this is spread across mxs. Shawn, is there any plan for PM implementation > for MXS ? Take a look at s3c64xx - I did som

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

2012-08-02 Thread Marek Vasut
Dear Mark Brown, Thanks for the review! > On Mon, Jul 23, 2012 at 10:40:48PM +0200, Marek Vasut wrote: > > This is slightly reworked version of the SPI driver. > > Support for DT has been added and it's been converted > > to queued API. > > Looks reasonable overall. > > > + bits_per_word = de

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

2012-08-01 Thread Mark Brown
On Mon, Jul 23, 2012 at 10:40:48PM +0200, Marek Vasut wrote: > This is slightly reworked version of the SPI driver. > Support for DT has been added and it's been converted > to queued API. Looks reasonable overall. > + bits_per_word = dev->bits_per_word; > + if (t && t->bits_per_word) >

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-08-01 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 03:50:12PM +0800, Shawn Guo wrote: > On Tue, Jul 31, 2012 at 11:56:50PM -0700, Guenter Roeck wrote: > > Guess we are in violent agreement. The sequence would then either be > > master = spi_alloc_device(); > > The discussion is around spi_alloc_master rather than spi_al

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-08-01 Thread Shawn Guo
On Wed, Aug 01, 2012 at 09:38:07AM +0200, Lothar Waßmann wrote: > Shawn Guo writes: > > On Wed, Aug 01, 2012 at 08:45:19AM +0200, Marek Vasut wrote: > > > > I must be missing something. Why do almost all spi drivers call it in > > > > the > > > > error path, even if there is no call to spi_master

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-08-01 Thread Lothar Waßmann
Shawn Guo writes: > On Wed, Aug 01, 2012 at 08:45:19AM +0200, Marek Vasut wrote: > > > I must be missing something. Why do almost all spi drivers call it in the > > > error path, even if there is no call to spi_master_get ? > > > > To push the refcounting to 0, to deallocate the device, I'd say .

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-08-01 Thread Shawn Guo
On Tue, Jul 31, 2012 at 11:56:50PM -0700, Guenter Roeck wrote: > Guess we are in violent agreement. The sequence would then either be > master = spi_alloc_device(); The discussion is around spi_alloc_master rather than spi_alloc_device, isn't it? Regards, Shawn > ... > spi_mast

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-08-01 Thread Shawn Guo
On Wed, Aug 01, 2012 at 03:40:53PM +0800, Shawn Guo wrote: > On Wed, Aug 01, 2012 at 08:45:19AM +0200, Marek Vasut wrote: > > > I must be missing something. Why do almost all spi drivers call it in the > > > error path, even if there is no call to spi_master_get ? > > > > To push the refcounting

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-08-01 Thread Shawn Guo
On Wed, Aug 01, 2012 at 08:45:19AM +0200, Marek Vasut wrote: > > I must be missing something. Why do almost all spi drivers call it in the > > error path, even if there is no call to spi_master_get ? > > To push the refcounting to 0, to deallocate the device, I'd say ... > It's not going to work

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 08:45:19AM +0200, Marek Vasut wrote: > Dear Guenter Roeck, > > > On Wed, Aug 01, 2012 at 08:10:37AM +0200, Marek Vasut wrote: > > > Dear Shawn Guo, > > > > > > > On Tue, Jul 31, 2012 at 10:42:28PM -0700, Guenter Roeck wrote: > > > > > On Wed, Aug 01, 2012 at 01:58:56PM +08

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Marek Vasut
Dear Guenter Roeck, > On Wed, Aug 01, 2012 at 08:10:37AM +0200, Marek Vasut wrote: > > Dear Shawn Guo, > > > > > On Tue, Jul 31, 2012 at 10:42:28PM -0700, Guenter Roeck wrote: > > > > On Wed, Aug 01, 2012 at 01:58:56PM +0800, Shawn Guo wrote: > > > > > On Tue, Jul 31, 2012 at 10:29:47PM -0700, Gu

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Marek Vasut
Dear Guenter Roeck, > On Wed, Aug 01, 2012 at 11:16:15AM +0530, Shubhrajyoti Datta wrote: > > On Wed, Aug 1, 2012 at 10:59 AM, Guenter Roeck wrote: > > > On Wed, Aug 01, 2012 at 07:00:54AM +0200, Marek Vasut wrote: > > >> Dear Shawn Guo, > > >> > > >> > On Tue, Jul 31, 2012 at 08:35:59PM -0700,

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Marek Vasut
Dear Guenter Roeck, > On Wed, Aug 01, 2012 at 02:28:40PM +0800, Shawn Guo wrote: > > On Tue, Jul 31, 2012 at 10:42:28PM -0700, Guenter Roeck wrote: > > > On Wed, Aug 01, 2012 at 01:58:56PM +0800, Shawn Guo wrote: > > > > On Tue, Jul 31, 2012 at 10:29:47PM -0700, Guenter Roeck wrote: > > > > > Anyo

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 08:10:37AM +0200, Marek Vasut wrote: > Dear Shawn Guo, > > > On Tue, Jul 31, 2012 at 10:42:28PM -0700, Guenter Roeck wrote: > > > On Wed, Aug 01, 2012 at 01:58:56PM +0800, Shawn Guo wrote: > > > > On Tue, Jul 31, 2012 at 10:29:47PM -0700, Guenter Roeck wrote: > > > > > Anyo

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 11:16:15AM +0530, Shubhrajyoti Datta wrote: > On Wed, Aug 1, 2012 at 10:59 AM, Guenter Roeck wrote: > > On Wed, Aug 01, 2012 at 07:00:54AM +0200, Marek Vasut wrote: > >> Dear Shawn Guo, > >> > >> > On Tue, Jul 31, 2012 at 08:35:59PM -0700, Guenter Roeck wrote: > >> > > I th

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 02:28:40PM +0800, Shawn Guo wrote: > On Tue, Jul 31, 2012 at 10:42:28PM -0700, Guenter Roeck wrote: > > On Wed, Aug 01, 2012 at 01:58:56PM +0800, Shawn Guo wrote: > > > On Tue, Jul 31, 2012 at 10:29:47PM -0700, Guenter Roeck wrote: > > > > Anyone up for writing some patches

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Marek Vasut
Dear Shawn Guo, > On Tue, Jul 31, 2012 at 10:42:28PM -0700, Guenter Roeck wrote: > > On Wed, Aug 01, 2012 at 01:58:56PM +0800, Shawn Guo wrote: > > > On Tue, Jul 31, 2012 at 10:29:47PM -0700, Guenter Roeck wrote: > > > > Anyone up for writing some patches ? If not, I'll do it. > > > > > > Go ahea

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Shawn Guo
On Tue, Jul 31, 2012 at 10:42:28PM -0700, Guenter Roeck wrote: > On Wed, Aug 01, 2012 at 01:58:56PM +0800, Shawn Guo wrote: > > On Tue, Jul 31, 2012 at 10:29:47PM -0700, Guenter Roeck wrote: > > > Anyone up for writing some patches ? If not, I'll do it. > > > > > Go ahead. > > > Ok, will do. It i

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Shubhrajyoti Datta
On Wed, Aug 1, 2012 at 10:59 AM, Guenter Roeck wrote: > On Wed, Aug 01, 2012 at 07:00:54AM +0200, Marek Vasut wrote: >> Dear Shawn Guo, >> >> > On Tue, Jul 31, 2012 at 08:35:59PM -0700, Guenter Roeck wrote: >> > > I think the call to spi_master_put() triggers the call to >> > > spi_master_release(

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 01:58:56PM +0800, Shawn Guo wrote: > On Tue, Jul 31, 2012 at 10:29:47PM -0700, Guenter Roeck wrote: > > Anyone up for writing some patches ? If not, I'll do it. > > > Go ahead. > Ok, will do. It isn't that simple, actually, since at least some of the drivers also call spi_

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Shawn Guo
On Tue, Jul 31, 2012 at 10:29:47PM -0700, Guenter Roeck wrote: > Anyone up for writing some patches ? If not, I'll do it. > Go ahead. Regards, Shawn -- Live Security Virtual Conference Exclusive live event will cover al

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 07:00:54AM +0200, Marek Vasut wrote: > Dear Shawn Guo, > > > On Tue, Jul 31, 2012 at 08:35:59PM -0700, Guenter Roeck wrote: > > > I think the call to spi_master_put() triggers the call to > > > spi_master_release(). If so, kfree() would not be needed at all, and the > > > d

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Marek Vasut
Dear Shawn Guo, > On Tue, Jul 31, 2012 at 08:35:59PM -0700, Guenter Roeck wrote: > > I think the call to spi_master_put() triggers the call to > > spi_master_release(). If so, kfree() would not be needed at all, and the > > documentation is wrong. > > Also those drivers calling kfree in probe. L

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Marek Vasut
Dear Shawn Guo, > On Wed, Aug 01, 2012 at 04:31:04AM +0200, Marek Vasut wrote: > > > Couple of reasons for asking: No other SPI master driver calls it in > > > the remove function (unless I missed it), most drivers don't call it > > > in the probe function error path, and if I call it in the remov

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Shawn Guo
On Tue, Jul 31, 2012 at 08:35:59PM -0700, Guenter Roeck wrote: > I think the call to spi_master_put() triggers the call to > spi_master_release(). > If so, kfree() would not be needed at all, and the documentation is wrong. > Also those drivers calling kfree in probe. Regards, Shawn --

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Wed, Aug 01, 2012 at 11:53:36AM +0800, Shawn Guo wrote: > On Wed, Aug 01, 2012 at 04:31:04AM +0200, Marek Vasut wrote: > > > Couple of reasons for asking: No other SPI master driver calls it in the > > > remove function (unless I missed it), most drivers don't call it in the > > > probe function

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
Hi Marek, On Wed, Aug 01, 2012 at 04:31:04AM +0200, Marek Vasut wrote: > Dear Guenter Roeck, > > [...] > > > > +static int __devexit mxs_spi_remove(struct platform_device *pdev) > > > +{ > > > + struct spi_master *host; > > > + struct mxs_spi *spi; > > > + struct mxs_ssp *ssp; > > > + > > > + ho

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Shawn Guo
On Wed, Aug 01, 2012 at 04:31:04AM +0200, Marek Vasut wrote: > > Couple of reasons for asking: No other SPI master driver calls it in the > > remove function (unless I missed it), most drivers don't call it in the > > probe function error path, and if I call it in the remove function in a > > SPI m

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Shawn Guo
On Tue, Jul 31, 2012 at 01:53:00PM -0700, Guenter Roeck wrote: > > + spi_master_put(host); > > + kfree(host); > > + > > Is the kfree() here and in the probe function really necessary ? > The following is how the kerneldoc of spi_alloc_master says. * The caller is responsible for assigning

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Marek Vasut
Dear Guenter Roeck, [...] > > +static int __devexit mxs_spi_remove(struct platform_device *pdev) > > +{ > > + struct spi_master *host; > > + struct mxs_spi *spi; > > + struct mxs_ssp *ssp; > > + > > + host = platform_get_drvdata(pdev); > > + spi = spi_master_get_devdata(host); > > + s

Re: [06/10,V2] spi: Add SPI driver for mx233/mx28

2012-07-31 Thread Guenter Roeck
On Fri, Jul 06, 2012 at 06:17:25AM -, Marek Vasut wrote: > This is slightly reworked version of the SPI driver. > Support for DT has been added and it's been converted > to queued API. > > Based on previous attempt by: > Fabio Estevam > > Signed-off-by: Fabio Estevam > Signed-off-by: Marek

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

2012-07-23 Thread Marek Vasut
This is slightly reworked version of the SPI driver. Support for DT has been added and it's been converted to queued API. Based on previous attempt by: Fabio Estevam Signed-off-by: Fabio Estevam Signed-off-by: Marek Vasut Cc: Attila Kinali Cc: Chris Ball CC: Dong Aisheng Cc: Grant Likely C

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

2012-07-05 Thread Marek Vasut
This is slightly reworked version of the SPI driver. Support for DT has been added and it's been converted to queued API. Based on previous attempt by: Fabio Estevam Signed-off-by: Fabio Estevam Signed-off-by: Marek Vasut Cc: Chris Ball Cc: Detlev Zundel CC: Dong Aisheng Cc: Grant Likely C