Skip to contentSkip to conversation

i2c: mux: Allow muxes to work as children of i2c bus without i2c-parent

PATCH New Moritz Fischer 3 participants 8 messages Dec 29, 2016 – Jan 23, 2017 I2C muxes

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: mux: Allow muxes to work as children of i2c bus without i2c-parent

For mux check if the parent is already a device of UCLASS_I2C and if yes just use that. Otherwise see if someone specified an i2c-parent phandle. This mimics the behavior found in the Kernel, as it removes the requirement to explicitly specify a i2c-parent phandle.

Cc Heiko Schocher <[email protected]>
Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Michal Simek <[email protected]>
Cc u-boot at lists.denx.de
---
 drivers/i2c/muxes/i2c-mux-uclass.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/i2c/muxes/i2c-mux-uclass.c +9 -0
index 7a698b6..e01b773 100644
@@ -86,6 +86,15 @@ static int i2c_mux_post_probe(struct udevice *mux)
 	debug("%s: %s\n", __func__, mux->name);
 	priv->selected = -1;
 
+	/* if parent is of i2c uclass already, we'll take that, otherwise
+	 * look if we find an i2c-parent phandle */
+	if (UCLASS_I2C == device_get_uclass_id(mux->parent)) {
+		priv->i2c_bus = dev_get_parent(mux);
+		debug("%s: bus=%p/%s\n", __func__, priv->i2c_bus,
+		      priv->i2c_bus->name);
+		return 0;
+	}
+
 	ret = uclass_get_device_by_phandle(UCLASS_I2C, mux, "i2c-parent",
 					   &priv->i2c_bus);
 	if (ret)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 i2c: mux: Allow muxes to work as children of i2c bus without i2c-parent

Quoted 20 lines · Moritz Fischer

For mux check if the parent is already a device of UCLASS_I2C and if yes just use that. Otherwise see if someone specified an i2c-parent phandle. This mimics the behavior found in the Kernel, as it removes the requirement to explicitly specify a i2c-parent phandle.

Cc Heiko Schocher <[email protected]>
Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Michal Simek <[email protected]>
Cc u-boot at lists.denx.de
---
 drivers/i2c/muxes/i2c-mux-uclass.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/i2c/muxes/i2c-mux-uclass.c +0 -0
index 7a698b6..e01b773 100644

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 90

Quoted 5 lines
drivers/i2c/muxes/i2c-mux-uclass.c +2 -0
@@ -86,6 +86,15 @@ static int i2c_mux_post_probe(struct udevice *mux)
 	debug("%s: %s\n", __func__, mux->name);
 	priv->selected = -1;
 
+	/* if parent is of i2c uclass already, we'll take that, otherwise
+	 * look if we find an i2c-parent phandle */

Incorrect comment style.

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 100

Quoted 11 lines
drivers/i2c/muxes/i2c-mux-uclass.c +7 -0
+	if (UCLASS_I2C == device_get_uclass_id(mux->parent)) {
+		priv->i2c_bus = dev_get_parent(mux);
+		debug("%s: bus=%p/%s\n", __func__, priv->i2c_bus,
+		      priv->i2c_bus->name);
+		return 0;
+	}
+
 	ret = uclass_get_device_by_phandle(UCLASS_I2C, mux, "i2c-parent",
 					   &priv->i2c_bus);
 	if (ret)

The part of this will be good to also handle
req_seq for mux busses. But at least this should solved part of the problems.

Thanks,
Michal

#2 lore raw

PATCH 1/1 i2c: mux: Allow muxes to work as children of i2c bus without i2c-parent

Hi Michal,

Quoted 24 lines · Michal Simek
Quoted 23 lines · Moritz Fischer

For mux check if the parent is already a device of UCLASS_I2C and if yes just use that. Otherwise see if someone specified an i2c-parent phandle. This mimics the behavior found in the Kernel, as it removes the requirement to explicitly specify a i2c-parent phandle.

Cc Heiko Schocher <[email protected]>
Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Michal Simek <[email protected]>
Cc u-boot at lists.denx.de
---
 drivers/i2c/muxes/i2c-mux-uclass.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/i2c/muxes/i2c-mux-uclass.c +0 -0
