Skip to contentSkip to conversation

i2c:zynq: I2C multi-bus support on Zynq

PATCH New Michael Burr 3 participants 7 messages Sep 20, 2013 – Sep 24, 2013

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

PATCH 1/1 i2c:zynq: I2C multi-bus support on Zynq

Changes:
'zynq_i2c.c':
Adapted driver for compliance with "new" I2C driver model (CONFIG_SYS_I2C).
Support for 0-length register address in 'i2c_write', 'i2c_read'. 'i2c.h', 'i2c_core.c':
Support for Texas Instruments PCA9548 bus multiplexer.

Tested:
Xilinx ZC702 eval board (single bus master 'I2C0' with multiplexer PCA9548).
Write and read registers with addresses of length 0 and 1.

Note:
Mainline code does not work "out of the box" on ZC702 at this time; ad hoc adaptations based on 'u-boot-xlnx' repository were needed in order to test on this board. (Those adapatations are not included with this patch.)

Cc Heiko Schocher <[email protected]>
Cc Michal Simek <[email protected]>
---
 drivers/i2c/i2c_core.c |    5 ++
 drivers/i2c/zynq_i2c.c |  148 +++++++++++++++++++++++++++++-------------------
 include/i2c.h          |    3 +
 3 files changed, 97 insertions(+), 59 deletions(-)
