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

Imx8mm compatibility #126

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Imx8mm compatibility #126

wants to merge 8 commits into from

Conversation

lucypa
Copy link

@lucypa lucypa commented Mar 11, 2022

This is an extension to the imx6 driver to support imx8mq and imx8mm dev boards.
Ideally the systems will actually have their own files (Todo), and in my opinion there is a tidy up to be done on this folder (I can get onto this in the near future). Perhaps this update should go somewhere else for the time being?

@lsf37
Copy link
Member

lsf37 commented Mar 11, 2022

Depending on time frame, we could leave this open as a draft PR until you think it is fully. Or if you think it'll be a bit longer, an in-repo branch here would also be Ok.

xurtis and others added 8 commits March 11, 2022 13:49
The IMX.6 ethernet driver is compatible with the IMX.8 but our
implementation assumes the IMX.6 OCOTP which stores the MAC address at
boot and is not compatible with the IMX.8.

It's also possible that the ethernet device already has the register
initialised by the bootloader already at this point...

Signed-off-by: Curtis Millar <[email protected]>
Signed-off-by: Lucy <[email protected]>
Signed-off-by: Lucy <[email protected]>
@lucypa
Copy link
Author

lucypa commented Mar 11, 2022

@lsf37 It might be a month or two before I'll have time to sort through it again. I also would appreciate feedback from the systems guys on the imx8mm specific changes.

@@ -63,7 +63,7 @@ mark_as_advanced(
)
add_config_library(ethdrivers "${configure_string}")

if("${KernelPlatform}" MATCHES "imx8mq-evk")
if(("${KernelPlatform}" MATCHES "imx8mq-evk") OR ("${KernelPlatform}" MATCHES "imx8mm-evk"))
Copy link
Member

Choose a reason for hiding this comment

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

I just wonder, was there any reason we say MATCHES here and not STREQ? We could simply use the flags here also if this selects well define platforms: if(KernelPlatformImx8mq-evk OR KernelPlatformImx8mm-evk)

#ifdef CONFIG_PLAT_IMX8MQ_EVK
#define CCM_PADDR 0x30380000
#if (defined(CONFIG_PLAT_IMX8MQ_EVK) || defined(CONFIG_PLAT_IMX8MM_EVK))
#define CCM_PADDR 0x30380000 // from: root/arch/arm/include/asm/arch-imx8m/imx-regs-imx8mm.h
Copy link
Member

Choose a reason for hiding this comment

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

What is "root"?

if (!enet_tx_enabled(dev->enet)) {
enet_tx_enable(dev->enet);
}
return;
if (d->stat & TXD_READY) return;
Copy link
Member

Choose a reason for hiding this comment

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

please use

Suggested change
if (d->stat & TXD_READY) return;
if (d->stat & TXD_READY) {
return;
}

// ethif_print_state(netif_get_eth_driver(netif));
assert(0);
while (1);
while (e & IRQ_MASK) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we merge this as a potential bug fix in a separate PR? Looping to consume all pending interrupt seems a good general pattern and I can't remember any reason not to do it here.

* hardware MAC address. */
uint64_t mac = 0;
ZF_LOGI("using MAC configured by bootloader");
#else
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should make this a conditional else, so we handle all known platform explicitly and don't have a default behavior? Ir would fail compilation for unknown platforms then and requires explicit action.

@@ -211,10 +210,16 @@ uint64_t ocotp_get_mac(struct ocotp *ocotp, unsigned int id)
uint64_t mac = 0;

switch (id) {
#if defined(CONFIG_PLAT_IMX8MM_EVK) || defined(CONFIG_IMX8MQ_EVK)
case 0:
mac = ((uint64_t)((uint16_t)regs->res37[4]) << 32) | regs->res37[0];
Copy link
Member

Choose a reason for hiding this comment

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

Please give the registers a name in the definition, reading a MAC from reserved registers is a bit odd.

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.

4 participants