mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH v2 2/3] e1000: implement support for smaller flash chips
Date: Mon,  9 Oct 2017 21:06:26 +0200	[thread overview]
Message-ID: <20171009190627.2486-3-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20171009190627.2486-1-u.kleine-koenig@pengutronix.de>

Even though the register description of the FLA register suggests (on
page 386 of the i210 datasheet (rev. 3.1)) that 2 MB, 4 MB and 8 MB are
the only supported flash sizes, the list of supported flashes (on page
794 of the same document) lists for example a Micron M25PE80 which only
has a size of 1 MB.

Also in general it seems sensible to stick to the formula given for the
meaning of the values that are not explicitly listed.

Acked-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/e1000/e1000.h  |  3 ---
 drivers/net/e1000/eeprom.c | 14 +++-----------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 45514629dd72..f2da08b4d5c1 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -2105,9 +2105,6 @@ struct e1000_eeprom_info {
 #define E1000_FLA			0x1201C
 #define E1000_FLA_FL_SIZE_SHIFT		17
 #define E1000_FLA_FL_SIZE_MASK		(0b111 << E1000_FLA_FL_SIZE_SHIFT) /* EEprom Size */
-#define E1000_FLA_FL_SIZE_2MB		0b101
-#define E1000_FLA_FL_SIZE_4MB		0b110
-#define E1000_FLA_FL_SIZE_8MB		0b111
 
 
 #define E1000_FLSWCTL_ADDR(a)		((a) & 0x00FFFFFF)
diff --git a/drivers/net/e1000/eeprom.c b/drivers/net/e1000/eeprom.c
index 1a0c6e15abef..739bc17a519e 100644
--- a/drivers/net/e1000/eeprom.c
+++ b/drivers/net/e1000/eeprom.c
@@ -414,17 +414,9 @@ int32_t e1000_init_eeprom_params(struct e1000_hw *hw)
 			fla &= E1000_FLA_FL_SIZE_MASK;
 			fla >>= E1000_FLA_FL_SIZE_SHIFT;
 
-			switch (fla) {
-			case E1000_FLA_FL_SIZE_8MB:
-				eeprom->word_size = SZ_8M / 2;
-				break;
-			case E1000_FLA_FL_SIZE_4MB:
-				eeprom->word_size = SZ_4M / 2;
-				break;
-			case E1000_FLA_FL_SIZE_2MB:
-				eeprom->word_size = SZ_2M / 2;
-				break;
-			default:
+			if (fla) {
+				eeprom->word_size = (SZ_64K << fla) / 2;
+			} else {
 				eeprom->word_size = 2048;
 				dev_info(hw->dev, "Unprogrammed Flash detected, "
 					 "limiting access to first 4KB\n");
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2017-10-09 19:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 19:06 [PATCH v2 0/3] e1000: fix access to companion flash chip Uwe Kleine-König
2017-10-09 19:06 ` [PATCH v2 1/3] e1000: implement register mapping for E1000_FLSW{CTL, DATA, CNT} Uwe Kleine-König
2017-10-09 19:06 ` Uwe Kleine-König [this message]
2017-10-09 19:06 ` [PATCH v2 3/3] e1000: Don't poll for FLSWCTL.GLDONE before starting a flash transaction Uwe Kleine-König
2017-10-16  8:26 ` [PATCH v2 0/3] e1000: fix access to companion flash chip Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171009190627.2486-3-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox