All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] i2c: Fix deselection of muxes
@ 2014-12-01 19:49 Mark Tomlinson
  2014-12-01 19:49 ` [U-Boot] [PATCH 2/2] i2c: Correct spelling error Mark Tomlinson
  2014-12-03  7:35 ` [U-Boot] [PATCH 1/2] i2c: Fix deselection of muxes Chris Packham
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Tomlinson @ 2014-12-01 19:49 UTC (permalink / raw)
  To: u-boot

Due to an uninitialised variable, when muxes were deselected, any value
could be written to the mux control register. On the PCA9548, this could
result in multiple channels being selected, thus enabling multiple
pull-up resistors, and much bus capacitance.

The fix is simply to initialise the written value to zero.

Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
---
 drivers/i2c/i2c_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
index d34b749..4539667 100644
--- a/drivers/i2c/i2c_core.c
+++ b/drivers/i2c/i2c_core.c
@@ -178,7 +178,7 @@ static int i2c_mux_disconnet_all(void)
 {
 	struct	i2c_bus_hose *i2c_bus_tmp = &i2c_bus[I2C_BUS];
 	int	i;
-	uint8_t	buf;
+	uint8_t	buf = 0;
 
 	if (I2C_ADAP->init_done == 0)
 		return 0;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 2/2] i2c: Correct spelling error
  2014-12-01 19:49 [U-Boot] [PATCH 1/2] i2c: Fix deselection of muxes Mark Tomlinson
@ 2014-12-01 19:49 ` Mark Tomlinson
  2014-12-03  7:36   ` Chris Packham
  2014-12-03  7:35 ` [U-Boot] [PATCH 1/2] i2c: Fix deselection of muxes Chris Packham
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Tomlinson @ 2014-12-01 19:49 UTC (permalink / raw)
  To: u-boot

"diconnect" and "disconnet" should both be "disconnect".

Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
---
 drivers/i2c/i2c_core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
index 4539667..41cc3b8 100644
--- a/drivers/i2c/i2c_core.c
+++ b/drivers/i2c/i2c_core.c
@@ -174,7 +174,7 @@ static int i2c_mux_set_all(void)
 	return 0;
 }
 
-static int i2c_mux_disconnet_all(void)
+static int i2c_mux_disconnect_all(void)
 {
 	struct	i2c_bus_hose *i2c_bus_tmp = &i2c_bus[I2C_BUS];
 	int	i;
@@ -197,7 +197,7 @@ static int i2c_mux_disconnet_all(void)
 
 			ret = I2C_ADAP->write(I2C_ADAP, chip, 0, 0, &buf, 1);
 			if (ret != 0) {
-				printf("i2c: mux diconnect error\n");
+				printf("i2c: mux disconnect error\n");
 				return ret;
 			}
 		} while (i > 0);
@@ -293,7 +293,7 @@ int i2c_set_bus_num(unsigned int bus)
 	}
 
 #ifndef CONFIG_SYS_I2C_DIRECT_BUS
-	i2c_mux_disconnet_all();
+	i2c_mux_disconnect_all();
 #endif
 
 	gd->cur_i2c_bus = bus;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 1/2] i2c: Fix deselection of muxes
  2014-12-01 19:49 [U-Boot] [PATCH 1/2] i2c: Fix deselection of muxes Mark Tomlinson
  2014-12-01 19:49 ` [U-Boot] [PATCH 2/2] i2c: Correct spelling error Mark Tomlinson
@ 2014-12-03  7:35 ` Chris Packham
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Packham @ 2014-12-03  7:35 UTC (permalink / raw)
  To: u-boot

Hi Mark,

This might get more attention if Heiko was on the Cc list.

On Tue, Dec 2, 2014 at 8:49 AM, Mark Tomlinson
<mark.tomlinson@alliedtelesis.co.nz> wrote:
> Due to an uninitialised variable, when muxes were deselected, any value
> could be written to the mux control register. On the PCA9548, this could
> result in multiple channels being selected, thus enabling multiple
> pull-up resistors, and much bus capacitance.
>
> The fix is simply to initialise the written value to zero.
>
> Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
> ---
>  drivers/i2c/i2c_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
> index d34b749..4539667 100644
> --- a/drivers/i2c/i2c_core.c
> +++ b/drivers/i2c/i2c_core.c
> @@ -178,7 +178,7 @@ static int i2c_mux_disconnet_all(void)
>  {
>         struct  i2c_bus_hose *i2c_bus_tmp = &i2c_bus[I2C_BUS];
>         int     i;
> -       uint8_t buf;
> +       uint8_t buf = 0;
>
>         if (I2C_ADAP->init_done == 0)
>                 return 0;
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 2/2] i2c: Correct spelling error
  2014-12-01 19:49 ` [U-Boot] [PATCH 2/2] i2c: Correct spelling error Mark Tomlinson
@ 2014-12-03  7:36   ` Chris Packham
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Packham @ 2014-12-03  7:36 UTC (permalink / raw)
  To: u-boot

This one too.

On Tue, Dec 2, 2014 at 8:49 AM, Mark Tomlinson
<mark.tomlinson@alliedtelesis.co.nz> wrote:
> "diconnect" and "disconnet" should both be "disconnect".
>
> Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
> ---
>  drivers/i2c/i2c_core.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
> index 4539667..41cc3b8 100644
> --- a/drivers/i2c/i2c_core.c
> +++ b/drivers/i2c/i2c_core.c
> @@ -174,7 +174,7 @@ static int i2c_mux_set_all(void)
>         return 0;
>  }
>
> -static int i2c_mux_disconnet_all(void)
> +static int i2c_mux_disconnect_all(void)
>  {
>         struct  i2c_bus_hose *i2c_bus_tmp = &i2c_bus[I2C_BUS];
>         int     i;
> @@ -197,7 +197,7 @@ static int i2c_mux_disconnet_all(void)
>
>                         ret = I2C_ADAP->write(I2C_ADAP, chip, 0, 0, &buf, 1);
>                         if (ret != 0) {
> -                               printf("i2c: mux diconnect error\n");
> +                               printf("i2c: mux disconnect error\n");
>                                 return ret;
>                         }
>                 } while (i > 0);
> @@ -293,7 +293,7 @@ int i2c_set_bus_num(unsigned int bus)
>         }
>
>  #ifndef CONFIG_SYS_I2C_DIRECT_BUS
> -       i2c_mux_disconnet_all();
> +       i2c_mux_disconnect_all();
>  #endif
>
>         gd->cur_i2c_bus = bus;
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-03  7:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-01 19:49 [U-Boot] [PATCH 1/2] i2c: Fix deselection of muxes Mark Tomlinson
2014-12-01 19:49 ` [U-Boot] [PATCH 2/2] i2c: Correct spelling error Mark Tomlinson
2014-12-03  7:36   ` Chris Packham
2014-12-03  7:35 ` [U-Boot] [PATCH 1/2] i2c: Fix deselection of muxes Chris Packham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.