X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmain%2Fscala%2Fdevices%2Fspi%2FSPIPeriphery.scala;h=f2b3b4198fc1e7ce96b02d612581c38f5d5dca2e;hb=ef4f2ed888cd614858c6b2647c1eb6f988ff3973;hp=15e28faf302ea5727947ef7350872f3f67f8fa6e;hpb=fb9dd313741196a062e6a0f6462cf3a2bce710a9;p=sifive-blocks.git diff --git a/src/main/scala/devices/spi/SPIPeriphery.scala b/src/main/scala/devices/spi/SPIPeriphery.scala index 15e28fa..f2b3b41 100644 --- a/src/main/scala/devices/spi/SPIPeriphery.scala +++ b/src/main/scala/devices/spi/SPIPeriphery.scala @@ -21,20 +21,15 @@ trait HasPeripherySPI extends HasSystemNetworks { } trait HasPeripherySPIBundle { - val spis: HeterogeneousBag[SPIPortIO] + val spi: HeterogeneousBag[SPIPortIO] - def SPItoGPIOPins(syncStages: Int = 0): Seq[SPIPinsIO] = spis.map { s => - val pins = Module(new SPIGPIOPort(s.c, syncStages)) - pins.io.spi <> s - pins.io.pins - } } trait HasPeripherySPIModuleImp extends LazyMultiIOModuleImp with HasPeripherySPIBundle { val outer: HasPeripherySPI - val spis = IO(HeterogeneousBag(outer.spiParams.map(new SPIPortIO(_)))) + val spi = IO(HeterogeneousBag(outer.spiParams.map(new SPIPortIO(_)))) - (spis zip outer.spis).foreach { case (io, device) => + (spi zip outer.spis).foreach { case (io, device) => io <> device.module.io.port } } @@ -43,7 +38,7 @@ case object PeripherySPIFlashKey extends Field[Seq[SPIFlashParams]] trait HasPeripherySPIFlash extends HasSystemNetworks { val spiFlashParams = p(PeripherySPIFlashKey) - val qspi = spiFlashParams map { params => + val qspis = spiFlashParams map { params => val qspi = LazyModule(new TLSPIFlash(peripheryBusBytes, params)) qspi.rnode := TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node) qspi.fnode := TLFragmenter(1, cacheBlockBytes)(TLWidthWidget(peripheryBusBytes)(peripheryBus.node)) @@ -55,21 +50,13 @@ trait HasPeripherySPIFlash extends HasSystemNetworks { trait HasPeripherySPIFlashBundle { val qspi: HeterogeneousBag[SPIPortIO] - // It is important for SPIFlash that the syncStages is agreed upon, because - // internally it needs to realign the input data to the output SCK. - // Therefore, we rely on the syncStages parameter. - def SPIFlashtoGPIOPins(syncStages: Int = 0): Seq[SPIPinsIO] = qspi.map { s => - val pins = Module(new SPIGPIOPort(s.c, syncStages)) - pins.io.spi <> s - pins.io.pins - } } trait HasPeripherySPIFlashModuleImp extends LazyMultiIOModuleImp with HasPeripherySPIFlashBundle { val outer: HasPeripherySPIFlash val qspi = IO(HeterogeneousBag(outer.spiFlashParams.map(new SPIPortIO(_)))) - (qspi zip outer.qspi) foreach { case (io, device) => + (qspi zip outer.qspis) foreach { case (io, device) => io <> device.module.io.port } }