ccimx93: add xbee support

ConnectCore 93 DVK only connects the XBee reset line (XBEE_RESET_N_GPIO) but not
the sleep request (XBEE_SLEEP_RQ_GPIO)

It also reworks the 'xbee-init' script to support empty reset
(XBEE_RESET_N_GPIO) or sleep request (XBEE_SLEEP_RQ_GPIO) values.

https://onedigi.atlassian.net/browse/DEL-8375

Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
This commit is contained in:
Tatiana Leon 2023-02-22 10:17:57 +01:00
parent adbb511484
commit ec1ad99f45
4 changed files with 30 additions and 19 deletions

View File

@ -26,6 +26,11 @@ IMAGE_BOOT_FILES:append:use-nxp-bsp = " \
"
WKS_FILE_DEPENDS:append = " imx-m33-demos"
# XBee
XBEE_RESET_N_GPIO ?= "gpio2@19"
XBEE_SLEEP_RQ_GPIO ?= ""
XBEE_TTY ?= "ttyLP3"
# Image FS types
IMAGE_FSTYPES ?= '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", \
"boot.vfat recovery.vfat squashfs tar.bz2", \

View File

@ -39,6 +39,10 @@ SPL_BINARY = "spl/u-boot-spl.bin"
# Set ATF platform name
ATF_PLATFORM = "imx93"
MACHINE_EXTRA_RDEPENDS += " \
xbee-init \
"
# TrustFence
TRUSTFENCE_SIGN_MODE = "AHAB"

View File

@ -42,4 +42,4 @@ SYSTEMD_PACKAGES = "${PN}-init"
SYSTEMD_SERVICE:${PN}-init = "xbee-init.service"
PACKAGE_ARCH = "${MACHINE_ARCH}"
COMPATIBLE_MACHINE = "(ccimx8x|ccimx8m)"
COMPATIBLE_MACHINE = "(ccimx8x|ccimx8m|ccimx93)"

View File

@ -4,35 +4,37 @@
XBEE_RESET_N_GPIO="##XBEE_RESET_N_GPIO##"
XBEE_SLEEP_RQ_GPIO="##XBEE_SLEEP_RQ_GPIO##"
xbee_init() {
# Set low XBEE_SLEEP_RQ
gpioset ${3} ${4}=0
# 1=chip name
# 2=gpio offset
xbee_reset() {
# Power cycle XBEE_RESET_N
gpioset ${1} ${2}=0
gpioset ${1} ${2}=1
gpioset "${1}" "${2}"=0
gpioset "${1}" "${2}"=1
}
# 1=chip name
# 2=gpio offset
xbee_no_sleep() {
# Set low XBEE_SLEEP_RQ
gpioset "${1}" "${2}"=0
}
xbee_iterate_list() {
i=0
for SLEEP in $(echo ${XBEE_SLEEP_RQ_GPIO} | sed "s/,/ /g"); do
# Do not quote command expansion (function expects two parameters)
xbee_no_sleep $(echo "${SLEEP}" | sed "s/@/ /g")
done
for RESET in $(echo ${XBEE_RESET_N_GPIO} | sed "s/,/ /g"); do
j=0
for SLEEP in $(echo ${XBEE_SLEEP_RQ_GPIO} | sed "s/,/ /g"); do
if [ "${i}" = "${j}" ]; then
if [ "${1}" = "start" ]; then
xbee_init $(echo ${RESET} | sed "s/@/ /g") $(echo ${SLEEP} | sed "s/@/ /g")
fi
fi
j="$((j + 1))"
done
i="$((i + 1))"
# Do not quote command expansion (function expects two parameters)
xbee_reset $(echo "${RESET}" | sed "s/@/ /g")
done
}
case "$1" in
start)
echo -n "Starting XBee hardware: "
xbee_iterate_list start
xbee_iterate_list
echo "done."
;;
stop)