Skip to contentSkip to conversation

MXS: Set I2C timing registers for mxs-i2c

PATCH New Marek Vasut 4 participants 17 messages Jul 9, 2012 – Jul 28, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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 <[email protected]>

Cc Detlev Zundel <[email protected]>
CC Dong Aisheng <[email protected]>
CC Fabio Estevam <[email protected]>
Cc Linux ARM kernel <[email protected]>
Cc linux-i2c at vger.kernel.org
CC Sascha Hauer <[email protected]>
CC Shawn Guo <[email protected]>
Cc Stefano Babic <[email protected]>
CC Uwe Kleine-K?nig <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Wolfram Sang <[email protected]>
---
 Documentation/devicetree/bindings/i2c/i2c-mxs.txt |    3 +
 arch/arm/boot/dts/imx28.dtsi                      |    2 +
 drivers/i2c/busses/i2c-mxs.c                      |   66 +++++++++++++++++++++
 3 files changed, 71 insertions(+)

V2: Fixed static const struct mxs_i2c_speed_config
V3: Use 100kHz by default
Document support only for 100kHz and 400kHz
Document why the bus is configured to 95kHz instead of 100kHz Replace "Invalid speed ..." message with "Unsupported speed ..." message

Documentation/devicetree/bindings/i2c/i2c-mxs.txt +3 -0
index 1bfc02d..30ac3a0 100644
@@ -4,6 +4,8 @@ Required properties:
 - compatible: Should be "fsl,<chip>-i2c"
 - reg: Should contain registers location and length
 - interrupts: Should contain ERROR and DMA interrupts
+- clock-frequency: Desired I2C bus clock frequency in Hz.
+                   Only 100000Hz and 400000Hz modes are supported.
 
 Examples:
 
@@ -13,4 +15,5 @@ i2c0: i2c at 80058000 {
 	compatible = "fsl,imx28-i2c";
 	reg = <0x80058000 2000>;
 	interrupts = <111 68>;
+	clock-frequency = <100000>;
 };
arch/arm/boot/dts/imx28.dtsi +2 -0
index adb5ffc..e2e9a2b 100644
@@ -586,6 +586,7 @@
 				compatible = "fsl,imx28-i2c";
 				reg = <0x80058000 2000>;
 				interrupts = <111 68>;
+				clock-frequency = <100000>;
 				status = "disabled";
 			};
 
@@ -595,6 +596,7 @@
 				compatible = "fsl,imx28-i2c";
 				reg = <0x8005a000 2000>;
 				interrupts = <110 69>;
+				clock-frequency = <100000>;
 				status = "disabled";
 			};
 
drivers/i2c/busses/i2c-mxs.c +66 -0

101 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#1 lore raw

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

This patch implements DMA support into mxs-i2c. DMA transfers are now enabled via DT. The DMA operation is enabled by default.

Cc Detlev Zundel <[email protected]>
CC Dong Aisheng <[email protected]>
CC Fabio Estevam <[email protected]>
Cc Linux ARM kernel <[email protected]>
Cc linux-i2c at vger.kernel.org
CC Sascha Hauer <[email protected]>
CC Shawn Guo <[email protected]>
Cc Stefano Babic <[email protected]>
CC Uwe Kleine-K?nig <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Wolfram Sang <[email protected]>
---
 Documentation/devicetree/bindings/i2c/i2c-mxs.txt |    5 +
 arch/arm/boot/dts/imx28.dtsi                      |    2 +
 drivers/i2c/busses/i2c-mxs.c                      |  267 +++++++++++++++++++--
 3 files changed, 252 insertions(+), 22 deletions(-)

V2: Fixed return value from mxs_i2c_dma_setup_xfer().
Fixed coding style nitpicks
Call mxs_i2c_dma_finish() in failpath only if DMA is active
V3: Align with changes in previous patch

Documentation/devicetree/bindings/i2c/i2c-mxs.txt +5 -0
index 30ac3a0..45b6307 100644
@@ -6,6 +6,10 @@ Required properties:
 - interrupts: Should contain ERROR and DMA interrupts
 - clock-frequency: Desired I2C bus clock frequency in Hz.
                    Only 100000Hz and 400000Hz modes are supported.
