On Sat, Jul 27, 2019 at 7:35 PM Christian Mauderer <l...@c-mauderer.de> wrote:
> Does this initialize only the pins for drivers that are registered in > libbsd or all pins? I think you had an extended boot log where you might > could see it. > > If it is all pins, this might interfere with RTEMS drivers that are not > libbsd based. In that case we need some kind of solution (not sure yet > which one). > > It's muxing more pins than just the HDMI, including i2c pins. Please have a look at the log that I got from RTEMS: https://paste.ofcode.org/kVvrdYAfvC3G6kBtG5iaTb These pins to be initialized are being decided from the device tree nodes with the pinctrl-single,pins property. If the initialized pins are not all required, then I would like to propose a solution of using an overlay to rename the property to "rtems-pinctrl-single,pins" or something like this for the pins that we need to be initialized, like hdmi. And in the ti_pinmux.c modify the code to search for this property instead of the default. I haven't attempted doing it but before I attempt I would like to make sure if you think it's OK and not too hackish approach. > Beneath that: I added some comments in the code below. > > On 26/07/2019 13:22, Vijay Kumar Banerjee wrote: > > --- > > Makefile.todo | 13 ++++++ > > buildset/default.ini | 1 + > > libbsd.py | 33 +++++++++++++++ > > rtemsbsd/include/bsp/nexus-devices.h | 1 + > > .../machine/rtems-bsd-kernel-namespace.h | 9 +++++ > > .../include/rtems/bsd/local/fdt_pinctrl_if.h | 40 +++++++++++++++++++ > > rtemsbsd/local/fdt_pinctrl_if.c | 27 +++++++++++++ > > 7 files changed, 124 insertions(+) > > create mode 100644 rtemsbsd/local/fdt_pinctrl_if.c > > > > diff --git a/Makefile.todo b/Makefile.todo > > index ed1e428e..1bf61432 100644 > > --- a/Makefile.todo > > +++ b/Makefile.todo > > @@ -53,6 +53,8 @@ GENERATED += $(LOCAL_INC)/hdmi_if.h > > GENERATED += $(LOCAL_SRC)/hdmi_if.c > > GENERATED += $(LOCAL_INC)/fb_if.h > > GENERATED += $(LOCAL_SRC)/fb_if.c > > +GENERATED += $(LOCAL_INC)/fdt_pinctrl_if.h > > +GENERATED += $(LOCAL_SRC)/fdt_pinctrl_if.c > > GENERATED += rtemsbsd/include/machine/rtems-bsd-regdomain.h > > GENERATED += rtemsbsd/rtems/rtems-bsd-regdomain.c > > > > @@ -279,6 +281,17 @@ $(LOCAL_SRC)/fb_if.c: > $(FREEBSD_SRC)/sys/dev/fb/fb_if.m > > -e 's|#include "fb_if.h"|#include <rtems/bsd/local/fb_if.h>|' > > mv fb_if.c $@ > > > > +$(LOCAL_INC)/fdt_pinctrl_if.h: > $(FREEBSD_SRC)/sys/dev/fdt/fdt_pinctrl_if.m > > + awk -f $(TOOLS)/makeobjops.awk $< -h > > + mv fdt_pinctrl_if.h $@ > > + > > +$(LOCAL_SRC)/fdt_pinctrl_if.c: > $(FREEBSD_SRC)/sys/dev/fdt/fdt_pinctrl_if.m > > + awk -f $(TOOLS)/makeobjops.awk $< -c > > + sed -i fdt_pinctrl_if.c \ > > + -e '1 i\#include <machine/rtems-bsd-kernel-space.h>\n' \ > > + -e 's|#include "fdt_pinctrl_if.h"|#include > <rtems/bsd/local/fdt_pinctrl_if.h>|' > > + mv fdt_pinctrl_if.c $@ > > + > > $(LOCAL_SRC)/gpio_if.c: $(FREEBSD_SRC)/sys/dev/gpio/gpio_if.m > > awk -f $(TOOLS)/makeobjops.awk $< -c > > mv gpio_if.c $@ > > diff --git a/buildset/default.ini b/buildset/default.ini > > index 1d052a48..eed5cb75 100644 > > --- a/buildset/default.ini > > +++ b/buildset/default.ini > > @@ -38,6 +38,7 @@ dev_usb_wlan = off > > dev_wlan_rtwn = off > > iic = on > > display = on > > +ti_pinmux = on > > dhcpcd = on > > dpaa = on > > evdev = on > > diff --git a/libbsd.py b/libbsd.py > > index 775eeeac..cdd97010 100644 > > --- a/libbsd.py > > +++ b/libbsd.py > > @@ -840,6 +840,38 @@ class display(builder.Module): > > mm.generator['source']() > > ) > > > > +# > > +# TI PINMUX > > +# > > +class ti_pinmux(builder.Module): > > + > > + def __init__(self, manager): > > + super(ti_pinmux, self).__init__(manager, type(self).__name__) > > + > > + def generate(self): > > + mm = self.manager > > + self.addKernelSpaceHeaderFiles( > > + [ > > + 'sys/arm/ti/ti_pinmux.h', > > + 'sys/arm/ti/omap4/omap4_scm_padconf.h', > > + 'sys/arm/ti/am335x/am335x_scm_padconf.h', > > + ] > > + ) > > + self.addKernelSpaceSourceFiles( > > + [ > > + 'sys/arm/ti/ti_pinmux.c', > > + 'sys/dev/fdt/fdt_pinctrl.c', > > That looks like a general file. So either this module isn't ti_pinmux > but pinmux or the pinctrl should be somewhere else. > > > + 'sys/arm/ti/am335x/am335x_scm_padconf.c', > > + ], > > + mm.generator['source']() > > + ) > > + self.addRTEMSSourceFiles( > > + [ > > + 'local/fdt_pinctrl_if.c', > > Same for that. > > > + ], > > + mm.generator['source']() > > + ) > > + > > # > > # USB > > # > > @@ -5198,6 +5230,7 @@ def load(mm): > > mm.addModule(evdev(mm)) > > mm.addModule(iic(mm)) > > mm.addModule(display(mm)) > > + mm.addModule(ti_pinmux(mm)) > > > > mm.addModule(dev_usb(mm)) > > mm.addModule(dev_usb_controller(mm)) > > diff --git a/rtemsbsd/include/bsp/nexus-devices.h > b/rtemsbsd/include/bsp/nexus-devices.h > > index 313c40d4..a22102c8 100644 > > --- a/rtemsbsd/include/bsp/nexus-devices.h > > +++ b/rtemsbsd/include/bsp/nexus-devices.h > > @@ -54,6 +54,7 @@ RTEMS_BSD_DRIVER_SMC0(0x4e000000, > RVPBXA9_IRQ_ETHERNET); > > RTEMS_BSD_DEFINE_NEXUS_DEVICE(ofwbus, 0, 0, NULL); > > SYSINIT_DRIVER_REFERENCE(simplebus, ofwbus); > > SYSINIT_DRIVER_REFERENCE(ti_scm, simplebus); > > +SYSINIT_DRIVER_REFERENCE(ti_pinmux, simplebus); > > SYSINIT_DRIVER_REFERENCE(am335x_prcm, simplebus); > > SYSINIT_DRIVER_REFERENCE(usbss, simplebus); > > SYSINIT_DRIVER_REFERENCE(musbotg, usbss); > > diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h > b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h > > index d796d3d1..96ca6a7c 100644 > > --- a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h > > +++ b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h > > @@ -1294,6 +1294,10 @@ > > #define fdt_immr_va _bsd_fdt_immr_va > > #define fdt_is_compatible_strict _bsd_fdt_is_compatible_strict > > #define fdt_parent_addr_cells _bsd_fdt_parent_addr_cells > > +#define fdt_pinctrl_configure _bsd_fdt_pinctrl_configure > > +#define fdt_pinctrl_configure_by_name > _bsd_fdt_pinctrl_configure_by_name > > +#define fdt_pinctrl_configure_tree _bsd_fdt_pinctrl_configure_tree > > +#define fdt_pinctrl_register _bsd_fdt_pinctrl_register > > #define fdt_regsize _bsd_fdt_regsize > > #define fib4_free_nh_ext _bsd_fib4_free_nh_ext > > #define fib4_lookup_nh_basic _bsd_fib4_lookup_nh_basic > > @@ -5038,6 +5042,7 @@ > > #define t_functions _bsd_t_functions > > #define t_functions_inited _bsd_t_functions_inited > > #define ti_am335x_clk_devmap _bsd_ti_am335x_clk_devmap > > +#define ti_am335x_pinmux_dev _bsd_ti_am335x_pinmux_dev > > #define tick _bsd_tick > > #define ticket_altqs_active _bsd_ticket_altqs_active > > #define ticket_altqs_inactive _bsd_ticket_altqs_inactive > > @@ -5052,6 +5057,10 @@ > > #define _timeout_task_init _bsd__timeout_task_init > > #define timevaladd _bsd_timevaladd > > #define timevalsub _bsd_timevalsub > > +#define ti_pinmux_padconf_get _bsd_ti_pinmux_padconf_get > > +#define ti_pinmux_padconf_get_gpiomode > _bsd_ti_pinmux_padconf_get_gpiomode > > +#define ti_pinmux_padconf_set _bsd_ti_pinmux_padconf_set > > +#define ti_pinmux_padconf_set_gpiomode > _bsd_ti_pinmux_padconf_set_gpiomode > > #define ti_prcm_clk_disable _bsd_ti_prcm_clk_disable > > #define ti_prcm_clk_enable _bsd_ti_prcm_clk_enable > > #define ti_prcm_clk_get_source_freq > _bsd_ti_prcm_clk_get_source_freq > > diff --git a/rtemsbsd/include/rtems/bsd/local/fdt_pinctrl_if.h > b/rtemsbsd/include/rtems/bsd/local/fdt_pinctrl_if.h > > index e69de29b..6343de41 100644 > > --- a/rtemsbsd/include/rtems/bsd/local/fdt_pinctrl_if.h > > +++ b/rtemsbsd/include/rtems/bsd/local/fdt_pinctrl_if.h > > @@ -0,0 +1,40 @@ > > +/* > > + * This file is produced automatically. > > + * Do not modify anything in here by hand. > > + * > > + * Created from source file > > + * freebsd-org/sys/dev/fdt/fdt_pinctrl_if.m > > + * with > > + * makeobjops.awk > > + * > > + * See the source file for legal information > > + */ > > + > > + > > +#ifndef _fdt_pinctrl_if_h_ > > +#define _fdt_pinctrl_if_h_ > > + > > + > > +#include <sys/tslog.h> > > + > > +/** @brief Unique descriptor for the FDT_PINCTRL_CONFIGURE() method */ > > +extern struct kobjop_desc fdt_pinctrl_configure_desc; > > +/** @brief A function implementing the FDT_PINCTRL_CONFIGURE() method */ > > +typedef int fdt_pinctrl_configure_t(device_t pinctrl, phandle_t > cfgxref); > > + > > +static __inline int FDT_PINCTRL_CONFIGURE(device_t pinctrl, phandle_t > cfgxref) > > +{ > > + kobjop_t _m; > > + int rc; > > + > > +TSENTER2(device_get_name(pinctrl)); > > + > > + KOBJOPLOOKUP(((kobj_t)pinctrl)->ops,fdt_pinctrl_configure); > > + rc = ((fdt_pinctrl_configure_t *) _m)(pinctrl, cfgxref); > > + > > +TSEXIT2(device_get_name(pinctrl)); > > + > > + return (rc); > > +} > > + > > +#endif /* _fdt_pinctrl_if_h_ */ > > diff --git a/rtemsbsd/local/fdt_pinctrl_if.c > b/rtemsbsd/local/fdt_pinctrl_if.c > > new file mode 100644 > > index 00000000..9609add0 > > --- /dev/null > > +++ b/rtemsbsd/local/fdt_pinctrl_if.c > > @@ -0,0 +1,27 @@ > > +#include <machine/rtems-bsd-kernel-space.h> > > + > > +/* > > + * This file is produced automatically. > > + * Do not modify anything in here by hand. > > + * > > + * Created from source file > > + * freebsd-org/sys/dev/fdt/fdt_pinctrl_if.m > > + * with > > + * makeobjops.awk > > + * > > + * See the source file for legal information > > + */ > > + > > +#include <sys/param.h> > > +#include <sys/queue.h> > > +#include <sys/kernel.h> > > +#include <sys/kobj.h> > > +#include <sys/types.h> > > +#include <sys/bus.h> > > +#include <dev/ofw/openfirm.h> > > +#include <rtems/bsd/local/fdt_pinctrl_if.h> > > + > > +struct kobjop_desc fdt_pinctrl_configure_desc = { > > + 0, { &fdt_pinctrl_configure_desc, (kobjop_t)kobj_error_method } > > +}; > > + > > >
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel