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 1/3] e1000: implement register mapping for E1000_{EERD, FLSW{CTL, DATA, CNT}}
Date: Mon,  9 Oct 2017 11:36:14 +0200	[thread overview]
Message-ID: <20171009093616.12686-2-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20171009093616.12686-1-u.kleine-koenig@pengutronix.de>

Fixes: 4ff3269a70b5 ("e1000: Expose i210's external flash as MTD")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/e1000/e1000.h |  9 +++++----
 drivers/net/e1000/regio.c | 12 ++++++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index e6b493c84cc1..2a29ef47e818 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -410,7 +410,8 @@ struct e1000_tx_desc {
 #define E1000_CTRL     0x00000	/* Device Control - RW */
 #define E1000_STATUS   0x00008	/* Device Status - RO */
 #define E1000_EECD     0x00010	/* EEPROM/Flash Control - RW */
-#define E1000_EERD     0x00014	/* EEPROM Read - RW */
+#define E1000_EERD     (E1000_MIGHT_BE_REMAPPED | 0x00014)	/* EEPROM Read - RW */
+#define E1000_I210_EERD     0x12014	/* EEPROM Read - RW */
 #define E1000_CTRL_EXT 0x00018	/* Extended Device Control - RW */
 #define E1000_MDIC     0x00020	/* MDI Control - RW */
 #define E1000_FCAL     0x00028	/* Flow Control Address Low - RW */
@@ -447,11 +448,11 @@ struct e1000_tx_desc {
 #define E1000_FLASHT   0x01028  /* FLASH Timer Register */
 #define E1000_EEWR     (E1000_MIGHT_BE_REMAPPED | 0x0102C)  /* EEPROM Write Register - RW */
 #define E1000_I210_EEWR     0x12018  /* EEPROM Write Register - RW */
-#define E1000_FLSWCTL  0x01030  /* FLASH control register */
+#define E1000_FLSWCTL  (E1000_MIGHT_BE_REMAPPED | 0x01030)  /* FLASH control register */
 #define E1000_I210_FLSWCTL 0x12048  /* FLASH control register */
-#define E1000_FLSWDATA 0x01034  /* FLASH data register */
+#define E1000_FLSWDATA (E1000_MIGHT_BE_REMAPPED | 0x01034)  /* FLASH data register */
 #define E1000_I210_FLSWDATA 0x1204C  /* FLASH data register */
-#define E1000_FLSWCNT  0x01038  /* FLASH Access Counter */
+#define E1000_FLSWCNT  (E1000_MIGHT_BE_REMAPPED | 0x01038)  /* FLASH Access Counter */
 #define E1000_I210_FLSWCNT  0x12050  /* FLASH Access Counter */
 #define E1000_FLOP     0x0103C  /* FLASH Opcode Register */
 #define E1000_ERT      0x02008  /* Early Rx Threshold - RW */
diff --git a/drivers/net/e1000/regio.c b/drivers/net/e1000/regio.c
index 1610d5851f05..9ef325fb8581 100644
--- a/drivers/net/e1000/regio.c
+++ b/drivers/net/e1000/regio.c
@@ -7,6 +7,9 @@ static uint32_t e1000_true_offset(struct e1000_hw *hw, uint32_t reg)
 	if (reg & E1000_MIGHT_BE_REMAPPED) {
 		if (hw->mac_type == e1000_igb) {
 			switch (reg) {
+			case E1000_EERD:
+				reg = E1000_I210_EERD;
+				break;
 			case E1000_EEWR:
 				reg = E1000_I210_EEWR;
 				break;
@@ -16,6 +19,15 @@ static uint32_t e1000_true_offset(struct e1000_hw *hw, uint32_t reg)
 			case E1000_EEMNGCTL:
 				reg = E1000_I210_EEMNGCTL;
 				break;
+			case E1000_FLSWCTL:
+				reg = E1000_I210_FLSWCTL;
+				break;
+			case E1000_FLSWCNT:
+				reg = E1000_I210_FLSWCNT;
+				break;
+			case E1000_FLSWDATA:
+				reg = E1000_I210_FLSWDATA;
+				break;
 			}
 		}
 		reg &= ~E1000_MIGHT_BE_REMAPPED;
-- 
2.11.0


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

  reply	other threads:[~2017-10-09  9:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09  9:36 [PATCH 0/3] e1000: access to flash on i210 Uwe Kleine-König
2017-10-09  9:36 ` Uwe Kleine-König [this message]
2017-10-09 18:22   ` [PATCH 1/3] e1000: implement register mapping for E1000_{EERD, FLSW{CTL, DATA, CNT}} Andrey Smirnov
2017-10-09 18:33     ` [PATCH 1/3] e1000: implement register mapping for E1000_{EERD,FLSW{CTL,DATA,CNT}} Uwe Kleine-König
2017-10-09  9:36 ` [PATCH 2/3] e1000: implement support for smaller flash chips Uwe Kleine-König
2017-10-09 18:24   ` Andrey Smirnov
2017-10-09  9:36 ` [PATCH 3/3] HACK: e1000: don't check for FLSWCTL.GLDONE when waiting for idle Uwe Kleine-König
2017-10-09 14:24   ` Uwe Kleine-König
2017-10-09 18:15     ` Andrey Smirnov
2017-10-09 18:41       ` Uwe Kleine-König

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=20171009093616.12686-2-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