Hi @Norihiro ,
(1) There is iMX8Pkg and iMXPlatformPkg in mu_platform_nxp\Silicon\ARM\NXP directory.
Why these packages are seperated?
The first package contains code specific for i.MX8 family, the second one contains code useful for most i.MX processors. At least that is my understanding.
(2) There is driver and library directory also.
Why these directories are seperated?
Library usually contains code for general use, which can be used by multiple drivers. Driver contains code for the specific drivers.
(3) As for register access from i.MX8M via I2C,
Using iMXI2cWrite and iMXI2cRead is right way to have access to registers in this RTC?
I do not have extensive knowledge regarding the use of I2C with external RTC. Yes, the mentioned functions are generally useful for I2C communication, however, you need to keep in mind that specific RTC chips use special messages to give specific commands to the RTC. Best way is to consult the manual for the RTC and carefully setup the I2C message content according to the RTC commands. I.e. you might want to modify the existing functions. And of course, going back to my original point - replicate these into the ACPI Time and Alarm Device functions as well.
(4) We want to make sure if procedure in our ASL is correct or not.
Is it possible to review our ASL if we upload it to this thread?
You can verify the procedure in C/UEFI and then replicate the functionality in ASL/ACPI. The algorithm should be the same, just written in different programming language. The I2C communication protocol for RX8010 can be found in the RX8010 Application Manual (found on web, in my case section 15.6). In case you use the iMXI2cWrite/Read functions and modify them (i.e. the data inside as RTC messages) to your purpose, please make sure they follow that manual. The iMXI2cLib.c contains more granular sub-functions (like e.g. iMXI2cGenerateStop) so you can build the algorithm "stone by stone". Putting the code from C to ASL to replicate the functionality from UEFI to ACPI should be very tedious but straightforward once the UEFI part works.
Let me know if this was of any help!
Best regards,
Hector.