summaryrefslogtreecommitdiffstats
path: root/programmer.h
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2011-11-06 23:51:09 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2011-11-06 23:51:09 +0000
commita8d838d9d3a0373b51408a2ecb647c320e1aaff9 (patch)
tree8524bb99c9ff890da6311769656a6480abb0a1d5 /programmer.h
parent532c717bccc95aa93bae7af8be0695bee83c32b5 (diff)
downloadast2050-flashrom-a8d838d9d3a0373b51408a2ecb647c320e1aaff9.zip
ast2050-flashrom-a8d838d9d3a0373b51408a2ecb647c320e1aaff9.tar.gz
ichspi: use a variable to distinguish ich generations instead of spi_programmer->type
The type member is enough most of the time to derive the wanted information, but - not always (e.g. ich_set_bbar), - only available after registration, which we want to delay till the end of init, and - we really want to distinguish between chipset version-grained attributes which are not reflected by the registered programmer. Hence this patch introduces a new static variable which is set up early by the init functions and allows us to get rid of all "switch (spi_programmer->type)" in ichspi.c. We reuse the enum introduced for descriptor mode for the type of the new variable. Previously magic numbers were passed by chipset_enable wrappers. Now they use the enumeration items too. To get this working the enum definition had to be moved to programmer.h. Another noteworthy detail: previously we have checked for a valid programmer/ich generation all over the place. I have removed those checks and added one single check in the init method. Calling any function of a programmer without executing the init method first, is undefined behavior. Corresponding to flashrom svn r1460. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'programmer.h')
-rw-r--r--programmer.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/programmer.h b/programmer.h
index 16947f1..143f963 100644
--- a/programmer.h
+++ b/programmer.h
@@ -579,9 +579,20 @@ void register_spi_programmer(const struct spi_programmer *programmer);
/* ichspi.c */
#if CONFIG_INTERNAL == 1
+enum ich_chipset {
+ CHIPSET_ICH_UNKNOWN,
+ CHIPSET_ICH7 = 7,
+ CHIPSET_ICH8,
+ CHIPSET_ICH9,
+ CHIPSET_ICH10,
+ CHIPSET_5_SERIES_IBEX_PEAK,
+ CHIPSET_6_SERIES_COUGAR_POINT,
+ CHIPSET_7_SERIES_PANTHER_POINT
+};
+
extern uint32_t ichspi_bbar;
int ich_init_spi(struct pci_dev *dev, uint32_t base, void *rcrb,
- int ich_generation);
+ enum ich_chipset ich_generation);
int via_init_spi(struct pci_dev *dev);
/* it85spi.c */
OpenPOWER on IntegriCloud