diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2014-01-27 16:04:17 -0500 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2014-04-16 06:03:08 -0400 |
commit | c924d2d2a964715b55b6601be338b3bd05a1ced5 (patch) | |
tree | b6a418cf799fed2921f26766d23038a023cd60d8 /drivers/clocksource/sh_cmt.c | |
parent | 36f1ac982d94cd3cce8ae24abd0676b79dec6126 (diff) |
clocksource: sh_cmt: Add memory base to sh_cmt_channel structure
The channel memory base is channel-specific, add it to the channel
structure in preparation for support of multiple channels per device.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Diffstat (limited to 'drivers/clocksource/sh_cmt.c')
-rw-r--r-- | drivers/clocksource/sh_cmt.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index eb93b889e189..4fcb05dc9ea4 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -40,6 +40,8 @@ struct sh_cmt_device; | |||
40 | struct sh_cmt_channel { | 40 | struct sh_cmt_channel { |
41 | struct sh_cmt_device *cmt; | 41 | struct sh_cmt_device *cmt; |
42 | 42 | ||
43 | void __iomem *base; | ||
44 | |||
43 | unsigned long flags; | 45 | unsigned long flags; |
44 | unsigned long match_value; | 46 | unsigned long match_value; |
45 | unsigned long next_match_value; | 47 | unsigned long next_match_value; |
@@ -130,12 +132,12 @@ static inline unsigned long sh_cmt_read_cmstr(struct sh_cmt_channel *ch) | |||
130 | 132 | ||
131 | static inline unsigned long sh_cmt_read_cmcsr(struct sh_cmt_channel *ch) | 133 | static inline unsigned long sh_cmt_read_cmcsr(struct sh_cmt_channel *ch) |
132 | { | 134 | { |
133 | return ch->cmt->read_control(ch->cmt->mapbase_ch, CMCSR); | 135 | return ch->cmt->read_control(ch->base, CMCSR); |
134 | } | 136 | } |
135 | 137 | ||
136 | static inline unsigned long sh_cmt_read_cmcnt(struct sh_cmt_channel *ch) | 138 | static inline unsigned long sh_cmt_read_cmcnt(struct sh_cmt_channel *ch) |
137 | { | 139 | { |
138 | return ch->cmt->read_count(ch->cmt->mapbase_ch, CMCNT); | 140 | return ch->cmt->read_count(ch->base, CMCNT); |
139 | } | 141 | } |
140 | 142 | ||
141 | static inline void sh_cmt_write_cmstr(struct sh_cmt_channel *ch, | 143 | static inline void sh_cmt_write_cmstr(struct sh_cmt_channel *ch, |
@@ -147,19 +149,19 @@ static inline void sh_cmt_write_cmstr(struct sh_cmt_channel *ch, | |||
147 | static inline void sh_cmt_write_cmcsr(struct sh_cmt_channel *ch, | 149 | static inline void sh_cmt_write_cmcsr(struct sh_cmt_channel *ch, |
148 | unsigned long value) | 150 | unsigned long value) |
149 | { | 151 | { |
150 | ch->cmt->write_control(ch->cmt->mapbase_ch, CMCSR, value); | 152 | ch->cmt->write_control(ch->base, CMCSR, value); |
151 | } | 153 | } |
152 | 154 | ||
153 | static inline void sh_cmt_write_cmcnt(struct sh_cmt_channel *ch, | 155 | static inline void sh_cmt_write_cmcnt(struct sh_cmt_channel *ch, |
154 | unsigned long value) | 156 | unsigned long value) |
155 | { | 157 | { |
156 | ch->cmt->write_count(ch->cmt->mapbase_ch, CMCNT, value); | 158 | ch->cmt->write_count(ch->base, CMCNT, value); |
157 | } | 159 | } |
158 | 160 | ||
159 | static inline void sh_cmt_write_cmcor(struct sh_cmt_channel *ch, | 161 | static inline void sh_cmt_write_cmcor(struct sh_cmt_channel *ch, |
160 | unsigned long value) | 162 | unsigned long value) |
161 | { | 163 | { |
162 | ch->cmt->write_count(ch->cmt->mapbase_ch, CMCOR, value); | 164 | ch->cmt->write_count(ch->base, CMCOR, value); |
163 | } | 165 | } |
164 | 166 | ||
165 | static unsigned long sh_cmt_get_counter(struct sh_cmt_channel *ch, | 167 | static unsigned long sh_cmt_get_counter(struct sh_cmt_channel *ch, |
@@ -702,6 +704,7 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, | |||
702 | 704 | ||
703 | memset(ch, 0, sizeof(*ch)); | 705 | memset(ch, 0, sizeof(*ch)); |
704 | ch->cmt = cmt; | 706 | ch->cmt = cmt; |
707 | ch->base = cmt->mapbase_ch; | ||
705 | 708 | ||
706 | irq = platform_get_irq(cmt->pdev, 0); | 709 | irq = platform_get_irq(cmt->pdev, 0); |
707 | if (irq < 0) { | 710 | if (irq < 0) { |