Patchwork [4/5] Generify probe_spi_rdid_generic() and add probe_spi_rdid_edi().

login
register
about
Submitter Antonio Ospite
Date 2012-10-15 08:56:10
Message ID <20121015105610.6f7915d56ef26669234cfc5c@studenti.unina.it>
Download mbox | patch
Permalink /patch/3775/
State Not for merge
Headers show

Comments

Antonio Ospite - 2012-10-15 08:56:10
On Wed,  3 Oct 2012 06:13:04 +0200
Stefan Tauner <stefan.tauner@student.tuwien.ac.at> wrote:

> Previously the "generic" function was working/used for exactly two
> cases, namely for manufacturer IDs with 0 or 1 continuation bytes.
> For this behavior it was overly complicated.
> 
> The new implementation handles up to 3 continuation bytes
> automatically and allows for up to 4 model bytes which is directly
> used to add support for an EDI probing function. The probe_spi_rdid4()
> function is removed because it is no longer needed.
> 
> The new probe_spi_rdid_generic() tries to figure out the maximum
> allowed read size by using the recently added check_trans() function
> to reduce the request size if necessary. While this does not make
> detection to succeed in all theoretical situations, it improves the
> code and will hopefully work in all realworld situations.
> 
> Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
> ---
>  flashchips.c |   24 +++++++--------
>  flashchips.h |    2 +-
>  spi25.c      |   97 ++++++++++++++++++++++++++++++----------------------------
>  3 files changed, 63 insertions(+), 60 deletions(-)
>

A fixup like this is needed for probe_spi_rdid_edi() to be usable:

Patch

diff --git a/chipdrivers.h b/chipdrivers.h
index 1ef4959..b754076 100644
--- a/chipdrivers.h
+++ b/chipdrivers.h
@@ -34,7 +34,7 @@  int spi_chip_read(struct flashctx *flash, uint8_t *buf, unsigned int start, int

 /* spi25.c */
 int probe_spi_rdid(struct flashctx *flash);
-int probe_spi_rdid4(struct flashctx *flash);
+int probe_spi_rdid_edi(struct flashctx *flash);
 int probe_spi_rems(struct flashctx *flash);
 int probe_spi_res1(struct flashctx *flash);
 int probe_spi_res2(struct flashctx *flash);