+- fsl,i2c-dma-channel: APBX DMA channel for the I2C
+
+Optional properties:
+- fsl,use-pio: Use PIO transfers instead of DMA, useful for debug
 
 Examples:
 
@@ -16,4 +20,5 @@ i2c0: i2c at 80058000 {
 	reg = <0x80058000 2000>;
 	interrupts = <111 68>;
 	clock-frequency = <100000>;
+	fsl,i2c-dma-channel = <6>;
 };
arch/arm/boot/dts/imx28.dtsi +2 -0
index e2e9a2b..99bd037 100644
@@ -587,6 +587,7 @@
 				reg = <0x80058000 2000>;
 				interrupts = <111 68>;
 				clock-frequency = <100000>;
+				fsl,i2c-dma-channel = <6>;
 				status = "disabled";
 			};
 
@@ -597,6 +598,7 @@
 				reg = <0x8005a000 2000>;
 				interrupts = <110 69>;
 				clock-frequency = <100000>;
+				fsl,i2c-dma-channel = <7>;
 				status = "disabled";
 			};
 
drivers/i2c/busses/i2c-mxs.c +245 -22

372 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#2 lore raw

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

Hi,

Quoted 31 lines · Marek Vasut

This patch implements DMA support into mxs-i2c. DMA transfers are now enabled via DT. The DMA operation is enabled by default.

Cc Detlev Zundel <[email protected]>
CC Dong Aisheng <[email protected]>
CC Fabio Estevam <[email protected]>
Cc Linux ARM kernel <[email protected]>
Cc linux-i2c at vger.kernel.org
CC Sascha Hauer <[email protected]>
CC Shawn Guo <[email protected]>
Cc Stefano Babic <[email protected]>
CC Uwe Kleine-K?nig <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Wolfram Sang <[email protected]>
---
 Documentation/devicetree/bindings/i2c/i2c-mxs.txt |    5 +
 arch/arm/boot/dts/imx28.dtsi                      |    2 +
 drivers/i2c/busses/i2c-mxs.c                      |  267 +++++++++++++++++++--
 3 files changed, 252 insertions(+), 22 deletions(-)

V2: Fixed return value from mxs_i2c_dma_setup_xfer().
Fixed coding style nitpicks
Call mxs_i2c_dma_finish() in failpath only if DMA is active
V3: Align with changes in previous patch

Documentation/devicetree/bindings/i2c/i2c-mxs.txt +0 -0
index 30ac3a0..45b6307 100644

Documentation/devicetree/bindings/i2c/i2c-mxs.txt Required properties: · line 12

Quoted 7 lines
Documentation/devicetree/bindings/i2c/i2c-mxs.txt +4 -0
@@ -6,6 +6,10 @@ Required properties:
 - interrupts: Should contain ERROR and DMA interrupts
 - clock-frequency: Desired I2C bus clock frequency in Hz.
                    Only 100000Hz and 400000Hz modes are supported.
+- fsl,i2c-dma-channel: APBX DMA channel for the I2C
+
+Optional properties:
+- fsl,use-pio: Use PIO transfers instead of DMA, useful for debug

Having PIOQUEUE (not PIO) as a fallback is good. I'd rather like to see this as a module parameter, though. For one reason, this is not a hardware property or board specific, so not a good device tree property. Also, it is implicitly deprecated somehow since either we want DMA to fully work or, even better, somewhen be able to automatically switch between PIOQUEUE and DMA depending on the i2c_msg size. Deprecated properties are also troublesome. Third, we don't really need this per instance, if somebody really has problems with DMA, it will apply to all i2c busses. Makes sense?

