Hello Everyone,
I'm using my own custom design board based on the i.MX8QM MEK board. I have been trying to drive high all four mipi dsi gpios to enable the power on four cameras. So, I'd like to drive high the following pins early during the boot process, either from the scu or from u-boot:
So, it seems that the mipi gpios resource is not available or not powered before the kernel fully starts.
I can control other pins correctly like SC_P_SCU_GPIO0_06 either from scu and u-boot.
Here is what I've tried for the mipi gpios.
I tried to use the scu api in my imx8qm_mek.c
static iomux_cfg_t ss_mux_gpio[] = {
SC_P_MIPI_DSI0_GPIO0_00 | MUX_MODE_ALT(3) | MUX_PAD_CTRL(GPIO_PAD_CTRL),
SC_P_MIPI_DSI0_GPIO0_01 | MUX_MODE_ALT(3) | MUX_PAD_CTRL(GPIO_PAD_CTRL),
SC_P_MIPI_DSI1_GPIO0_00 | MUX_MODE_ALT(3) | MUX_PAD_CTRL(GPIO_PAD_CTRL),
SC_P_MIPI_DSI1_GPIO0_01 | MUX_MODE_ALT(3) | MUX_PAD_CTRL(GPIO_PAD_CTRL),
// SC_P_SCU_GPIO0_06 | MUX_MODE_ALT(3) | MUX_PAD_CTRL(GPIO_PAD_CTRL),
};
static void board_gpio_init(void)
{
int ret;
struct gpio_desc desc;
puts("Board: board_gpio_init\n");
ret = sc_pm_set_resource_power_mode(-1, SC_R_GPIO_1, SC_PM_PW_MODE_ON);
if (ret != SC_ERR_NONE)
return ret;
ret = sc_pm_set_resource_power_mode(-1, SC_R_MIPI_0, SC_PM_PW_MODE_ON);
if (ret != SC_ERR_NONE)
return ret;
ret = sc_pm_set_resource_power_mode(-1, SC_R_MIPI_1, SC_PM_PW_MODE_ON);
if (ret != SC_ERR_NONE)
return ret;
imx8_iomux_setup_multiple_pads(ss_mux_gpio_poc, ARRAY_SIZE(ss_mux_gpio));
/* switch on */
gpio_request(IMX_GPIO_NR(1,18), "GPIO1_18");
gpio_direction_output(IMX_GPIO_NR(1,18), 1);
gpio_request(IMX_GPIO_NR(1,19), "GPIO1_19");
gpio_direction_output(IMX_GPIO_NR(1,19), 1);
gpio_request(IMX_GPIO_NR(1,22), "GPIO1_22");
gpio_direction_output(IMX_GPIO_NR(1,22), 1);
gpio_request(IMX_GPIO_NR(1,23), "GPIO1_23");
gpio_direction_output(IMX_GPIO_NR(1,23), 1);
}
No success. Tried with pin mux set to 0 but gives same behavior
I also tried defining the gpios in the device tree
// imx8qm-mek.dts
pinctrl-0 = <&pinctrl_power>;
pinctrl_power: powergrp {
fsl,pins = <
/*SC_P_COMP_CTL_GPIO_1V8_3V3_MIPIDSIGPIO 0x000514a0*/
SC_P_MIPI_DSI0_GPIO0_00_LSIO_GPIO1_IO18 0x0600004c /* DSI0_GPIO_00 - gpio466 */
SC_P_MIPI_DSI0_GPIO0_01_LSIO_GPIO1_IO19 0x0600004c /* DSI0_GPIO_01 - gpio467 */
SC_P_MIPI_DSI1_GPIO0_00_LSIO_GPIO1_IO22 0x0600004c /* DSI1_GPIO_00 - gpio470 */
SC_P_MIPI_DSI1_GPIO0_01_LSIO_GPIO1_IO23 0x0600004c /* DSI1_GPIO_01 - gpio471 */
};
// imx8qm_mek.c, board_gpio_init function
ret = dm_gpio_lookup_name("GPIO1_18", &desc);
if (ret) {
printf("%s lookup GPIO@1_18 failed ret = %d\n", __func__, ret);
return;
}
ret = dm_gpio_request(&desc, "GPIO1_18");
if (ret) {
printf("%s request GPIO1_18 failed ret = %d\n", __func__, ret);
return;
}
dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
...
I've tried to enable the power on all resources and then niche down to what it seems the mipi needs
//board.c
void board_init(boot_phase_t phase)
{
...
else if (phase == BOOT_PHASE_FINAL_INIT)
{
pmic_init();
pm_force_resource_power_mode_v(SC_R_DC_0, SC_PM_PW_MODE_ON);
pm_force_resource_power_mode_v(SC_R_MIPI_0, SC_PM_PW_MODE_ON);
pm_force_resource_power_mode_v(SC_R_DC_1, SC_PM_PW_MODE_ON);
pm_force_resource_power_mode_v(SC_R_MIPI_1, SC_PM_PW_MODE_ON);
pad_force_mux(SC_P_MIPI_DSI0_GPIO0_00, 3, SC_PAD_CONFIG_NORMAL,
SC_PAD_ISO_OFF);
gpio_pin_config.outputLogic = 1U;
GPIO_PinInit(GPIO1, 18U, &gpio_pin_config);
...
}
...
Also tried with configuring the pins with pad_set_mux and then pad_config.or using pad_force_mux, pad_set_gp_28fdsoi and pad_config.
Also tried moving the mipi resources and pad to SC_PT instead of BOOT_PT by setting the rm_set_resource_movable and rm_set_pad_movable and then use the pad mux set to 0.
So, all of the above did not work and I can't pin point where the problem exactly is.
Can you please guide me into the right direction whether something is missing or what I should try next? I was thinking to try again modifying the clocks for the mipi but I'm not sure it will help.
Also, can someone explain what is the purpose of the fake pin SC_P_COMP_CTL_GPIO_1V8_3V3_MIPIDSIGPIO? Do I need to use it?
Thank you very much for your help