Date: Tue, 3 Feb 2015 17:22:41 -0700 From: Warner Losh <imp@bsdimp.com> To: Nathan Whitehorn <nwhitehorn@freebsd.org> Cc: Luiz Otavio O Souza <loos@freebsd.org>, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ian Lepore <ian@freebsd.org> Subject: Re: svn commit: r278108 - head/sys/dev/gpio Message-ID: <40055CE4-282E-4D9C-AD06-06331EAE5F5F@bsdimp.com> In-Reply-To: <54CFDBAF.2010003@freebsd.org> References: <201502021922.t12JMZDE040713@svn.freebsd.org> <54CFCEF5.70200@freebsd.org> <1422907737.15718.291.camel@freebsd.org> <54CFDBAF.2010003@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Feb 2, 2015, at 1:18 PM, Nathan Whitehorn <nwhitehorn@freebsd.org> = wrote: >=20 > On 02/02/15 12:08, Ian Lepore wrote: >> On Mon, 2015-02-02 at 11:24 -0800, Nathan Whitehorn wrote: >>> Please don't condition things like this on FDT. They are useful on = Open >>> Firmware systems too. >>> -Nathan >>>=20 >>=20 >> Is there something defined for OFW? The gpio code needs to work on >> hint-based (not-FDT and not-OFW) mips systems too. >=20 > There isn't right now, so far as I'm aware, but there should be. > -Nathan It=92s a one-liner in sys/conf/options to have DEV_OFWBUS defined whenever ofwbus is in the kernel. Warner >> -- Ian >>=20 >>=20 >>> On 02/02/15 11:22, Luiz Otavio O Souza wrote: >>>> Author: loos >>>> Date: Mon Feb 2 19:22:34 2015 >>>> New Revision: 278108 >>>> URL: https://svnweb.freebsd.org/changeset/base/278108 >>>>=20 >>>> Log: >>>> Register the GPIO controller device reference on xref table for = FDT systems. >>>>=20 >>>> Modified: >>>> head/sys/dev/gpio/gpiobus.c >>>> head/sys/dev/gpio/gpiobusvar.h >>>> head/sys/dev/gpio/ofw_gpiobus.c >>>>=20 >>>> Modified: head/sys/dev/gpio/gpiobus.c >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/dev/gpio/gpiobus.c Mon Feb 2 19:00:18 2015 = (r278107) >>>> +++ head/sys/dev/gpio/gpiobus.c Mon Feb 2 19:22:34 2015 = (r278108) >>>> @@ -143,6 +143,9 @@ gpiobus_attach_bus(device_t dev) >>>> device_delete_child(dev, busdev); >>>> return (NULL); >>>> } >>>> +#ifdef FDT >>>> + ofw_gpiobus_register_provider(dev); >>>> +#endif >>>> bus_generic_attach(dev); >>>>=20 >>>> return (busdev); >>>> @@ -152,6 +155,10 @@ int >>>> gpiobus_detach_bus(device_t dev) >>>> { >>>>=20 >>>> +#ifdef FDT >>>> + ofw_gpiobus_unregister_provider(dev); >>>> +#endif >>>> + >>>> return (bus_generic_detach(dev)); >>>> } >>>>=20 >>>>=20 >>>> Modified: head/sys/dev/gpio/gpiobusvar.h >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/dev/gpio/gpiobusvar.h Mon Feb 2 19:00:18 2015 = (r278107) >>>> +++ head/sys/dev/gpio/gpiobusvar.h Mon Feb 2 19:22:34 2015 = (r278108) >>>> @@ -93,6 +93,8 @@ gpio_map_gpios(device_t bus, phandle_t d >>>> } >>>>=20 >>>> device_t ofw_gpiobus_add_fdt_child(device_t, phandle_t); >>>> +void ofw_gpiobus_register_provider(device_t); >>>> +void ofw_gpiobus_unregister_provider(device_t); >>>> #endif >>>> int gpio_check_flags(uint32_t, uint32_t); >>>> device_t gpiobus_attach_bus(device_t); >>>>=20 >>>> Modified: head/sys/dev/gpio/ofw_gpiobus.c >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- head/sys/dev/gpio/ofw_gpiobus.c Mon Feb 2 19:00:18 2015 = (r278107) >>>> +++ head/sys/dev/gpio/ofw_gpiobus.c Mon Feb 2 19:22:34 2015 = (r278108) >>>> @@ -217,6 +217,24 @@ ofw_gpiobus_parse_gpios(struct gpiobus_s >>>> return (0); >>>> } >>>>=20 >>>> +void >>>> +ofw_gpiobus_register_provider(device_t provider) >>>> +{ >>>> + phandle_t node; >>>> + >>>> + node =3D ofw_bus_get_node(provider); >>>> + OF_device_register_xref(OF_xref_from_node(node), provider); >>>> +} >>>> + >>>> +void >>>> +ofw_gpiobus_unregister_provider(device_t provider) >>>> +{ >>>> + phandle_t node; >>>> + >>>> + node =3D ofw_bus_get_node(provider); >>>> + OF_device_register_xref(OF_xref_from_node(node), NULL); >>>> +} >>>> + >>>> static struct ofw_gpiobus_devinfo * >>>> ofw_gpiobus_setup_devinfo(device_t dev, phandle_t node) >>>> { >>>>=20 >>>=20 >>>=20 >>=20 >>=20 >=20 >=20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40055CE4-282E-4D9C-AD06-06331EAE5F5F>