New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPI: -- spi_flash: fix bitbang with spi_width=1 #14

Merged
merged 1 commit into from Jan 17, 2017
Jump to file or symbol
Failed to load files and symbols.
+8 −3
Diff settings

Always

Just for now

spi_flash: fix bitbang with spi_width=1

  • Loading branch information...
sbourdeauducq authored and mithro committed Dec 21, 2016
commit e39c470bbc627212f394f528a0b1943b83cc7809
@@ -63,8 +63,6 @@ def __init__(self, pads, dummy=15, div=2, with_bitbang=True):
self.specials.dq = dq.get_tristate(pads.dq)
sr = Signal(max(cmd_width, addr_width, wbone_width))
dqs = Replicate(1, spi_width-1)
self.comb += bus.dat_r.eq(sr)
hw_read_logic = [
@@ -78,7 +76,6 @@ def __init__(self, pads, dummy=15, div=2, with_bitbang=True):
bitbang_logic = [
pads.clk.eq(self.bitbang.storage[1]),
pads.cs_n.eq(self.bitbang.storage[2]),
dq.o.eq(Cat(self.bitbang.storage[0], dqs)),
If(self.bitbang.storage[3],
dq.oe.eq(0)
).Else(
@@ -88,6 +85,14 @@ def __init__(self, pads, dummy=15, div=2, with_bitbang=True):
self.miso.status.eq(dq.i[1])
)
]
if spi_width > 1:
bitbang_logic += [
dq.o.eq(Cat(self.bitbang.storage[0], Replicate(1, spi_width-1)))
]
else:
bitbang_logic += [
dq.o.eq(self.bitbang.storage[0])
]
self.comb += \
If(self.bitbang_en.storage,
ProTip! Use n and p to navigate between commits in a pull request.