DTS: collect common DTS nodes and move timebase-frequency to cores
Putting the common DTS nodes into a shared object makes them get emitted only one time. Plus it's better style. timebase-frequency should really have been in the cpu nodes in the first place according to the spec anyway. I was foolishly trying to save bytes. However, now we really want it there in case it differs.
This commit is contained in:
		| @@ -285,3 +285,40 @@ object ResourceBinding | ||||
|     scope.get.resourceBindingFns = { () => block } +: scope.get.resourceBindingFns | ||||
|   } | ||||
| } | ||||
|  | ||||
| object ResourceAnchors | ||||
| { | ||||
|   val root = new Device { | ||||
|     def describe(resources: ResourceBindings): Description = { | ||||
|       val width = resources("width").map(_.value) | ||||
|       val model = resources("model").map(_.value) | ||||
|       val compat = resources("compat").map(_.value) | ||||
|       Description("/", Map( | ||||
|         "#address-cells" -> width, | ||||
|         "#size-cells"    -> width, | ||||
|         "model"          -> model, | ||||
|         "compatible"     -> compat)) | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   val soc = new Device { | ||||
|     def describe(resources: ResourceBindings): Description = { | ||||
|       val width = resources("width").map(_.value) | ||||
|       val compat = resources("compat").map(_.value) :+ ResourceString("simple-bus") | ||||
|       Description("soc", Map( | ||||
|         "#address-cells" -> width, | ||||
|         "#size-cells"    -> width, | ||||
|         "compatible"     -> compat, | ||||
|         "ranges"         -> Nil)) | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   val cpus = new Device { | ||||
|     def describe(resources: ResourceBindings): Description = { | ||||
|       val width = resources("width").map(_.value) | ||||
|       Description("cpus", Map( | ||||
|         "#address-cells" -> width, | ||||
|         "#size-cells"    -> Seq(ResourceInt(0)))) | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user