Hi,
I am developing a custom board with 66ak2g12. I am developing the software with linux-rt sdk ti-processor-sdk-linux-rt-k2g-evm-06.01.00.08.
I am using ds3232 as RTC, linked on I2C_2 with processor. In u-boot (ver. 2019.01) shell I am using i2c md ... (to read) and i2c mw ... (to write) in ds3232 registers and these commands work correctly, therefore I assume that hardware is ok.
I have decided to enable "date" command from u-boot shell in order to set the time easily before OS linux start-up, therefore I have added ds3232.c driver in /drivers/rtc/ (not present in u-boot 2019.01), I have done the proper modification in /drivers/rtc/Kconfig , /drivers/rtc/Makefile, /drivers/cmd/Makefile in order to enable ds3232.c driver and date command during compilation according to that link
https://patchwork.ozlabs.org/project/uboot/patch/20191112083922.22683-1-nandor.han@vaisala.com/
then I have modified the .dts file as below
&i2c2 {
status = "okay";
rtc@68 {
compatible = "dallas,ds3232";
reg = <0x68>;
};
};
and I have added these configs in k2g_<myboad>_defconfig as below
CONFIG_SPL_I2C_SUPPORT=y CONFIG_SYS_I2C_DAVINCI=y CONFIG_CMD_DATE=y CONFIG_DM_RTC=y CONFIG_RTC_DRV_DS3232=y
but when I launch the date command the RTC is not recognized
=> date Cannot find RTC: err=-19
That problem is related to uclass_get_device() function in do_date(...) in /cmd/date.c
rcode = uclass_get_device(UCLASS_RTC, 0, &dev);
if (rcode) {
printf("Cannot find RTC: err=%d\n", rcode);
return CMD_RET_FAILURE;
}
The function uclass_get_device(...) seems to not work. Since I am not sure about '0' as second argument in that function, basing on ds3232 driver description as below in /drivers/rtc/ds3232.c
U_BOOT_DRIVER(rtc_ds3232) = {
.name = "rtc-ds3232",
.id = UCLASS_RTC,
.probe = ds3232_probe,
.of_match = ds3232_rtc_ids,
.ops = &ds3232_rtc_ops,
.priv_auto = sizeof(struct ds3232_priv_data),
};
I have tried to replace with other 2 functions in order to be sure that the driver bind happes correctly. I have replaced
rcode = uclass_get_device(UCLASS_RTC, 0, &dev);
with
rcode = uclass_get_device_by_name(UCLASS_RTC, "rtc-ds3232", &dev);
but the RTC continues to be not found, and then I have tried
rcode = uclass_get_device_by_driver(UCLASS_RTC, DM_GET_DRIVER(rtc_ds3232), &dev);
and in that case the u-boot compilation fails:
/home/rufolog/workspace/hpc/ti-processor-sdk-linux-rt-k2g-evm-06.01.00.08/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-ld.bfd: cmd/built-in.o: in function `do_date':
/home/rufolog/workspace/hpc/ti-processor-sdk-linux-rt-k2g-evm-06.01.00.08/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/k2g_hpc/../cmd/date.c:119: undefined reference to `_u_boot_list_2_driver_2_rtc_ds3232'
/home/rufolog/workspace/hpc/ti-processor-sdk-linux-rt-k2g-evm-06.01.00.08/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/Makefile:1501: recipe for target 'u-boot' failed
make[1]: *** [u-boot] Error 1
make[1]: Leaving directory '/home/rufolog/workspace/hpc/ti-processor-sdk-linux-rt-k2g-evm-06.01.00.08/board-support/u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a/k2g_hpc'
Makefile:148: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
Note: k2g_hpc is the directory where output compilation is placed.
I don't understand the error ../k2g_hpc/../cmd/date.c:119: undefined reference to `_u_boot_list_2_driver_2_rtc_ds3232' because at line 119 there is no presence of
_u_boot_list_2_driver_2_rtc_ds3232.
I hope to receive a fast feedback in order to solve that problem and enable ds3232 driver in u-boot.
Regards
Graziano