power: pmic: rk8xx: Workaround pmic failure when probed before relocation
PATCH 1/1 power: pmic: rk8xx: Workaround pmic failure when probed before relocation
When the sysreset is added as child of the pmic the pmic is probed before relocation. That probe fails, and subsequent attempts to probe after reloaction fail as well.
As a workaround do not bind the sysreset before relocation.
--- drivers/power/pmic/rk8xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/pmic/rk8xx.c +1 -1
@@ -131,7 +131,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len)static int rk8xx_bind (struct udevice *dev) { -if (CONFIG_IS_ENABLED (SYSRESET )) { +if (CONFIG_IS_ENABLED (SYSRESET ) && (gd->flags &GD_FLG_RELOC )) {device_bind_driver (dev,"rk8xx_sysreset" ,"rk8xx_sysreset" ,NULL ); }
Signature · 1 line
2.37.1
Hi Michal,
Quoted 26 lines · Michal Suchanek
When the sysreset is added as child of the pmic the pmic is probed before relocation. That probe fails, and subsequent attempts to probe after reloaction fail as well.
As a workaround do not bind the sysreset before relocation.
Signed-off-by Michal Suchanek <[email protected]>--- drivers/power/pmic/rk8xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/power/pmic/rk8xx.c +1
-2@@ -131,7 +131,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len)static int rk8xx_bind (struct udevice *dev) { -if (CONFIG_IS_ENABLED (SYSRESET )) { +if (CONFIG_IS_ENABLED (SYSRESET ) && (gd->flags &GD_FLG_RELOC )) {device_bind_driver (dev,"rk8xx_sysreset" ,"rk8xx_sysreset" ,NULL ); } --
Quoted 2 lines
2.37.1
I think it is OK to avoid starting a device before relocation, or make that device do something different. I really don't like the binding being optional though...we have the 'u-boot,dm-pre-reloc' for that.
But missing from your commit message is exactly what fails?
Regards,
Simon
Quoted 21 lines · Simon Glass
Hi Michal,
Quoted 18 lines · Michal Suchanek
When the sysreset is added as child of the pmic the pmic is probed before relocation. That probe fails, and subsequent attempts to probe after reloaction fail as well.
As a workaround do not bind the sysreset before relocation.
Signed-off-by Michal Suchanek <[email protected]>--- drivers/power/pmic/rk8xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/power/pmic/rk8xx.c +0
-0@@ -131,7 +131,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
Quoted 14 lines
Quoted 10 lines
drivers/power/pmic/rk8xx.c +1
-2static int rk8xx_bind (struct udevice *dev) { -if (CONFIG_IS_ENABLED (SYSRESET )) { +if (CONFIG_IS_ENABLED (SYSRESET ) && (gd->flags &GD_FLG_RELOC )) {device_bind_driver (dev,"rk8xx_sysreset" ,"rk8xx_sysreset" ,NULL ); } --2.37.1
I think it is OK to avoid starting a device before relocation, or make that device do something different. I really don't like the binding being optional though...we have the 'u-boot,dm-pre-reloc' for that.
So perhaps the flag should be dropped from rk8xx then.
Quoted 2 lines
But missing from your commit message is exactly what fails?
The pmic is an i2c device, all i2c tranferss fail if initialized pre-relocation. I supect it's the i2c bus that fails if initialized before reloc - the regulatorss that share the i2c bus also report i2c transfer failure.
Thanks
Michal
Hi Michal,
Quoted 41 lines · Michal Suchánek
Quoted 21 lines · Simon Glass
Hi Michal,
Quoted 18 lines · Michal Suchanek
When the sysreset is added as child of the pmic the pmic is probed before relocation. That probe fails, and subsequent attempts to probe after reloaction fail as well.
As a workaround do not bind the sysreset before relocation.
Signed-off-by Michal Suchanek <[email protected]>--- drivers/power/pmic/rk8xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/power/pmic/rk8xx.c +0
-0@@ -131,7 +131,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len)Quoted 14 lines
Quoted 10 lines
drivers/power/pmic/rk8xx.c +1
-2static int rk8xx_bind (struct udevice *dev) { -if (CONFIG_IS_ENABLED (SYSRESET )) { +if (CONFIG_IS_ENABLED (SYSRESET ) && (gd->flags &GD_FLG_RELOC )) {device_bind_driver (dev,"rk8xx_sysreset" ,"rk8xx_sysreset" ,NULL ); } --2.37.1
I think it is OK to avoid starting a device before relocation, or make that device do something different. I really don't like the binding being optional though...we have the 'u-boot,dm-pre-reloc' for that.
So perhaps the flag should be dropped from rk8xx then.
Quoted 1 line
Quoted 6 lines
Quoted 1 line
But missing from your commit message is exactly what fails?
The pmic is an i2c device, all i2c tranferss fail if initialized pre-relocation. I supect it's the i2c bus that fails if initialized before reloc - the regulatorss that share the i2c bus also report i2c transfer failure.
OK, I wonder why i2c fails? It works OK on the rockchip devices I'm familiar with, e.g. chromebooks.
Regards,
Simon
Quoted 46 lines · Simon Glass
Hi Michal,
Quoted 43 lines · Michal Suchánek
Quoted 21 lines · Simon Glass
Hi Michal,
Quoted 18 lines · Michal Suchanek
When the sysreset is added as child of the pmic the pmic is probed before relocation. That probe fails, and subsequent attempts to probe after reloaction fail as well.
As a workaround do not bind the sysreset before relocation.
Signed-off-by Michal Suchanek <[email protected]>--- drivers/power/pmic/rk8xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/power/pmic/rk8xx.c +0
-0@@ -131,7 +131,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len)Quoted 14 lines
Quoted 10 lines
drivers/power/pmic/rk8xx.c +1
-2static int rk8xx_bind (struct udevice *dev) { -if (CONFIG_IS_ENABLED (SYSRESET )) { +if (CONFIG_IS_ENABLED (SYSRESET ) && (gd->flags &GD_FLG_RELOC )) {device_bind_driver (dev,"rk8xx_sysreset" ,"rk8xx_sysreset" ,NULL ); } --2.37.1
I think it is OK to avoid starting a device before relocation, or make that device do something different. I really don't like the binding being optional though...we have the 'u-boot,dm-pre-reloc' for that.
So perhaps the flag should be dropped from rk8xx then.
Quoted 2 lines
But missing from your commit message is exactly what fails?
Quoted 7 lines
Quoted 4 lines
The pmic is an i2c device, all i2c tranferss fail if initialized pre-relocation. I supect it's the i2c bus that fails if initialized before reloc - the regulatorss that share the i2c bus also report i2c transfer failure.
OK, I wonder why i2c fails? It works OK on the rockchip devices I'm familiar with, e.g. chromebooks.
It worksss fine here as well - so long as it is not initialized before relocation.
Thanks
Michal
Hi Michal,
Quoted 53 lines · Michal Suchánek
Quoted 51 lines · Simon Glass
Hi Michal,
Quoted 47 lines · Michal Suchánek
Quoted 21 lines · Simon Glass
Hi Michal,
Quoted 18 lines · Michal Suchanek
When the sysreset is added as child of the pmic the pmic is probed before relocation. That probe fails, and subsequent attempts to probe after reloaction fail as well.
As a workaround do not bind the sysreset before relocation.
Signed-off-by Michal Suchanek <[email protected]>--- drivers/power/pmic/rk8xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/power/pmic/rk8xx.c +0
-0@@ -131,7 +131,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len)Quoted 14 lines
Quoted 10 lines
drivers/power/pmic/rk8xx.c +1
-2static int rk8xx_bind (struct udevice *dev) { -if (CONFIG_IS_ENABLED (SYSRESET )) { +if (CONFIG_IS_ENABLED (SYSRESET ) && (gd->flags &GD_FLG_RELOC )) {device_bind_driver (dev,"rk8xx_sysreset" ,"rk8xx_sysreset" ,NULL ); } --2.37.1
I think it is OK to avoid starting a device before relocation, or make that device do something different. I really don't like the binding being optional though...we have the 'u-boot,dm-pre-reloc' for that.
So perhaps the flag should be dropped from rk8xx then.
Quoted 2 lines
But missing from your commit message is exactly what fails?
The pmic is an i2c device, all i2c tranferss fail if initialized pre-relocation. I supect it's the i2c bus that fails if initialized before reloc - the regulatorss that share the i2c bus also report i2c transfer failure.
Quoted 5 lines
Quoted 2 lines
OK, I wonder why i2c fails? It works OK on the rockchip devices I'm familiar with, e.g. chromebooks.
It worksss fine here as well - so long as it is not initialized before relocation.
I wonder if the clock driver is doing something different then, or has a limited number of clocks?
Regards,
Simon
Quoted 56 lines · Simon Glass
Hi Michal,
Quoted 53 lines · Michal Suchánek
Quoted 51 lines · Simon Glass
Hi Michal,
Quoted 47 lines · Michal Suchánek
Quoted 21 lines · Simon Glass
Hi Michal,
Quoted 18 lines · Michal Suchanek
When the sysreset is added as child of the pmic the pmic is probed before relocation. That probe fails, and subsequent attempts to probe after reloaction fail as well.
As a workaround do not bind the sysreset before relocation.
Signed-off-by Michal Suchanek <[email protected]>--- drivers/power/pmic/rk8xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/power/pmic/rk8xx.c +0
-0@@ -131,7 +131,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len)Quoted 14 lines
Quoted 10 lines
drivers/power/pmic/rk8xx.c +1
-2static int rk8xx_bind (struct udevice *dev) { -if (CONFIG_IS_ENABLED (SYSRESET )) { +if (CONFIG_IS_ENABLED (SYSRESET ) && (gd->flags &GD_FLG_RELOC )) {device_bind_driver (dev,"rk8xx_sysreset" ,"rk8xx_sysreset" ,NULL ); } --2.37.1
I think it is OK to avoid starting a device before relocation, or make that device do something different. I really don't like the binding being optional though...we have the 'u-boot,dm-pre-reloc' for that.
So perhaps the flag should be dropped from rk8xx then.
Quoted 2 lines
But missing from your commit message is exactly what fails?
The pmic is an i2c device, all i2c tranferss fail if initialized pre-relocation. I supect it's the i2c bus that fails if initialized before reloc - the regulatorss that share the i2c bus also report i2c transfer failure.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
OK, I wonder why i2c fails? It works OK on the rockchip devices I'm familiar with, e.g. chromebooks.
It worksss fine here as well - so long as it is not initialized before relocation.
I wonder if the clock driver is doing something different then, or has a limited number of clocks?
Looks like it is not the clocks.
There is something slightly fishy going on there with them:
In the broken case the i2c clock is not initialized before reloc
TICE: BL31: v2.6(debug): NOTICE: BL31: Built : 14:50:40, Jul 1 2022 INFO: GICv3 with legacy support detected. INFO: ARM GICv3 driver initialized in EL3 INFO: Maximum SPI INTID supported: 287 INFO: plat_rockchip_pmu_init(1624): pd status 3e INFO: BL31: Initializing runtime services INFO: BL31: cortex_a53: CPU workaround for 855873 was applied WARNING: BL31: cortex_a53: CPU workaround for 1530924 was missing! INFO: BL31: Preparing for EL3 exit to normal world INFO: Entry point address = 0x200000 INFO: SPSR = 0x3c9
rk8xx_bind
global flags 0 relocaddr 0 rk8xx_sysreset_bindrk8xx_bind: 'pmic@1b' - found regulators subnoderk3399_clk_get_rate: clk clock-controller@ff760000 83 clock-controller@ff760000 83: clock rate 24000000
U-Boot 2022.07-00038-g61e11a8e9f-dirty (Aug 07 2022 - 19:53:20 +0200)
U-Boot PLL at 00000000ff750000: fbdiv=112, refdiv=2, postdiv1=2, postdiv2=1, vco=1344000 khz, output=672000 khz i2c@ff3c0000: Got clock pmu-clock-controller@ff750000 9rockchip_i2c_probe: clk: pmu-clock-controller@ff750000 9 rate 0 count 0 flags 0 rockchip_i2c_set_bus_speed: 400000rk3399_i2c_get_pmuclk: clk 9, con 771, div 3rk3399_pmuclk_get_rate: clk pmu-clock-controller@ff750000 9 -> 169000000 <<< different freqency pmu-clock-controller@ff750000 9: clock rate 169000000rk_i2c_set_clk: clk pmu-clock-controller@ff750000 9, i2c rate = 169000000, scl rate = 400000
set i2c clk div = 51, divh = 26, divl = 25
set clk(I2C_CLKDIV: 0x001a0019)rk8xx_probe
original ID registeri2c_xfer: 2 messagesi2c_xfer: chip=0x1b, len=0x1rk_i2c_write: chip = 27, reg = 0, r_len = 0, b_len = 1
I2c Send Start bit.
I2C Send Start Bit Timeouti2c_con: 0x00010009i2c_clkdiv: 0x001a0019i2c_mrxaddr: 0x00000000i2c_mrxraddR: 0x00000000i2c_mtxcnt: 0x00000000i2c_mrxcnt: 0x00000000i2c_ien: 0x00000010i2c_ipd: 0x00000000i2c_fcnt: 0x00000000i2c_txdata0: 0x00000000i2c_txdata1: 0x00000000i2c_txdata2: 0x00000000i2c_txdata3: 0x00000000i2c_txdata4: 0x00000000i2c_txdata5: 0x00000000i2c_txdata6: 0x00000000i2c_txdata7: 0x00000000i2c_rxdata0: 0x00000000i2c_rxdata1: 0x00000000i2c_rxdata2: 0x00000000i2c_rxdata3: 0x00000000i2c_rxdata4: 0x00000000i2c_rxdata5: 0x00000000i2c_rxdata6: 0x00000000i2c_rxdata7: 0x00000000i2c_write: error sending
read from device: 00000000002fcff0 register: 0x17 -> -121
SoC: Rockchip rk3399
Reset cause: RST
Model: Pine64 Pinebook Pro
DRAM: 3.9 GiBrk8xx_bind
global flags 301 relocaddr f6f1d000rk8xx_sysreset_bindrk8xx_bind: 'pmic@1b' - found regulators subnode
U-Boot PLL at 00000000ff750000: fbdiv=112, refdiv=2, postdiv1=2, postdiv2=1, vco=1344000 khz, output=672000 khz i2c@ff3c0000: Got clock pmu-clock-controller@ff750000 9rk3399_i2c_set_pmuclk: clk 9, hz 200000000, div 3rk3399_pmuclk_set_rate: clk pmu-clock-controller@ff750000 9 rate 200000000 -> 169000000 <<< here the old frequency is returnedrockchip_i2c_probe: clk: pmu-clock-controller@ff750000 9 rate 0 count 0 flags 0 rockchip_i2c_set_bus_speed: 400000rk3399_i2c_get_pmuclk: clk 9, con 770, div 2rk3399_pmuclk_get_rate: clk pmu-clock-controller@ff750000 9 -> 225333333 <<< but here the frequency is reported higher pmu-clock-controller@ff750000 9: clock rate 225333333rk_i2c_set_clk: clk pmu-clock-controller@ff750000 9, i2c rate = 225333333, scl rate = 400000
set i2c clk div = 69, divh = 35, divl = 34
set clk(I2C_CLKDIV: 0x00230022)rk8xx_probe
original ID registeri2c_xfer: 2 messagesi2c_xfer: chip=0x1b, len=0x1rk_i2c_write: chip = 27, reg = 0, r_len = 0, b_len = 1
I2c Send Start bit.
I2C Send Start Bit Timeout
Basically the old 169000000 and the new 225333333 frequency are both different rounding of 200000000 for lower and higher divisor and generally not all that different.
It is fishy that get_clock_rate and set_clock_rate report different frequency using the same frequency calcualtion macro. Nonetheless, forcing the set_clock_rate call from the i2c driver does not help, the i2c transfers fail anyway:
rk8xx_bind
global flags 0 relocaddr 0 rk8xx_sysreset_bindrk8xx_bind: 'pmic@1b' - found regulators subnoderk3399_clk_get_rate: clk clock-controller@ff760000 83
U-Boot 2022.07-00043-g395bdd35fe-dirty (Aug 08 2022 - 22:09:19 +0200)
U-Boot PLL at 00000000ff750000: fbdiv=112, refdiv=2, postdiv1=2, postdiv2=1, vco=1344000 khz, output=672000 khz i2c@ff3c0000: Got clock pmu-clock-controller@ff750000 9rk3399_i2c_get_pmuclk: clk 9, con 771, div 3rk3399_pmuclk_get_rate: clk pmu-clock-controller@ff750000 9 -> 169000000rockchip_i2c_probe: clk: pmu-clock-controller@ff750000 9 rate 0 count 0 flags 0rk3399_i2c_set_pmuclk: clk 9, hz 200000000, div 3rk3399_pmuclk_set_rate: clk pmu-clock-controller@ff750000 9 rate 200000000 -> 169000000rockchip_i2c_probe: clk: pmu-clock-controller@ff750000 9 rate 0 count 0 flags 0 rockchip_i2c_set_bus_speed: 400000rk3399_i2c_get_pmuclk: clk 9, con 770, div 2rk3399_pmuclk_get_rate: clk pmu-clock-controller@ff750000 9 -> 225333333rk_i2c_set_clk: clk pmu-clock-controller@ff750000 9, i2c rate = 225333333, scl rate = 400000 set i2c clk div = 69, divh = 35, divl = 34
set clk(I2C_CLKDIV: 0x00230022)rk8xx_probe
original ID registeri2c_xfer: 2 messagesi2c_xfer: chip=0x1b, len=0x1rk_i2c_write: chip = 27, reg = 0, r_len = 0, b_len = 1
I2c Send Start bit.
I2C Send Start Bit Timeouti2c_con: 0x00010009i2c_clkdiv: 0x00230022i2c_mrxaddr: 0x00000000i2c_mrxraddR: 0x00000000i2c_mtxcnt: 0x00000000i2c_mrxcnt: 0x00000000i2c_ien: 0x00000010i2c_ipd: 0x00000000i2c_fcnt: 0x00000000i2c_txdata0: 0x00000000i2c_txdata1: 0x00000000i2c_txdata2: 0x00000000i2c_txdata3: 0x00000000i2c_txdata4: 0x00000000i2c_txdata5: 0x00000000i2c_txdata6: 0x00000000i2c_txdata7: 0x00000000i2c_rxdata0: 0x00000000i2c_rxdata1: 0x00000000i2c_rxdata2: 0x00000000i2c_rxdata3: 0x00000000i2c_rxdata4: 0x00000000i2c_rxdata5: 0x00000000i2c_rxdata6: 0x00000000i2c_rxdata7: 0x00000000
It looks like it is not clock related after all, although the i2c clock getting set post-relocation and not pre-relocation might be source of problems if the frequency was significantly different without the set_clock_rate call.
Thanks
Michal
Hi Michal,
Quoted 232 lines · Michal Suchánek
Quoted 56 lines · Simon Glass
Hi Michal,
Quoted 53 lines · Michal Suchánek
Quoted 51 lines · Simon Glass
Hi Michal,
Quoted 47 lines · Michal Suchánek
Quoted 21 lines · Simon Glass
Hi Michal,
Quoted 18 lines · Michal Suchanek
When the sysreset is added as child of the pmic the pmic is probed before relocation. That probe fails, and subsequent attempts to probe after reloaction fail as well.
As a workaround do not bind the sysreset before relocation.
Signed-off-by Michal Suchanek <[email protected]>--- drivers/power/pmic/rk8xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/power/pmic/rk8xx.c +0
-0@@ -131,7 +131,7 @@ static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len)Quoted 14 lines
Quoted 10 lines
drivers/power/pmic/rk8xx.c +1
-2static int rk8xx_bind (struct udevice *dev) { -if (CONFIG_IS_ENABLED (SYSRESET )) { +if (CONFIG_IS_ENABLED (SYSRESET ) && (gd->flags &GD_FLG_RELOC )) {device_bind_driver (dev,"rk8xx_sysreset" ,"rk8xx_sysreset" ,NULL ); } --2.37.1
I think it is OK to avoid starting a device before relocation, or make that device do something different. I really don't like the binding being optional though...we have the 'u-boot,dm-pre-reloc' for that.
So perhaps the flag should be dropped from rk8xx then.
Quoted 2 lines
But missing from your commit message is exactly what fails?
The pmic is an i2c device, all i2c tranferss fail if initialized pre-relocation. I supect it's the i2c bus that fails if initialized before reloc - the regulatorss that share the i2c bus also report i2c transfer failure.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
OK, I wonder why i2c fails? It works OK on the rockchip devices I'm familiar with, e.g. chromebooks.
It worksss fine here as well - so long as it is not initialized before relocation.
I wonder if the clock driver is doing something different then, or has a limited number of clocks?
Looks like it is not the clocks.
There is something slightly fishy going on there with them:
In the broken case the i2c clock is not initialized before reloc
TICE: BL31: v2.6(debug): NOTICE: BL31: Built : 14:50:40, Jul 1 2022 INFO: GICv3 with legacy support detected. INFO: ARM GICv3 driver initialized in EL3 INFO: Maximum SPI INTID supported: 287 INFO: plat_rockchip_pmu_init(1624): pd status 3e INFO: BL31: Initializing runtime services INFO: BL31: cortex_a53: CPU workaround for 855873 was applied WARNING: BL31: cortex_a53: CPU workaround for 1530924 was missing! INFO: BL31: Preparing for EL3 exit to normal world INFO: Entry point address = 0x200000 INFO: SPSR = 0x3c9
rk8xx_bind
global flags 0 relocaddr 0rk8xx_sysreset_bindrk8xx_bind: 'pmic@1b' - found regulators subnoderk3399_clk_get_rate: clk clock-controller@ff760000 83 clock-controller@ff760000 83: clock rate 24000000U-Boot 2022.07-00038-g61e11a8e9f-dirty (Aug 07 2022 - 19:53:20 +0200)
U-Boot PLL at
00000000ff750000: fbdiv=112, refdiv=2, postdiv1=2, postdiv2=1, vco=1344000 khz, output=672000 khz i2c@ff3c0000: Got clock pmu-clock-controller@ff750000 9rockchip_i2c_probe: clk: pmu-clock-controller@ff750000 9 rate 0 count 0 flags 0rockchip_i2c_set_bus_speed: 400000rk3399_i2c_get_pmuclk: clk 9, con 771, div 3rk3399_pmuclk_get_rate: clk pmu-clock-controller@ff750000 9 -> 169000000 <<< different freqency pmu-clock-controller@ff750000 9: clock rate 169000000rk_i2c_set_clk: clk pmu-clock-controller@ff750000 9, i2c rate = 169000000, scl rate = 400000
set i2c clk div = 51, divh = 26, divl = 25
setclk(I2C_CLKDIV: 0x001a0019)rk8xx_probe
original ID registeri2c_xfer: 2 messagesi2c_xfer: chip=0x1b, len=0x1rk_i2c_write: chip = 27, reg = 0,r_len= 0,b_len= 1
I2c Send Start bit.
I2C Send Start Bit Timeouti2c_con:0x00010009i2c_clkdiv:0x001a0019i2c_mrxaddr:0x00000000i2c_mrxraddR:0x00000000i2c_mtxcnt:0x00000000i2c_mrxcnt:0x00000000i2c_ien:0x00000010i2c_ipd:0x00000000i2c_fcnt:0x00000000i2c_txdata0:0x00000000i2c_txdata1:0x00000000i2c_txdata2:0x00000000i2c_txdata3:0x00000000i2c_txdata4:0x00000000i2c_txdata5:0x00000000i2c_txdata6:0x00000000i2c_txdata7:0x00000000i2c_rxdata0:0x00000000i2c_rxdata1:0x00000000i2c_rxdata2:0x00000000i2c_rxdata3:0x00000000i2c_rxdata4:0x00000000i2c_rxdata5:0x00000000i2c_rxdata6:0x00000000i2c_rxdata7:0x00000000i2c_write: error sending
read from device:00000000002fcff0register:0x17-> -121
SoC: Rockchip rk3399
Reset cause: RST
Model: Pine64 Pinebook Pro
DRAM: 3.9 GiBrk8xx_bind
global flags 301 relocaddrf6f1d000rk8xx_sysreset_bindrk8xx_bind: 'pmic@1b' - found regulators subnode
U-Boot PLL at00000000ff750000: fbdiv=112, refdiv=2, postdiv1=2, postdiv2=1, vco=1344000 khz, output=672000 khz i2c@ff3c0000: Got clock pmu-clock-controller@ff750000 9rk3399_i2c_set_pmuclk: clk 9, hz 200000000, div 3rk3399_pmuclk_set_rate: clk pmu-clock-controller@ff750000 9 rate 200000000 -> 169000000 <<< here the old frequency is returnedrockchip_i2c_probe: clk: pmu-clock-controller@ff750000 9 rate 0 count 0 flags 0rockchip_i2c_set_bus_speed: 400000rk3399_i2c_get_pmuclk: clk 9, con 770, div 2rk3399_pmuclk_get_rate: clk pmu-clock-controller@ff750000 9 -> 225333333 <<< but here the frequency is reported higher pmu-clock-controller@ff750000 9: clock rate 225333333rk_i2c_set_clk: clk pmu-clock-controller@ff750000 9, i2c rate = 225333333, scl rate = 400000
set i2c clk div = 69, divh = 35, divl = 34
setclk(I2C_CLKDIV: 0x00230022)rk8xx_probe
original ID registeri2c_xfer: 2 messagesi2c_xfer: chip=0x1b, len=0x1rk_i2c_write: chip = 27, reg = 0,r_len= 0,b_len= 1
I2c Send Start bit.
I2C Send Start Bit TimeoutBasically the old 169000000 and the new 225333333 frequency are both different rounding of 200000000 for lower and higher divisor and generally not all that different.
It is fishy that
get_clock_rateandset_clock_ratereport different frequency using the same frequency calcualtion macro. Nonetheless, forcing theset_clock_ratecall from the i2c driver does not help, the i2c transfers fail anyway:
rk8xx_bind
global flags 0 relocaddr 0rk8xx_sysreset_bindrk8xx_bind: 'pmic@1b' - found regulators subnoderk3399_clk_get_rate: clk clock-controller@ff760000 83U-Boot 2022.07-00043-g395bdd35fe-dirty (Aug 08 2022 - 22:09:19 +0200)
U-Boot PLL at
00000000ff750000: fbdiv=112, refdiv=2, postdiv1=2, postdiv2=1, vco=1344000 khz, output=672000 khz i2c@ff3c0000: Got clock pmu-clock-controller@ff750000 9rk3399_i2c_get_pmuclk: clk 9, con 771, div 3rk3399_pmuclk_get_rate: clk pmu-clock-controller@ff750000 9 -> 169000000rockchip_i2c_probe: clk: pmu-clock-controller@ff750000 9 rate 0 count 0 flags 0rk3399_i2c_set_pmuclk: clk 9, hz 200000000, div 3rk3399_pmuclk_set_rate: clk pmu-clock-controller@ff750000 9 rate 200000000 -> 169000000rockchip_i2c_probe: clk: pmu-clock-controller@ff750000 9 rate 0 count 0 flags 0rockchip_i2c_set_bus_speed: 400000rk3399_i2c_get_pmuclk: clk 9, con 770, div 2rk3399_pmuclk_get_rate: clk pmu-clock-controller@ff750000 9 -> 225333333rk_i2c_set_clk: clk pmu-clock-controller@ff750000 9, i2c rate = 225333333, scl rate = 400000 set i2c clk div = 69, divh = 35, divl = 34
setclk(I2C_CLKDIV: 0x00230022)rk8xx_probe
original ID registeri2c_xfer: 2 messagesi2c_xfer: chip=0x1b, len=0x1rk_i2c_write: chip = 27, reg = 0,r_len= 0,b_len= 1
I2c Send Start bit.
I2C Send Start Bit Timeouti2c_con:0x00010009i2c_clkdiv:0x00230022i2c_mrxaddr:0x00000000i2c_mrxraddR:0x00000000i2c_mtxcnt:0x00000000i2c_mrxcnt:0x00000000i2c_ien:0x00000010i2c_ipd:0x00000000i2c_fcnt:0x00000000i2c_txdata0:0x00000000i2c_txdata1:0x00000000i2c_txdata2:0x00000000i2c_txdata3:0x00000000i2c_txdata4:0x00000000i2c_txdata5:0x00000000i2c_txdata6:0x00000000i2c_txdata7:0x00000000i2c_rxdata0:0x00000000i2c_rxdata1:0x00000000i2c_rxdata2:0x00000000i2c_rxdata3:0x00000000i2c_rxdata4:0x00000000i2c_rxdata5:0x00000000i2c_rxdata6:0x00000000i2c_rxdata7:0x00000000
Quoted 4 lines
It looks like it is not clock related after all, although the i2c clock getting set post-relocation and not pre-relocation might be source of problems if the frequency was significantly different without the
set_clock_ratecall.
I suppose the other option is pinmux?
Regards,
Simon