Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
dt_ctrl
Commits
d92db750
Commit
d92db750
authored
Aug 09, 2015
by
Jeroen Vreeken
Browse files
Enable TBCLK in control module for pwm
parent
56773342
Changes
3
Hide whitespace changes
Inline
Side-by-side
controller/am335x/am335x.c
View file @
d92db750
...
...
@@ -144,6 +144,21 @@ static int am335x_control_module_init(void)
return
control_module_base
==
NULL
;
}
int
am335x_control_module_set
(
size_t
offset
,
uint32_t
bits
)
{
uint32_t
reg
;
if
(
!
control_module_base
)
{
if
(
am335x_control_module_init
())
{
log_send
(
LOG_T_ERROR
,
"am335x: CONTROL_MODULE init failed"
);
return
-
1
;
}
}
reg
=
am335x_read32
(
control_module_base
,
offset
);
am335x_write32
(
control_module_base
,
offset
,
reg
|
bits
);
}
int
am335x_pinmux_debug
(
size_t
offset
)
{
uint32_t
reg
;
...
...
controller/am335x/am335x.h
View file @
d92db750
...
...
@@ -69,6 +69,11 @@
#define AM335X_CONTROL_MODULE_CONF_LCD_DATA10 0x0c8
/* P8_36, 2: pwm1 A */
#define AM335X_CONTROL_MODULE_CONF_LCD_DATA11 0x0cc
/* P8_34, 2: pwm1 B */
#define AM335X_CONTROL_MODULE_PWMSS_CTRL 0x664
#define AM335X_CONTROL_MODULE_PWMSS0_TBCLKEN 0x00000001
#define AM335X_CONTROL_MODULE_PWMSS1_TBCLKEN 0x00000002
#define AM335X_CONTROL_MODULE_PWMSS2_TBCLKEN 0x00000004
#define AM335X_PWMSS0_BASE 0x48300000
#define AM335X_PWMSS1_BASE 0x48302000
#define AM335X_PWMSS2_BASE 0x48304000
...
...
@@ -359,4 +364,6 @@ int am335x_pinmux_set(size_t offset, unsigned mode, unsigned flags);
int
am335x_pinmux_gpio_offset
(
int
gpio
,
int
pin
,
size_t
*
offset
);
int
am335x_control_module_set
(
size_t
offset
,
uint32_t
bits
);
#endif
/* _INCLUDE_AM335X_ */
controller/am335x/block_am335x_pwm.c
View file @
d92db750
...
...
@@ -162,6 +162,7 @@ static struct controller_block * block_am335x_pwm_create(char *name, int argc, v
size_t
pin_b
;
unsigned
mode_a
;
unsigned
mode_b
;
uint32_t
ctrl_bits
;
pwm_nr
=
va_arg
(
ap
,
int
);
if
(
pwm_nr
<
0
||
pwm_nr
>
2
)
{
...
...
@@ -177,6 +178,7 @@ static struct controller_block * block_am335x_pwm_create(char *name, int argc, v
pin_b
=
AM335X_CONTROL_MODULE_CONF_MCASP0_FSX
;
mode_a
=
1
;
mode_b
=
1
;
ctrl_bits
=
AM335X_CONTROL_MODULE_PWMSS0_TBCLKEN
;
break
;
case
1
:
offset
=
AM335X_PWMSS1_BASE
;
...
...
@@ -185,6 +187,7 @@ static struct controller_block * block_am335x_pwm_create(char *name, int argc, v
pin_b
=
AM335X_CONTROL_MODULE_CONF_LCD_DATA11
;
mode_a
=
2
;
mode_b
=
2
;
ctrl_bits
=
AM335X_CONTROL_MODULE_PWMSS1_TBCLKEN
;
break
;
case
2
:
offset
=
AM335X_PWMSS2_BASE
;
...
...
@@ -193,6 +196,7 @@ static struct controller_block * block_am335x_pwm_create(char *name, int argc, v
pin_b
=
AM335X_CONTROL_MODULE_CONF_LCD_DATA1
;
mode_a
=
3
;
mode_b
=
3
;
ctrl_bits
=
AM335X_CONTROL_MODULE_PWMSS2_TBCLKEN
;
break
;
}
...
...
@@ -200,6 +204,13 @@ static struct controller_block * block_am335x_pwm_create(char *name, int argc, v
log_send
(
LOG_T_ERROR
,
"%s: Enabling L4LS clock failed"
,
name
);
return
NULL
;
}
if
(
am335x_control_module_set
(
AM335X_CONTROL_MODULE_PWMSS_CTRL
,
ctrl_bits
))
{
log_send
(
LOG_T_ERROR
,
"%s: Enabling TBCLK in control module failed"
,
name
);
return
NULL
;
}
if
(
am335x_cm_enable
(
cm_offset
))
{
log_send
(
LOG_T_ERROR
,
"%s: Enabling module failed"
,
name
);
return
NULL
;
...
...
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