Since commit
27cc5951c862 ("include: env: ti: add default for
do_main_cpsw0_qsgmii_phyinit"), the value of the environment variable
do_main_cpsw0_qsgmii_phyinit happened to remain '0' and couldn't be
changed without user intervention. This behavior is due to the following
cyclic dependency:
A) ti_common.env sets do_main_cpsw0_qsgmii_phyinit to '0' and its value
can only be updated automatically by main_cpsw0_qsgmii_phyinit.
B) main_cpsw0_qsgmii_phyinit is defined in j721e.env and it can run only
if 'do_main_cpsw0_qsgmii_phyinit' is already '1' which isn't possible
unless the user manually assigns the value.
Fix the aforementioned cyclic dependency by using board_late_init() to
detect the QSGMII Daughtercard and set do_main_cpsw0_qsgmii_phyinit.
Additionally, to address the issue of do_main_cpsw0_qsgmii_phyinit being
'undefined' for other platforms, replace:
if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1;
with:
if env exists do_main_cpsw0_qsgmii_phyinit;
in ti_common.env.
Fixes: 27cc5951c862 ("include: env: ti: add default for do_main_cpsw0_qsgmii_phyinit")
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Anshul Dalal <anshuld@ti.com>
rd_spec=-
#if CONFIG_TARGET_J7200_A72_EVM
-do_main_cpsw0_qsgmii_phyinit=1
init_main_cpsw0_qsgmii_phy=gpio set gpio@22_17;
gpio clear gpio@22_16
main_cpsw0_qsgmii_phyinit=
env_set("serial#", serial_string);
}
+static void qsgmii_daughtercard_env_update(void)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
+ if (!strcmp(ext_cards[i].card_name, "J7X-VSC8514-ETH") &&
+ daughter_card_detect_flags[i]) {
+ env_set("do_main_cpsw0_qsgmii_phyinit", "1");
+ return;
+ }
+ }
+}
+
int board_late_init(void)
{
if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
/* Check for and probe any plugged-in daughtercards */
if (board_is_j721e_som() || board_is_j7200_som())
probe_daughtercards();
+
+ /* Update env for power-on-reset of the QSGMII Daughtercard */
+ qsgmii_daughtercard_env_update();
}
return 0;
init_main_cpsw0_qsgmii_phy=gpio set gpio@22_17;
gpio clear gpio@22_16
main_cpsw0_qsgmii_phyinit=
- if test $board_name = J721EX-PM1-SOM || test $board_name = J721EX-PM2-SOM || test $board_name = j721e; then
- do_main_cpsw0_qsgmii_phyinit=1; else
- do_main_cpsw0_qsgmii_phyinit=0; fi;
if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1 && test ${dorprocboot} -eq 1 && test ${boot} = mmc; then
run init_main_cpsw0_qsgmii_phy; \
fi;
done;
get_fit_config=setexpr name_fit_config gsub / _ conf-${fdtfile}
run_fit=run get_fit_config; bootm ${addr_fit}#${name_fit_config}${overlaystring}
-do_main_cpsw0_qsgmii_phyinit=0
bootcmd_ti_mmc=
run init_${boot};
#if CONFIG_CMD_REMOTEPROC
- if test ${do_main_cpsw0_qsgmii_phyinit} -eq 1;
+ if env exists do_main_cpsw0_qsgmii_phyinit;
then run main_cpsw0_qsgmii_phyinit;
fi;
run boot_rprocs;