Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 372271
b: refs/heads/master
c: cccd704
h: refs/heads/master
i:
  372269: 75bfe8d
  372267: c0478f4
  372263: c481aa3
  372255: 6e99acc
v: v3
  • Loading branch information
Magnus Damm authored and Simon Horman committed Mar 12, 2013
1 parent 7452127 commit 97da3fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a6a912ca43843d43590ce5f1cbc85cbc7ac14bba
refs/heads/master: cccd70455c351604d0a9075d35298ed4ff66dab3
16 changes: 12 additions & 4 deletions trunk/drivers/clocksource/sh_cmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ struct sh_cmt_priv {
unsigned long total_cycles;
bool cs_enabled;

/* callbacks for CMSTR and CMCSR access */
unsigned long (*read_control)(void __iomem *base, unsigned long offs);
void (*write_control)(void __iomem *base, unsigned long offs,
unsigned long value);

/* callbacks for CMCNT and CMCOR access */
unsigned long (*read_count)(void __iomem *base, unsigned long offs);
void (*write_count)(void __iomem *base, unsigned long offs,
Expand Down Expand Up @@ -91,12 +96,12 @@ static inline unsigned long sh_cmt_read_cmstr(struct sh_cmt_priv *p)
{
struct sh_timer_config *cfg = p->pdev->dev.platform_data;

return sh_cmt_read16(p->mapbase - cfg->channel_offset, 0);
return p->read_control(p->mapbase - cfg->channel_offset, 0);
}

static inline unsigned long sh_cmt_read_cmcsr(struct sh_cmt_priv *p)
{
return sh_cmt_read16(p->mapbase, CMCSR);
return p->read_control(p->mapbase, CMCSR);
}

static inline unsigned long sh_cmt_read_cmcnt(struct sh_cmt_priv *p)
Expand All @@ -109,13 +114,13 @@ static inline void sh_cmt_write_cmstr(struct sh_cmt_priv *p,
{
struct sh_timer_config *cfg = p->pdev->dev.platform_data;

sh_cmt_write16(p->mapbase - cfg->channel_offset, 0, value);
p->write_control(p->mapbase - cfg->channel_offset, 0, value);
}

static inline void sh_cmt_write_cmcsr(struct sh_cmt_priv *p,
unsigned long value)
{
sh_cmt_write16(p->mapbase, CMCSR, value);
p->write_control(p->mapbase, CMCSR, value);
}

static inline void sh_cmt_write_cmcnt(struct sh_cmt_priv *p,
Expand Down Expand Up @@ -702,6 +707,9 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
goto err1;
}

p->read_control = sh_cmt_read16;
p->write_control = sh_cmt_write16;

if (resource_size(res) == 6) {
p->width = 16;
p->read_count = sh_cmt_read16;
Expand Down

0 comments on commit 97da3fd

Please sign in to comment.