Skip to content

Commit

Permalink
target/xxx: remove with-uartbone, add_uartbone and deal with case whe…
Browse files Browse the repository at this point in the history
…re uartbone is required inconditionnally
  • Loading branch information
trabucayre committed Oct 23, 2023
1 parent a6f3c52 commit f402005
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 47 deletions.
7 changes: 0 additions & 7 deletions litex_boards/targets/antmicro_datacenter_ddr4_test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def __init__(self, *, sys_clk_freq=100e6, iodelay_clk_freq=200e6,
eth_dynamic_ip = False,
with_hyperram = False,
with_sdcard = False,
with_uartbone = False,
with_spi_flash = False,
with_led_chaser = True,
with_video_terminal = False,
Expand Down Expand Up @@ -141,10 +140,6 @@ def __init__(self, *, sys_clk_freq=100e6, iodelay_clk_freq=200e6,
if with_etherbone:
self.add_etherbone(phy=self.ethphy, ip_address=eth_ip)

# UartBone ---------------------------------------------------------------------------------
if with_uartbone:
self.add_uartbone(baudrate=1e6)

# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
self.leds = LedChaser(
Expand Down Expand Up @@ -204,7 +199,6 @@ def main():
parser.add_target_argument("--eth-reset-time", default="10e-3", help="Duration of Ethernet PHY reset.")
parser.add_target_argument("--with-hyperram", action="store_true", help="Add HyperRAM.")
parser.add_target_argument("--with-sdcard", action="store_true", help="Add SDCard.")
parser.add_target_argument("--with-uartbone", action="store_true", help="Add UartBone on 2nd serial.")
parser.add_target_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (HDMI).")
parser.add_target_argument("--with-video-framebuffer", action="store_true", help="Enable Video Framebuffer (HDMI).")
parser.add_target_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed).")
Expand All @@ -221,7 +215,6 @@ def main():
eth_dynamic_ip = args.eth_dynamic_ip,
with_hyperram = args.with_hyperram,
with_sdcard = args.with_sdcard,
with_uartbone = args.with_uartbone,
with_spi_flash = args.with_spi_flash,
with_video_terminal = args.with_video_terminal,
with_video_framebuffer = args.with_video_framebuffer,
Expand Down
7 changes: 0 additions & 7 deletions litex_boards/targets/antmicro_lpddr4_test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def __init__(self, *, sys_clk_freq=50e6, iodelay_clk_freq=200e6,
eth_dynamic_ip = False,
with_hyperram = False,
with_sdcard = False,
with_uartbone = False,
with_led_chaser = True,
**kwargs):
platform = antmicro_lpddr4_test_board.Platform()
Expand Down Expand Up @@ -103,10 +102,6 @@ def __init__(self, *, sys_clk_freq=50e6, iodelay_clk_freq=200e6,
if with_etherbone:
self.add_etherbone(phy=self.ethphy, ip_address=eth_ip)

# UartBone ---------------------------------------------------------------------------------
if with_uartbone:
self.add_uartbone(baudrate=1e6)

# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
self.leds = LedChaser(
Expand All @@ -128,7 +123,6 @@ def main():
parser.add_target_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting.")
parser.add_target_argument("--with-hyperram", action="store_true", help="Add HyperRAM.")
parser.add_target_argument("--with-sdcard", action="store_true", help="Add SDCard.")
parser.add_target_argument("--with-uartbone", action="store_true", help="Add UartBone on 2nd serial.")
args = parser.parse_args()

assert not (args.with_etherbone and args.eth_dynamic_ip)
Expand All @@ -142,7 +136,6 @@ def main():
eth_dynamic_ip = args.eth_dynamic_ip,
with_hyperram = args.with_hyperram,
with_sdcard = args.with_sdcard,
with_uartbone = args.with_uartbone,
**parser.soc_argdict)
builder = Builder(soc, **parser.builder_argdict)
if args.build:
Expand Down
14 changes: 5 additions & 9 deletions litex_boards/targets/colorlight_5a_75x.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class BaseSoC(SoCCore):
def __init__(self, board, revision, sys_clk_freq=60e6, toolchain="trellis",
with_ethernet = False,
with_etherbone = False,
with_uartbone = False,
eth_ip = "192.168.1.50",
eth_phy = 0,
with_led_chaser = True,
Expand Down Expand Up @@ -155,6 +154,11 @@ def __init__(self, board, revision, sys_clk_freq=60e6, toolchain="trellis",
)

# SoCCore ----------------------------------------------------------------------------------
# Uartbone ---------------------------------------------------------------------------------
if kwargs["with_uartbone"]:
if board != "i5a-907":
raise ValueError("uartbone only supported on i5a-907")

SoCCore.__init__(self, platform, int(sys_clk_freq), ident="LiteX SoC on Colorlight " + board.upper(), **kwargs)

# SDR SDRAM --------------------------------------------------------------------------------
Expand Down Expand Up @@ -192,12 +196,6 @@ def __init__(self, board, revision, sys_clk_freq=60e6, toolchain="trellis",
pads = platform.request_all("user_led_n"),
sys_clk_freq = sys_clk_freq)

# Uartbone ---------------------------------------------------------------------------------
if with_uartbone:
if board != "i5a-907":
raise ValueError("uartbone only supported on i5a-907")
self.add_uartbone(uart_name="uartbone")

# SPI Flash --------------------------------------------------------------------------------
if with_spi_flash:
if board == "i5a-907":
Expand Down Expand Up @@ -229,7 +227,6 @@ def main():
ethopts = parser.target_group.add_mutually_exclusive_group()
ethopts.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
ethopts.add_argument("--with-etherbone", action="store_true", help="Enable Etherbone support.")
parser.add_target_argument("--with-uartbone", action="store_true", help="Add uartbone on 'FAN OUT' connector.")
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address.")
parser.add_target_argument("--eth-phy", default=0, type=int, help="Ethernet PHY (0 or 1).")
parser.add_target_argument("--use-internal-osc", action="store_true", help="Use internal oscillator.")
Expand All @@ -242,7 +239,6 @@ def main():
toolchain = args.toolchain,
with_ethernet = args.with_ethernet,
with_etherbone = args.with_etherbone,
with_uartbone = args.with_uartbone,
eth_ip = args.eth_ip,
eth_phy = args.eth_phy,
use_internal_osc = args.use_internal_osc,
Expand Down
7 changes: 0 additions & 7 deletions litex_boards/targets/lattice_crosslink_nx_evn.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=75e6, device="LIFCL-40-9BG400C", toolchain="radiant",
with_led_chaser = True,
with_spi_flash = False,
with_uartbone = False,
**kwargs):
platform = lattice_crosslink_nx_evn.Platform(device=device, toolchain=toolchain)

Expand All @@ -99,10 +98,6 @@ def __init__(self, sys_clk_freq=75e6, device="LIFCL-40-9BG400C", toolchain="radi
pads = Cat(*[platform.request("user_led", i) for i in range(14)]),
sys_clk_freq = sys_clk_freq)

# UARTBone ---------------------------------------------------------------------------------
if with_uartbone:
self.add_uartbone()

# SPI Flash --------------------------------------------------------------------------------
if with_spi_flash:
from litespi.modules import MX25L12833F
Expand All @@ -122,15 +117,13 @@ def main():
parser.add_target_argument("--address", default=0x0, help="Flash address to program bitstream at.")
parser.add_target_argument("--prog-target", default="direct", help="Programming Target (direct or flash).")
parser.add_target_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed).")
parser.add_target_argument("--with-uartbone", action="store_true", help="Add UartBone on 1st serial.")
args = parser.parse_args()

soc = BaseSoC(
sys_clk_freq = args.sys_clk_freq,
device = args.device,
toolchain = args.toolchain,
with_spi_flash = args.with_spi_flash,
with_uartbone = args.with_uartbone,
**parser.soc_argdict
)
builder = Builder(soc, **parser.builder_argdict)
Expand Down
5 changes: 0 additions & 5 deletions litex_boards/targets/lattice_ice40up5k_evn.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ def __init__(self, bios_flash_offset, sys_clk_freq=12e6,
pads = platform.request_all("user_led_n"),
sys_clk_freq = sys_clk_freq)

# Add a UARTBone bridge --------------------------------------------------------------------
debug_uart = False
if debug_uart:
self.add_uartbone()

# Flash --------------------------------------------------------------------------------------------

def flash(bios_flash_offset, target="lattice_ice40up5k_evn"):
Expand Down
7 changes: 3 additions & 4 deletions litex_boards/targets/sipeed_tang_nano.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ def __init__(self, sys_clk_freq=48e6, with_led_chaser=True, **kwargs):
self.crg = _CRG(platform, sys_clk_freq)

# SoCMini ----------------------------------------------------------------------------------
kwargs["uart_name"] = "crossover"
kwargs["uart_name"] = "crossover"
kwargs["uart_baudrate"] = 1e6 # CH552 firmware does not support traditional baudrates.
kwargs["with_uartbone"] = True
SoCMini.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on Tang Nano", **kwargs)

# UARTBone ---------------------------------------------------------------------------------
self.add_uartbone(baudrate=int(1e6)) # CH552 firmware does not support traditional baudrates.

# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
self.leds = LedChaser(
Expand Down
9 changes: 1 addition & 8 deletions litex_boards/targets/terasic_deca.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def __init__(self, platform, sys_clk_freq, with_usb_pll=False):
class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=50e6,
with_led_chaser = True,
with_uartbone = False,
with_video_terminal = False,
with_spi_sdcard = False,
with_ethernet = False,
Expand All @@ -79,14 +78,10 @@ def __init__(self, sys_clk_freq=50e6,
kwargs["uart_name"] = "crossover"
else:
kwargs["uart_name"] = "jtag_uart"
if with_uartbone:
if kwargs["with_uartbone":
kwargs["uart_name"] = "crossover"
SoCCore.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on Terasic DECA", **kwargs)

# UARTbone ---------------------------------------------------------------------------------
if with_uartbone:
self.add_uartbone(uart_name=real_uart_name, baudrate=kwargs["uart_baudrate"])

# Ethernet ---------------------------------------------------------------------------------
if with_ethernet or with_etherbone:
self.platform.toolchain.additional_sdc_commands += [
Expand Down Expand Up @@ -144,7 +139,6 @@ def main():
ethopts.add_argument("--with-etherbone", action="store_true", help="Enable Etherbone support.")
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address.")
parser.add_target_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting.")
parser.add_target_argument("--with-uartbone", action="store_true", help="Enable UARTbone support.")
parser.add_target_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (VGA).")
parser.add_target_argument("--with-spi-sdcard", action="store_true", help="Enable SPI SD card controller.")
args = parser.parse_args()
Expand All @@ -155,7 +149,6 @@ def main():
with_etherbone = args.with_etherbone,
eth_ip = args.eth_ip,
eth_dynamic_ip = args.eth_dynamic_ip,
with_uartbone = args.with_uartbone,
with_video_terminal = args.with_video_terminal,
with_spi_sdcard = args.with_spi_sdcard,
**parser.soc_argdict
Expand Down

0 comments on commit f402005

Please sign in to comment.