diff mbox series

[v3] board: freescale: p1_p2_rdb_pc: Fix parsing inverted bits from boot input data

Message ID 20220616123707.8562-1-pali@kernel.org
State Accepted
Delegated to: Tom Rini
Headers show
Series [v3] board: freescale: p1_p2_rdb_pc: Fix parsing inverted bits from boot input data | expand

Commit Message

Pali Rohár June 16, 2022, 12:37 p.m. UTC
On some boards upper 4 bits of i2c boot input data (register 0) are
inverted. Information which bits are inverted is stored in register 2.

So invert read input data back according to register 2 prior processing
them. This fixes printing "rom_loc: value" line during booting.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
Changes in v3:
* Rebased on top of the U-Boot next branch, commit a87a6fcd20c0e29fe55bfbb6917c4aa1f1bbce74

Changes in v2:
* Use register 2 for detecting which bits needs to be inverted
---
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Pali Rohár June 23, 2022, 1:04 p.m. UTC | #1
On Thursday 16 June 2022 14:37:07 Pali Rohár wrote:
> On some boards upper 4 bits of i2c boot input data (register 0) are
> inverted. Information which bits are inverted is stored in register 2.
> 
> So invert read input data back according to register 2 prior processing
> them. This fixes printing "rom_loc: value" line during booting.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> Changes in v3:
> * Rebased on top of the U-Boot next branch, commit a87a6fcd20c0e29fe55bfbb6917c4aa1f1bbce74

PING?

