libboard_zynq::flash: keep spi_en=1 over multiple manual transfers

This commit is contained in:
Astro 2020-01-18 00:59:11 +01:00
parent e2ba91b79b
commit c8d03a43c6
2 changed files with 8 additions and 9 deletions

View File

@ -326,6 +326,11 @@ impl Flash<()> {
.lq_mode(false) .lq_mode(false)
); );
self.regs.enable.write(
regs::Enable::zeroed()
.spi_en(true)
);
self.transition() self.transition()
} }
} }
@ -351,6 +356,8 @@ impl Flash<LinearAddressing> {
impl Flash<Manual> { impl Flash<Manual> {
pub fn stop(self) -> Flash<()> { pub fn stop(self) -> Flash<()> {
self.regs.enable.modify(|_, w| w.spi_en(false));
self.transition() self.transition()
} }

View File

@ -13,10 +13,6 @@ pub struct Transfer<'a, Args: Iterator<Item = W>, W: Into<SpiWord>> {
impl<'a, Args: Iterator<Item = W>, W: Into<SpiWord>> Transfer<'a, Args, W> { impl<'a, Args: Iterator<Item = W>, W: Into<SpiWord>> Transfer<'a, Args, W> {
pub fn new(flash: &'a mut Flash<Manual>, args: Args, len: usize) -> Self { pub fn new(flash: &'a mut Flash<Manual>, args: Args, len: usize) -> Self {
flash.regs.config.modify(|_, w| w.pcs(false)); flash.regs.config.modify(|_, w| w.pcs(false));
flash.regs.enable.write(
regs::Enable::zeroed()
.spi_en(true)
);
let mut xfer = Transfer { let mut xfer = Transfer {
flash, flash,
@ -97,11 +93,7 @@ impl<'a, Args: Iterator<Item = W>, W: Into<SpiWord>> Drop for Transfer<'a, Args,
self.read(); self.read();
} }
// Stop
self.flash.regs.enable.write(
regs::Enable::zeroed()
.spi_en(false)
);
self.flash.regs.config.modify(|_, w| w self.flash.regs.config.modify(|_, w| w
.pcs(true) .pcs(true)
.man_start_com(false) .man_start_com(false)