On Sun, Jul 10, 2016 at 09:12:03PM +0200, Mark Kettenis wrote: > Currently the armv7 port has several bits ehci(4) glue code. > Basically there is one of these for every SoC platform that we > support. I converted the glue for the i.MX6 platform to use the FDT > and that works fine. However, this prevents us from converting the > other bits of glue, since it isn't possible to have multiple bits of > glue for: > > ehic? at fdt? > > We have a couple of solutions here: > > 1. Introduce a single armv7 ehci(4) glue driver that calls the > appropriate SoC-specifuc implementation based on the compatible > string. With this approach we continue to have: > > ehci0 at simplebus1 > > lines in dmesg. > > 2. Introduce SoC-specific busses such that we can have bus-specific > glue code for each SoC platform we want to support. This would > mean that on i.MX6 we would get something like: > > ehci0 at aipsbus1 > > lines in dmesg. The SoC-specific bus drivers would be essentially > clones of simplebus(4), with stricter match code that returns a > higher value. Tis is not entirely straigtforward, and if we need > to attach ehci(4) to mainbus(4) on more than one SoC the approach > fails. > > 3. Use SoC-specific driver names. We'd get something like: > > imxehci0 at simplebus1 > > on i.NX6 and > > omehci0 at simplebus0 > > on OMAP. We'd need to think about how we document these new > drivers. > > I'm currently leaning towards option #3. It can be argues that the > SoC-specific glue code is complicated enough to warrant its own driver > anyway. The changes are fairly easy to make and the code stays nicely > separated. See diff below. > > Or is there another option that I'm missing?
#3 sounds good to me as well. The same problem occurs for ahci as imx and sunxi both have it. > > > Index: arch/armv7/conf/GENERIC > =================================================================== > RCS file: /cvs/src/sys/arch/armv7/conf/GENERIC,v > retrieving revision 1.28 > diff -u -p -r1.28 GENERIC > --- arch/armv7/conf/GENERIC 9 Jul 2016 12:32:50 -0000 1.28 > +++ arch/armv7/conf/GENERIC 10 Jul 2016 19:09:31 -0000 > @@ -52,8 +52,8 @@ iic* at imxiic? > imxesdhc* at fdt? # SDHC controller > sdmmc* at imxesdhc? # SD/MMC bus > ahci* at fdt? # AHCI/SATA > -ehci* at fdt? # EHCI (shim) > -usb* at ehci? > +imxehci* at fdt? # EHCI > +usb* at imxehci? > > # OMAP3xxx/OMAP4xxx SoC > omap0 at mainbus? > Index: arch/armv7/imx/files.imx > =================================================================== > RCS file: /cvs/src/sys/arch/armv7/imx/files.imx,v > retrieving revision 1.12 > diff -u -p -r1.12 files.imx > --- arch/armv7/imx/files.imx 9 Jul 2016 12:32:50 -0000 1.12 > +++ arch/armv7/imx/files.imx 10 Jul 2016 19:09:31 -0000 > @@ -40,7 +40,8 @@ device fec: ether, ifnet, mii, ifmedia > attach fec at fdt > file arch/armv7/imx/if_fec.c fec > > -attach ehci at fdt with imxehci > +device imxehci: usbus > +attach imxehci at fdt > file arch/armv7/imx/imxehci.c imxehci > > device imxesdhc: sdmmcbus > Index: arch/armv7/imx/imxehci.c > =================================================================== > RCS file: /cvs/src/sys/arch/armv7/imx/imxehci.c,v > retrieving revision 1.11 > diff -u -p -r1.11 imxehci.c > --- arch/armv7/imx/imxehci.c 10 Jul 2016 11:46:28 -0000 1.11 > +++ arch/armv7/imx/imxehci.c 10 Jul 2016 19:09:31 -0000 > @@ -94,6 +94,10 @@ struct cfattach imxehci_ca = { > imxehci_detach > }; > > +struct cfdriver imxehci_cd = { > + NULL, "imxehci", DV_DULL > +}; > + > int > imxehci_match(struct device *parent, void *match, void *aux) > { >