Skip to content

Commit 362a28b

Browse files
committed
efinix: fix reset
fix reset on all efinix boards. To reset the PLL a pulse is needed, which has to be driven by a clock that is not generated by the PLL. Signed-off-by: Fin Maaß <[email protected]>
1 parent 88f7d5f commit 362a28b

15 files changed

+97
-19
lines changed

litex_boards/platforms/efinix_t8f81_dev_kit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
class Platform(EfinixPlatform):
5454
default_clk_name = "clk33"
55+
default_clk_freq = 33.333e6
5556
default_clk_period = 1e9/33.333e6
5657

5758
def __init__(self, toolchain="efinity"):

litex_boards/platforms/efinix_titanium_ti60_f225_dev_kit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ def rgmii_ethernet_qse_ios(con, n=""):
183183

184184
class Platform(EfinixPlatform):
185185
default_clk_name = "clk25"
186+
default_clk_freq = 25e6
186187
default_clk_period = 1e9/50e6
187188

188189
def __init__(self, toolchain="efinity"):

litex_boards/platforms/efinix_trion_t120_bga576_dev_kit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def usb_pmod_io(pmod):
174174

175175
class Platform(EfinixPlatform):
176176
default_clk_name = "clk40"
177+
default_clk_freq = 40e6
177178
default_clk_period = 1e9/40e6
178179

179180
def __init__(self, toolchain="efinity"):

litex_boards/platforms/efinix_trion_t20_bga256_dev_kit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113

114114
class Platform(EfinixPlatform):
115115
default_clk_name = "clk50"
116+
default_clk_freq = 50e6
116117
default_clk_period = 1e9/50e6
117118

118119
def __init__(self, toolchain="efinity"):

litex_boards/platforms/efinix_trion_t20_mipi_dev_kit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464

6565
class Platform(EfinixPlatform):
6666
default_clk_name = "clk50"
67+
default_clk_freq = 50e6
6768
default_clk_period = 1e9/50e6
6869

6970
def __init__(self, toolchain="efinity"):

litex_boards/platforms/efinix_xyloni_dev_kit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171

7272
class Platform(EfinixPlatform):
7373
default_clk_name = "clk33"
74+
default_clk_freq = 33.333e6
7475
default_clk_period = 1e9/33.333e6
7576

7677
def __init__(self, toolchain="efinity"):

litex_boards/platforms/jungle_electronics_fireant.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
class Platform(EfinixPlatform):
5151
default_clk_name = "clk33"
52+
default_clk_freq = 33.33e6
5253
default_clk_period = 1e9/33.33e6
5354

5455
def __init__(self, toolchain="efinity"):

litex_boards/targets/efinix_t8f81_dev_kit.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from migen.genlib.resetsync import AsyncResetSynchronizer
1414

1515
from litex.gen import *
16+
from litex.gen.genlib.misc import WaitTimer
1617

1718
from litex_boards.platforms import efinix_t8f81_dev_kit
1819

@@ -28,16 +29,25 @@ class _CRG(LiteXModule):
2829
def __init__(self, platform, sys_clk_freq):
2930
self.rst = Signal()
3031
self.cd_sys = ClockDomain()
32+
self.cd_rst = ClockDomain(reset_less=True)
3133

3234
# # #
3335

3436
clk33 = platform.request("clk33")
3537
rst_n = platform.request("user_btn", 0)
3638

39+
self.comb += self.cd_rst.clk.eq(clk33)
40+
41+
# A pulse is necessary to do a reset.
42+
self.rst_pulse = Signal()
43+
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
44+
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
45+
self.comb += reset_timer.wait.eq(self.rst)
46+
3747
# PLL.
3848
self.pll = pll = TRIONPLL(platform)
39-
self.comb += pll.reset.eq(~rst_n | self.rst)
40-
pll.register_clkin(clk33, 33.333e6)
49+
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
50+
pll.register_clkin(clk33, platform.default_clk_freq)
4151
pll.create_clkout(self.cd_sys, sys_clk_freq, with_reset=True)
4252

