Other Parts Discussed in Thread: AM625
Tool/software:
Hi TI,
We we are using multiple different AM62 for development, both AM621 with discrete memory and AM62SIP on customs boards. I would like to support both boards with the same build. We have 3 GPIO that can be read on boot to select the board. Since I have to deal with different DDR configurations. I need to select it early on in the R5 SPL.
I was attempting to copy what am642_init.c was doing in uboot with do_board_init
#ifdef CONFIG_SPL_OF_LIST void do_dt_magic(void) { int ret, rescan; /* Perform board detection */ do_board_detect(); /* * Board detection has been done. * Let us see if another dtb wouldn't be a better match * for our board */ if (IS_ENABLED(CONFIG_CPU_V7R)) { ret = fdtdec_resetup(&rescan); if (!ret && rescan) { dm_uninit(); dm_init_and_scan(true); } } } #endif
I have these set in my config
CONFIG_SPL_OF_CONTROL=y
CONFIG_SPL_DM=y
CONFIG_SPL_DM_GPIO=y
CONFIG_SPL_DM_GPIO_LOOKUP_LABEL=y
My do_board_detect
#if defined(CONFIG_SPL_LOAD_FIT) void do_board_detect(void) { struct gpio_desc desc; int ret; printf("do_board_detect\n"); ret = dm_gpio_lookup_name("SOM_ID_MSB", &desc); if (ret) printf("Cannot get SOM_ID_MSB\n"); /* Request GPIO, simply re-using the name as label */ ret = dm_gpio_request(&desc, "SOM_ID_MSB"); printf("dm_gpio_request %d\n",ret); ret = dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN); printf("dm_gpio_set_dir_flags %d\n",ret); ret = dm_gpio_get_value(&desc); printf("dm_gpio_get_value %d\n",ret); }
I am including <asm/gpio.h>
But still getting these errors.
/am62x/lgsom.c:81:(.text.do_board_detect+0x1c): undefined reference to `dm_gpio_request' /am62x/lgsom.c:84:(.text.do_board_detect+0x2e): undefined reference to `dm_gpio_set_dir_flags' /am62x/lgsom.c:87:(.text.do_board_detect+0x3c): undefined reference to `dm_gpio_get_value'
Before I dig into it too much more. Would this be the recommended way to do this? Or would there be a different better way?