[PATCH 1/2] MXS: Set I2C timing registers for mxs-i2c

2012-06-29 Thread Marek Vasut
This patch configures the I2C bus timing registers according to information passed via DT. Currently, 100kHz and 400kHz modes are supported. The TIMING2 register value is wrong in the documentation for i.MX28! This was found and fixed by: Shawn Guo shawn@linaro.org Signed-off-by: Marek

[PATCH 2/2] MXS: Implement DMA support into mxs-i2c

2012-06-29 Thread Marek Vasut
This patch implements DMA support into mxs-i2c. DMA transfers are now enabled via DT. The DMA operation is enabled by default. Signed-off-by: Marek Vasut ma...@denx.de Cc: Detlev Zundel d...@denx.de CC: Dong Aisheng b29...@freescale.com CC: Fabio Estevam fabio.este...@freescale.com Cc: Linux ARM

[PATCH] I2C: OMAP: fix runtime PM get/put balance on error

2012-06-29 Thread Shubhrajyoti D
ensure pm_runtime_put() is called, on pm_runtime_get_sync() failure. Without this, after a failed call, the runtime PM usecount will have been incremented, but not decremented causing the usecount to never reach zero after a failure. Thanks to Kevin for educating about it.

Re: [PATCH 1/2] MXS: Set I2C timing registers for mxs-i2c

2012-06-29 Thread Dong Aisheng
Hi Marek, On Fri, Jun 29, 2012 at 04:24:02PM +0800, Marek Vasut wrote: This patch configures the I2C bus timing registers according to information passed via DT. Currently, 100kHz and 400kHz modes are supported. The TIMING2 register value is wrong in the documentation for i.MX28! This was

Re: [PATCH 2/2] MXS: Implement DMA support into mxs-i2c

2012-06-29 Thread Dong Aisheng
On Fri, Jun 29, 2012 at 04:24:03PM +0800, Marek Vasut wrote: This patch implements DMA support into mxs-i2c. DMA transfers are now enabled via DT. The DMA operation is enabled by default. Signed-off-by: Marek Vasut ma...@denx.de Cc: Detlev Zundel d...@denx.de CC: Dong Aisheng

Re: [PATCH 2/2] MXS: Implement DMA support into mxs-i2c

2012-06-29 Thread Marek Vasut
Dear Dong Aisheng, On Fri, Jun 29, 2012 at 04:24:03PM +0800, Marek Vasut wrote: This patch implements DMA support into mxs-i2c. DMA transfers are now enabled via DT. The DMA operation is enabled by default. Signed-off-by: Marek Vasut ma...@denx.de Cc: Detlev Zundel d...@denx.de CC:

Re: [PATCH] i2c-s3c2410: Use plain pm_runtime_put()

2012-06-29 Thread Shubhrajyoti Datta
Hi Mark, On Thu, Jun 28, 2012 at 6:38 PM, Mark Brown broo...@opensource.wolfsonmicro.com wrote: There's no point in using _sync() as we don't really care if the suspend has completed immediately. Agree. Reviewed-by: Shubhrajyoti D shubhrajy...@ti.com Signed-off-by: Mark Brown

Re: [PATCH 1/2] MXS: Set I2C timing registers for mxs-i2c

2012-06-29 Thread Marek Vasut
Dear Dong Aisheng, Hi Marek, On Fri, Jun 29, 2012 at 04:24:02PM +0800, Marek Vasut wrote: This patch configures the I2C bus timing registers according to information passed via DT. Currently, 100kHz and 400kHz modes are supported. The TIMING2 register value is wrong in the

Re: [PATCH 2/2] MXS: Implement DMA support into mxs-i2c

2012-06-29 Thread Dong Aisheng
On Fri, Jun 29, 2012 at 05:30:16PM +0800, Marek Vasut wrote: Dear Dong Aisheng, On Fri, Jun 29, 2012 at 04:24:03PM +0800, Marek Vasut wrote: This patch implements DMA support into mxs-i2c. DMA transfers are now enabled via DT. The DMA operation is enabled by default.

