X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmain%2Fscala%2Fdevices%2Fspi%2FSPIPeriphery.scala;fp=src%2Fmain%2Fscala%2Fdevices%2Fspi%2FSPIPeriphery.scala;h=daa0a9f9ed5cc3c02e5af41a0dde991d6aa09d58;hb=27b00e177c2b4cd29234e556b3b6a0260d151431;hp=1509ea73c7a38bfae1cb3e3182a8ee4f2aad9636;hpb=0ca609d324424dc2488e51273ec89c5714d3c95e;p=sifive-blocks.git diff --git a/src/main/scala/devices/spi/SPIPeriphery.scala b/src/main/scala/devices/spi/SPIPeriphery.scala index 1509ea7..daa0a9f 100644 --- a/src/main/scala/devices/spi/SPIPeriphery.scala +++ b/src/main/scala/devices/spi/SPIPeriphery.scala @@ -37,23 +37,30 @@ trait HasPeripherySPIModule extends HasTopLevelNetworksModule { } } -case object PeripherySPIFlashKey extends Field[SPIFlashParams] +case object PeripherySPIFlashKey extends Field[Seq[SPIFlashParams]] trait HasPeripherySPIFlash extends HasTopLevelNetworks { val spiFlashParams = p(PeripherySPIFlashKey) - val qspi = LazyModule(new TLSPIFlash(peripheryBusBytes, spiFlashParams)) - qspi.rnode := TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node) - qspi.fnode := TLFragmenter(1, cacheBlockBytes)(TLWidthWidget(peripheryBusBytes)(peripheryBus.node)) - intBus.intnode := qspi.intnode + val qspi = 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)) + intBus.intnode := qspi.intnode + qspi + } } trait HasPeripherySPIFlashBundle extends HasTopLevelNetworksBundle { val outer: HasPeripherySPIFlash - val qspi = new SPIPortIO(outer.spiFlashParams) + val qspi = HeterogeneousBag(outer.spiFlashParams.map(new SPIPortIO(_))) } trait HasPeripherySPIFlashModule extends HasTopLevelNetworksModule { val outer: HasPeripherySPIFlash val io: HasPeripherySPIFlashBundle - io.qspi <> outer.qspi.module.io.port + + (io.qspi zip outer.qspi) foreach { case (io, device) => + io <> device.module.io.port + } } +