On Wed, Sep 11, 2019 at 4:38 PM Christian Mauderer < christian.maude...@embedded-brains.de> wrote:
> On 11/09/2019 10:48, Vijay Kumar Banerjee wrote: > > > > Hi, > > > > Since adding I2C in BBB initialization seems like the right solution, > > should we ask > > in devel and user lists in a separate thread, to know if anyone is > > opposed to this change? > > Hello Vijay, > > just send a patch. That will start the discussion if someone objects to it. > > > > > Where should I be looking for to add i2c in BBB initialization? > > Please take a look at the dependencies. If there are any (like clocks or > similar) you have to add it afterwards. > > Take a look at some other BSPs where similar hardware (like I2C, SPI, > some external chips, ...) is initialized. For example the mvme3100 uses > a RTEMS_SYSINIT_ITEM to pick a random sample. But I think most BSPs use > a special init function similar to the one in BBB. > > Hi, I tried a very similar approach and added RTEMS_SYSINIT_ITEM : ``` diff --git a/bsps/arm/beagle/start/bspstart.c b/bsps/arm/beagle/start/bspstart.c index 224f9ecf3b..35839e774b 100644 --- a/bsps/arm/beagle/start/bspstart.c +++ b/bsps/arm/beagle/start/bspstart.c @@ -17,6 +17,8 @@ #include <bsp/irq-generic.h> #include <bsp/fdt.h> #include <bsp/linker-symbols.h> +#include <bsp/i2c.h> +#include <rtems/sysinit.h> #include "bspdebug.h" @@ -41,3 +43,15 @@ uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells) { return intr[0]; } + +static void bbb_i2c_0_initialize(void) +{ + bbb_register_i2c_0(); +} + +RTEMS_SYSINIT_ITEM( + bbb_i2c_0_initialize, + RTEMS_SYSINIT_BSP_PRE_DRIVERS, + RTEMS_SYSINIT_ORDER_MIDDLE +); ``` This is successfully calling the `am335x_i2c_bus_register` but the issue with this approach is that it's returning the following internal error after `am335x_i2c_reset` call. ``` _Terminate (the_source=the_source@entry=INTERNAL_ERROR_CORE, the_error=the_error@entry=30) ``` Any hint on what might be the cause of the error? > Best regards > > Christian >
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel