linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Chris Brandt <Chris.Brandt@renesas.com>
Cc: linux-renesas-soc@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH rza_u-boot-2017.05 1/2] net: sh_eth: Fix port offset on RZ/A2
Date: Thu,  4 Jul 2019 17:37:25 +0200	[thread overview]
Message-ID: <20190704153726.10507-2-geert+renesas@glider.be> (raw)
In-Reply-To: <20190704153726.10507-1-geert+renesas@glider.be>

The sh_eth driver assumes a hardcoded offset of 0x800 between multiple
port instances, which is incorrect on RZ/A2.

Fix this by making the port offset configurable, depending on SoC type.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/net/sh_eth.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h
index 906d93d8e7e0421f..d20abc7873e45850 100644
--- a/drivers/net/sh_eth.h
+++ b/drivers/net/sh_eth.h
@@ -366,8 +366,13 @@ static const u16 sh_eth_offset_fast_sh4[SH_ETH_MAX_REGISTER_OFFSET] = {
 #define BASE_IO_ADDR	0xE8203000
 #elif defined(CONFIG_R7S9210)
 #define SH_ETH_TYPE_RZ
-#define BASE_IO_ADDR	0xE8204000	/* EDMAC0 + ETHERC0 */
-//#define BASE_IO_ADDR	0xE8204200	/* EDMAC1 + ETHERC1 */
+#define BASE_IO_ADDR	0xE8204000
+#endif
+
+#if defined(CONFIG_R7S9210)
+#define PORT_OFFSET	0x200
+#else
+#define PORT_OFFSET	0x800
 #endif
 
 /*
@@ -674,7 +679,7 @@ static inline unsigned long sh_eth_reg_addr(struct sh_eth_dev *eth,
 #else
 #error
 #endif
-	return BASE_IO_ADDR + reg_offset[enum_index] + 0x800 * eth->port;
+	return BASE_IO_ADDR + reg_offset[enum_index] + PORT_OFFSET * eth->port;
 }
 
 static inline void sh_eth_write(struct sh_eth_dev *eth, unsigned long data,
-- 
2.17.1


  reply	other threads:[~2019-07-04 15:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-04 15:37 [PATCH rza_u-boot-2017.05 0/2] rza2mevb: Allow using Ethernet when SDRAM is enabled Geert Uytterhoeven
2019-07-04 15:37 ` Geert Uytterhoeven [this message]
2019-07-10 18:57   ` [PATCH rza_u-boot-2017.05 1/2] net: sh_eth: Fix port offset on RZ/A2 Chris Brandt
2019-07-04 15:37 ` [PATCH rza_u-boot-2017.05 2/2] rza2mevb: Use second Ethernet port if first one is not available Geert Uytterhoeven
2019-07-10 18:57   ` Chris Brandt
2019-07-10 19:15 ` [PATCH rza_u-boot-2017.05 0/2] rza2mevb: Allow using Ethernet when SDRAM is enabled Chris Brandt
2019-07-11 10:06   ` Geert Uytterhoeven
2019-07-11 11:49     ` Chris Brandt

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=20190704153726.10507-2-geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=Chris.Brandt@renesas.com \
    --cc=linux-renesas-soc@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).