mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 12:46:40 +07:00
Blackfin: gptimers: use bfin read/write helpers
Use proper helper macros for reading/writing the MMRs rather than volatile markings on the struct. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
24a6b91f69
commit
997f95e190
@ -124,7 +124,7 @@ static uint32_t const timil_mask[MAX_BLACKFIN_GPTIMERS] =
|
|||||||
void set_gptimer_pwidth(unsigned int timer_id, uint32_t value)
|
void set_gptimer_pwidth(unsigned int timer_id, uint32_t value)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
timer_regs[timer_id]->width = value;
|
bfin_write(&timer_regs[timer_id]->width, value);
|
||||||
SSYNC();
|
SSYNC();
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(set_gptimer_pwidth);
|
EXPORT_SYMBOL(set_gptimer_pwidth);
|
||||||
@ -132,14 +132,14 @@ EXPORT_SYMBOL(set_gptimer_pwidth);
|
|||||||
uint32_t get_gptimer_pwidth(unsigned int timer_id)
|
uint32_t get_gptimer_pwidth(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return timer_regs[timer_id]->width;
|
return bfin_read(&timer_regs[timer_id]->width);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_pwidth);
|
EXPORT_SYMBOL(get_gptimer_pwidth);
|
||||||
|
|
||||||
void set_gptimer_period(unsigned int timer_id, uint32_t period)
|
void set_gptimer_period(unsigned int timer_id, uint32_t period)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
timer_regs[timer_id]->period = period;
|
bfin_write(&timer_regs[timer_id]->period, period);
|
||||||
SSYNC();
|
SSYNC();
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(set_gptimer_period);
|
EXPORT_SYMBOL(set_gptimer_period);
|
||||||
@ -147,71 +147,76 @@ EXPORT_SYMBOL(set_gptimer_period);
|
|||||||
uint32_t get_gptimer_period(unsigned int timer_id)
|
uint32_t get_gptimer_period(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return timer_regs[timer_id]->period;
|
return bfin_read(&timer_regs[timer_id]->period);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_period);
|
EXPORT_SYMBOL(get_gptimer_period);
|
||||||
|
|
||||||
uint32_t get_gptimer_count(unsigned int timer_id)
|
uint32_t get_gptimer_count(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return timer_regs[timer_id]->counter;
|
return bfin_read(&timer_regs[timer_id]->counter);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_count);
|
EXPORT_SYMBOL(get_gptimer_count);
|
||||||
|
|
||||||
uint32_t get_gptimer_status(unsigned int group)
|
uint32_t get_gptimer_status(unsigned int group)
|
||||||
{
|
{
|
||||||
tassert(group < BFIN_TIMER_NUM_GROUP);
|
tassert(group < BFIN_TIMER_NUM_GROUP);
|
||||||
return group_regs[group]->status;
|
return bfin_read(&group_regs[group]->status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_status);
|
EXPORT_SYMBOL(get_gptimer_status);
|
||||||
|
|
||||||
void set_gptimer_status(unsigned int group, uint32_t value)
|
void set_gptimer_status(unsigned int group, uint32_t value)
|
||||||
{
|
{
|
||||||
tassert(group < BFIN_TIMER_NUM_GROUP);
|
tassert(group < BFIN_TIMER_NUM_GROUP);
|
||||||
group_regs[group]->status = value;
|
bfin_write(&group_regs[group]->status, value);
|
||||||
SSYNC();
|
SSYNC();
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(set_gptimer_status);
|
EXPORT_SYMBOL(set_gptimer_status);
|
||||||
|
|
||||||
|
static uint32_t read_gptimer_status(unsigned int timer_id)
|
||||||
|
{
|
||||||
|
return bfin_read(&group_regs[BFIN_TIMER_OCTET(timer_id)]->status);
|
||||||
|
}
|
||||||
|
|
||||||
int get_gptimer_intr(unsigned int timer_id)
|
int get_gptimer_intr(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & timil_mask[timer_id]);
|
return !!(read_gptimer_status(timer_id) & timil_mask[timer_id]);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_intr);
|
EXPORT_SYMBOL(get_gptimer_intr);
|
||||||
|
|
||||||
void clear_gptimer_intr(unsigned int timer_id)
|
void clear_gptimer_intr(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
group_regs[BFIN_TIMER_OCTET(timer_id)]->status = timil_mask[timer_id];
|
bfin_write(&group_regs[BFIN_TIMER_OCTET(timer_id)]->status, timil_mask[timer_id]);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(clear_gptimer_intr);
|
EXPORT_SYMBOL(clear_gptimer_intr);
|
||||||
|
|
||||||
int get_gptimer_over(unsigned int timer_id)
|
int get_gptimer_over(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & tovf_mask[timer_id]);
|
return !!(read_gptimer_status(timer_id) & tovf_mask[timer_id]);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_over);
|
EXPORT_SYMBOL(get_gptimer_over);
|
||||||
|
|
||||||
void clear_gptimer_over(unsigned int timer_id)
|
void clear_gptimer_over(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
group_regs[BFIN_TIMER_OCTET(timer_id)]->status = tovf_mask[timer_id];
|
bfin_write(&group_regs[BFIN_TIMER_OCTET(timer_id)]->status, tovf_mask[timer_id]);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(clear_gptimer_over);
|
EXPORT_SYMBOL(clear_gptimer_over);
|
||||||
|
|
||||||
int get_gptimer_run(unsigned int timer_id)
|
int get_gptimer_run(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & trun_mask[timer_id]);
|
return !!(read_gptimer_status(timer_id) & trun_mask[timer_id]);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_run);
|
EXPORT_SYMBOL(get_gptimer_run);
|
||||||
|
|
||||||
void set_gptimer_config(unsigned int timer_id, uint16_t config)
|
void set_gptimer_config(unsigned int timer_id, uint16_t config)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
timer_regs[timer_id]->config = config;
|
bfin_write(&timer_regs[timer_id]->config, config);
|
||||||
SSYNC();
|
SSYNC();
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(set_gptimer_config);
|
EXPORT_SYMBOL(set_gptimer_config);
|
||||||
@ -219,7 +224,7 @@ EXPORT_SYMBOL(set_gptimer_config);
|
|||||||
uint16_t get_gptimer_config(unsigned int timer_id)
|
uint16_t get_gptimer_config(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return timer_regs[timer_id]->config;
|
return bfin_read(&timer_regs[timer_id]->config);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_config);
|
EXPORT_SYMBOL(get_gptimer_config);
|
||||||
|
|
||||||
@ -228,7 +233,7 @@ void enable_gptimers(uint16_t mask)
|
|||||||
int i;
|
int i;
|
||||||
tassert((mask & ~BLACKFIN_GPTIMER_IDMASK) == 0);
|
tassert((mask & ~BLACKFIN_GPTIMER_IDMASK) == 0);
|
||||||
for (i = 0; i < BFIN_TIMER_NUM_GROUP; ++i) {
|
for (i = 0; i < BFIN_TIMER_NUM_GROUP; ++i) {
|
||||||
group_regs[i]->enable = mask & 0xFF;
|
bfin_write(&group_regs[i]->enable, mask & 0xFF);
|
||||||
mask >>= 8;
|
mask >>= 8;
|
||||||
}
|
}
|
||||||
SSYNC();
|
SSYNC();
|
||||||
@ -241,7 +246,7 @@ static void _disable_gptimers(uint16_t mask)
|
|||||||
uint16_t m = mask;
|
uint16_t m = mask;
|
||||||
tassert((mask & ~BLACKFIN_GPTIMER_IDMASK) == 0);
|
tassert((mask & ~BLACKFIN_GPTIMER_IDMASK) == 0);
|
||||||
for (i = 0; i < BFIN_TIMER_NUM_GROUP; ++i) {
|
for (i = 0; i < BFIN_TIMER_NUM_GROUP; ++i) {
|
||||||
group_regs[i]->disable = m & 0xFF;
|
bfin_write(&group_regs[i]->disable, m & 0xFF);
|
||||||
m >>= 8;
|
m >>= 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +257,7 @@ void disable_gptimers(uint16_t mask)
|
|||||||
_disable_gptimers(mask);
|
_disable_gptimers(mask);
|
||||||
for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i)
|
for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i)
|
||||||
if (mask & (1 << i))
|
if (mask & (1 << i))
|
||||||
group_regs[BFIN_TIMER_OCTET(i)]->status = trun_mask[i];
|
bfin_write(&group_regs[BFIN_TIMER_OCTET(i)]->status, trun_mask[i]);
|
||||||
SSYNC();
|
SSYNC();
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(disable_gptimers);
|
EXPORT_SYMBOL(disable_gptimers);
|
||||||
@ -267,7 +272,7 @@ EXPORT_SYMBOL(disable_gptimers_sync);
|
|||||||
void set_gptimer_pulse_hi(unsigned int timer_id)
|
void set_gptimer_pulse_hi(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
timer_regs[timer_id]->config |= TIMER_PULSE_HI;
|
bfin_write_or(&timer_regs[timer_id]->config, TIMER_PULSE_HI);
|
||||||
SSYNC();
|
SSYNC();
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(set_gptimer_pulse_hi);
|
EXPORT_SYMBOL(set_gptimer_pulse_hi);
|
||||||
@ -275,7 +280,7 @@ EXPORT_SYMBOL(set_gptimer_pulse_hi);
|
|||||||
void clear_gptimer_pulse_hi(unsigned int timer_id)
|
void clear_gptimer_pulse_hi(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
timer_regs[timer_id]->config &= ~TIMER_PULSE_HI;
|
bfin_write_and(&timer_regs[timer_id]->config, ~TIMER_PULSE_HI);
|
||||||
SSYNC();
|
SSYNC();
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(clear_gptimer_pulse_hi);
|
EXPORT_SYMBOL(clear_gptimer_pulse_hi);
|
||||||
@ -285,7 +290,7 @@ uint16_t get_enabled_gptimers(void)
|
|||||||
int i;
|
int i;
|
||||||
uint16_t result = 0;
|
uint16_t result = 0;
|
||||||
for (i = 0; i < BFIN_TIMER_NUM_GROUP; ++i)
|
for (i = 0; i < BFIN_TIMER_NUM_GROUP; ++i)
|
||||||
result |= (group_regs[i]->enable << (i << 3));
|
result |= (bfin_read(&group_regs[i]->enable) << (i << 3));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_enabled_gptimers);
|
EXPORT_SYMBOL(get_enabled_gptimers);
|
||||||
|
Loading…
Reference in New Issue
Block a user