index 7a698b6..e01b773 100644
@@ -86,6 +86,15 @@ static int i2c_mux_post_probe(struct udevice *mux)
      debug("%s: %s\n", __func__, mux->name);
      priv->selected = -1;
 
Quoted 4 lines

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 90

Quoted 2 lines
drivers/i2c/muxes/i2c-mux-uclass.c +2 -0
+     /* if parent is of i2c uclass already, we'll take that, otherwise
+      * look if we find an i2c-parent phandle */

Incorrect comment style.

Yeah, wasn't flagged by checkpatch .... will fix.

Quoted 13 lines

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 100

Quoted 12 lines
drivers/i2c/muxes/i2c-mux-uclass.c +7 -0
+     if (UCLASS_I2C == device_get_uclass_id(mux->parent)) {
+             priv->i2c_bus = dev_get_parent(mux);
+             debug("%s: bus=%p/%s\n", __func__, priv->i2c_bus,
+                   priv->i2c_bus->name);
+             return 0;
+     }
+
      ret = uclass_get_device_by_phandle(UCLASS_I2C, mux, "i2c-parent",
                                         &priv->i2c_bus);
      if (ret)
Quoted 3 lines

The part of this will be good to also handle
req_seq for mux busses. But at least this should solved part of the problems.

I'm not sure I understand this comment.

Thanks for the review, will resubmit

Moritz

#3 lore raw

PATCH 1/1 i2c: mux: Allow muxes to work as children of i2c bus without i2c-parent

Quoted 46 lines · Moritz Fischer

Hi Michal,

Quoted 24 lines · Michal Simek
Quoted 23 lines · Moritz Fischer

For mux check if the parent is already a device of UCLASS_I2C and if yes just use that. Otherwise see if someone specified an i2c-parent phandle. This mimics the behavior found in the Kernel, as it removes the requirement to explicitly specify a i2c-parent phandle.

Cc Heiko Schocher <[email protected]>
Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Michal Simek <[email protected]>
Cc u-boot at lists.denx.de
---
 drivers/i2c/muxes/i2c-mux-uclass.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/i2c/muxes/i2c-mux-uclass.c +0 -0
index 7a698b6..e01b773 100644
@@ -86,6 +86,15 @@ static int i2c_mux_post_probe(struct udevice *mux)
      debug("%s: %s\n", __func__, mux->name);
      priv->selected = -1;
 
Quoted 4 lines

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 90

Quoted 2 lines
drivers/i2c/muxes/i2c-mux-uclass.c +2 -0
+     /* if parent is of i2c uclass already, we'll take that, otherwise
+      * look if we find an i2c-parent phandle */

Incorrect comment style.

Yeah, wasn't flagged by checkpatch .... will fix.

Quoted 13 lines
Quoted 12 lines
drivers/i2c/muxes/i2c-mux-uclass.c +7 -0
+     if (UCLASS_I2C == device_get_uclass_id(mux->parent)) {
+             priv->i2c_bus = dev_get_parent(mux);
+             debug("%s: bus=%p/%s\n", __func__, priv->i2c_bus,
+                   priv->i2c_bus->name);
+             return 0;
+     }
+
      ret = uclass_get_device_by_phandle(UCLASS_I2C, mux, "i2c-parent",
                                         &priv->i2c_bus);
      if (ret)
Quoted 5 lines
Quoted 3 lines

The part of this will be good to also handle
req_seq for mux busses. But at least this should solved part of the problems.

I'm not sure I understand this comment.

AFAIK using i2c muxes requires two changes in DTS file. First change is this to setup i2c-parent in DTS file which is something what Linux doesn't need.
The next change is that you have to extend i2c aliases to point to i2c mux sub busses which is the second thing what Linux doesn't need. I expect that this change you have in your dts file.

I think that if you detect mux with 8 ports you can simply use unique busid to be able to address them.

Thanks,
Michal

#4 lore raw

PATCH 1/1 i2c: mux: Allow muxes to work as children of i2c bus without i2c-parent

Hi Michal,

Quoted 51 lines · Michal Simek
Quoted 50 lines · Moritz Fischer

Hi Michal,

Quoted 24 lines · Michal Simek
Quoted 23 lines · Moritz Fischer