> Changes in v2:
> * Use register 2 for detecting which bits needs to be inverted
> ---
>  board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> index 6665aa4ba94e..d36306f35427 100644
> --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> @@ -174,7 +174,7 @@ int checkboard(void)
>  {
>  	struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE);
>  	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
> -	u8 in, out, io_config, val;
> +	u8 in, out, invert, io_config, val;
>  	int bus_num = CONFIG_SYS_SPD_BUS_NUM;
>  
>  	/* FIXME: This should just use the model from the device tree or similar */
> @@ -198,6 +198,7 @@ int checkboard(void)
>  
>  	if (dm_i2c_read(dev, 0, &in, 1) < 0 ||
>  	    dm_i2c_read(dev, 1, &out, 1) < 0 ||
> +	    dm_i2c_read(dev, 2, &invert, 1) < 0 ||
>  	    dm_i2c_read(dev, 3, &io_config, 1) < 0) {
>  		printf("Error reading i2c boot information!\n");
>  		return 0; /* Don't want to hang() on this error */
> @@ -207,13 +208,14 @@ int checkboard(void)
>  
>  	if (i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 0, 1, &in, 1) < 0 ||
>  	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 1, 1, &out, 1) < 0 ||
> +	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 2, 1, &invert, 1) < 0 ||
>  	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 3, 1, &io_config, 1) < 0) {
>  		printf("Error reading i2c boot information!\n");
>  		return 0; /* Don't want to hang() on this error */
>  	}
>  	#endif
>  
> -	val = (in & io_config) | (out & (~io_config));
> +	val = ((in ^ invert) & io_config) | (out & (~io_config));
>  
>  	puts("rom_loc: ");
>  	if ((val & (~__SW_BOOT_MASK)) == __SW_BOOT_SD) {
> -- 
> 2.20.1
>
Pali Rohár July 3, 2022, 12:39 p.m. UTC | #2
On Thursday 23 June 2022 15:04:08 Pali Rohár wrote:
> On Thursday 16 June 2022 14:37:07 Pali Rohár wrote:
> > On some boards upper 4 bits of i2c boot input data (register 0) are
> > inverted. Information which bits are inverted is stored in register 2.
> > 
> > So invert read input data back according to register 2 prior processing
> > them. This fixes printing "rom_loc: value" line during booting.
> > 
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > ---
> > Changes in v3:
> > * Rebased on top of the U-Boot next branch, commit a87a6fcd20c0e29fe55bfbb6917c4aa1f1bbce74
> 
> PING?

PING?

> > Changes in v2:
> > * Use register 2 for detecting which bits needs to be inverted
> > ---
> >  board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > index 6665aa4ba94e..d36306f35427 100644
> > --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > @@ -174,7 +174,7 @@ int checkboard(void)
> >  {
> >  	struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE);
> >  	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
> > -	u8 in, out, io_config, val;
> > +	u8 in, out, invert, io_config, val;
> >  	int bus_num = CONFIG_SYS_SPD_BUS_NUM;
> >  
> >  	/* FIXME: This should just use the model from the device tree or similar */
> > @@ -198,6 +198,7 @@ int checkboard(void)
> >  
> >  	if (dm_i2c_read(dev, 0, &in, 1) < 0 ||
> >  	    dm_i2c_read(dev, 1, &out, 1) < 0 ||
> > +	    dm_i2c_read(dev, 2, &invert, 1) < 0 ||
> >  	    dm_i2c_read(dev, 3, &io_config, 1) < 0) {
> >  		printf("Error reading i2c boot information!\n");
> >  		return 0; /* Don't want to hang() on this error */
> > @@ -207,13 +208,14 @@ int checkboard(void)
> >  
> >  	if (i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 0, 1, &in, 1) < 0 ||
> >  	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 1, 1, &out, 1) < 0 ||
> > +	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 2, 1, &invert, 1) < 0 ||
> >  	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 3, 1, &io_config, 1) < 0) {
> >  		printf("Error reading i2c boot information!\n");
> >  		return 0; /* Don't want to hang() on this error */
> >  	}
> >  	#endif
> >  
> > -	val = (in & io_config) | (out & (~io_config));
> > +	val = ((in ^ invert) & io_config) | (out & (~io_config));
> >  
> >  	puts("rom_loc: ");
> >  	if ((val & (~__SW_BOOT_MASK)) == __SW_BOOT_SD) {
> > -- 
> > 2.20.1
> >
Pali Rohár July 8, 2022, 10:49 p.m. UTC | #3
PING?

How many times you would ask me to again rebase this patch??

On Sunday 03 July 2022 14:39:13 Pali Rohár wrote:
> On Thursday 23 June 2022 15:04:08 Pali Rohár wrote:
> > On Thursday 16 June 2022 14:37:07 Pali Rohár wrote:
> > > On some boards upper 4 bits of i2c boot input data (register 0) are
> > > inverted. Information which bits are inverted is stored in register 2.
> > > 
> > > So invert read input data back according to register 2 prior processing
> > > them. This fixes printing "rom_loc: value" line during booting.
> > > 
> > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > ---
> > > Changes in v3:
> > > * Rebased on top of the U-Boot next branch, commit a87a6fcd20c0e29fe55bfbb6917c4aa1f1bbce74
> > 
> > PING?
> 
> PING?
> 
> > > Changes in v2:
> > > * Use register 2 for detecting which bits needs to be inverted
> > > ---
> > >  board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > > index 6665aa4ba94e..d36306f35427 100644
> > > --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > > +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > > @@ -174,7 +174,7 @@ int checkboard(void)
> > >  {
> > >  	struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE);
> > >  	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
> > > -	u8 in, out, io_config, val;
> > > +	u8 in, out, invert, io_config, val;
> > >  	int bus_num = CONFIG_SYS_SPD_BUS_NUM;
> > >  
> > >  	/* FIXME: This should just use the model from the device tree or similar */
> > > @@ -198,6 +198,7 @@ int checkboard(void)
> > >  
> > >  	if (dm_i2c_read(dev, 0, &in, 1) < 0 ||
> > >  	    dm_i2c_read(dev, 1, &out, 1) < 0 ||
> > > +	    dm_i2c_read(dev, 2, &invert, 1) < 0 ||
> > >  	    dm_i2c_read(dev, 3, &io_config, 1) < 0) {
> > >  		printf("Error reading i2c boot information!\n");
> > >  		return 0; /* Don't want to hang() on this error */
> > > @@ -207,13 +208,14 @@ int checkboard(void)
> > >  
> > >  	if (i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 0, 1, &in, 1) < 0 ||
> > >  	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 1, 1, &out, 1) < 0 ||
> > > +	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 2, 1, &invert, 1) < 0 ||
> > >  	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 3, 1, &io_config, 1) < 0) {
> > >  		printf("Error reading i2c boot information!\n");
> > >  		return 0; /* Don't want to hang() on this error */
> > >  	}
> > >  	#endif
> > >  
> > > -	val = (in & io_config) | (out & (~io_config));
> > > +	val = ((in ^ invert) & io_config) | (out & (~io_config));
> > >  
> > >  	puts("rom_loc: ");
> > >  	if ((val & (~__SW_BOOT_MASK)) == __SW_BOOT_SD) {
> > > -- 
> > > 2.20.1
> > >
Tom Rini July 8, 2022, 11:10 p.m. UTC | #4
On Sat, Jul 09, 2022 at 12:49:27AM +0200, Pali Rohár wrote:
> PING?
> 
> How many times you would ask me to again rebase this patch??
> 
> On Sunday 03 July 2022 14:39:13 Pali Rohár wrote:
> > On Thursday 23 June 2022 15:04:08 Pali Rohár wrote:
> > > On Thursday 16 June 2022 14:37:07 Pali Rohár wrote:
> > > > On some boards upper 4 bits of i2c boot input data (register 0) are
> > > > inverted. Information which bits are inverted is stored in register 2.
> > > > 
> > > > So invert read input data back according to register 2 prior processing
> > > > them. This fixes printing "rom_loc: value" line during booting.
> > > > 
> > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > ---
> > > > Changes in v3:
> > > > * Rebased on top of the U-Boot next branch, commit a87a6fcd20c0e29fe55bfbb6917c4aa1f1bbce74
> > > 
> > > PING?
> > 
> > PING?
> > 
> > > > Changes in v2:
> > > > * Use register 2 for detecting which bits needs to be inverted
> > > > ---
> > > >  board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 6 ++++--
> > > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > > > index 6665aa4ba94e..d36306f35427 100644
> > > > --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > > > +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > > > @@ -174,7 +174,7 @@ int checkboard(void)
> > > >  {
> > > >  	struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE);
> > > >  	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
> > > > -	u8 in, out, io_config, val;
> > > > +	u8 in, out, invert, io_config, val;
> > > >  	int bus_num = CONFIG_SYS_SPD_BUS_NUM;
> > > >  
> > > >  	/* FIXME: This should just use the model from the device tree or similar */
> > > > @@ -198,6 +198,7 @@ int checkboard(void)
> > > >  
> > > >  	if (dm_i2c_read(dev, 0, &in, 1) < 0 ||
> > > >  	    dm_i2c_read(dev, 1, &out, 1) < 0 ||
> > > > +	    dm_i2c_read(dev, 2, &invert, 1) < 0 ||
> > > >  	    dm_i2c_read(dev, 3, &io_config, 1) < 0) {
> > > >  		printf("Error reading i2c boot information!\n");
> > > >  		return 0; /* Don't want to hang() on this error */
> > > > @@ -207,13 +208,14 @@ int checkboard(void)
> > > >  
> > > >  	if (i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 0, 1, &in, 1) < 0 ||
> > > >  	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 1, 1, &out, 1) < 0 ||
> > > > +	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 2, 1, &invert, 1) < 0 ||
> > > >  	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 3, 1, &io_config, 1) < 0) {
> > > >  		printf("Error reading i2c boot information!\n");
> > > >  		return 0; /* Don't want to hang() on this error */
> > > >  	}
> > > >  	#endif
> > > >  
> > > > -	val = (in & io_config) | (out & (~io_config));
> > > > +	val = ((in ^ invert) & io_config) | (out & (~io_config));
> > > >  
> > > >  	puts("rom_loc: ");
> > > >  	if ((val & (~__SW_BOOT_MASK)) == __SW_BOOT_SD) {

Peng, this patch doesn't apply currently but also looks fairly obvious
to adapt to top of tree.  Please just make it apply when you pick this
up, thanks.
Pali Rohár July 23, 2022, 9:48 a.m. UTC | #5
On Friday 08 July 2022 19:10:26 Tom Rini wrote:
> On Sat, Jul 09, 2022 at 12:49:27AM +0200, Pali Rohár wrote:
> > PING?
> > 
> > How many times you would ask me to again rebase this patch??
> > 
> > On Sunday 03 July 2022 14:39:13 Pali Rohár wrote:
> > > On Thursday 23 June 2022 15:04:08 Pali Rohár wrote:
> > > > On Thursday 16 June 2022 14:37:07 Pali Rohár wrote:
> > > > > On some boards upper 4 bits of i2c boot input data (register 0) are
> > > > > inverted. Information which bits are inverted is stored in register 2.
> > > > > 
> > > > > So invert read input data back according to register 2 prior processing
> > > > > them. This fixes printing "rom_loc: value" line during booting.
> > > > > 
> > > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > > ---
> > > > > Changes in v3:
> > > > > * Rebased on top of the U-Boot next branch, commit a87a6fcd20c0e29fe55bfbb6917c4aa1f1bbce74
> > > > 
> > > > PING?
> > > 
> > > PING?
> > > 
> > > > > Changes in v2:
> > > > > * Use register 2 for detecting which bits needs to be inverted
> > > > > ---
> > > > >  board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 6 ++++--
> > > > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > > > > index 6665aa4ba94e..d36306f35427 100644
> > > > > --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > > > > +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > > > > @@ -174,7 +174,7 @@ int checkboard(void)
> > > > >  {
> > > > >  	struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE);
> > > > >  	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
> > > > > -	u8 in, out, io_config, val;
> > > > > +	u8 in, out, invert, io_config, val;
> > > > >  	int bus_num = CONFIG_SYS_SPD_BUS_NUM;
> > > > >  
> > > > >  	/* FIXME: This should just use the model from the device tree or similar */
> > > > > @@ -198,6 +198,7 @@ int checkboard(void)
> > > > >  
> > > > >  	if (dm_i2c_read(dev, 0, &in, 1) < 0 ||
> > > > >  	    dm_i2c_read(dev, 1, &out, 1) < 0 ||
> > > > > +	    dm_i2c_read(dev, 2, &invert, 1) < 0 ||
> > > > >  	    dm_i2c_read(dev, 3, &io_config, 1) < 0) {
> > > > >  		printf("Error reading i2c boot information!\n");
> > > > >  		return 0; /* Don't want to hang() on this error */
> > > > > @@ -207,13 +208,14 @@ int checkboard(void)
> > > > >  
> > > > >  	if (i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 0, 1, &in, 1) < 0 ||
> > > > >  	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 1, 1, &out, 1) < 0 ||
> > > > > +	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 2, 1, &invert, 1) < 0 ||
> > > > >  	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 3, 1, &io_config, 1) < 0) {
> > > > >  		printf("Error reading i2c boot information!\n");
> > > > >  		return 0; /* Don't want to hang() on this error */
> > > > >  	}
> > > > >  	#endif
> > > > >  
> > > > > -	val = (in & io_config) | (out & (~io_config));
> > > > > +	val = ((in ^ invert) & io_config) | (out & (~io_config));
> > > > >  
> > > > >  	puts("rom_loc: ");
> > > > >  	if ((val & (~__SW_BOOT_MASK)) == __SW_BOOT_SD) {
> 
> Peng, this patch doesn't apply currently but also looks fairly obvious
> to adapt to top of tree.  Please just make it apply when you pick this
> up, thanks.
> 
> -- 
> Tom

June 16 I got message that this patch does not apply:
https://lore.kernel.org/u-boot/8d8a6be1-6033-5771-0e0e-f51de1488e69@oss.nxp.com/

Just few hours later I sent rebased patch which applied cleanly:
https://lore.kernel.org/u-boot/20220616123707.8562-1-pali@kernel.org/

And since June 16 I have not received any reply.

Guys, why you are asking me for rebasing patches and then you do not
care about them and wait until they do not apply again?

I was asked to remind pending patches -- I have did it more times and I
got absolutely no response. Now is July 23.
diff mbox series

Patch

diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index 6665aa4ba94e..d36306f35427 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -174,7 +174,7 @@  int checkboard(void)
 {
 	struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE);
 	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
-	u8 in, out, io_config, val;
+	u8 in, out, invert, io_config, val;
 	int bus_num = CONFIG_SYS_SPD_BUS_NUM;
 
 	/* FIXME: This should just use the model from the device tree or similar */
@@ -198,6 +198,7 @@  int checkboard(void)
 
 	if (dm_i2c_read(dev, 0, &in, 1) < 0 ||
 	    dm_i2c_read(dev, 1, &out, 1) < 0 ||
+	    dm_i2c_read(dev, 2, &invert, 1) < 0 ||
 	    dm_i2c_read(dev, 3, &io_config, 1) < 0) {
 		printf("Error reading i2c boot information!\n");
 		return 0; /* Don't want to hang() on this error */
@@ -207,13 +208,14 @@  int checkboard(void)
 
 	if (i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 0, 1, &in, 1) < 0 ||
 	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 1, 1, &out, 1) < 0 ||
+	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 2, 1, &invert, 1) < 0 ||
 	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 3, 1, &io_config, 1) < 0) {
 		printf("Error reading i2c boot information!\n");
 		return 0; /* Don't want to hang() on this error */
 	}
 	#endif
 
-	val = (in & io_config) | (out & (~io_config));
+	val = ((in ^ invert) & io_config) | (out & (~io_config));
 
 	puts("rom_loc: ");
 	if ((val & (~__SW_BOOT_MASK)) == __SW_BOOT_SD) {