Skip to content

Commit

Permalink
fix gpio_mmc_power execution
Browse files Browse the repository at this point in the history
  • Loading branch information
gtxaspec committed Feb 1, 2024
1 parent 72fd972 commit acfdb90
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions arch/mips/lib/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ extern void board_usb_init(void);

/* Try to get the value of the 'disable_sd' environment variable */
char* disable_sd = getenv("disable_sd");
int networkInitializationAttempted = 0;

/* Check if disable_eth is set to "true" */
if (disable_eth && strcmp(disable_eth, "true") == 0) {
Expand All @@ -431,18 +432,23 @@ extern void board_usb_init(void);
handle_gpio_settings("gpio_default_net");
} else {
/* Attempt network initialization */
networkInitializationAttempted = 1;
ret = jz_net_initialize(gd->bd);
if (ret < 0) {
debug("Net: Network initialization failed.\n");
// Network initialization failed, handle GPIO settings here
handle_gpio_settings("gpio_default_net");
if (disable_sd != NULL && strcmp(disable_sd, "false") == 0) {
/* MMC specific user GPIO set */
handle_gpio_settings("gpio_mmc_power");
}
}
/* Note: jz_net_initialize succeeds here */
}

/* Check if disable_sd is "false" AND either network initialization was not attempted
due to disable_eth being "true" OR it failed. */
if (disable_sd != NULL && strcmp(disable_sd, "false") == 0 &&
(!networkInitializationAttempted || ret < 0)) {
/* MMC specific user GPIO set */
handle_gpio_settings("gpio_mmc_power");
}

#endif

/* IRCUT GPIO set */
Expand Down

0 comments on commit acfdb90

Please sign in to comment.