For mux check if the parent is already a device of UCLASS_I2C and if yes just use that. Otherwise see if someone specified an i2c-parent phandle. This mimics the behavior found in the Kernel, as it removes the requirement to explicitly specify a i2c-parent phandle.

Cc Heiko Schocher <[email protected]>
Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Michal Simek <[email protected]>
Cc u-boot at lists.denx.de
---
 drivers/i2c/muxes/i2c-mux-uclass.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/i2c/muxes/i2c-mux-uclass.c +0 -0
index 7a698b6..e01b773 100644
@@ -86,6 +86,15 @@ static int i2c_mux_post_probe(struct udevice *mux)
      debug("%s: %s\n", __func__, mux->name);
      priv->selected = -1;
 
Quoted 4 lines

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 90

Quoted 2 lines
drivers/i2c/muxes/i2c-mux-uclass.c +2 -0
+     /* if parent is of i2c uclass already, we'll take that, otherwise
+      * look if we find an i2c-parent phandle */

Incorrect comment style.

Yeah, wasn't flagged by checkpatch .... will fix.

Quoted 16 lines

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 100

Quoted 12 lines
drivers/i2c/muxes/i2c-mux-uclass.c +7 -0
+     if (UCLASS_I2C == device_get_uclass_id(mux->parent)) {
+             priv->i2c_bus = dev_get_parent(mux);
+             debug("%s: bus=%p/%s\n", __func__, priv->i2c_bus,
+                   priv->i2c_bus->name);
+             return 0;
+     }
+
      ret = uclass_get_device_by_phandle(UCLASS_I2C, mux, "i2c-parent",
                                         &priv->i2c_bus);
      if (ret)

The part of this will be good to also handle
req_seq for mux busses. But at least this should solved part of the problems.

Quoted 5 lines
Quoted 1 line

I'm not sure I understand this comment.

AFAIK using i2c muxes requires two changes in DTS file. First change is this to setup i2c-parent in DTS file which is something what Linux doesn't need.

Yeah this part is addressed in this patch.

Quoted 3 lines

The next change is that you have to extend i2c aliases to point to i2c mux sub busses which is the second thing what Linux doesn't need. I expect that this change you have in your dts file.

Yeah, thanks for clarifying. In my dts I have aliases for each of the mux channels,
which, I don't have a good idea on how to solve differently. In Linux I think I don't need that.

Quoted 2 lines

I think that if you detect mux with 8 ports you can simply use unique busid to be able to address them.

In Linux? I'll have to take another look at that. Currently I get busses like 700,701,702 etc (which are aliases I defined). Each of them points to a mux channel.

<snip>
aliases { ...

                i2c0 = &i2c0;
                i2c0700 = &i2c0_70_0;
                i2c0701 = &i2c0_70_1;
                i2c0702 = &i2c0_70_2;
                i2c0703 = &i2c0_70_3;
};

...

        i2cswitch at 70 {
                compatible = "ti,pca9548", "nxp,pca9548";
                #address-cells = <1>;
                #size-cells = <0>;
                reg = <0x70>;
                status = "okay";

                i2c0_70_0: i2c at 0 {
                        reg = <0x0>;
                        #address-cells = <1>;
                        #size-cells = <0>;

                        status = "okay";
                };
                ...
          };

</snip>

I Will resubmit a v2 for the other changes above

If you or Simon have ideas on how to correctly solve the alias issue, I can take another stab at that.

Thanks,

Moritz

#5 lore raw

PATCH 1/1 i2c: mux: Allow muxes to work as children of i2c bus without i2c-parent

Hi,

Quoted 54 lines · Moritz Fischer

Hi Michal,

Quoted 51 lines · Michal Simek
Quoted 50 lines · Moritz Fischer

Hi Michal,

Quoted 24 lines · Michal Simek
Quoted 23 lines · Moritz Fischer

For mux check if the parent is already a device of UCLASS_I2C and if yes just use that. Otherwise see if someone specified an i2c-parent phandle. This mimics the behavior found in the Kernel, as it removes the requirement to explicitly specify a i2c-parent phandle.