drivers/i2c/i2c_core.c +5 -0
index d1072e8..b263562 100644
@@ -138,6 +138,11 @@ static int i2c_mux_set(struct i2c_adapter *adap, int mux_id, int chip,
 			return -1;
 		buf = (uint8_t)((channel & 0x07) | (1 << 3));
 		break;
+	case I2C_MUX_PCA9548_ID:
+		if (channel > 7)
+			return -1;
+		buf = (uint8_t)(0x01 << channel);
+		break;
 	default:
 		printf("%s: wrong mux id: %d\n", __func__, mux_id);
 		return -1;
drivers/i2c/zynq_i2c.c +89 -59

261 lines not on this page · raw message

include/i2c.h +3 -0
index 8fd17d1..683affe 100644
@@ -40,6 +40,7 @@
 #define CONFIG_SYS_I2C_MAX_HOPS		0
 #define CONFIG_SYS_NUM_I2C_BUSES	ll_entry_count(struct i2c_adapter, i2c)
 #else
+
 /* we use i2c muxes */
 #undef CONFIG_SYS_I2C_DIRECT_BUS
 #endif
@@ -135,6 +136,8 @@ extern struct i2c_bus_hose	i2c_bus[];
 #define I2C_MUX_PCA9544		{I2C_MUX_PCA9544_ID, "PCA9544A"}
 #define I2C_MUX_PCA9547_ID	4
 #define I2C_MUX_PCA9547		{I2C_MUX_PCA9547_ID, "PCA9547A"}
+#define I2C_MUX_PCA9548_ID	5
+#define I2C_MUX_PCA9548		{I2C_MUX_PCA9548_ID, "PCA9548"}
 #endif
 
 #ifndef I2C_SOFT_DECLARATIONS
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 i2c:zynq: I2C multi-bus support on Zynq

Hello Michael,

Am 20.09.2013 22:40, schrieb Michael Burr:

Quoted 7 lines

Changes:
'zynq_i2c.c':
Adapted driver for compliance with "new" I2C driver model (CONFIG_SYS_I2C).
Support for 0-length register address in 'i2c_write', 'i2c_read'. 'i2c.h', 'i2c_core.c':
Support for Texas Instruments PCA9548 bus multiplexer.

Your commit message implements, that your patch contains 3 independent changes ... it would be better to seperate your patch in 3 pieces ... so if your patch introduces a problem, it is better to identify, which part it introduced ...

Can you do this easy? Except of this, I have only one minor Codingstyle comment

Quoted 10 lines

Tested:
Xilinx ZC702 eval board (single bus master 'I2C0' with multiplexer PCA9548).
Write and read registers with addresses of length 0 and 1.

Note:
Mainline code does not work "out of the box" on ZC702 at this time; ad hoc adaptations based on 'u-boot-xlnx' repository were needed in order to test on this board. (Those adapatations are not included with this patch.)

? Where can I find this repository?

Quoted 8 lines
Cc Heiko Schocher<[email protected]>
Cc Michal Simek<[email protected]>
---
  drivers/i2c/i2c_core.c |    5 ++
  drivers/i2c/zynq_i2c.c |  148 +++++++++++++++++++++++++++++-------------------
  include/i2c.h          |    3 +
  3 files changed, 97 insertions(+), 59 deletions(-)

[...]

include/i2c.h line 43

Quoted 9 lines
include/i2c.h +1 -0
index 8fd17d1..683affe 100644
@@ -40,6 +40,7 @@
  #define CONFIG_SYS_I2C_MAX_HOPS		0
  #define CONFIG_SYS_NUM_I2C_BUSES	ll_entry_count(struct i2c_adapter, i2c)
  #else
+

Change not needed!

include/i2c.h extern struct i2c_bus_hose i2c_bus[]; · line 143

Quoted 12 lines
include/i2c.h +2 -0
  /* we use i2c muxes */
  #undef CONFIG_SYS_I2C_DIRECT_BUS
  #endif
@@ -135,6 +136,8 @@ extern struct i2c_bus_hose	i2c_bus[];
  #define I2C_MUX_PCA9544		{I2C_MUX_PCA9544_ID, "PCA9544A"}
  #define I2C_MUX_PCA9547_ID	4
  #define I2C_MUX_PCA9547		{I2C_MUX_PCA9547_ID, "PCA9547A"}
+#define I2C_MUX_PCA9548_ID	5
+#define I2C_MUX_PCA9548		{I2C_MUX_PCA9548_ID, "PCA9548"}
  #endif
 
  #ifndef I2C_SOFT_DECLARATIONS

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#2 lore raw

PATCH 1/1 i2c:zynq: I2C multi-bus support on Zynq

See below... (My replies are tagged with "[MRB:]".)

Michael Burr ?//? Software Engineer II

Logic PD
T // 612.436.7273
NOTICE: Important disclaimers and limitations apply to this email. Please see this web page for our disclaimers and limitations:
http://logicpd.com/email-disclaimer/

-----Original Message-----
From: Heiko Schocher [mailto:hs at denx.de]
Sent: Sunday, September 22, 2013 2:33 AM
To: Michael Burr
Cc: u-boot at lists.denx.de; Michal Simek
Subject: Re: [PATCH] i2c:zynq: I2C multi-bus support on Zynq

Hello Michael,

Am 20.09.2013 22:40, schrieb Michael Burr:

Quoted 7 lines

Changes:
'zynq_i2c.c':
Adapted driver for compliance with "new" I2C driver model (CONFIG_SYS_I2C).
Support for 0-length register address in 'i2c_write', 'i2c_read'. 'i2c.h', 'i2c_core.c':
Support for Texas Instruments PCA9548 bus multiplexer.

Your commit message implements, that your patch contains 3 independent changes ... it would be better to seperate your patch in 3 pieces ... so if your patch introduces a problem, it is better to identify, which part it introduced ...

Can you do this easy?

[MRB:] I will give it a try...

Except of this, I have only one minor Codingstyle comment

Quoted 10 lines

Tested:
Xilinx ZC702 eval board (single bus master 'I2C0' with multiplexer PCA9548).
Write and read registers with addresses of length 0 and 1.

Note:
Mainline code does not work "out of the box" on ZC702 at this time; ad hoc adaptations based on 'u-boot-xlnx' repository were needed in order to test on this board. (Those adapatations are not included with this patch.)

? Where can I find this repository?

[MRB:] At the following address. (I believe Michal Simek is the person who manages this.)

http://github.com/Xilinx/u-boot-xlnx/

Quoted 8 lines
Cc Heiko Schocher<[email protected]>
Cc Michal Simek<[email protected]>
---
  drivers/i2c/i2c_core.c |    5 ++
  drivers/i2c/zynq_i2c.c |  148 +++++++++++++++++++++++++++++-------------------
  include/i2c.h          |    3 +
  3 files changed, 97 insertions(+), 59 deletions(-)

[...]

include/i2c.h line 43

Quoted 9 lines
include/i2c.h index 8fd17d1..683affe renamed from include/i2c.h +0 -0

100644

include/i2c.h +1 -0
@@ -40,6 +40,7 @@
  #define CONFIG_SYS_I2C_MAX_HOPS		0
  #define CONFIG_SYS_NUM_I2C_BUSES	ll_entry_count(struct i2c_adapter, i2c)
  #else
+

Change not needed!

[MRB:] Oops. I'll get rid of that...

include/i2c.h extern struct i2c_bus_hose i2c_bus[]; · line 143

Quoted 12 lines
include/i2c.h +2 -0
  /* we use i2c muxes */
  #undef CONFIG_SYS_I2C_DIRECT_BUS
  #endif
@@ -135,6 +136,8 @@ extern struct i2c_bus_hose	i2c_bus[];
  #define I2C_MUX_PCA9544		{I2C_MUX_PCA9544_ID, "PCA9544A"}
  #define I2C_MUX_PCA9547_ID	4
  #define I2C_MUX_PCA9547		{I2C_MUX_PCA9547_ID, "PCA9547A"}
+#define I2C_MUX_PCA9548_ID	5
+#define I2C_MUX_PCA9548		{I2C_MUX_PCA9548_ID, "PCA9548"}
  #endif
 
  #ifndef I2C_SOFT_DECLARATIONS

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH 1/1 i2c:zynq: I2C multi-bus support on Zynq

Quoted 11 lines
Quoted 10 lines

Tested:
Xilinx ZC702 eval board (single bus master 'I2C0' with multiplexer PCA9548).
Write and read registers with addresses of length 0 and 1.

Note:
Mainline code does not work "out of the box" on ZC702 at this time; ad hoc adaptations based on 'u-boot-xlnx' repository were needed in order to test on this board. (Those adapatations are not included with this patch.)

Quoted 5 lines

? Where can I find this repository?

[MRB:] At the following address. (I believe Michal Simek is the person who manages this.)

http://github.com/Xilinx/u-boot-xlnx/

That's xilinx repo. But you should remove this from commit message. If there is something wrong in the mainline u-boot initialization in connection to this you should send patch for it.
As I wrote you in other email we are going to invest our time to sync configuration from this repo with mainline in the next merge window because also these changes when they are reviewed will go to the next u-boot version.

Thanks,
Michal

Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130924/cec6145e/attachment.pgp>
#4 lore raw

PATCH 1/1 i2c:zynq: I2C multi-bus support on Zynq

Sorry, Michal

I only wrote that part to explain how I was able to test on the ZC702 board (in case somebody else should want to reproduce the results).

I understand that you will sync the 'u-boot-xlnx' repo with mainline at some time in the future, on your own schedule. I was not trying to suggest that anything else be done right now.

Thanks again for your feedback,

Michael Burr ?//? Software Engineer II

Logic PD
T // 612.436.7273
NOTICE: Important disclaimers and limitations apply to this email. Please see this web page for our disclaimers and limitations:
http://logicpd.com/email-disclaimer/

-----Original Message-----
From: Michal Simek [mailto:monstr at monstr.eu]
Sent: Tuesday, September 24, 2013 3:31 AM
To: Michael Burr
Cc: hs at denx.de; u-boot at lists.denx.de
Subject: Re: [PATCH] i2c:zynq: I2C multi-bus support on Zynq

Quoted 12 lines
Quoted 11 lines

Tested:
Xilinx ZC702 eval board (single bus master 'I2C0' with multiplexer PCA9548).
Write and read registers with addresses of length 0 and 1.

Note:
Mainline code does not work "out of the box" on ZC702 at this time; ad hoc adaptations based on 'u-boot-xlnx' repository were needed in order to test on this board. (Those adapatations are not included with this
patch.)

Quoted 6 lines

? Where can I find this repository?

[MRB:] At the following address. (I believe Michal Simek is the person who manages this.)

http://github.com/Xilinx/u-boot-xlnx/

That's xilinx repo. But you should remove this from commit message.
If there is something wrong in the mainline u-boot initialization in connection to this you should send patch for it.
As I wrote you in other email we are going to invest our time to sync configuration from this repo with mainline in the next merge window because also these changes when they are reviewed will go to the next u-boot version.

Thanks,
Michal

--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform

#5 lore raw

PATCH 1/1 i2c:zynq: I2C multi-bus support on Zynq

Quoted 11 lines · Michael Burr

Sorry, Michal

I only wrote that part to explain how I was able to test on the ZC702 board (in case somebody else should want to reproduce the results).

I understand that you will sync the 'u-boot-xlnx' repo with mainline at some time in the future, on your own schedule. I was not trying to suggest that anything else be done right now.

Thanks again for your feedback,

I got this but keep in your mind that Heiko or others will apply this patch by git-am and your commit message will be the part of u-boot source code.
That's why there should be focus on problems which you are trying to solve.

If you need to point/explain something then write it below your SoB line and below "---" which ensure that git-am will remove these messages.

I would suggest to you to run git format-patch and then running git am < patch to see what will be there.

Thanks,
Michal

Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130924/f6b1c332/attachment.pgp>
#6 lore raw

PATCH 1/1 i2c:zynq: I2C multi-bus support on Zynq

Oh, OK. I see what you mean. I'm still very new to this process, so it takes some practice to "learn the customs". Thanks for clarifying.

So, in future I will keep those explanations below the "---" line.

Michael Burr ?//? Software Engineer II

Logic PD
T // 612.436.7273
NOTICE: Important disclaimers and limitations apply to this email. Please see this web page for our disclaimers and limitations:
http://logicpd.com/email-disclaimer/

-----Original Message-----
From: Michal Simek [mailto:monstr at monstr.eu]
Sent: Tuesday, September 24, 2013 10:19 AM
To: Michael Burr
Cc: hs at denx.de; u-boot at lists.denx.de
Subject: Re: [PATCH] i2c:zynq: I2C multi-bus support on Zynq

Quoted 11 lines · Michael Burr

Sorry, Michal

I only wrote that part to explain how I was able to test on the ZC702 board (in case somebody else should want to reproduce the results).

I understand that you will sync the 'u-boot-xlnx' repo with mainline at some time in the future, on your own schedule. I was not trying to suggest that anything else be done right now.

Thanks again for your feedback,

I got this but keep in your mind that Heiko or others will apply this patch by git-am and your commit message will be the part of u-boot source code. That's why there should be focus on problems which you are trying to solve.

If you need to point/explain something then write it below your SoB line and below "---" which ensure that git-am will remove these messages.

I would suggest to you to run git format-patch and then running git am < patch to see what will be there.

Thanks,
Michal

--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform