Skip to content

Commit

Permalink
litex_acorn_baseboard_mini: Add SATA support (Gen1 and Gen2).
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Feb 29, 2024
1 parent 9dd246c commit 8b80cc1
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions litex_boards/targets/litex_acorn_baseboard_mini.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __init__(self, variant="cle-215+", sys_clk_freq=125.00e6,
remote_ip = None,
eth_dynamic_ip = False,
with_led_chaser = True,
with_sata = False, sata_gen="gen2",
**kwargs):
platform = Platform(variant=variant)
platform.add_extension(_serial_io, prepend=True)
Expand Down Expand Up @@ -147,6 +148,42 @@ def __init__(self, variant="cle-215+", sys_clk_freq=125.00e6,
elif with_ethernet:
self.add_ethernet(phy=self.ethphy, dynamic_ip=eth_dynamic_ip, local_ip=eth_ip, remote_ip=remote_ip)

# SATA -------------------------------------------------------------------------------------
if with_sata:
from litex.build.generic_platform import Subsignal, Pins
from litesata.phy import LiteSATAPHY

# IOs
_sata_io = [
("sata", 0,
# Inverted on Acorn.
Subsignal("tx_p", Pins("B6")),
Subsignal("tx_n", Pins("A5")),
# Inverted on Acorn.
Subsignal("rx_p", Pins("B10")),
Subsignal("rx_n", Pins("A10")),
),
]
platform.add_extension(_sata_io)

# RefClk, generate 150MHz from PLL.
self.cd_sata_refclk = ClockDomain()
self.crg.pll.create_clkout(self.cd_sata_refclk, 150e6)
sata_refclk = ClockSignal("sata_refclk")
platform.add_platform_command("set_property SEVERITY {{WARNING}} [get_drc_checks REQP-49]")

# PHY
self.sata_phy = LiteSATAPHY(platform.device,
refclk = sata_refclk,
pads = platform.request("sata"),
gen = sata_gen,
clk_freq = sys_clk_freq,
data_width = 16
)

# Core
self.add_sata(phy=self.sata_phy, mode="read+write")

# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
self.leds = LedChaser(
Expand All @@ -166,6 +203,8 @@ def main():
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address.")
parser.add_target_argument("--remote-ip", default="192.168.1.100", help="Remote IP address of TFTP server.")
parser.add_target_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting.")
parser.add_target_argument("--with-sata", action="store_true", help="Enable SATA support (over FMCRAID).")
parser.add_target_argument("--sata-gen", default="2", help="SATA Gen.", choices=["1", "2"])
args = parser.parse_args()

soc = BaseSoC(
Expand All @@ -176,6 +215,8 @@ def main():
eth_ip = args.eth_ip,
remote_ip = args.remote_ip,
eth_dynamic_ip = args.eth_dynamic_ip,
with_sata = args.with_sata,
sata_gen = "gen" + args.sata_gen,
**parser.soc_argdict
)

Expand Down

0 comments on commit 8b80cc1

Please sign in to comment.