From f402005bedf39942e36522ab8008671aeb7bc137 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Mon, 23 Oct 2023 17:30:39 +0200 Subject: [PATCH] target/xxx: remove with-uartbone, add_uartbone and deal with case where uartbone is required inconditionnally --- .../targets/antmicro_datacenter_ddr4_test_board.py | 7 ------- litex_boards/targets/antmicro_lpddr4_test_board.py | 7 ------- litex_boards/targets/colorlight_5a_75x.py | 14 +++++--------- litex_boards/targets/lattice_crosslink_nx_evn.py | 7 ------- litex_boards/targets/lattice_ice40up5k_evn.py | 5 ----- litex_boards/targets/sipeed_tang_nano.py | 7 +++---- litex_boards/targets/terasic_deca.py | 9 +-------- 7 files changed, 9 insertions(+), 47 deletions(-) diff --git a/litex_boards/targets/antmicro_datacenter_ddr4_test_board.py b/litex_boards/targets/antmicro_datacenter_ddr4_test_board.py index 074dacdb6..1e8a4d48f 100755 --- a/litex_boards/targets/antmicro_datacenter_ddr4_test_board.py +++ b/litex_boards/targets/antmicro_datacenter_ddr4_test_board.py @@ -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, @@ -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( @@ -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).") @@ -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, diff --git a/litex_boards/targets/antmicro_lpddr4_test_board.py b/litex_boards/targets/antmicro_lpddr4_test_board.py index c6adbc4c8..79f58acca 100755 --- a/litex_boards/targets/antmicro_lpddr4_test_board.py +++ b/litex_boards/targets/antmicro_lpddr4_test_board.py @@ -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() @@ -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( @@ -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) @@ -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: diff --git a/litex_boards/targets/colorlight_5a_75x.py b/litex_boards/targets/colorlight_5a_75x.py index 873ff5e4a..2dd2efd2f 100755 --- a/litex_boards/targets/colorlight_5a_75x.py +++ b/litex_boards/targets/colorlight_5a_75x.py @@ -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, @@ -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 -------------------------------------------------------------------------------- @@ -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": @@ -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.") @@ -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, diff --git a/litex_boards/targets/lattice_crosslink_nx_evn.py b/litex_boards/targets/lattice_crosslink_nx_evn.py index 93feff4f8..43eb5d7a7 100755 --- a/litex_boards/targets/lattice_crosslink_nx_evn.py +++ b/litex_boards/targets/lattice_crosslink_nx_evn.py @@ -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) @@ -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 @@ -122,7 +117,6 @@ 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( @@ -130,7 +124,6 @@ def main(): 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) diff --git a/litex_boards/targets/lattice_ice40up5k_evn.py b/litex_boards/targets/lattice_ice40up5k_evn.py index 9a5388761..67e298b91 100755 --- a/litex_boards/targets/lattice_ice40up5k_evn.py +++ b/litex_boards/targets/lattice_ice40up5k_evn.py @@ -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"): diff --git a/litex_boards/targets/sipeed_tang_nano.py b/litex_boards/targets/sipeed_tang_nano.py index 3960384a6..95b0df96f 100755 --- a/litex_boards/targets/sipeed_tang_nano.py +++ b/litex_boards/targets/sipeed_tang_nano.py @@ -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( diff --git a/litex_boards/targets/terasic_deca.py b/litex_boards/targets/terasic_deca.py index 1ad5e45ff..177d12b92 100755 --- a/litex_boards/targets/terasic_deca.py +++ b/litex_boards/targets/terasic_deca.py @@ -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, @@ -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 += [ @@ -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() @@ -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