Cc Heiko Schocher <[email protected]>
Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Michal Simek <[email protected]>
Cc u-boot at lists.denx.de
---
 drivers/i2c/muxes/i2c-mux-uclass.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/i2c/muxes/i2c-mux-uclass.c +0 -0
index 7a698b6..e01b773 100644
@@ -86,6 +86,15 @@ static int i2c_mux_post_probe(struct udevice *mux)
      debug("%s: %s\n", __func__, mux->name);
      priv->selected = -1;
 
Quoted 4 lines

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 90

Quoted 2 lines
drivers/i2c/muxes/i2c-mux-uclass.c +2 -0
+     /* if parent is of i2c uclass already, we'll take that, otherwise
+      * look if we find an i2c-parent phandle */

Incorrect comment style.

Yeah, wasn't flagged by checkpatch .... will fix.

Quoted 16 lines

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 100

Quoted 12 lines
drivers/i2c/muxes/i2c-mux-uclass.c +7 -0
+     if (UCLASS_I2C == device_get_uclass_id(mux->parent)) {
+             priv->i2c_bus = dev_get_parent(mux);
+             debug("%s: bus=%p/%s\n", __func__, priv->i2c_bus,
+                   priv->i2c_bus->name);
+             return 0;
+     }
+
      ret = uclass_get_device_by_phandle(UCLASS_I2C, mux, "i2c-parent",
                                         &priv->i2c_bus);
      if (ret)

The part of this will be good to also handle
req_seq for mux busses. But at least this should solved part of the problems.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I'm not sure I understand this comment.

AFAIK using i2c muxes requires two changes in DTS file. First change is this to setup i2c-parent in DTS file which is something what Linux doesn't need.

Yeah this part is addressed in this patch.

yep

Quoted 9 lines
Quoted 4 lines

The next change is that you have to extend i2c aliases to point to i2c mux sub busses which is the second thing what Linux doesn't need. I expect that this change you have in your dts file.

Yeah, thanks for clarifying. In my dts I have aliases for each of the mux channels,
which, I don't have a good idea on how to solve differently. In Linux I think I don't need that.

yes and this is not required by Linux kernel.
IIRC Linux simply assign free ID to that bus.
It means starting from 0 and asking if there is alias or not and then +1, etc should work.

Quoted 5 lines
Quoted 2 lines

I think that if you detect mux with 8 ports you can simply use unique busid to be able to address them.

In Linux? I'll have to take another look at that. Currently I get busses like 700,701,702 etc (which are aliases I defined).

When I was playing with this if you define other aliases like 1700, 1701, 1702 etc u-boot will mess it up.

Quoted 29 lines

Each of them points to a mux channel.

<snip>
aliases { ...

                i2c0 = &i2c0;
                i2c0700 = &i2c0_70_0;
                i2c0701 = &i2c0_70_1;
                i2c0702 = &i2c0_70_2;
                i2c0703 = &i2c0_70_3;
};

...

        i2cswitch at 70 {
                compatible = "ti,pca9548", "nxp,pca9548";
                #address-cells = <1>;
                #size-cells = <0>;
                reg = <0x70>;
                status = "okay";

                i2c0_70_0: i2c at 0 {
                        reg = <0x0>;
                        #address-cells = <1>;
                        #size-cells = <0>;

                        status = "okay";
                };
                ...
          };
Quoted 6 lines

</snip>

I Will resubmit a v2 for the other changes above

If you or Simon have ideas on how to correctly solve the alias issue, I can take another stab at that.

Look at this.
http://lists.denx.de/pipermail/u-boot/2016-April/251769.html

Thanks,
Michal

#6 lore raw

PATCH 1/1 i2c: mux: Allow muxes to work as children of i2c bus without i2c-parent

Hi Michal,

Quoted 124 lines · Michal Simek

Hi,

Quoted 54 lines · Moritz Fischer

Hi Michal,

Quoted 51 lines · Michal Simek
Quoted 50 lines · Moritz Fischer

Hi Michal,

Quoted 24 lines · Michal Simek
Quoted 23 lines · Moritz Fischer

For mux check if the parent is already a device of UCLASS_I2C and if yes just use that. Otherwise see if someone specified an i2c-parent phandle. This mimics the behavior found in the Kernel, as it removes the requirement to explicitly specify a i2c-parent phandle.

