From 19b59bd9d5f21afcd6d862e54127cb93510e0daa Mon Sep 17 00:00:00 2001 From: Mircea Caprioru Date: Tue, 16 Mar 2021 17:24:11 +0200 Subject: [PATCH] config: zynq-common: Fix attr_val attr_name Reorder the operations for attr_val and check that the values are valid before applying the changes. Signed-off-by: Mircea Caprioru --- include/configs/zynq-common.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h index 14610036b69..e8a0bfbd970 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -283,12 +283,16 @@ "if test \"${refclk_source}\" = \"internal\" && test \"${model}\" = \"Analog Devices PlutoSDR Rev.C (Z7010/AD9363)\" ; then " \ "fdt rm /amba/gpio@e000a000/clock_extern_en; " \ "fi; " \ - "if test -n \"${attr_name}\" && test -n \"${attr_val}\"; then " \ - "fdt set /amba/spi@e0006000/ad9361-phy@0 ${attr_name} ${attr_val}; " \ - "fi; " \ "if test \"${refclk_source}\" = \"external\" && test \"${model}\" = \"Analog Devices PlutoSDR Rev.C (Z7010/AD9363)\" ; then " \ "fdt rm /amba/gpio@e000a000/clock_internal_en; " \ "fi; " \ + "if test \"${attr_val}\" = \"ad9361\" && test ! \"${model}\" = \"Analog Devices PlutoSDR Rev.C (Z7010/AD9363)\" ; then " \ + "setenv attr_val ad9363a; " \ + "saveenv; " \ + "fi; " \ + "if test -n \"${attr_name}\" && test -n \"${attr_val}\"; then " \ + "fdt set /amba/spi@e0006000/ad9361-phy@0 ${attr_name} ${attr_val}; " \ + "fi; " \ "if test -n \"${compatible}\" && test ! \"${compatible}\" = \"ad9361\" && test ! \"${compatible}\" = \"ad9363a\" && test ! \"${compatible}\" = \"ad9364\"; then " \ "setenv compatible ad9363a; " \ "saveenv; " \