Re: [PATCH 1/2] MXS: Set I2C timing registers for mxs-i2c

2012-06-29 Thread Dong Aisheng
On Fri, Jun 29, 2012 at 05:33:09PM +0800, Marek Vasut wrote: MX28 datasheet 27.5.2 - 27.5.4 ... there was a discussion about these in the thread under older patches. Those shall explain your questions below. Thanks for the info. Regards Dong Aisheng -- To unsubscribe from this list: send

Re: [PATCH 2/2] MXS: Implement DMA support into mxs-i2c

2012-06-29 Thread Marek Vasut
Dear Dong Aisheng, On Fri, Jun 29, 2012 at 05:30:16PM +0800, Marek Vasut wrote: Dear Dong Aisheng, On Fri, Jun 29, 2012 at 04:24:03PM +0800, Marek Vasut wrote: This patch implements DMA support into mxs-i2c. DMA transfers are now enabled via DT. The DMA operation is enabled by

Re: [PATCH 1/2] MXS: Set I2C timing registers for mxs-i2c

2012-06-29 Thread Marek Vasut
Dear Dong Aisheng, On Fri, Jun 29, 2012 at 05:33:09PM +0800, Marek Vasut wrote: MX28 datasheet 27.5.2 - 27.5.4 ... there was a discussion about these in the thread under older patches. Those shall explain your questions below. Thanks for the info. You're welcome. Hope it helps ;-)

[PATCHv3 02/17] i2c: omap: simplify num_bytes handling

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com trivial patch, no functional changes If the fifo is disabled or fifo_size is 0 the num_bytes is set to 1. Else it is set to fifo_size or in case of a draining interrupt the remaining bytes in the buff stat. So the zero check is redundant and can be safely

[PATCHv3 10/17] i2c: omap: ack IRQ in parts

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com According to flow diagrams on OMAP TRMs, we should ACK the IRQ as they happen. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c | 28 1 files changed, 16

[PATCHv3 17/17] i2c: omap: get rid of the complete label

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com we can ack stat and complete the command from the errata handling itself. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c | 16 +--- 1 files changed, 13 insertions(+), 3

[PATCHv3 15/17] i2c: omap: simplify IRQ exit path

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com instead of having multiple return points, use a goto statement to make that clearer. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c | 20 1 files changed, 8

[PATCHv3 05/17] i2c: omap: simplify omap_i2c_ack_stat()

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com stat BIT(1) is the same as BIT(1), so let's simplify things a bit by removing stat from all omap_i2c_ack_stat() calls. Code snippet (extremely simplified): if (stat NACK) { ... omap_i2c_ack_stat(dev, stat NACK); } if (stat RDR) { ...

