Date: Thu, 29 Sep 2016 23:38:13 -0500 From: Justin Hibbits <jhibbits@freebsd.org> To: Nathan Whitehorn <nwhitehorn@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r306473 - head/sys/dev/fdt Message-ID: <CAHSQbTDgR%2BOVdTGPC28yYFwDtPfOcACqct%2BnU8AdPiU_GcwU-A@mail.gmail.com> In-Reply-To: <f5044e38-278f-46d2-40ea-3c0eb624281e@freebsd.org> References: <201609300248.u8U2meEe014568@repo.freebsd.org> <889ba670-a36a-8b80-d9f9-8d8d23cce423@freebsd.org> <CAHSQbTC677Z8dhS8ty_Vcpr9TBtHiMTKFs_1p_ak1FAt10GSQw@mail.gmail.com> <f5044e38-278f-46d2-40ea-3c0eb624281e@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
If I remember correctly, newbus will throw an error if you try to create two devices with the same number. Applying the logic of using the cell-index property for all device nodes, if two sub buses from simplebus have the same set of child nodes, with the same cell-index property values, one set of children would error and not attach. Of course this change is only for simplebus, so shouldn't have too big an impact. - Justin On Sep 29, 2016 23:23, "Nathan Whitehorn" <nwhitehorn@freebsd.org> wrote: > Eh, I don't care much, especially if it's for cosmetic reasons only. I'm > not sure I understand your suggested complication, but will leave the > choice to you in any case. > -Nathan > > On 09/29/16 21:16, Justin Hibbits wrote: > >> >> It's more cosmetic than anything else. I did realize a potential >> complication with it tonight, too, if newbus devices are created as >> children (like DMA channels in this case), and have the cell-index >> property. If you object it's an easy revert. >> >> - Justin >> >> >> On Sep 29, 2016 23:10, "Nathan Whitehorn" <nwhitehorn@freebsd.org >> <mailto:nwhitehorn@freebsd.org>> wrote: >> >> I'm a little dubious about this change. It's not really safe to >> rely on newbus unit numbers anywhere, so making them meaningful in >> this context seems like a bad idea. >> -Nathan >> >> On 09/29/16 19:48, Justin Hibbits wrote: >> >> Author: jhibbits >> Date: Fri Sep 30 02:48:40 2016 >> New Revision: 306473 >> URL: https://svnweb.freebsd.org/changeset/base/306473 >> <https://svnweb.freebsd.org/changeset/base/306473> >> >> Log: >> Use the cell-index property as the unit number if available. >> Summary: >> NXP/Freescale, among others, includes an optional >> cell-index property >> on nodes to denote the SoC block number of the node. This >> can be useful if, for >> example, a node is disabled or nonexistent in the fdt, or >> the blocks are not >> organized in address-sorted order. For instance, on the >> P1022, DMA2 is located >> at CCSR offset 0xC000, while DMA1 is located at 0x21000. >> Reviewed By: jmcneill >> Differential Revision: https://reviews.freebsd.org/D8054 >> <https://reviews.freebsd.org/D8054> >> >> Modified: >> head/sys/dev/fdt/simplebus.c >> >> Modified: head/sys/dev/fdt/simplebus.c >> ============================================================ >> ================== >> --- head/sys/dev/fdt/simplebus.c Fri Sep 30 01:42:29 >> 2016 (r306472) >> +++ head/sys/dev/fdt/simplebus.c Fri Sep 30 02:48:40 >> 2016 (r306473) >> @@ -265,6 +265,15 @@ simplebus_add_device(device_t dev, phand >> if ((ndi = simplebus_setup_dinfo(dev, node, di)) == NULL) >> return (NULL); >> + >> + /* >> + * If the order is unspecified, use the cell-index >> field, if available. >> + * The cell-index property is not part of any >> standard, but is widely >> + * used in NXP/Freescale and Marvell device trees. >> + */ >> + if (order == -1) >> + OF_getencprop(node, "cell-index", &order, >> sizeof(order)); >> + >> cdev = device_add_child_ordered(dev, order, name, unit); >> if (cdev == NULL) { >> device_printf(dev, "<%s>: device_add_child >> failed\n", >> >> >> >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHSQbTDgR%2BOVdTGPC28yYFwDtPfOcACqct%2BnU8AdPiU_GcwU-A>