1
0

spi: add dts ranges field for memory mapped spi (#19)

This commit is contained in:
Wesley W. Terpstra 2017-06-14 17:06:55 -07:00 committed by GitHub
parent dacca7e7b1
commit 90d3931f5a
2 changed files with 10 additions and 1 deletions

View File

@ -109,7 +109,15 @@ class SPITopModule[B <: SPITopBundle](c: SPIParamsBase, bundle: => B, outer: TLS
abstract class TLSPIBase(w: Int, c: SPIParamsBase)(implicit p: Parameters) extends LazyModule { abstract class TLSPIBase(w: Int, c: SPIParamsBase)(implicit p: Parameters) extends LazyModule {
require(isPow2(c.rSize)) require(isPow2(c.rSize))
val device = new SimpleDevice("spi", Seq("sifive,spi0")) val device = new SimpleDevice("spi", Seq("sifive,spi0")) {
override def describe(resources: ResourceBindings): Description = {
val Description(name, mapping) = super.describe(resources)
val rangesSeq = resources("ranges").map(_.value)
val ranges = if (rangesSeq.isEmpty) Map() else Map("ranges" -> rangesSeq)
Description(name, mapping ++ ranges)
}
}
val rnode = TLRegisterNode(address = Seq(AddressSet(c.rAddress, c.rSize-1)), device = device, beatBytes = w) val rnode = TLRegisterNode(address = Seq(AddressSet(c.rAddress, c.rSize-1)), device = device, beatBytes = w)
val intnode = IntSourceNode(IntSourcePortSimple(resources = device.int)) val intnode = IntSourceNode(IntSourcePortSimple(resources = device.int))
} }

View File

@ -95,6 +95,7 @@ abstract class TLSPIFlashBase(w: Int, c: SPIFlashParamsBase)(implicit p: Paramet
require(isPow2(c.fSize)) require(isPow2(c.fSize))
val fnode = TLManagerNode(1, TLManagerParameters( val fnode = TLManagerNode(1, TLManagerParameters(
address = Seq(AddressSet(c.fAddress, c.fSize-1)), address = Seq(AddressSet(c.fAddress, c.fSize-1)),
resources = Seq(Resource(device, "ranges")),
regionType = RegionType.UNCACHED, regionType = RegionType.UNCACHED,
executable = true, executable = true,
supportsGet = TransferSizes(1, 1), supportsGet = TransferSizes(1, 1),