4353
# BaseSoC ------------------------------------------------------------------------------------------

litex_boards/targets/efinix_ti375_c529_dev_kit.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from migen.genlib.resetsync import AsyncResetSynchronizer
1111

1212
from litex.gen import *
13+
from litex.gen.genlib.misc import WaitTimer
1314

1415
from litex.build.io import DDROutput, SDROutput, SDRTristate
1516
from litex.build.generic_platform import Subsignal, Pins, Misc, IOStandard
@@ -39,22 +40,31 @@
3940

4041
class _CRG(LiteXModule):
4142
def __init__(self, platform, sys_clk_freq, cpu_clk_freq):
42-
#self.rst = Signal()
43+
self.rst = Signal()
4344
self.cd_sys = ClockDomain()
4445
self.cd_usb = ClockDomain()
4546
self.cd_video = ClockDomain()
4647
self.cd_cpu = ClockDomain()
48+
self.cd_rst = ClockDomain(reset_less=True)
4749

4850
# # #
4951

5052
# Clk/Rst.
5153
clk100 = platform.request("clk100")
5254
rst_n = platform.request("user_btn", 0)
5355

56+
self.comb += self.cd_rst.clk.eq(clk100)
57+
58+
# A pulse is necessary to do a reset.
59+
self.rst_pulse = Signal()
60+
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
61+
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
62+
self.comb += reset_timer.wait.eq(self.rst)
63+
5464
# PLL.
5565
self.pll = pll = TITANIUMPLL(platform)
56-
self.comb += pll.reset.eq(~rst_n)
57-
pll.register_clkin(clk100, 100e6)
66+
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
67+
pll.register_clkin(clk100, platform.default_clk_freq)
5868
# You can use CLKOUT0 only for clocks with a maximum frequency of 4x
5969
# (integer) of the reference clock. If all your system clocks do not fall within
6070
# this range, you should dedicate one unused clock for CLKOUT0.

litex_boards/targets/efinix_titanium_ti60_f225_dev_kit.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from migen.genlib.resetsync import AsyncResetSynchronizer
1111

1212
from litex.gen import *
13+
from litex.gen.genlib.misc import WaitTimer
1314

1415
from litex_boards.platforms import efinix_titanium_ti60_f225_dev_kit
1516

@@ -31,16 +32,25 @@ def __init__(self, platform, sys_clk_freq):
3132
self.cd_sys = ClockDomain()
3233
self.cd_sys2x = ClockDomain()
3334
self.cd_sys2x_ps = ClockDomain()
35+
self.cd_rst = ClockDomain(reset_less=True)
3436

3537
# # #
3638

3739
clk25 = platform.request("clk25")
3840
rst_n = platform.request("user_btn", 0)
3941

42+
self.comb += self.cd_rst.clk.eq(clk25)
43+
44+
# A pulse is necessary to do a reset.
45+
self.rst_pulse = Signal()
46+
self.reset_timer = reset_timer = ClockDomainsRenamer("rst")(WaitTimer(25e-6*platform.default_clk_freq))
47+
self.comb += self.rst_pulse.eq(self.rst ^ reset_timer.done)
48+
self.comb += reset_timer.wait.eq(self.rst)
49+
4050
# PLL
4151
self.pll = pll = TITANIUMPLL(platform)
42-
self.comb += pll.reset.eq(~rst_n | self.rst)
43-
pll.register_clkin(clk25, 25e6)
52+
self.comb += pll.reset.eq(~rst_n | self.rst_pulse)
53+
pll.register_clkin(clk25, platform.default_clk_freq)
4454
# You can use CLKOUT0 only for clocks with a maximum frequency of 4x
4555
# (integer) of the reference clock. If all your system clocks do not fall within
4656
# this range, you should dedicate one unused clock for CLKOUT0.

0 commit comments

Comments
 (0)