-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i.MX IPM #8527
i.MX IPM #8527
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the documentation. Here are some recommended changes.
|
||
Overview | ||
******** | ||
A simple example that can be used with multicore i.MX SoC's containing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a complete sentence, and change SoC's
to plural spelling:
This simple example can be used with multicore i.MX SoCs containing a
Messaging Unit peripheral.
the received data is printed to the console. When sending the data back, | ||
it blocks until the data are read by the remote side. | ||
|
||
The i.MX Messaging Unit peripheral consists of 4 32-bit transmit and receive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It reads better to spell out small numbers, so:
... consists of four 32-bit transmit ...
it blocks until the data are read by the remote side. | ||
|
||
The i.MX Messaging Unit peripheral consists of 4 32-bit transmit and receive | ||
registers. The sample uses the option CONFIG_IPM_IMX_MAX_DATA_SIZE_4, which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can automatically create a link to the config option documentation by writing this as:
... uses the option :option:`CONFIG_IPM_IMX_MAX_DATA_SIZE_4`, which
The i.MX Messaging Unit peripheral consists of 4 32-bit transmit and receive | ||
registers. The sample uses the option CONFIG_IPM_IMX_MAX_DATA_SIZE_4, which | ||
effectively creates 4 IPM channels. Selecting the option | ||
CONFIG_IPM_IMX_MAX_DATA_SIZE_8 or CONFIG_IPM_IMX_MAX_DATA_SIZE_16 would result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here to have the option be a link to its documentation:
:option:`CONFIG_IPM_IMX_MAX_DATA_SIZE_4` or
:option:`CONFIG_IPM_IMX_MAX_DATA_SIZE_16`
in two 64-bit channels or a single 128-bit channel respectively. | ||
|
||
Note that this is just a simple demo to demonstrate the i.MX IPM functionality | ||
and blocking sending of the data back is done in the interrupt which would not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clarify with:
... is done in the interrupt handler, which would not ...
|
||
Note that this is just a simple demo to demonstrate the i.MX IPM functionality | ||
and blocking sending of the data back is done in the interrupt which would not | ||
be appropriate for the real world application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for a real world
|
||
The sample requires that data are being sent by the remote core so it can echo | ||
it back. The other core is usually not running Zephyr but Linux on i.MX | ||
multicore processors, this code is not part of this Zephyr sample. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start a new sentence:
multicore processors. This remote core code is not ...
:goals: build flash | ||
:compact: | ||
|
||
Follow the instructions from board documentation on how to load the Zephyr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to include a reference to the board documentation:
Follow the instructions in the :ref:`udoo_neo_full_m4` board documentation
for how to load the Zephyr binary to the desired core and execute it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed this, thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM
@@ -0,0 +1,8 @@ | |||
sample: | |||
description: TBD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we fill this information in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the name and description, thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
I have a question about where to put the Linux part of the demo (which would run on the Cortex-A core). |
The driver looks good, but can we unify the IPM samples into one sample with multiple build configurations? |
There are three IPM examples:
So there is some opportunity to unify, but it could become more clumsy for the end user and having it unified could limit adding of features which are useful in one scenario only (for example with Linux demo, we need to reply data back in a blocking fashion, so Linux can read what was written to a device - other IPM samples have different functionality). |
@nashif @galak @carlescufi ^^^ |
is this something that could live in the linux kernel itself in linux/samples/ ? |
I am not sure, it is related to the Zephyr sample of i.MX Messaging Unit peripheral. |
The TSC agreed this week that it is ok to include the Linux part of the sample with a BSD-3 license in the Zephyr tree. The non-Apache license in the main part of the tree is acceptable in this case because it is a sample and will never be compiled into a Zephyr application. Will you please add it to the commit "sample: Add IMX IPM sample application"? |
Yes, I am updating the documentation and will add it to the commit, but I have encountered one problem. If I use BSD license, compiling of the kernel module from example fails:
Therefore it seems that the example kernel module needs to have a dual license:
Does it change anything, is it still ok to include in the Zephyr source tree? |
I have added the Linux kernel module code and updated the sample documentation to describe the Linux part. Note that the kernel module file samples/subsys/ipc/ipm_imx/linux/mu.c has dual BSD/GPL license otherwise it cannot build. Let me know if it is ok. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about the zephyr_mu.patch. Is this something that can just get upstream'd to linux or the UDOOboard kernel?
@galak, are you concerned because the patch is changing the GPL-ed files or because it depends on an exact commit in the outside repository? The patch disables the kernel's usage of Messaging Unit and replaces it with the functionality needed by the demo application. Upstreaming to UDOObuntu kernel goes against their usage of Messaging Unit. Maybe the Zephyr example's Linux side should go into a different repository at the end. Or we could fork UDOObuntu kernel into a repository controlled by us (to avoid dependency on a single commit in a third party controlled repository) and commit our changes there. |
Hello, could this be merged as it is or should we move Linux kernel module and Linux kernel changes into a different repository and reference it? Or could we merge at least the first 3 commits, without the Linux example? We have raised a request for UDOO Neo regarding the possibility to include our Linux kernel changes but haven't received any response yet. I have rebased the PR recently to reflect changes in master (domain ID). Thanks. |
Codecov Report
@@ Coverage Diff @@
## master #8527 +/- ##
=======================================
Coverage 48.38% 48.38%
=======================================
Files 265 265
Lines 42193 42193
Branches 10137 10137
=======================================
Hits 20413 20413
Misses 17703 17703
Partials 4077 4077 Continue to review full report at Codecov.
|
How is UDOObuntu using the message unit? Trying to understand how this differs from what they are doing? Do you have a pointer to the UDOObuntu kernel repo? |
@galak, UDOObuntu version of kernel is here: https://github.com/UDOOboard/linux_kernel |
I understand, we should focus on what upstream Linux supports or see what we can get supported there and not worry about the UDOOboard kernel being pretty old. I see code for remoteproc on imx in the upstream kernel, not sure if there is a message unit driver or not in the upstream/mainline kernel. |
This branch is the PR zephyrproject-rtos#8527 which was not upstreamed yet.
The non-Apache-2.0 / Linux code has been removed from this PR. It will go into a new repository https://source.codeaurora.org/external/imxsupport/imx-mu/. Unfortunatelly I cannot push it myself - another person must do. Once the content is there, I will let you know so this can be finally merged. |
@galak The non-Apache-2.0 / Linux code has been moved to https://source.codeaurora.org/external/imxsupport/imx-mu/. I think the pull request could be merged now. |
@galak , Any idea when this is going to be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline comments:
Also (related to inline comments), these build warnings:
udoo_neo_full_m4.dts_compiled: Warning (simple_bus_reg): /soc/mu@4229C000: simple-bus unit address format error, expected "4229c000"
extract_dts_includes.py: WARNING: id field set in 'IMX MESSAGING UNIT', should be removed.
dts/arm/nxp/nxp_imx6sx_m4.dtsi
Outdated
@@ -241,6 +241,18 @@ | |||
#gpio-cells = <2>; | |||
status = "disabled"; | |||
}; | |||
|
|||
mub:mu@4229C000 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this 4229C000 -> 4229c000 (and the reg as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
dts/bindings/arm/nxp,imx-mu.yaml
Outdated
# | ||
--- | ||
title: IMX MESSAGING UNIT | ||
id: nxp,imx-mu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove id:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
tests: | ||
test: | ||
build_only: true | ||
filter: CONFIG_SOC_IMX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be filter: CONFIG_SOC_FAMILY_IMX
If we do that, do we need the platform_whitelist as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - filter changed. The platform_whitelist is still needed, once @diegosueiro merges MU support into his work on i.MX7, platform_whitelist could be perhaps removed then.
@@ -72,27 +72,32 @@ | |||
#define CONFIG_UART_IMX_UART_3_BASE_ADDRESS NXP_IMX_UART_421EC000_BASE_ADDRESS | |||
#define CONFIG_UART_IMX_UART_3_NAME NXP_IMX_UART_421EC000_LABEL | |||
#define CONFIG_UART_IMX_UART_3_IRQ_NUM NXP_IMX_UART_421EC000_IRQ_0 | |||
#define CONFIG_UART_IMX_UART_3_IRQ_PRI NXP_IMX_UART_421EC000_IRQ_0_PRIORITY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix up for CONFIG_ -> DT_ change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Add driver for i.MX Messaging Unit peripheral which can be used for i.MX6SoloX, i.MX7D and other i.MX socs. Origin: Original Signed-off-by: Stanislav Poboril <[email protected]>
Add Messaging Unit B peripheral support for i.MX6SoloX soc so it can use IMX IPM. Origin: Original Signed-off-by: Stanislav Poboril <[email protected]>
Enabled Messaging Unit B in Cortex-M4 core of Udoo Neo Full board so it can use IMX IPM. Origin: Original Signed-off-by: Stanislav Poboril <[email protected]>
Add IMX IPM sample application. It reads the data sent to the Messaging Unit and sends them back. It has been tested on Udoo Neo Full board with the Cortex-A9 core running Linux and sending the data into the Messaging Unit A and the Cortex-M4 running this sample Zephyr application and reading the data from Messaging Unit B and sending it back for Linux side to read it from Messaging Unit A. Origin: Original Signed-off-by: Stanislav Poboril <[email protected]>
This pull request adds IPM support for i.MX via Messaging Unit peripheral. It contains driver shim and enables the Messaging Unit on i.MX 6SoloX SoC and Udoo Neo board. The pull request also adds the sample application, which echoes data back.
I have also written a sample Linux kernel module to be used to send the data from Linux and cooperate with the Zephyr application running on Cortex-M4. But I am not sure whether I should put it to a separate repository on Github and reference it - or I should put its source code into the Zephyr repository tree.