i2c device initialization on MVME3100 RTEMS5 (presumably also in 6?)
Heinz Junkes
junkes at fhi-berlin.mpg.de
Wed Aug 3 11:52:08 UTC 2022
We had a problem initialising the i2c devices on the MVME3100.
Unfortunately, I still don't understand the order of initialisation.
However, the direct driver initialisation from bspstart no longer worked as it did with older versions.
My workaround therefore looks like this:
rtems at rtems-dev:~/MVME3100/kernel$ git diff bsps/powerpc/mvme3100/start/bspstart.c
diff --git a/bsps/powerpc/mvme3100/start/bspstart.c b/bsps/powerpc/mvme3100/start/bspstart.c
index 0ec215e33b..96d6e2f9cd 100644
--- a/bsps/powerpc/mvme3100/start/bspstart.c
+++ b/bsps/powerpc/mvme3100/start/bspstart.c
@@ -52,6 +52,8 @@
extern unsigned long __rtems_end[];
extern unsigned ppc_exc_lock_std, ppc_exc_gpr3_std;
+extern bool _IO_All_drivers_initialized;
+
/*
* Copy Additional boot param passed by boot loader
*/
@@ -419,7 +421,14 @@ void bsp_start( void )
static void mvme3100_i2c_initialize(void)
{
+ printk("-------- call BSP_i2c_initialize() with _IO_All_drivers_initialized = true\n");
+ /*
+ * we need the drivers registered as they appear, due to get
+ * the i2c devices ready
+ */
+ _IO_All_drivers_initialized = true;
BSP_i2c_initialize();
+ _IO_All_drivers_initialized = false;
}
RTEMS_SYSINIT_ITEM(
You can find this in cpukit/sapi/src/ioregisterdriver.c:
if ( _IO_All_drivers_initialized ) {
/* Other drivers have already been initialized, we initialize
* the driver directly.
*/
return rtems_io_initialize( major, 0, NULL );
} else {
/* The driver will be initialized together with all other drivers
* in a later stage by _IO_Initialize_all_drivers().
*/
return RTEMS_SUCCESSFUL;
}
I can imagine that this is not an elegant way, but it's the best I could do. Is there any idea how to do it "right"?
Or should I submit this patch?
Viele Grüße
Heinz Junkes
--
Experience directly varies with equipment ruined.
More information about the devel
mailing list