Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Unified Diff: wpce775x.c

Issue 6897014: Do not call EC programmer shutdown functions explicitly. (Closed) Base URL: svn://coreboot.org/flashrom/trunk
Patch Set: Fix code as per Stefan's comments Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « programmer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: wpce775x.c
diff --git a/wpce775x.c b/wpce775x.c
index f394e64b6fb8d132bd9468233a905c2fc648850f..1cf13bcb60582813fd2531268060b6149362fb66 100644
--- a/wpce775x.c
+++ b/wpce775x.c
@@ -540,6 +540,30 @@ int ExitFlashUpdateFirmwareChanged(void) {
return ExitFlashUpdate(0x21);
}
+static void wpce775x_shutdown(void *data)
+{
+ if (spi_controller != SPI_CONTROLLER_WPCE775X)
+ return;
+
+ msg_pdbg("%s(): firmware %s\n", __func__,
+ firmware_changed ? "changed" : "not changed");
+
+ msg_pdbg("%s: in_flash_update_mode: %d\n", __func__, in_flash_update_mode);
+ if (in_flash_update_mode) {
+ if (firmware_changed)
+ ExitFlashUpdateFirmwareChanged();
+ else
+ ExitFlashUpdateFirmwareNoChange();
+
+ in_flash_update_mode = 0;
+ }
+
+ if (initflash_cfg)
+ free(initflash_cfg);
+ else
+ msg_perr("%s(): No initflash_cfg to free?!?\n", __func__);
+}
+
int wpce775x_spi_common_init(void)
{
uint16_t sio_port;
@@ -592,6 +616,9 @@ int wpce775x_spi_common_init(void)
/* TODO: set fwh_idsel of chipset.
Currently, we employ "-p internal:fwh_idsel=0x0000223e". */
+ if (register_shutdown(wpce775x_shutdown, NULL))
+ return 1;
+
/* Enter flash update mode unconditionally. This is required even
for reading. */
if (EnterFlashUpdate()) return 1;
@@ -599,33 +626,6 @@ int wpce775x_spi_common_init(void)
spi_controller = SPI_CONTROLLER_WPCE775X;
msg_pdbg("%s(): successfully initialized wpce775x\n", __func__);
return 0;
-
-}
-
-int wpce775x_shutdown(void)
-{
- if (spi_controller != SPI_CONTROLLER_WPCE775X)
- return 0;
-
- msg_pdbg("%s(): firmware %s\n", __func__,
- firmware_changed ? "changed" : "not changed");
-
- msg_pdbg("%s: in_flash_update_mode: %d\n", __func__, in_flash_update_mode);
- if (in_flash_update_mode) {
- if (firmware_changed)
- ExitFlashUpdateFirmwareChanged();
- else
- ExitFlashUpdateFirmwareNoChange();
-
- in_flash_update_mode = 0;
- }
-
- if (initflash_cfg)
- free(initflash_cfg);
- else
- msg_perr("%s(): No initflash_cfg to free?!?\n", __func__);
-
- return 0;
}
/* Called by internal_init() */
« no previous file with comments | « programmer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698