From 76df4e39c88d4052bee61c01af5d0b2500545b75 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 29 May 2020 19:20:27 +0200 Subject: [PATCH] targets: simplify Ethernet/Etherbone integration on targets with both. --- litex_boards/targets/arty.py | 17 ++++++----------- litex_boards/targets/colorlight_5a_75b.py | 17 ++++++----------- litex_boards/targets/genesys2.py | 17 ++++++----------- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/litex_boards/targets/arty.py b/litex_boards/targets/arty.py index bba25de..8a7e373 100755 --- a/litex_boards/targets/arty.py +++ b/litex_boards/targets/arty.py @@ -79,21 +79,16 @@ class BaseSoC(SoCCore): l2_cache_reverse = True ) - # Ethernet --------------------------------------------------------------------------------- - if with_ethernet: + # Ethernet / Etherbone --------------------------------------------------------------------- + if with_ethernet or with_etherbone: self.submodules.ethphy = LiteEthPHYMII( clock_pads = self.platform.request("eth_clocks"), pads = self.platform.request("eth")) self.add_csr("ethphy") - self.add_ethernet(phy=self.ethphy) - - # Etherbone -------------------------------------------------------------------------------- - if with_etherbone: - self.submodules.ethphy = LiteEthPHYMII( - clock_pads = self.platform.request("eth_clocks"), - pads = self.platform.request("eth")) - self.add_csr("ethphy") - self.add_etherbone(phy=self.ethphy) + if with_ethernet: + self.add_ethernet(phy=self.ethphy) + if with_etherbone: + self.add_etherbone(phy=self.ethphy) # Leds ------------------------------------------------------------------------------------- self.submodules.leds = LedChaser( diff --git a/litex_boards/targets/colorlight_5a_75b.py b/litex_boards/targets/colorlight_5a_75b.py index 898296a..5431704 100755 --- a/litex_boards/targets/colorlight_5a_75b.py +++ b/litex_boards/targets/colorlight_5a_75b.py @@ -118,21 +118,16 @@ class BaseSoC(SoCCore): l2_cache_reverse = True ) - # Ethernet --------------------------------------------------------------------------------- - if with_ethernet: + # Ethernet / Etherbone --------------------------------------------------------------------- + if with_ethernet or with_etherbone: self.submodules.ethphy = LiteEthPHYRGMII( clock_pads = self.platform.request("eth_clocks"), pads = self.platform.request("eth")) self.add_csr("ethphy") - self.add_ethernet(phy=self.ethphy) - - # Etherbone -------------------------------------------------------------------------------- - if with_etherbone: - self.submodules.ethphy = LiteEthPHYRGMII( - clock_pads = self.platform.request("eth_clocks"), - pads = self.platform.request("eth")) - self.add_csr("ethphy") - self.add_etherbone(phy=self.ethphy) + if with_ethernet: + self.add_ethernet(phy=self.ethphy) + if with_etherbone: + self.add_etherbone(phy=self.ethphy) # Build -------------------------------------------------------------------------------------------- diff --git a/litex_boards/targets/genesys2.py b/litex_boards/targets/genesys2.py index 98cd8e2..80f9169 100755 --- a/litex_boards/targets/genesys2.py +++ b/litex_boards/targets/genesys2.py @@ -70,21 +70,16 @@ class BaseSoC(SoCCore): l2_cache_reverse = True ) - # Ethernet --------------------------------------------------------------------------------- - if with_ethernet: + # Ethernet / Etherbone --------------------------------------------------------------------- + if with_ethernet or with_etherbone: self.submodules.ethphy = LiteEthPHYRGMII( clock_pads = self.platform.request("eth_clocks"), pads = self.platform.request("eth")) self.add_csr("ethphy") - self.add_ethernet(phy=self.ethphy) - - # Etherbone -------------------------------------------------------------------------------- - if with_etherbone: - self.submodules.ethphy = LiteEthPHYRGMII( - clock_pads = self.platform.request("eth_clocks"), - pads = self.platform.request("eth")) - self.add_csr("ethphy") - self.add_etherbone(phy=self.ethphy) + if with_ethernet: + self.add_ethernet(phy=self.ethphy) + if with_etherbone: + self.add_etherbone(phy=self.ethphy) # Leds ------------------------------------------------------------------------------------- self.submodules.leds = LedChaser(