[PATCHv3 03/17] i2c: omap: decrease indentation level on data handling

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com The patch intends to decrease the indentation level on the data handling by using the fact that else of if (dev-buf_len) is same as if (!dev-buf_len) if (dev-buf_len) { aaa; } else { bbb; break; } to if (!dev-buf_len) { bbb;

[PATCHv3 12/17] i2c: omap: bus: add a receiver flag

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com that way we can ignore TX IRQs while in receiver mode and ignore RX IRQs while in transmitter mode. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c |9 + 1 files changed, 9

[PATCHv3 11/17] i2c: omap: switch to platform_get_irq()

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com that's a nice helper from drivers core which will give us the exact IRQ number, instead of a pointer to an IRQ resource. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c | 12

[PATCHv3 14/17] i2c: omap: always return IRQ_HANDLED

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com otherwise we could get our IRQ line disabled due to many spurious IRQs. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff

[PATCHv3 09/17] i2c: omap: switch over to do {} while loop

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com this will make sure that we execute at least once. No functional changes otherwise. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c | 20 ++-- 1 files changed, 14

[PATCHv3 04/17] i2c: omap: add blank lines

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com trivial patch to aid readability. No functional changes. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git

[PATCHv3 01/17] i2c: omap: switch to devm_* API

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com that helps deleting some boiler plate code and lets driver-core manage our resources for us. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c | 40

[PATCHv3 08/17] i2c: omap: re-factor receive/transmit data loop

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com re-factor the common parts to a separate function, so that code is easier to read and understand. No functional changes. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c | 204

[PATCHv3 07/17] i2c: omap: improve i462 errata handling

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com Make it not depend on ISR's local variables in order to make it easier to re-factor the transmit data loop. Also since we are waiting for XUDF just before writing data lets not flag the underflow. This is anyways going to go once we write the data. Signed-off-by:

[PATCHv3 13/17] i2c: omap: simplify errata check

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com omap_i2c_dev is allocated with kzalloc(), so we need not initialize b_hw to zero. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c |4 +--- 1 files changed, 1 insertions(+), 3

[PATCHv3 16/17] i2c: omap: resize fifos before each message

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com This patch will try to avoid the usage of draining feature by reconfiguring the FIFO the start condition of each message based on the message's size. By doing that, we will be better utilizing the FIFO when doing big transfers. While at that also drop the now

[PATCHv3 00/17] I2C Big cleanup

2012-06-29 Thread Shubhrajyoti D
I have dropped a few patches from the series and also tested every single patch on my pandaboard. There's still lots of work to be done on the i2c-omap.c driver but it's now easier to read, IMO. Changes since v1: - removed tabification on patch 6/17 - removed dev_err() which was

[PATCHv3 06/17] i2c: omap: split out [XR]DR and [XR]RDY

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com While they do pretty much the same thing, there are a few peculiarities. Specially WRT erratas, it's best to split those out and re-factor the read/write loop to another function which both cases call. This last part will be done on another patch. While at that,

[PATCH] i2c: Export an unlocked flavor of i2c_transfer

2012-06-29 Thread Jean Delvare
Some drivers (in particular for TV cards) need exclusive access to their I2C buses for specific operations. Export an unlocked flavor of i2c_transfer to give them full control. The unlocked flavor has the following limitations: * Obviously, caller must hold the i2c adapter lock. * No debug

[RFC PATCH 0/3] I2C: Report the actual transferred bytes

2012-06-29 Thread Shubhrajyoti D
Currently the I2C core reports only a negative number on errors. However some of the users in case of errors want to re-transfer only the remaining bytes. The patch series tries to add a actual field to the msg which can be checked by the user. Also a patch to implement the actual bytes

[RFC PATCH 3/3] i2c: inititalise the actual transferred to zero

2012-06-29 Thread Shubhrajyoti D
In i2c_smbus_xfer_emulated initialise the actual bytes to zero. Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/i2c-core.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index a6ad32b..fa7f799 100644

[RFC PATCH 1/3] i2c: add 'actual' field to struct i2c_msg

2012-06-29 Thread Shubhrajyoti D
In case of a NACK, it's wise to tell our clients drivers about how many bytes were actually transferred. Support this by adding an extra field to the struct i2c_msg which gets incremented the amount of bytes actually transferred. Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com Signed-off-by:

[RFC PATCH 2/3] i2c: omap: implement handling for 'actual' bytes transferred

2012-06-29 Thread Shubhrajyoti D
From: Felipe Balbi ba...@ti.com this is important in cases where client driver wants to know how many bytes were actually transferred. Signed-off-by: Felipe Balbi ba...@ti.com Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/busses/i2c-omap.c |5 + 1 files changed, 5

Re: [PATCH 1/2] MXS: Set I2C timing registers for mxs-i2c

2012-06-29 Thread Shawn Guo
On Fri, Jun 29, 2012 at 11:33:09AM +0200, Marek Vasut wrote: I did not check spec, is it possible the supplied clock changed? It's possible indeed ... Shawn? It's technically possible, but probably not practically. The imx28 RM does not mention i2c clock at all, and I was told by

Re: [PATCH] I2C: OMAP: fix runtime PM get/put balance on error

2012-06-29 Thread Kevin Hilman
Shubhrajyoti D shubhrajy...@ti.com writes: ensure pm_runtime_put() is called, on pm_runtime_get_sync() failure. Without this, after a failed call, the runtime PM usecount will have been incremented, but not decremented causing the usecount to never reach zero after a

Re: [PATCH 2/2] MXS: Implement DMA support into mxs-i2c

2012-06-29 Thread Dong Aisheng
On Fri, Jun 29, 2012 at 06:02:46PM +0800, Marek Vasut wrote: Dear Dong Aisheng, On Fri, Jun 29, 2012 at 05:30:16PM +0800, Marek Vasut wrote: Dear Dong Aisheng, On Fri, Jun 29, 2012 at 04:24:03PM +0800, Marek Vasut wrote: This patch implements DMA support into mxs-i2c. DMA

Re: [RFC PATCH 1/3] i2c: add 'actual' field to struct i2c_msg

2012-06-29 Thread Jean Delvare
On Fri, 29 Jun 2012 16:35:25 +0530, Shubhrajyoti D wrote: In case of a NACK, it's wise to tell our clients drivers about how many bytes were actually transferred. Support this by adding an extra field to the struct i2c_msg which gets incremented the amount of bytes actually transferred.

Re: [RFC PATCH 3/3] i2c: inititalise the actual transferred to zero

2012-06-29 Thread Jean Delvare
On Fri, 29 Jun 2012 16:35:27 +0530, Shubhrajyoti D wrote: In i2c_smbus_xfer_emulated initialise the actual bytes to zero. Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/i2c-core.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git

Re: [PATCH] I2C: OMAP: fix runtime PM get/put balance on error

2012-06-29 Thread Shubhrajyoti
On Friday 29 June 2012 05:32 PM, Kevin Hilman wrote: Shubhrajyoti D shubhrajy...@ti.com writes: ensure pm_runtime_put() is called, on pm_runtime_get_sync() failure. Without this, after a failed call, the runtime PM usecount will have been incremented, but not decremented

Re: [RFC PATCH 3/3] i2c: inititalise the actual transferred to zero

2012-06-29 Thread Jean Delvare
On Fri, 29 Jun 2012 14:40:02 +0200, Jean Delvare wrote: On Fri, 29 Jun 2012 16:35:27 +0530, Shubhrajyoti D wrote: In i2c_smbus_xfer_emulated initialise the actual bytes to zero. Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com --- drivers/i2c/i2c-core.c |4 ++-- 1 files

Re: [RFC PATCH 3/3] i2c: inititalise the actual transferred to zero

2012-06-29 Thread Shubhrajyoti
On Friday 29 June 2012 06:27 PM, Jean Delvare wrote: drivers/gpu/drm/nouveau/nouveau_bios.c:3535:3: warning: (near initialization for ‘msg[1].actual’) [enabled by default] This needs to be all fixed (converted to C99-style struct initialization) before your patch is considered for inclusion.

Re: [RFC PATCH 3/3] i2c: inititalise the actual transferred to zero

2012-06-29 Thread Jean Delvare
On Fri, 29 Jun 2012 18:42:08 +0530, Shubhrajyoti wrote: On Friday 29 June 2012 06:27 PM, Jean Delvare wrote: drivers/gpu/drm/nouveau/nouveau_bios.c:3535:3: warning: (near initialization for ‘msg[1].actual’) [enabled by default] This needs to be all fixed (converted to C99-style struct

Re: [PATCH] I2C: OMAP: fix runtime PM get/put balance on error

2012-06-29 Thread Kevin Hilman
Shubhrajyoti shubhrajy...@ti.com writes: On Friday 29 June 2012 05:32 PM, Kevin Hilman wrote: Shubhrajyoti D shubhrajy...@ti.com writes: ensure pm_runtime_put() is called, on pm_runtime_get_sync() failure. Without this, after a failed call, the runtime PM usecount will have