Skip to content
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

Zephyr opanamp rsc dev 1 #1

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Conversation

alxlastur
Copy link
Owner

No description provided.

Added the imx8mp_evk_mimx8ml8_m7.conf and
imx8mp_evk_mimx8ml8_m7.overlay files in the boards directory.

Signed-off-by: Alexandru Lastur <[email protected]>
Added the imx93_evk_mimx9352_m33.conf and
imx93_evk_mimx9352_m33.overlay files in the boards directory

Signed-off-by: Alexandru Lastur <[email protected]>
drivers: ipm: ipm_imx.c

Handles the status of Mailbox Unit RX register when the target
is SOC_MIMX9352. This change is required as the imx93 mailbox
register map have a different structure.

Signed-off-by: Alexandru Lastur <[email protected]>
Added a structure which will store and pass it to
mailbox_notify()  the channel id of the Linux messaging
unit during the platform_ipm_callback(). This change was
necessary, because until now the zephyr target
(in openamp_rsc sample) would always notify the Linux
target with a channel id of 0, even if Linux would send
a notification on another channel differnt than 0.
For example in imx8mp_evk cortex m7 and
imx93_evk cortex m33 BSP, the .dts is configuring
the messaging unit to use channel 1.

Signed-off-by: Alexandru Lastur <[email protected]>
Added a resource table section named '.resource_table' because
Linux remoteproc driver is parsingthe elf file, and  will look
for that section named '.resource_table'. Added this
configuration in include/zephyr/arch/arm/cortex_m/scripts/linker.ld
as it should  benefits all the Cortex M cofiguration
when using th sample opanamp_rsc.

linker: imx8mp_evk m7 linke.ld: removed CONFIG_OPENAMP_RSC_TABLE

Removed CONFIG_OPENAMP_RSC_TABLE from soc/nxp/imx/imx8m/m7
as it is already configured in the general linker.ld file

Signed-off-by: Alexandru Lastur <[email protected]>
@@ -0,0 +1,9 @@
CONFIG_LOG_PRINTK=n
CONFIG_IPM_IMX_MAX_DATA_SIZE_16=n
Copy link
Collaborator

@dbaluta dbaluta Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since 8mp support doesn't depend on other patches lets send this as a separate Pull request.

Commit message should look like this:

sample: open_amp_rsc_table: Add support for imx8mp_evk M7 core

This enables openamp_rsc_table sample for imx8mp_evk on M7 core

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2013-2014 Wind River Systems, Inc.
* Copyright 2024 NXP
Copy link
Collaborator

@dbaluta dbaluta Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reformat commit message as follows:

linker: Move resource_table to generic cortex M linker file
 
In order to avoid copying the '.resource_table' section each time we add support for a new board
lets have this section in the generic linker file and enable it using CONFIG_OPENAMP_RSC_TABLE.

A commit should specifically state WHY the change is needed. In this case the change is needed because we want to avoid copying the linker section every time we want to add support for a new board.

@@ -0,0 +1,9 @@
CONFIG_LOG_PRINTK=n
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message here should be similiar with the one from 8mp_evk

@@ -1,5 +1,6 @@
/*
Copy link
Collaborator

@dbaluta dbaluta Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't start a commit message with an explanation of what the code DOES. But with an explanation of WHY the code is needed.

Also try to use natural language when explaining things. For the rest people can just inspect the code.

So, let's reformat the commit message as follows:

samples: openamp_rsc_table: Don't hardcode notification channel ID to 0

Currently, Zephyr is always sending back notifications to AP (e.g Linux in our case)
on channel 0. 

But this currently doesn't work if Linux uses other channel id for communication.
So, save the channel id used by Linux and use it to send back replies.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we put this in the same PR for imx8mp? Asking because the example wouldn't work if we don't modify the channel

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alxlastur yes, that makes sense.

Copy link
Owner Author

@alxlastur alxlastur Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, by mistake the first time I made the PR, I made it over the one from the upstream zephyr github (not nxp one) and closed it immediately. But someone put some comments even if it was closed:
image

Then realised it was closed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have a link for this?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, lets go on with the plan we already have. And once you add the PR I will copy paste @arnopo'
s comment and restart the discussion from there.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok @dbaluta , then I will make a PR for imx8mp with 2 commits:

  • First commit contains: samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.conf and samples/subsys/ipc/openamp_rsc_table/boards/imx8mp_evk_mimx8ml8_m7.overlay

  • Second commit contain samples/subsys/ipc/openamp_rsc_table/src/main_remote.c

Right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Make sure you add proper commit messages as I previously commented.

compatible = "nxp,imx-mu";
reg = <0x44220000 DT_SIZE_K(64)>;
interrupts = <21 0>;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved in the same patch with the one adding overlays for imx93 M33 core as it is a change related to DTS.

status_reg = base->SR >>= MU_SR_RFn_SHIFT;
#endif

for (id = CONFIG_IPM_IMX_MAX_ID_VAL; id >= 0; id--) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a standalone patch explaining that MU register layout has changed or imx93 and we need to reverse the bits in order to work.

This would be the most problematic change to get in. but lets sending it like this and hope for the best.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alxlastur is it possible to do this change in NXP hal - in fsl_mu.c?
When taking the status_reg this should be already shifted for i.mx93.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iuliana-prodan , as far as I see I don't think so. The isr is defined in ipx_imx.c:
image
I see no ISR in fsl_mu.c or fsl_mu.h

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking to get the status register from fsl_mu by writing a function that does what you have above.
Here, like we have the MU_GetStatusFlags(), something like MU_GetStatusRegister().
I have to take a look on imx93 MU :)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. In this case it needs a MU_GetStatusRegister() that works for for all platforms. So MU_GetStatusRegister() should work for imx93 and imx8mp.

@@ -95,6 +95,12 @@
clocks = <&ccm IMX_CCM_LPUART2_CLK 0x6c 24>;
status = "disabled";
};

mu1: mu1@44220000 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be mu1: mu@4422000....

CONFIG_LOG=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_DEFAULT_LEVEL=0
CONFIG_LOG_MODE_MINIMAL=y

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a newline here

reg = <0xA4000000 0x120000>;
};

mu1{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a space between mu1 and {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants