X-Git-Url: https://git.libre-soc.org/?p=sifive-blocks.git;a=blobdiff_plain;f=src%2Fmain%2Fscala%2Fdevices%2Fi2c%2FI2CPeriphery.scala;h=d4ad9fe1ebaf1ab3d2507de2cb649c79ca1ad3df;hp=d9c3ff4085d3aa515f1dcc309dd6eed5d77d8002;hb=4fcf349adb9e66ea7d8cc5394de5d3e0a2340985;hpb=b06b80dccdf4e71b37866cc0e32a800a2b1a62d1 diff --git a/src/main/scala/devices/i2c/I2CPeriphery.scala b/src/main/scala/devices/i2c/I2CPeriphery.scala index d9c3ff4..d4ad9fe 100644 --- a/src/main/scala/devices/i2c/I2CPeriphery.scala +++ b/src/main/scala/devices/i2c/I2CPeriphery.scala @@ -2,38 +2,31 @@ package sifive.blocks.devices.i2c import Chisel._ -import config.Field -import diplomacy.{LazyModule,LazyMultiIOModuleImp} -import rocketchip.{HasSystemNetworks} -import uncore.tilelink2.TLFragmenter +import freechips.rocketchip.config.Field +import freechips.rocketchip.coreplex.{HasPeripheryBus, HasInterruptBus} +import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp} case object PeripheryI2CKey extends Field[Seq[I2CParams]] -trait HasPeripheryI2C extends HasSystemNetworks { +trait HasPeripheryI2C extends HasPeripheryBus { val i2cParams = p(PeripheryI2CKey) val i2c = i2cParams map { params => - val i2c = LazyModule(new TLI2C(peripheryBusBytes, params)) - i2c.node := TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node) - intBus.intnode := i2c.intnode + val i2c = LazyModule(new TLI2C(pbus.beatBytes, params)) + i2c.node := pbus.toVariableWidthSlaves + ibus.fromSync := i2c.intnode i2c } } trait HasPeripheryI2CBundle { - val i2cs: Vec[I2CPort] - - def toGPIOPins(syncStages: Int = 0): Seq[I2CGPIOPort] = i2cs.map { i => - val pin = Module(new I2CGPIOPort(syncStages)) - pin.io.i2c <> i - pin - } + val i2c: Vec[I2CPort] } -trait HasPeripheryI2CModuleImp extends LazyMultiIOModuleImp with HasPeripheryI2CBundle { +trait HasPeripheryI2CModuleImp extends LazyModuleImp with HasPeripheryI2CBundle { val outer: HasPeripheryI2C - val i2cs = IO(Vec(outer.i2cParams.size, new I2CPort)) + val i2c = IO(Vec(outer.i2cParams.size, new I2CPort)) - (i2cs zip outer.i2c).foreach { case (io, device) => + (i2c zip outer.i2c).foreach { case (io, device) => io <> device.module.io.port } }