<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 12, 2019 at 2:37 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"><br>
<br>
On 12/09/2019 10:28, Vijay Kumar Banerjee wrote:<br>
> <br>
> <br>
> <br>
> On Wed, Sep 11, 2019 at 4:38 PM Christian Mauderer<br>
> <<a href="mailto:christian.mauderer@embedded-brains.de" target="_blank">christian.mauderer@embedded-brains.de</a><br>
> <mailto:<a href="mailto:christian.mauderer@embedded-brains.de" target="_blank">christian.mauderer@embedded-brains.de</a>>> wrote:<br>
> <br>
> 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<br>
> 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>
> Hi,<br>
> <br>
> I tried a very similar approach and added RTEMS_SYSINIT_ITEM<br>
> :<br>
> ```<br>
> diff --git a/bsps/arm/beagle/start/bspstart.c<br>
> b/bsps/arm/beagle/start/bspstart.c<br>
> 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,<br>
> 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>
> +);<br>
> ``` <br>
> This is successfully calling the `am335x_i2c_bus_register` but<br>
> the issue with this approach is that it's returning the following<br>
> internal error after `am335x_i2c_reset` call.<br>
> ```<br>
> _Terminate (the_source=the_source@entry=INTERNAL_ERROR_CORE,<br>
> the_error=the_error@entry=30)<br>
> ```<br>
> <br>
> Any hint on what might be the cause of the error?<br>
<br>
Just a guess: Are you sure that "BSP_PRE_DRIVERS" is the right order?<br>
It's a driver so maybe somewhen during the drivers?<br>
<br></blockquote><div>I tried RTEMS_SYSINIT_DEVICE_DRIVERS, and eve RTEMS_SYSINIT_LAST,</div><div>but it doesn't seem to work. Maybe it needs to be called in a further later stage.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Does bbb_i2c_0_initialize has a type that is compatible with the sysinit<br>
items?<br>
<br></blockquote><div>yes, I checked this. the function is called and it's reaching am335x_i2c_* calls</div><div>but it's getting stuck somewhere between i2c_reset and pinmux. Am I possibly</div><div>missing some other drivers that it depends on? </div><div>Can you please point me to the doc/note where the init sequence is properly </div><div>described. Also, if there's some other bsp that has initialized a driver at init, please</div><div>point me to that for reference. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> <br>
> Best regards<br>
> <br>
> Christian<br>
> <br>
<br>
-- <br>
--------------------------------------------<br>
embedded brains GmbH<br>
Herr Christian Mauderer<br>
Dornierstr. 4<br>
D-82178 Puchheim<br>
Germany<br>
email: <a href="mailto:christian.mauderer@embedded-brains.de" target="_blank">christian.mauderer@embedded-brains.de</a><br>
Phone: +49-89-18 94 741 - 18<br>
Fax: +49-89-18 94 741 - 08<br>
PGP: Public key available on request.<br>
<br>
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>
</blockquote></div></div>