Documentation/devicetree/bindings/i2c/i2c-mxs.txt i2c0: i2c at 80058000 {

Quoted 13 lines
Documentation/devicetree/bindings/i2c/i2c-mxs.txt +4 -0
 Examples:
 
@@ -16,4 +20,5 @@ i2c0: i2c at 80058000 {
 	reg = <0x80058000 2000>;
 	interrupts = <111 68>;
 	clock-frequency = <100000>;
+	fsl,i2c-dma-channel = <6>;
 };
 
+	/*
+	 * The MXS I2C DMA mode is prefered and enabled by default.
+	 * The PIO mode is still supported, but should be used only

PIOQUEUE

Documentation/devicetree/bindings/i2c/i2c-mxs.txt

Quoted 12 lines
Documentation/devicetree/bindings/i2c/i2c-mxs.txt +12 -0
+	 * for debuging purposes etc.
+	 */
+	i2c->dma_mode = 1;
+	if (of_find_property(node, "fsl,use-pio", NULL)) {
+		i2c->dma_mode = 0;
+		dev_info(dev, "Using PIO mode for I2C transfers!\n");
+	}
+
+	/*
+	 * TODO: This is a temporary solution and should be changed
+	 * to use generic DMA binding later when the helpers get in.
+	 */

@Shawn: Any idea when this is going to happen? And why do we need this? AFAICT it will be always channel 6/7 on mx28?

Documentation/devicetree/bindings/i2c/i2c-mxs.txt

Quoted 7 lines
Documentation/devicetree/bindings/i2c/i2c-mxs.txt +7 -0
+	ret = of_property_read_u32(node, "fsl,i2c-dma-channel",
+				   &i2c->dma_channel);
+	if (ret) {
+		dev_warn(dev, "Failed to get DMA channel!\n");
+		i2c->dma_mode = 0;
+	}
+

Rest looks good, thanks!

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120713/622a36fd/attachment-0001.sig>
#3 lore raw

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

Dear Wolfram Sang,

Quoted 45 lines

Hi,

Quoted 42 lines · Marek Vasut

This patch implements DMA support into mxs-i2c. DMA transfers are now enabled via DT. The DMA operation is enabled by default.

Cc Detlev Zundel <[email protected]>
CC Dong Aisheng <[email protected]>
CC Fabio Estevam <[email protected]>
Cc Linux ARM kernel <[email protected]>
Cc linux-i2c at vger.kernel.org
CC Sascha Hauer <[email protected]>
CC Shawn Guo <[email protected]>
Cc Stefano Babic <[email protected]>
CC Uwe Kleine-K?nig <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Wolfram Sang <[email protected]>

---

 Documentation/devicetree/bindings/i2c/i2c-mxs.txt |    5 +
 arch/arm/boot/dts/imx28.dtsi                      |    2 +
 drivers/i2c/busses/i2c-mxs.c                      |  267

+++++++++++++++++++-- 3 files changed, 252 insertions(+), 22 deletions(-)

V2: Fixed return value from mxs_i2c_dma_setup_xfer().

Fixed coding style nitpicks
Call mxs_i2c_dma_finish() in failpath only if DMA is active

V3: Align with changes in previous patch

(quoted diff) +0 -0

b/Documentation/devicetree/bindings/i2c/i2c-mxs.txt index 30ac3a0..45b6307 100644

Documentation/devicetree/bindings/i2c/i2c-mxs.txt +0 -0
@@ -6,6 +6,10 @@ Required properties:
 - interrupts: Should contain ERROR and DMA interrupts
 - clock-frequency: Desired I2C bus clock frequency in Hz.
 
                    Only 100000Hz and 400000Hz modes are supported.
 
Quoted 7 lines

Documentation/devicetree/bindings/i2c/i2c-mxs.txt Required properties: · line 12

Quoted 4 lines
Documentation/devicetree/bindings/i2c/i2c-mxs.txt +4 -0
+- fsl,i2c-dma-channel: APBX DMA channel for the I2C
+
+Optional properties:
+- fsl,use-pio: Use PIO transfers instead of DMA, useful for debug

Having PIOQUEUE (not PIO) as a fallback is good. I'd rather like to see this as a module parameter, though.

It'd be cool if someone complained earlier and the responses to new patches would be faster. This series has been going on for more than two months and noone complained about this part until now. Instead I was made to document this and now I have to do it in completely different way? Decide already ...

Quoted 2 lines

For one reason, this is not a
hardware property or board specific, so not a good device tree property.

Actually, there're still people who might benefit of doing PIOq only, since they do small (eg. one byte) transfers. And this is good to have configurable per bus.

Quoted 2 lines

Also, it is implicitly deprecated somehow since either we want DMA to fully work

And the DMA doesn't fully work?

Quoted 2 lines

or, even better, somewhen be able to automatically switch between PIOQUEUE and DMA depending on the i2c_msg size.

That'd be cool. Some months ago, you promised to take a look. I tried it recently again with not much luck.

Quoted 4 lines

Deprecated
properties are also troublesome. Third, we don't really need this per instance, if somebody really has problems with DMA, it will apply to all i2c busses. Makes sense?

No, it doesn't. See above about small transfers. Consider the easy situation where you have sensor on one bus (so you do PIO because you transfer small data) and you have EEPROM on other bus, where you use DMA because you transfer large data. And the mixed mode isn't there yet.

Quoted 43 lines
Quoted 4 lines
Documentation/devicetree/bindings/i2c/i2c-mxs.txt +0 -0
 Examples:
@@ -16,4 +20,5 @@ i2c0: i2c at 80058000 {
 
 	reg = <0x80058000 2000>;

Documentation/devicetree/bindings/i2c/i2c-mxs.txt i2c0: i2c at 80058000 {

Quoted 10 lines
Documentation/devicetree/bindings/i2c/i2c-mxs.txt +4 -0
 	interrupts = <111 68>;
 	clock-frequency = <100000>;
 
+	fsl,i2c-dma-channel = <6>;
 
 };
 
+	/*
+	 * The MXS I2C DMA mode is prefered and enabled by default.
+	 * The PIO mode is still supported, but should be used only

PIOQUEUE

Documentation/devicetree/bindings/i2c/i2c-mxs.txt

Quoted 12 lines
Documentation/devicetree/bindings/i2c/i2c-mxs.txt +12 -0
+	 * for debuging purposes etc.
+	 */
+	i2c->dma_mode = 1;
+	if (of_find_property(node, "fsl,use-pio", NULL)) {
+		i2c->dma_mode = 0;
+		dev_info(dev, "Using PIO mode for I2C transfers!\n");
+	}
+
+	/*
+	 * TODO: This is a temporary solution and should be changed
+	 * to use generic DMA binding later when the helpers get in.
+	 */

@Shawn: Any idea when this is going to happen? And why do we need this? AFAICT it will be always channel 6/7 on mx28?

Documentation/devicetree/bindings/i2c/i2c-mxs.txt

Quoted 7 lines
Documentation/devicetree/bindings/i2c/i2c-mxs.txt +7 -0
+	ret = of_property_read_u32(node, "fsl,i2c-dma-channel",
+				   &i2c->dma_channel);
+	if (ret) {
+		dev_warn(dev, "Failed to get DMA channel!\n");
+		i2c->dma_mode = 0;
+	}
+

Rest looks good, thanks!

Quoted 1 line

Wolfram

Best regards,
Marek Vasut

#4 lore raw

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

Marek,

Quoted 2 lines

It'd be cool if someone complained earlier and the responses to new patches would be faster. This series has been going on for more than two months and

I agree it would be cool to response faster. Maintaining being mostly my priavte fun, I can't make guarantees, though. It just happened that I didn't have much time for Linux in the last weeks. Actually, I am quite happy that I managed to work through most of the backlog for the next merge-window at all (in my holidays!). That's from my side, I can't tell why other people didn't review; all being too busy is the most likely guess.

Quoted 2 lines

noone complained about this part until now. Instead I was made to document this and now I have to do it in completely different way? Decide already ...

When we decided to have the fallback mode as a configuration option, the driver was still considering platform_data. That would have been no problem...

Quoted 7 lines
Quoted 3 lines

For one reason, this is not a
hardware property or board specific, so not a good device tree property.

Actually, there're still people who might benefit of doing PIOq only, since they do small (eg. one byte) transfers. And this is good to have configurable per bus.

... but we are now on devicetree and things are different there, sadly. "use-pio" is exposing a driver specific detail which is neither describing the hardware nor it is OS agnostic. Other drivers from other OS might not even have the seperation, because they might only use PIO mode (not even PIOQUEUE). So, the binding is not acceptable AFAIK. We can add devicetree-discuss to the CC-list.

Quoted 4 lines
Quoted 2 lines

Also, it is implicitly deprecated somehow since either we want DMA to fully work

And the DMA doesn't fully work?

It probably does. I was just stating the intention.

Quoted 5 lines
Quoted 2 lines

or, even better, somewhen be able to automatically switch between PIOQUEUE and DMA depending on the i2c_msg size.

That'd be cool. Some months ago, you promised to take a look. I tried it recently again with not much luck.

Yes, I wanted to. I couldn't (see above). I do imagine that it really might not be possible to switch modes at runtime. This is why I was trying to get the patch into the next release without the mode-switching. But for that to happen, there was the binding issue. I came up with the module parameter as the easiest way to fix it. I am open to other solutions. Simply dropping the binding might be another idea if we pay attention that there are no regressions, going from PIOQUEUE to DMA.

I am also still interested to check the runtime switching, but it might take another month until I can really hack on it.

Quoted 9 lines
Quoted 4 lines

Deprecated
properties are also troublesome. Third, we don't really need this per instance, if somebody really has problems with DMA, it will apply to all i2c busses. Makes sense?

No, it doesn't. See above about small transfers. Consider the easy situation where you have sensor on one bus (so you do PIO because you transfer small data) and you have EEPROM on other bus, where you use DMA because you transfer large data. And the mixed mode isn't there yet.

I fully understand what you want to configure. I did before. Yet, devicetree bindings are not platform_data and shouldn't be used like them.

Regards,

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120714/bcd928c3/attachment.sig>
#5 lore raw

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

Dear Wolfram Sang,

[...]

Quoted 12 lines
Quoted 2 lines

That'd be cool. Some months ago, you promised to take a look. I tried it recently again with not much luck.

Yes, I wanted to. I couldn't (see above). I do imagine that it really might not be possible to switch modes at runtime. This is why I was trying to get the patch into the next release without the mode-switching. But for that to happen, there was the binding issue. I came up with the module parameter as the easiest way to fix it. I am open to other solutions. Simply dropping the binding might be another idea if we pay attention that there are no regressions, going from PIOQUEUE to DMA.

Quoted 2 lines

I am also still interested to check the runtime switching, but it might take another month until I can really hack on it.

Good, there is some bit that probably needs to be flipped to allow this switching. I managed to get this working with SPI, not with i2c though. With i2c, if I restarted the controller inbetween each transaction, it worked ... which is not what I'd like to see there.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Deprecated
properties are also troublesome. Third, we don't really need this per instance, if somebody really has problems with DMA, it will apply to all i2c busses. Makes sense?

Quoted 8 lines
Quoted 4 lines

No, it doesn't. See above about small transfers. Consider the easy situation where you have sensor on one bus (so you do PIO because you transfer small data) and you have EEPROM on other bus, where you use DMA because you transfer large data. And the mixed mode isn't there yet.

I fully understand what you want to configure. I did before. Yet, devicetree bindings are not platform_data and shouldn't be used like them.

But then, how would you configure this detail on a per-bus basis? Well all right, screw this, let's make it impotent and go for the module parameter. This patch actually fixes a real issue, I'd like to have it in ASAP and it's been aboue three months already, which sucks.

Quoted 3 lines

Regards,

Wolfram

Best regards,
Marek Vasut

#6 lore raw

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

Marek,

Quoted 5 lines
Quoted 2 lines

I am also still interested to check the runtime switching, but it might take another month until I can really hack on it.

Good, there is some bit that probably needs to be flipped to allow this switching. I managed to get this working with SPI, not with i2c though. With

Ah, hearing that it works with SPI is good news.

Quoted 2 lines

i2c, if I restarted the controller inbetween each transaction, it worked ... which is not what I'd like to see there.

Agreed.

Quoted 10 lines
Quoted 8 lines
Quoted 4 lines

No, it doesn't. See above about small transfers. Consider the easy situation where you have sensor on one bus (so you do PIO because you transfer small data) and you have EEPROM on other bus, where you use DMA because you transfer large data. And the mixed mode isn't there yet.

I fully understand what you want to configure. I did before. Yet, devicetree bindings are not platform_data and shouldn't be used like them.

But then, how would you configure this detail on a per-bus basis? Well all

This is a question for devicetree-discuss.

Quoted 2 lines

patch actually fixes a real issue, I'd like to have it in ASAP and it's been aboue three months already, which sucks.

I am open to ideas improving the situation (which is: a lot more patches, but not a lot more reviewers)

Thanks,

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120716/ef204b42/attachment.sig>
#7 lore raw

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

Dear Wolfram Sang,

Quoted 22 lines

Marek,

Quoted 6 lines
Quoted 2 lines

I am also still interested to check the runtime switching, but it might take another month until I can really hack on it.

Good, there is some bit that probably needs to be flipped to allow this switching. I managed to get this working with SPI, not with i2c though. With

Ah, hearing that it works with SPI is good news.

Quoted 2 lines

i2c, if I restarted the controller inbetween each transaction, it worked ... which is not what I'd like to see there.

Agreed.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

No, it doesn't. See above about small transfers. Consider the easy situation where you have sensor on one bus (so you do PIO because you transfer small data) and you have EEPROM on other bus, where you use DMA because you transfer large data. And the mixed mode isn't there yet.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I fully understand what you want to configure. I did before. Yet, devicetree bindings are not platform_data and shouldn't be used like them.

But then, how would you configure this detail on a per-bus basis? Well all

This is a question for devicetree-discuss.

Did you Cc it?

Quoted 9 lines
Quoted 2 lines

patch actually fixes a real issue, I'd like to have it in ASAP and it's been aboue three months already, which sucks.

I am open to ideas improving the situation (which is: a lot more patches, but not a lot more reviewers)

Thanks,

Wolfram

Best regards,
Marek Vasut

#8 lore raw

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

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines

No, it doesn't. See above about small transfers. Consider the easy situation where you have sensor on one bus (so you do PIO because you transfer small data) and you have EEPROM on other bus, where you use DMA because you transfer large data. And the mixed mode isn't there yet.

I fully understand what you want to configure. I did before. Yet, devicetree bindings are not platform_data and shouldn't be used like them.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

But then, how would you configure this detail on a per-bus basis? Well all

This is a question for devicetree-discuss.

Did you Cc it?

Well, I guess you already checked the mail headers and found out yourself. The question behind the question probably is "Why didn't you CC it?". The answer to that is that I didn't have much success by adding it to $RANDOM_THREAD. It might be more efficient to answer starting a new thread with explicit "[RFC] $THE_ISSUE". Since a conclusion there won't make the next merge-window anyhow, I haven't done that now. That put aside, it might be more efficient if someone with a bigger urge might strive for a solution (yes, probably, but not necessarily you). For me, it currently is just one task which needs to be scheduled inbetween others.

Regards,

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120716/d049fd78/attachment.sig>
#9 lore raw

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

In reply to Wolfram Sang
Quoted 6 lines · Wolfram Sang

drivers/i2c/busses/i2c-mxs.c static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c) · line 571

Quoted 4 lines
drivers/i2c/busses/i2c-mxs.c +4 -0
+	/*
+	 * TODO: This is a temporary solution and should be changed
+	 * to use generic DMA binding later when the helpers get in.
+	 */

@Shawn: Any idea when this is going to happen? And why do we need this?

See thread [1] for current statues. I'm not sure when it's going to happen though.

Quoted 2 lines

AFAICT it will be always channel 6/7 on mx28?

Yes, but it might be a different channel on mx23. Just like we define IO region and interrupt number in device tree, dma channel is just another resource of hardware block that we choose to define in device tree.

Regards,
Shawn

[1] http://thread.gmane.org/gmane.linux.ports.arm.omap/75828

#10 lore raw

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

Quoted 10 lines · Shawn Guo
Quoted 6 lines · Wolfram Sang

drivers/i2c/busses/i2c-mxs.c static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c) · line 571

