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