Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jul 2012 23:04:19 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Arnaud Lacombe <lacombar@gmail.com>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: Interfacing devices with multiple parents within newbus
Message-ID:  <FEAC4049-11B0-4B3D-BB7A-0946DBBFF530@bsdimp.com>
In-Reply-To: <CACqU3MU6iv%2Bo26fCdL5M6Kg6XMM1uZPih5FBiBKPOD9WDx%2BNGg@mail.gmail.com>
References:  <CACqU3MU6iv%2Bo26fCdL5M6Kg6XMM1uZPih5FBiBKPOD9WDx%2BNGg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Jul 5, 2012, at 5:14 PM, Arnaud Lacombe wrote:

> Hi folks,
>=20
> The problem has been raised in the last BSDCan during a talk, but no
> clear answer has been given. Some (pseudo-)devices might require
> resources from multiple other (pseudo-)devices.
>=20
> For example, a device is sitting on an SMBus, but need to access a
> software controlled LED, sitting on a GPIO bus, itself sitting on an
> LPC bus... Or a variant where everything is controlled on the same
> chip, but different GPIO banks. For that specific example, all the
> GPIO pin could be implement on the same GPIObus, however, gpiobus(4)
> is limited to 32 pins and the chip provides 5 banks of 8 pins, ie. a
> total of 40 pins[0]. In the same idea, a device sitting on GPIOs
> controlled by two independant chips, say one being an ICH10R chipset
> on a PCI device function, and the other being a
> SuperIO on an LPC bus.
>=20
> This situation make me really dubious that FreeBSD will be able to
> support configuration such as:
>=20
> esdhc@50004000 { /* ESDHC1 */
>        cd-gpios =3D <&gpio2 13 0>; /* GPIO3_13 */
>        wp-gpios =3D <&gpio3 11 0>; /* GPIO4_11 */
>        status =3D "okay";
> };
>=20
> or:
>=20
> ecspi@50010000 { /* ECSPI1 */
>        fsl,spi-num-chipselects =3D <2>;
>        cs-gpios =3D <&gpio1 30 0>, /* GPIO2_30 */
>                   <&gpio2 19 0>; /* GPIO3_19 */
>        status =3D "okay";
> [...]
>=20
> This example is taken from Linux' `arch/arm/boot/dts/imx53-smd.dts'.
> Here, SDHC or SPI controller are using different GPIO devices. Note
> that these GPIO pins does not seem to be multi-function pins as
> another .dts defines ESDHC1 as:
>=20
> esdhc@50004000 { /* ESDHC1 */
>        cd-gpios =3D <&gpio2 13 0>; /* GPIO3_13 */
>        wp-gpios =3D <&gpio2 14 0>; /* GPIO3_14 */
>        status =3D "okay";
> };
>=20
> AFAIK, newbus is unable to model any of the above situation without
> being bypassed one way or another.
>=20
> any hints ?

That's not correct.  You don't need a parent-child relationship in =
newbus to interact with another node in the tree.  You can look up the =
other node by name, and then call functions based on finding that other =
device.

Warner




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FEAC4049-11B0-4B3D-BB7A-0946DBBFF530>