On Thu, Apr 07, 2016 at 06:31:22PM +0200, Patrick Wildt wrote: > On Thu, Apr 07, 2016 at 06:00:25PM +0200, Mark Kettenis wrote: > > > Date: Thu, 7 Apr 2016 16:54:19 +0200 > > > From: Patrick Wildt <[email protected]> > > > > > > Hi, > > > > > > after a bit of talking with jsg@ we have found a way forward on how to > > > integrate FDT into ARM. > > > > > > An aspect of this is having an MI FDT bus residing in sys/dev/ofw/, > > > where the fdt subroutines currently already are. Then we'll convert > > > the vexpress platform to use FDT and continue with Exynos later on. > > > > > > As a first step I would rename fdt.c to fdt_subr.c. The actual fdt bus > > > will then be committed to fdt.c. Also, create sys/dev/ofw/files.fdt to > > > later on declare the new fdt bus in there. > > > > > > As we'll soon declare fdt at mainbus, I think we should also move the > > > include of files.fdt to be after mainbus on socppc. Even if it won't > > > be used on socppc. > > > > > > ok? > > > > I have no objections to rename fdt.c fdt_subr.c. However, I do object > > against having an "fdt" bus, at least for socppc. The fdt code should > > I don't propose an fdt bus for socppc. > > > just be the enumeration mechanism for "mainbus". And I think armv7 > > should be the same. > > That sounds more like implementing the fdtbus functionality, but just > call it mainbus. > > The current situation is that we have a mainbus0 on arm that attaches > anything that wants to be attached. It's not really the mainbus you > expect it to be. What is does is attach cpu0 at mainbus0 and depending > on the SoC an obio0 at mainbus0, pxaip0 at mainbus0, or imx0 at > mainbus0, exynos0 at mainbus0 and so on. These are the actual busses > that create their own bus space and bus dma tag and pass it to the > controller driver instance. mainbus0 does (not yet) do anything in that > regard. This also means all drivers are ... imxuart0 at imx0, not at > mainbus0. > > Looks like: > > mainbus0 at root > cpu0 at mainbus0 > cortex0 at mainbus0 > ampintc0 at mainbus0 > imx0 at mainbus0 > imxuart0 at imx0 > imxiic0 at imx0 > ehci0 at imx0 > > Goal was: > > mainbus0 at root > cpu0 at mainbus0 > ampintc0 at fdt0 > imxuart0 at fdt0 > > So the idea was to replace imx0, exynos0, vexpress0, etc. on ARMv7 with > an fdt0 that does all that what e. g. imx0 used to do, just with FDT > only. > > Attaching controllers from FDT is not just going through the tree and > attaching all nodes that are there. You have to take care of interrupt- > controller hierarchy and clocks. Those need to be attached first. This > adds a bit of complexity and should probably not be duplicated for a new > arch (arm64 for instance). Which is why we thought it would be nice to > have that in sys/dev/ofw/. > > I could though completely replace mainbus.c with the fdtbus, call it > mainbus, implement it for armv7 only, and fall back to the old version > for the legacy platforms armish, zaurus and non-fdt armv7. Is that the > way to go?
I think the real problem here is that all the arm ports share sys/arch/arm/mainbus/* if that moved to just being a per port mainbus.c then the fdt enumeration and any special ordering of soc devices could live in the armv7 specific mainbus.c
