Commit 690b846a authored by Albrecht Dreß's avatar Albrecht Dreß Committed by Grant Likely

mpc5200/gpt: tiny fix for gpt period limitation

This patch changes the period parameter of mpc52xx_gpt_start_timer to
a u64 to support larger timeout periods.
Signed-off-by: default avatarAlbrecht Dreß <albrecht.dress@arcor.de>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent 02d9e58e
...@@ -279,7 +279,7 @@ extern void mpc52xx_restart(char *cmd); ...@@ -279,7 +279,7 @@ extern void mpc52xx_restart(char *cmd);
/* mpc52xx_gpt.c */ /* mpc52xx_gpt.c */
struct mpc52xx_gpt_priv; struct mpc52xx_gpt_priv;
extern struct mpc52xx_gpt_priv *mpc52xx_gpt_from_irq(int irq); extern struct mpc52xx_gpt_priv *mpc52xx_gpt_from_irq(int irq);
extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int period, extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 period,
int continuous); int continuous);
extern void mpc52xx_gpt_stop_timer(struct mpc52xx_gpt_priv *gpt); extern void mpc52xx_gpt_stop_timer(struct mpc52xx_gpt_priv *gpt);
......
...@@ -378,12 +378,12 @@ EXPORT_SYMBOL(mpc52xx_gpt_from_irq); ...@@ -378,12 +378,12 @@ EXPORT_SYMBOL(mpc52xx_gpt_from_irq);
/** /**
* mpc52xx_gpt_start_timer - Set and enable the GPT timer * mpc52xx_gpt_start_timer - Set and enable the GPT timer
* @gpt: Pointer to gpt private data structure * @gpt: Pointer to gpt private data structure
* @period: period of timer * @period: period of timer in ns; max. ~130s @ 33MHz IPB clock
* @continuous: set to 1 to make timer continuous free running * @continuous: set to 1 to make timer continuous free running
* *
* An interrupt will be generated every time the timer fires * An interrupt will be generated every time the timer fires
*/ */
int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int period, int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 period,
int continuous) int continuous)
{ {
u32 clear, set; u32 clear, set;
...@@ -400,7 +400,7 @@ int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int period, ...@@ -400,7 +400,7 @@ int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, int period,
* arithmatic is done here to preserve the precision until the value * arithmatic is done here to preserve the precision until the value
* is scaled back down into the u32 range. Period is in 'ns', bus * is scaled back down into the u32 range. Period is in 'ns', bus
* frequency is in Hz. */ * frequency is in Hz. */
clocks = (u64)period * (u64)gpt->ipb_freq; clocks = period * (u64)gpt->ipb_freq;
do_div(clocks, 1000000000); /* Scale it down to ns range */ do_div(clocks, 1000000000); /* Scale it down to ns range */
/* This device cannot handle a clock count greater than 32 bits */ /* This device cannot handle a clock count greater than 32 bits */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment