How to access M4 I2C in UBoot (A35)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to access M4 I2C in UBoot (A35)

1,333 Views
Raana
Contributor III

Dear All,

Currently, I'm using i.Mx8QxP based custom board.

There, I need to configure M4-i2c in A35 domain.
I'm able to configure and access M4-i2c from Linux Kernel. Both i2c read and write are working fine.
 
But I'm facing issue in accessing M4 i2c from u-boot.

We are getting below error with u-boot i2c utils.
> i2c probe
No I2C bus selected
> i2c bus
Bus -1: i2c@37230000
 
Please find the configuration done in u-boot dts file.

&intmux_cm40 {
        status = "okay";
};
&pd_cm40_intmux {
        early_power_on;
};
&i2c0_cm40 {
        #address-cells = <1>;
        #size-cells = <0>;
        pinctrl-0 = <&pinctrl_i2c0>;
        pinctrl-names = "default";
        clock-frequency = <100000>;
        status = "okay";
        pca9535: pca9535e@21 {
                reg = <0x21>;
        };
};  
pinctrl_i2c0: i2c0m40grp {
fsl,pins = <
        SC_P_ADC_IN1_M40_I2C0_SDA               0x0600004c
        SC_P_ADC_IN0_M40_I2C0_SCL               0x0600004c
>;
};
   
As this i2C is M4 dedicated i2c, I believe that M4 should be powered ON before access.
So I also added below code in board.c in board_early_init() function. (We have also tried in board_late_init() - But same result).

if (sc_pm_set_resource_power_mode(ipcHndl, SC_R_M4_0_PID0, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
         return 0;
if (sc_pm_set_resource_power_mode(ipcHndl, SC_R_M4_0_MU_1A, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
         return 0;


/* Power up M4 I2C */
if (sc_pm_set_resource_power_mode(ipcHndl, SC_R_M4_0_I2C, SC_PM_PW_MODE_ON) != SC_ERR_NONE)
         return 0;
if (sc_pm_clock_enable(ipcHndl, SC_R_M4_0_I2C, SC_PM_CLK_PER, true, false) != SC_ERR_NONE)
         return 0;
if (sc_pm_set_clock_rate(ipcHndl, SC_R_M4_0_I2C, SC_PM_CLK_PER, &src_rate) != SC_ERR_NONE)
         return 0;
 
U-boot is able to identify and access lpi2c (if configured in dts); But facing issues in M4-i2c access.
Let us know if any specific sequence to be followed to access M4 i2C in u-boot.

Please guide me to move further.

Thank You.

Best Regards,

J.P.Raja

0 Kudos
4 Replies

1,193 Views
igorpadykov
NXP Employee
NXP Employee

Hi Raja

there is i2c support in arm2 board :

imx8qxp_arm2.c\imx8qxp_arm2\freescale\board - uboot-imx - i.MX U-Boot 

First necessary that if  LPI2C belongs to some subsystem, that subsystem's power should

be turned on. Example:

 if (!power_domain_lookup_name("dma_lpi2c0", &pd))
   power_domain_on(&pd);

 /* This is needed to drive the pads to 1.8V instead of 1.5V */
 i2c_set_bus_num(CONFIG_MAX7322_I2C_BUS);

 if (!i2c_probe(CONFIG_MAX7322_I2C_ADDR)) {
  /* Write 0x1 to enable O0 output, this device has no addr */
  /* hence addr length is 0 */
  value = 0x1;
  if (i2c_write(CONFIG_MAX7322_I2C_ADDR, 0, 0, &value, 1))
   printf("MAX7322 write failed\n");
 } else {
  printf("MAX7322 Not found\n");
 }

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,193 Views
Raana
Contributor III

Hi Igor,

Thanks for your quick reply.

I can able to access LpI2C in Uboot as well as in Kernel level (Both buses and slaves are detecting).

But when I'm trying to access M4-I2C (dedicated to M4) from Uboot, it was throwing error but it's working fine with kernel level.

I want to know, whether any special sequence or something needed in Uboot to make this M4-I2C work.

Thank You.

Best Regards,

J.P.Raja

0 Kudos

771 Views
xaviersoulie
Contributor I

Hello Raja & Igor,
Were you able to get the I2C interface associated with the M4 processor working in Uboot?
If yes, can you tell us what procedure you followed?
Thanks in advance
Xavier

 

0 Kudos

1,193 Views
igorpadykov
NXP Employee
NXP Employee

Hi Raja

this is preproduction part as described on below link in red

i.MX 8X Applications Processors| Arm® Cortex®-A35, Cortex-M4 | NXP 

so it is not fully suuported. For additional help suggest to proceed with help of

Commercial Support and Engineering Services | NXP 

Best regards
igor

0 Kudos