1
0

spi: Fix invalid D channel response when flash interface is disabled

Issue: When the memory-mapped flash region is accessed while the flash
read mode is disabled (fctrl.en flag is clear), the SPI flash controller
generates an invalid response on the D channel.
This may cause the TileLink bus to deadlock.

Workaround: Software should avoid accessing the memory-mapped flash
region when the SPI controller is not in the flash read mode.
This commit is contained in:
Albert Ou 2017-08-02 13:50:00 -07:00
parent 015f87ec6b
commit c59356d1de

View File

@ -86,7 +86,7 @@ class SPIFlashMap(c: SPIFlashParamsBase) extends Module {
}
}
val (s_idle :: s_cmd :: s_addr :: s_pad :: s_data_pre :: s_data_post :: Nil) = Enum(UInt(), 6)
val (s_idle :: s_cmd :: s_addr :: s_pad :: s_data_pre :: s_data_post :: s_off :: Nil) = Enum(UInt(), 7)
val state = Reg(init = s_idle)
switch (state) {
@ -105,10 +105,11 @@ class SPIFlashMap(c: SPIFlashParamsBase) extends Module {
io.link.lock := Bool(false)
}
} .otherwise {
io.data.valid := io.addr.valid
io.addr.ready := io.data.ready
io.data.bits := UInt(0)
io.addr.ready := Bool(true)
io.link.lock := Bool(false)
when (io.addr.valid) {
state := s_off
}
}
}
@ -158,5 +159,13 @@ class SPIFlashMap(c: SPIFlashParamsBase) extends Module {
state := s_idle
}
}
is (s_off) {
io.data.valid := Bool(true)
io.data.bits := UInt(0)
when (io.data.ready) {
state := s_idle
}
}
}
}