-
Notifications
You must be signed in to change notification settings - Fork 6.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 EPIT Timer Driver #11441
i.MX EPIT Timer Driver #11441
Conversation
Codecov Report
@@ Coverage Diff @@
## topic-counters #11441 +/- ##
==================================================
- Coverage 55.08% 53.94% -1.14%
==================================================
Files 255 242 -13
Lines 28923 27654 -1269
Branches 6975 6717 -258
==================================================
- Hits 15931 14917 -1014
+ Misses 10095 9932 -163
+ Partials 2897 2805 -92 Continue to review full report at Codecov.
|
drivers/counter/Kconfig.imx_epit
Outdated
|
||
if TIMER_IMX_EPIT_1 | ||
|
||
config TIMER_IMX_EPIT_1_PRESCALER |
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 put the prescaler in DTS?
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.
I think we should move the others to dts 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.
Moved the prescaler setting into DTS for this pr.
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 think EPIT2 is at wrong address in DTS:
devices/MCIMX6X/MCIMX6X_M4.h:#define EPIT1_BASE (0x420D0000u)
devices/MCIMX6X/MCIMX6X_M4.h:#define EPIT2_BASE (0x420D4000u)
drivers/counter/timer_imx_epit.c
Outdated
EPIT_Type *base = get_epit_config(dev)->base; | ||
struct imx_epit_data *driver_data = dev->driver_data; | ||
|
||
if ((EPIT_CR_REG(base) & EPIT_CR_EN_MASK) == 0U) { |
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 shoulld be possible to set wrap when counter is not started.
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.
Fixed.
drivers/counter/timer_imx_epit.c
Outdated
/* (Re)enable EPIT Output Compare interrupt */ | ||
EPIT_SetIntCmd(base, true); | ||
} else { | ||
/* Reset reload value without affecting the actual count */ |
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.
why callback=NULL resets wrap? There is no such statement in the API. Null callback mainly makes sense when channel alarms are implemented because it is establishing period.
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.
Removed this.
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 also add counter
to the list of supported features in the board yaml and doc, and update tests/drivers/counter/counter_basic_api
to run on this board?
drivers/counter/Kconfig.imx_epit
Outdated
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
config TIMER_IMX_EPIT |
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.
Rename this to COUNTER_IMX_EPIT
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.
drivers/counter/timer_imx_epit.c
Outdated
@@ -0,0 +1,206 @@ | |||
/* |
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.
Rename the file to counter_imx_epit.c
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.
default y | ||
|
||
config TIMER_IMX_EPIT_2 | ||
default n |
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 remove these two lines
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.
@MaureenHelm @nordic-krch I've added two commits for the tests, one fixes the compilation errors existing on the How about the functionality when only one compare register is available? We have some options:
|
2e57cff
to
215f872
Compare
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 for doc changes
@stanislav-poboril could you rebase? regarding the approach when only one channel is available. There are 2 scenarios that can be covered with that:
For periodic alarm you need |
rebased |
215f872
to
6b96890
Compare
@nordic-krch Please revisit |
2f603c6
to
72f7261
Compare
Add shim driver for i.MX EPIT (Enhanced Periodic Interrupt Timer) 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 EPIT (Enhanced Periodic Interrupt Timer) peripheral support for i.MX6SoloX soc. Origin: Original Signed-off-by: Stanislav Poboril <[email protected]>
Enabled EPIT (Enhanced Periodic Interrupt Timer) in Cortex-M4 core of Udoo Neo Full board so the counter API could be used there. Origin: Original Signed-off-by: Stanislav Poboril <[email protected]>
Tests i.MX EPIT timer peripheral driver. Since it supports zero number of channel alarms, some tests had to be adjusted to look at the number of channel alarms supported first. Signed-off-by: Stanislav Poboril <[email protected]>
Rebased and updated after the merge of #11572. |
This adds EPIT driver and enables it on M4 core of i.MX 6SoloX SoC and on UDOO Neo Full board.
The driver conforms to the new counter API (#8340, #8331) and should be merged into topic-counters branch.