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

Unified Diff: mec1308.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 | « it85spi.c ('k') | programmer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mec1308.c
diff --git a/mec1308.c b/mec1308.c
index c4db628d891ae93b21203d685bcff56a212ed81f..433cc91cf1a3249ccd4441ff67da03ab81b3c667 100644
--- a/mec1308.c
+++ b/mec1308.c
@@ -307,6 +307,21 @@ static int enter_passthru_mode(void)
return 0;
}
+static void mec1308_shutdown(void *data)
+{
+ if (spi_controller != SPI_CONTROLLER_MEC1308)
+ return;
+
+ /* Exit passthru mode before performing commands which do not affect
+ the SPI ROM */
+ mec1308_exit_passthru_mode();
+
+ /* Re-enable SMI and ACPI.
+ FIXME: is there an ordering dependency? */
+ mbx_write(MEC1308_MBX_CMD, MEC1308_CMD_SMI_ENABLE);
+ mbx_write(MEC1308_MBX_CMD, MEC1308_CMD_ACPI_ENABLE);
+}
+
/* Called by internal_init() */
int mec1308_probe_spi_flash(const char *name)
{
@@ -361,12 +376,16 @@ int mec1308_probe_spi_flash(const char *name)
mbx_write(MEC1308_MBX_CMD, MEC1308_CMD_ACPI_DISABLE);
mbx_write(MEC1308_MBX_CMD, MEC1308_CMD_SMI_DISABLE);
+ if (register_shutdown(mec1308_shutdown, NULL))
+ return 1;
+
/*
* Enter SPI Pass-Thru Mode after commands which do not require access
* to SPI ROM are complete. We'll start by doing the exit_passthru_mode
* sequence, which is benign if the EC is already in passthru mode.
*/
mec1308_exit_passthru_mode();
+
if (enter_passthru_mode())
return 1;
@@ -374,23 +393,6 @@ int mec1308_probe_spi_flash(const char *name)
return 0;
}
-int mec1308_shutdown(void)
-{
- if (spi_controller != SPI_CONTROLLER_MEC1308)
- return 0;
-
- /* Exit passthru mode before performing commands which do not affect
- the SPI ROM */
- mec1308_exit_passthru_mode();
-
- /* Re-enable SMI and ACPI.
- FIXME: is there an ordering dependency? */
- mbx_write(MEC1308_MBX_CMD, MEC1308_CMD_SMI_ENABLE);
- mbx_write(MEC1308_MBX_CMD, MEC1308_CMD_ACPI_ENABLE);
-
- return 0;
-}
-
int mec1308_spi_read(struct flashchip *flash, uint8_t * buf, int start, int len)
{
return spi_read_chunked(flash, buf, start, len, flash->page_size);
« no previous file with comments | « it85spi.c ('k') | programmer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698