Hello
I'm working with a custom board based on iMX8DXL and I need to access to SCU_GPIO0_00 and SCU_GPIO0_01 from the core A35 (u-boot or linux).
In scfw I have changed the mux from defaul scu_uart to scu_gpio, select as digital input and changed the owner partition.
I did this:
void init_scu_gpio_pins(void)
{
rgpio_pin_config_t config;
config.pinDirection = kRGPIO_DigitalInput;
rm_set_pad_movable(SC_PT, SC_P_SCU_GPIO0_00, SC_P_SCU_GPIO0_01, SC_TRUE);
pad_set_all(SC_PT, SC_P_SCU_GPIO0_00, 4U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF, 0x60, SC_PAD_WAKEUP_OFF);
pad_set_all(SC_PT, SC_P_SCU_GPIO0_01, 4U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF, 0x60, SC_PAD_WAKEUP_OFF);
RGPIO_PinInit(RGPIOA, 0U, &config);
RGPIO_PinInit(RGPIOA, 1U, &config);
rm_assign_pad (SC_PT, BOOT_PT, SC_P_SCU_GPIO0_00);
rm_assign_pad (SC_PT, BOOT_PT, SC_P_SCU_GPIO0_01);
}
I don't know if I missed something to do here or there are something wrong.
If it is correct, how can I access these pins (SCU pins) from linux or u-boot?
Thanks for your help!
Regards
Solved! Go to Solution.
Solved!
It seems that pmic must be initialized before call init_scu_gpio_pins() to work properly.
I do not why, but calling de gpio init function afterwards pmic_init() I can read values from scu_gpios.
good , where did u put pmic_init() ?
pmic_init() is in its default place: in board_init() when phase == BOOT_PHASE_FINAL_INIT
Solved!
It seems that pmic must be initialized before call init_scu_gpio_pins() to work properly.
I do not why, but calling de gpio init function afterwards pmic_init() I can read values from scu_gpios.
Hello again,
I've seen that these pins are only accesible from SCU, and I have to add/modify ioctl api to get "access" from A35, i.e. to read their values.
My problem now is that I only get 0's from that pins even though I have an '1' put on them.
I used that code in scfw board.c:
/*--------------------------------------------------------------------------*/
/* Init SCU pins */
/*--------------------------------------------------------------------------*/
static void init_scu_gpio_pins(void)
{
sc_err_t err;
rgpio_pin_config_t config;
config.pinDirection = kRGPIO_DigitalInput;
/* To disable uart-scu default gpios mux and set pins as normal gpios */
err=pad_set_all(SC_PT, SC_P_SCU_GPIO0_00, 4U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF, 0x60, SC_PAD_WAKEUP_OFF);
err=pad_set_all(SC_PT, SC_P_SCU_GPIO0_01, 4U, SC_PAD_CONFIG_NORMAL, SC_PAD_ISO_OFF, 0x60, SC_PAD_WAKEUP_OFF);
/* Init SCU_GPIO0_00 and SCU_GPIO0_01 as digital input */
RGPIO_PinInit(RGPIOA, 0U, &config);
RGPIO_PinInit(RGPIOA, 1U, &config);
}
static uint32_t ReadSCUPins (void)
{
uint32_t retval = 0U;
uint32_t gpio0_val = 0U, gpio1_val = 0U;
gpio0_val = RGPIO_PinRead(RGPIOA, 0U);
gpio1_val = RGPIO_PinRead(RGPIOA, 1U);
retval = (gpio0_val & 0x01) | ((gpio1_val & 0x01) <<1);
board_print(1, "SCU_GPIO0_00: %u, SCU_GPIO0_01: %u, retval: %u\n", gpio0_val, gpio1_val, retval);
return retval;
}