Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
a058cbc1
Commit
a058cbc1
authored
Jun 19, 2009
by
Sascha Hauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mxc pwm: add mx25 support
Signed-off-by:
Sascha Hauer
<
s.hauer@pengutronix.de
>
parent
6134b2cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
arch/arm/plat-mxc/pwm.c
arch/arm/plat-mxc/pwm.c
+13
-4
No files found.
arch/arm/plat-mxc/pwm.c
View file @
a058cbc1
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#define MX3_PWMPR 0x10
/* PWM Period Register */
#define MX3_PWMPR 0x10
/* PWM Period Register */
#define MX3_PWMCR_PRESCALER(x) (((x - 1) & 0xFFF) << 4)
#define MX3_PWMCR_PRESCALER(x) (((x - 1) & 0xFFF) << 4)
#define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16)
#define MX3_PWMCR_CLKSRC_IPG_HIGH (2 << 16)
#define MX3_PWMCR_CLKSRC_IPG (1 << 16)
#define MX3_PWMCR_EN (1 << 0)
#define MX3_PWMCR_EN (1 << 0)
...
@@ -55,9 +56,11 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
...
@@ -55,9 +56,11 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
if
(
pwm
==
NULL
||
period_ns
==
0
||
duty_ns
>
period_ns
)
if
(
pwm
==
NULL
||
period_ns
==
0
||
duty_ns
>
period_ns
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
cpu_is_mx27
()
||
cpu_is_mx3
())
{
if
(
cpu_is_mx27
()
||
cpu_is_mx3
()
||
cpu_is_mx25
()
)
{
unsigned
long
long
c
;
unsigned
long
long
c
;
unsigned
long
period_cycles
,
duty_cycles
,
prescale
;
unsigned
long
period_cycles
,
duty_cycles
,
prescale
;
u32
cr
;
c
=
clk_get_rate
(
pwm
->
clk
);
c
=
clk_get_rate
(
pwm
->
clk
);
c
=
c
*
period_ns
;
c
=
c
*
period_ns
;
do_div
(
c
,
1000000000
);
do_div
(
c
,
1000000000
);
...
@@ -72,9 +75,15 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
...
@@ -72,9 +75,15 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
writel
(
duty_cycles
,
pwm
->
mmio_base
+
MX3_PWMSAR
);
writel
(
duty_cycles
,
pwm
->
mmio_base
+
MX3_PWMSAR
);
writel
(
period_cycles
,
pwm
->
mmio_base
+
MX3_PWMPR
);
writel
(
period_cycles
,
pwm
->
mmio_base
+
MX3_PWMPR
);
writel
(
MX3_PWMCR_PRESCALER
(
prescale
)
|
MX3_PWMCR_CLKSRC_IPG_HIGH
|
MX3_PWMCR_EN
,
cr
=
MX3_PWMCR_PRESCALER
(
prescale
)
|
MX3_PWMCR_EN
;
pwm
->
mmio_base
+
MX3_PWMCR
);
if
(
cpu_is_mx25
())
cr
|=
MX3_PWMCR_CLKSRC_IPG
;
else
cr
|=
MX3_PWMCR_CLKSRC_IPG_HIGH
;
writel
(
cr
,
pwm
->
mmio_base
+
MX3_PWMCR
);
}
else
if
(
cpu_is_mx1
()
||
cpu_is_mx21
())
{
}
else
if
(
cpu_is_mx1
()
||
cpu_is_mx21
())
{
/* The PWM subsystem allows for exact frequencies. However,
/* The PWM subsystem allows for exact frequencies. However,
* I cannot connect a scope on my device to the PWM line and
* I cannot connect a scope on my device to the PWM line and
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment