exynos: Rework legacy PWM usage
The way that the timer support is currently done for exynos/nexell platforms relies on the legacy PWM infrastructure, and that needs to be updated. However, we really cannot safely undef CONFIG_DM_PWM to build the timer.c file without warnings. For now, rename the relevant legacy functions to be prefixed with s5p_ and add prototypes to the arch pwm.h files. Cc: Minkyu Kang <mk7.kang@samsung.com> Cc: Jaehoon Chung <jh80.chung@samsung.com> Cc: Dzmitry Sankouski <dsankouski@gmail.com> Cc: Stefan Bosch <stefan_b@posteo.net> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
52d91e1c20
commit
b9d1f88b3a
@ -7,12 +7,11 @@
|
|||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pwm.h>
|
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/arch/pwm.h>
|
#include <asm/arch/pwm.h>
|
||||||
#include <asm/arch/clk.h>
|
#include <asm/arch/clk.h>
|
||||||
|
|
||||||
int pwm_enable(int pwm_id)
|
int s5p_pwm_enable(int pwm_id)
|
||||||
{
|
{
|
||||||
const struct s5p_timer *pwm =
|
const struct s5p_timer *pwm =
|
||||||
#if defined(CONFIG_ARCH_NEXELL)
|
#if defined(CONFIG_ARCH_NEXELL)
|
||||||
@ -30,7 +29,7 @@ int pwm_enable(int pwm_id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pwm_disable(int pwm_id)
|
void s5p_pwm_disable(int pwm_id)
|
||||||
{
|
{
|
||||||
const struct s5p_timer *pwm =
|
const struct s5p_timer *pwm =
|
||||||
#if defined(CONFIG_ARCH_NEXELL)
|
#if defined(CONFIG_ARCH_NEXELL)
|
||||||
@ -92,7 +91,7 @@ static unsigned long pwm_calc_tin(int pwm_id, unsigned long freq)
|
|||||||
|
|
||||||
#define NS_IN_SEC 1000000000UL
|
#define NS_IN_SEC 1000000000UL
|
||||||
|
|
||||||
int pwm_config(int pwm_id, int duty_ns, int period_ns)
|
int s5p_pwm_config(int pwm_id, int duty_ns, int period_ns)
|
||||||
{
|
{
|
||||||
const struct s5p_timer *pwm =
|
const struct s5p_timer *pwm =
|
||||||
#if defined(CONFIG_ARCH_NEXELL)
|
#if defined(CONFIG_ARCH_NEXELL)
|
||||||
@ -157,7 +156,7 @@ int pwm_config(int pwm_id, int duty_ns, int period_ns)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pwm_init(int pwm_id, int div, int invert)
|
int s5p_pwm_init(int pwm_id, int div, int invert)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
const struct s5p_timer *pwm =
|
const struct s5p_timer *pwm =
|
||||||
@ -219,7 +218,7 @@ int pwm_init(int pwm_id, int div, int invert)
|
|||||||
val |= TCON_INVERTER(pwm_id);
|
val |= TCON_INVERTER(pwm_id);
|
||||||
writel(val, &pwm->tcon);
|
writel(val, &pwm->tcon);
|
||||||
|
|
||||||
pwm_enable(pwm_id);
|
s5p_pwm_enable(pwm_id);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,6 @@
|
|||||||
#include <asm/arch/clk.h>
|
#include <asm/arch/clk.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
|
|
||||||
/* Use the old PWM interface for now */
|
|
||||||
#undef CONFIG_DM_PWM
|
|
||||||
#include <pwm.h>
|
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
unsigned long get_current_tick(void);
|
unsigned long get_current_tick(void);
|
||||||
@ -49,9 +45,9 @@ static unsigned long timer_get_us_down(void)
|
|||||||
int timer_init(void)
|
int timer_init(void)
|
||||||
{
|
{
|
||||||
/* PWM Timer 4 */
|
/* PWM Timer 4 */
|
||||||
pwm_init(4, MUX_DIV_4, 0);
|
s5p_pwm_init(4, MUX_DIV_4, 0);
|
||||||
pwm_config(4, 100000, 100000);
|
s5p_pwm_config(4, 100000, 100000);
|
||||||
pwm_enable(4);
|
s5p_pwm_enable(4);
|
||||||
|
|
||||||
/* Use this as the current monotonic time in us */
|
/* Use this as the current monotonic time in us */
|
||||||
gd->arch.timer_reset_value = 0;
|
gd->arch.timer_reset_value = 0;
|
||||||
|
@ -49,6 +49,11 @@ struct s5p_timer {
|
|||||||
unsigned int tcnto4;
|
unsigned int tcnto4;
|
||||||
unsigned int tintcstat;
|
unsigned int tintcstat;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int s5p_pwm_init (int pwm_id, int div, int invert);
|
||||||
|
int s5p_pwm_config (int pwm_id, int duty_ns, int period_ns);
|
||||||
|
int s5p_pwm_enable (int pwm_id);
|
||||||
|
void s5p_pwm_disable (int pwm_id);
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,6 +49,11 @@ struct s5p_timer {
|
|||||||
unsigned int tcnto4;
|
unsigned int tcnto4;
|
||||||
unsigned int tintcstat;
|
unsigned int tintcstat;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int s5p_pwm_init (int pwm_id, int div, int invert);
|
||||||
|
int s5p_pwm_config (int pwm_id, int duty_ns, int period_ns);
|
||||||
|
int s5p_pwm_enable (int pwm_id);
|
||||||
|
void s5p_pwm_disable (int pwm_id);
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,6 +49,11 @@ struct s5p_timer {
|
|||||||
unsigned int tcnto4;
|
unsigned int tcnto4;
|
||||||
unsigned int tintcstat;
|
unsigned int tintcstat;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int s5p_pwm_init (int pwm_id, int div, int invert);
|
||||||
|
int s5p_pwm_config (int pwm_id, int duty_ns, int period_ns);
|
||||||
|
int s5p_pwm_enable (int pwm_id);
|
||||||
|
void s5p_pwm_disable (int pwm_id);
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -80,9 +80,9 @@ static void bd_backlight_on(void)
|
|||||||
|
|
||||||
#elif defined(BACKLIGHT_CH)
|
#elif defined(BACKLIGHT_CH)
|
||||||
/* pwm backlight ON: HIGH, ON: LOW */
|
/* pwm backlight ON: HIGH, ON: LOW */
|
||||||
pwm_init(BACKLIGHT_CH,
|
s5p_pwm_init(BACKLIGHT_CH,
|
||||||
BACKLIGHT_DIV, BACKLIGHT_INV);
|
BACKLIGHT_DIV, BACKLIGHT_INV);
|
||||||
pwm_config(BACKLIGHT_CH,
|
s5p_pwm_config(BACKLIGHT_CH,
|
||||||
TO_DUTY_NS(BACKLIGHT_DUTY, BACKLIGHT_HZ),
|
TO_DUTY_NS(BACKLIGHT_DUTY, BACKLIGHT_HZ),
|
||||||
TO_PERIOD_NS(BACKLIGHT_HZ));
|
TO_PERIOD_NS(BACKLIGHT_HZ));
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/arch/clk.h>
|
#include <asm/arch/clk.h>
|
||||||
|
#include <asm/arch/pwm.h>
|
||||||
#include <i2c.h>
|
#include <i2c.h>
|
||||||
#include <pwm.h>
|
|
||||||
|
|
||||||
#include <irq_func.h>
|
#include <irq_func.h>
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ static int onewire_init_timer(void)
|
|||||||
/* range: 1080~1970 */
|
/* range: 1080~1970 */
|
||||||
period_ns -= 1525;
|
period_ns -= 1525;
|
||||||
|
|
||||||
return pwm_config(PWM_CH, period_ns >> 1, period_ns);
|
return s5p_pwm_config(PWM_CH, period_ns >> 1, period_ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wait_one_tick(void)
|
static void wait_one_tick(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user