Quoted 4 lines
drivers/i2c/busses/i2c-mxs.c +4 -0
+	/*
+	 * TODO: This is a temporary solution and should be changed
+	 * to use generic DMA binding later when the helpers get in.
+	 */

@Shawn: Any idea when this is going to happen? And why do we need this?

See thread [1] for current statues. I'm not sure when it's going to happen though.

Phew, [1] is a bit too much too read. I will just assume there are still issues.

Quoted 6 lines
Quoted 2 lines

AFAICT it will be always channel 6/7 on mx28?

Yes, but it might be a different channel on mx23. Just like we define IO region and interrupt number in device tree, dma channel is just another resource of hardware block that we choose to define in device tree.

What makes me wonder now that I come to think of it (not necessarily a question for Shawn but to all):

If I have an I2C slave with an interrupt line tied to something, GPIO or external IRQ from the SoC, it makes perfect sense to define that in the devicetree.

Yet, if I know the compatible property for the mxs I2C driver, and also know the CPU type (be it MX23 or MX28), I can deduce from that a lot of information, including DMA channel. That is fix. Why encode it?

Regards,

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120721/bd4e8ae8/attachment.sig>
#11 lore raw

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

Dear Wolfram Sang,

Quoted 25 lines · Shawn Guo
Quoted 10 lines · Wolfram Sang
Quoted 6 lines

drivers/i2c/busses/i2c-mxs.c static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c) · line 571

Quoted 4 lines
drivers/i2c/busses/i2c-mxs.c +4 -0
+	/*
+	 * TODO: This is a temporary solution and should be changed
+	 * to use generic DMA binding later when the helpers get in.
+	 */

@Shawn: Any idea when this is going to happen? And why do we need this?

See thread [1] for current statues. I'm not sure when it's going to happen though.

Phew, [1] is a bit too much too read. I will just assume there are still issues.

Quoted 6 lines
Quoted 1 line

AFAICT it will be always channel 6/7 on mx28?

Yes, but it might be a different channel on mx23. Just like we define IO region and interrupt number in device tree, dma channel is just another resource of hardware block that we choose to define in device tree.

What makes me wonder now that I come to think of it (not necessarily a question for Shawn but to all):

Quoted 7 lines

If I have an I2C slave with an interrupt line tied to something, GPIO or external IRQ from the SoC, it makes perfect sense to define that in the devicetree.

Yet, if I know the compatible property for the mxs I2C driver, and also know the CPU type (be it MX23 or MX28), I can deduce from that a lot of information, including DMA channel. That is fix. Why encode it?

You know the compatible and the "fallback compatible". From the later one, you can deduce nothing if that happens to kick in.

btw. the PIO discussion on DT discuss is completely ignored. How shall we proceed, this driver is stalled for too long.

Quoted 3 lines

Regards,

Wolfram

Best regards,
Marek Vasut

#12 lore raw

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

Quoted 7 lines
Quoted 4 lines

Yet, if I know the compatible property for the mxs I2C driver, and also know the CPU type (be it MX23 or MX28), I can deduce from that a lot of information, including DMA channel. That is fix. Why encode it?

You know the compatible and the "fallback compatible". From the later one, you can deduce nothing if that happens to kick in.

Even if the driver was matched because of an MX23-I2C "compatible" binding, both devicetree and runtime could provide data that it actually runs on MX28. That shouldn't be a problem.

Quoted 2 lines

btw. the PIO discussion on DT discuss is completely ignored. How shall we proceed, this driver is stalled for too long.

IIRC I mentioned that a discussion about the bindings won't make the next merge window. That's why I proposed either module_parameter or dropping the binding entirely as possible inbetween options.

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120721/384e3d24/attachment.sig>
#13 lore raw

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

Dear Wolfram Sang,

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

Yet, if I know the compatible property for the mxs I2C driver, and also know the CPU type (be it MX23 or MX28), I can deduce from that a lot of information, including DMA channel. That is fix. Why encode it?

