-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
drivers: ethernet: stm32: Add get_config() support #86315
Conversation
8d987ea
to
22ed687
Compare
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) | ||
if (heth->Instance->MACPFR & ETH_MACPFR_PR) { | ||
config->promisc_mode = true; | ||
} else { | ||
config->promisc_mode = false; | ||
} | ||
#else | ||
if (heth->Instance->MACFFR & ETH_MACFFR_PM) { | ||
config->promisc_mode = true; | ||
} else { | ||
config->promisc_mode = false; | ||
} | ||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ |
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.
Nit: could be split out to a dedicated function to make easier to maintain if new IPs with different registers are introduced.
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.
+1 but could be part of a more generic driver update. See #86406
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) | ||
if (heth->Instance->MACPFR & ETH_MACPFR_PR) { | ||
config->promisc_mode = true; | ||
} else { | ||
config->promisc_mode = false; | ||
} | ||
#else | ||
if (heth->Instance->MACFFR & ETH_MACFFR_PM) { | ||
config->promisc_mode = true; | ||
} else { | ||
config->promisc_mode = false; | ||
} | ||
#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */ |
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.
Hi @mathieuchopstm and @erwango
Is it okay if I create a seperate function like this?
__STATIC_INLINE void stm32_eth_get_config_promisc_mode(Eth_HandleTypeDef *heth, struct ethernet_config *config)
{
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet)
if (heth->Instance->MACPFR & ETH_MACPFR_PR) {
config->promisc_mode = true;
} else {
config->promisc_mode = false;
}
#else
if (heth->Instance->MACFFR & ETH_MACFFR_PM) {
config->promisc_mode = true;
} else {
config->promisc_mode = false;
}
#endif /* DT_HAS_COMPAT_STATUS_OKAY(st_stm32h7_ethernet) */
}
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.
Actually, I think it would be better to address globally. See #86406
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.
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.
Actually, the problem is wider to this particular piece of code and split all over the driver. So I consider this is a work larger than fixing this new addition and hence would better be addressed in a dedicated PR.
Regarding the method, I'm opened, as long as:
- it is readable and easy to maintain
- it could be extended easily to new series with different register names
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.
09d4385
to
6151ab3
Compare
You have to rebase to the current main, not merge. |
79135f2
to
be7630c
Compare
The following west manifest projects have changed revision in this Pull Request:
✅ All manifest checks OK Note: This message is automatically posted and updated by the Manifest GitHub Action. |
Guys, I did something wrongly while rebasing. I guess it will take sometime to resolve this. Since I am going to out of station. Kindly apologize me for any inconvience caused here |
Simply do a |
Implementation of get_config() api added Fixes: zephyrproject-rtos#84898 Signed-off-by: Ram Mahesh <rammaheshram1234@gmail.com>
be7630c
to
6151ab3
Compare
6151ab3
to
e63e9f5
Compare
Implementation of get_config() api added
Fixes: #84898