Cc Heiko Schocher <[email protected]>
Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Michal Simek <[email protected]>
Cc u-boot at lists.denx.de
---
 drivers/i2c/muxes/i2c-mux-uclass.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/i2c/muxes/i2c-mux-uclass.c +0 -0
index 7a698b6..e01b773 100644
@@ -86,6 +86,15 @@ static int i2c_mux_post_probe(struct udevice *mux)
      debug("%s: %s\n", __func__, mux->name);
      priv->selected = -1;
 
Quoted 4 lines

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 90

Quoted 2 lines
drivers/i2c/muxes/i2c-mux-uclass.c +2 -0
+     /* if parent is of i2c uclass already, we'll take that, otherwise
+      * look if we find an i2c-parent phandle */

Incorrect comment style.

Yeah, wasn't flagged by checkpatch .... will fix.

Quoted 16 lines

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 100

Quoted 12 lines
drivers/i2c/muxes/i2c-mux-uclass.c +7 -0
+     if (UCLASS_I2C == device_get_uclass_id(mux->parent)) {
+             priv->i2c_bus = dev_get_parent(mux);
+             debug("%s: bus=%p/%s\n", __func__, priv->i2c_bus,
+                   priv->i2c_bus->name);
+             return 0;
+     }
+
      ret = uclass_get_device_by_phandle(UCLASS_I2C, mux, "i2c-parent",
                                         &priv->i2c_bus);
      if (ret)

The part of this will be good to also handle
req_seq for mux busses. But at least this should solved part of the problems.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I'm not sure I understand this comment.

AFAIK using i2c muxes requires two changes in DTS file. First change is this to setup i2c-parent in DTS file which is something what Linux doesn't need.

Yeah this part is addressed in this patch.

yep

Quoted 9 lines
Quoted 4 lines

The next change is that you have to extend i2c aliases to point to i2c mux sub busses which is the second thing what Linux doesn't need. I expect that this change you have in your dts file.

Yeah, thanks for clarifying. In my dts I have aliases for each of the mux channels,
which, I don't have a good idea on how to solve differently. In Linux I think I don't need that.

yes and this is not required by Linux kernel.
IIRC Linux simply assign free ID to that bus.
It means starting from 0 and asking if there is alias or not and then +1, etc should work.

Quoted 5 lines
Quoted 2 lines

I think that if you detect mux with 8 ports you can simply use unique busid to be able to address them.

In Linux? I'll have to take another look at that. Currently I get busses like 700,701,702 etc (which are aliases I defined).

When I was playing with this if you define other aliases like 1700, 1701, 1702 etc u-boot will mess it up.

Quoted 31 lines

Each of them points to a mux channel.

<snip>
aliases { ...

                i2c0 = &i2c0;
                i2c0700 = &i2c0_70_0;
                i2c0701 = &i2c0_70_1;
                i2c0702 = &i2c0_70_2;
                i2c0703 = &i2c0_70_3;
};

...

        i2cswitch at 70 {
                compatible = "ti,pca9548", "nxp,pca9548";
                #address-cells = <1>;
                #size-cells = <0>;
                reg = <0x70>;
                status = "okay";

                i2c0_70_0: i2c at 0 {
                        reg = <0x0>;
                        #address-cells = <1>;
                        #size-cells = <0>;

                        status = "okay";
                };
                ...
          };

</snip>

Quoted 7 lines
Quoted 4 lines

I Will resubmit a v2 for the other changes above

If you or Simon have ideas on how to correctly solve the alias issue, I can take another stab at that.

Look at this.
http://lists.denx.de/pipermail/u-boot/2016-April/251769.html

That patch was never applied but it would be good to get this problem resolved.

Regards,
Simon

#7 lore raw

PATCH 1/1 i2c: mux: Allow muxes to work as children of i2c bus without i2c-parent

Quoted 129 lines · Simon Glass

Hi Michal,

Quoted 126 lines · Michal Simek

Hi,

Quoted 54 lines · Moritz Fischer

Hi Michal,

Quoted 51 lines · Michal Simek
Quoted 50 lines · Moritz Fischer

Hi Michal,

Quoted 24 lines · Michal Simek
Quoted 23 lines · Moritz Fischer

For mux check if the parent is already a device of UCLASS_I2C and if yes just use that. Otherwise see if someone specified an i2c-parent phandle. This mimics the behavior found in the Kernel, as it removes the requirement to explicitly specify a i2c-parent phandle.

Cc Heiko Schocher <[email protected]>
Cc Bin Meng <[email protected]>
Cc Simon Glass <[email protected]>
Cc Michal Simek <[email protected]>
Cc u-boot at lists.denx.de
---
 drivers/i2c/muxes/i2c-mux-uclass.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/i2c/muxes/i2c-mux-uclass.c +0 -0
index 7a698b6..e01b773 100644
@@ -86,6 +86,15 @@ static int i2c_mux_post_probe(struct udevice *mux)
      debug("%s: %s\n", __func__, mux->name);
      priv->selected = -1;
 
Quoted 4 lines

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 90

Quoted 2 lines
drivers/i2c/muxes/i2c-mux-uclass.c +2 -0
+     /* if parent is of i2c uclass already, we'll take that, otherwise
+      * look if we find an i2c-parent phandle */

Incorrect comment style.

Yeah, wasn't flagged by checkpatch .... will fix.

Quoted 16 lines

drivers/i2c/muxes/i2c-mux-uclass.c static int i2c_mux_post_probe(struct udevice *mux) · line 100

Quoted 12 lines
drivers/i2c/muxes/i2c-mux-uclass.c +7 -0
+     if (UCLASS_I2C == device_get_uclass_id(mux->parent)) {
+             priv->i2c_bus = dev_get_parent(mux);
+             debug("%s: bus=%p/%s\n", __func__, priv->i2c_bus,
+                   priv->i2c_bus->name);
+             return 0;
+     }
+
      ret = uclass_get_device_by_phandle(UCLASS_I2C, mux, "i2c-parent",
                                         &priv->i2c_bus);
      if (ret)

The part of this will be good to also handle
req_seq for mux busses. But at least this should solved part of the problems.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I'm not sure I understand this comment.

AFAIK using i2c muxes requires two changes in DTS file. First change is this to setup i2c-parent in DTS file which is something what Linux doesn't need.

Yeah this part is addressed in this patch.

yep

Quoted 9 lines
Quoted 4 lines

The next change is that you have to extend i2c aliases to point to i2c mux sub busses which is the second thing what Linux doesn't need. I expect that this change you have in your dts file.

Yeah, thanks for clarifying. In my dts I have aliases for each of the mux channels,
which, I don't have a good idea on how to solve differently. In Linux I think I don't need that.

yes and this is not required by Linux kernel.
IIRC Linux simply assign free ID to that bus.
It means starting from 0 and asking if there is alias or not and then +1, etc should work.

Quoted 5 lines
Quoted 2 lines

I think that if you detect mux with 8 ports you can simply use unique busid to be able to address them.

In Linux? I'll have to take another look at that. Currently I get busses like 700,701,702 etc (which are aliases I defined).

When I was playing with this if you define other aliases like 1700, 1701, 1702 etc u-boot will mess it up.

Quoted 33 lines

Each of them points to a mux channel.

<snip>
aliases { ...

                i2c0 = &i2c0;
                i2c0700 = &i2c0_70_0;
                i2c0701 = &i2c0_70_1;
                i2c0702 = &i2c0_70_2;
                i2c0703 = &i2c0_70_3;
};

...

        i2cswitch at 70 {
                compatible = "ti,pca9548", "nxp,pca9548";
                #address-cells = <1>;
                #size-cells = <0>;
                reg = <0x70>;
                status = "okay";

                i2c0_70_0: i2c at 0 {
                        reg = <0x0>;
                        #address-cells = <1>;
                        #size-cells = <0>;

                        status = "okay";
                };
                ...
          };

</snip>

I Will resubmit a v2 for the other changes above

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

If you or Simon have ideas on how to correctly solve the alias issue, I can take another stab at that.

Look at this.
http://lists.denx.de/pipermail/u-boot/2016-April/251769.html

That patch was never applied but it would be good to get this problem resolved.

Definitely but TBH I won't have any time for looking at this at least for 2 months.

Thanks,
Michal