You know the compatible and the "fallback compatible". From the later one, you can deduce nothing if that happens to kick in.

Even if the driver was matched because of an MX23-I2C "compatible" binding, both devicetree and runtime could provide data that it actually runs on MX28. That shouldn't be a problem.

You mean like ... cpu_is_mx28() ? We got rid of that in favor of DT.

Quoted 5 lines
Quoted 2 lines

btw. the PIO discussion on DT discuss is completely ignored. How shall we proceed, this driver is stalled for too long.

IIRC I mentioned that a discussion about the bindings won't make the next merge window.

Yet another merge window, I have to mention. And only because very long pauses inbetween reviews and very minor nitpicks. I'm being annoyed by this patch so much I'm thinking of giving up on this. I wasted too much of my free time on this and the result is as is.

Quoted 1 line

That's why I proposed either module_parameter

Which I explained is not a way to go.

Quoted 2 lines

or
dropping the binding entirely as possible inbetween options.

Which is not an option either. And this discussion is only further stalling the patch.

We're adding fsl,something properties all over the DT all the time, yet this one is of concern?

Best regards,
Marek Vasut

#14 lore raw

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

Quoted 6 lines
Quoted 4 lines

Even if the driver was matched because of an MX23-I2C "compatible" binding, both devicetree and runtime could provide data that it actually runs on MX28. That shouldn't be a problem.

You mean like ... cpu_is_mx28() ? We got rid of that in favor of DT.

Might be. But the information is probably somewhere.

Quoted 7 lines
Quoted 2 lines

IIRC I mentioned that a discussion about the bindings won't make the next merge window.

Yet another merge window, I have to mention. And only because very long pauses inbetween reviews and very minor nitpicks. I'm being annoyed by this patch so much I'm thinking of giving up on this. I wasted too much of my free time on this and the result is as is.

For you it might be a minor nitpick, for me (as a maintainer) it is not. You have to deal with just one binding, I have to deal with many. And since they have to be supported forever, this can easily mess up code and make the subsystem clumsy and whatnot.

Quoted 3 lines
Quoted 1 line

That's why I proposed either module_parameter

Which I explained is not a way to go.

That's why I called it inbetween solution so the patch could go in. It's fine if you don't like it, I prefer dropping the binding as well.

Quoted 4 lines
Quoted 2 lines

or
dropping the binding entirely as possible inbetween options.

Which is not an option either.

It would enable you to add the binding as an out-of-tree patch.

Quoted 6 lines

And this discussion is only further stalling the
patch.

We're adding fsl,something properties all over the DT all the time, yet this one is of concern?

Yes. Adding all these properties is IMO not the right way, and I have the impression they often came in because of time pressure like this. If I think it is wrong for the kernel, I have to reject a patch unless I am convinced otherwise. Which did not happen yet; as you found out discussions on devicetree-discuss are slow. Might be another indication that devictree things happen too much at the time currently. This is not specific to your patch, there are more which need discussion or had to be reworked.

Regards,

Wolfram

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120722/ce0a1af1/attachment.sig>
#15 lore raw

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

In reply to Wolfram Sang
Quoted 4 lines · Wolfram Sang

Yet, if I know the compatible property for the mxs I2C driver, and also know the CPU type (be it MX23 or MX28), I can deduce from that a lot of information, including DMA channel. That is fix. Why encode it?

The driver shouldn't know the CPU type but just the IP type/version. We can definitely have "fsl,imx23-i2c" and "fsl,imx28-i2c" compatible strings for iMX23 and iMX28 respectively if the I2C controller on these two SoC differs on the IP inside aspects. But we shouldn't do that for IO region, interrupt number, DMA channel such differences at SoC integration level.

Signature · 2 lines
Regards,
Shawn
Applied
#16 lore raw

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

In reply to Marek Vasut
Quoted 9 lines · 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 <[email protected]>

Applied to next, thanks.

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120713/87880d65/attachment.sig>