Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163446
b: refs/heads/master
c: e174d13
h: refs/heads/master
v: v3
  • Loading branch information
Kuninori Morimoto authored and Paul Mundt committed Aug 18, 2009
1 parent 11ee3f5 commit 29d10ce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b2ea8b421515ddd692c88fc5afb0e7f93e96e6cb
refs/heads/master: e174d13010a6bd52045466bc35ca5a86e3f3ba9b
10 changes: 10 additions & 0 deletions trunk/arch/sh/drivers/heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,19 @@ static inline void heartbeat_toggle_bit(struct heartbeat_data *hd,
if (inverted)
new = ~new;

new &= hd->mask;

switch (hd->regsize) {
case 32:
new |= ioread32(hd->base) & ~hd->mask;
iowrite32(new, hd->base);
break;
case 16:
new |= ioread16(hd->base) & ~hd->mask;
iowrite16(new, hd->base);
break;
default:
new |= ioread8(hd->base) & ~hd->mask;
iowrite8(new, hd->base);
break;
}
Expand All @@ -72,6 +77,7 @@ static int heartbeat_drv_probe(struct platform_device *pdev)
{
struct resource *res;
struct heartbeat_data *hd;
int i;

if (unlikely(pdev->num_resources != 1)) {
dev_err(&pdev->dev, "invalid number of resources\n");
Expand Down Expand Up @@ -107,6 +113,10 @@ static int heartbeat_drv_probe(struct platform_device *pdev)
hd->nr_bits = ARRAY_SIZE(default_bit_pos);
}

hd->mask = 0;
for (i = 0; i < hd->nr_bits; i++)
hd->mask |= (1 << hd->bit_pos[i]);

if (!hd->regsize)
hd->regsize = 8; /* default access size */

Expand Down
1 change: 1 addition & 0 deletions trunk/arch/sh/include/asm/heartbeat.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct heartbeat_data {
unsigned int nr_bits;
struct timer_list timer;
unsigned int regsize;
unsigned int mask;
unsigned long flags;
};

Expand Down

0 comments on commit 29d10ce

Please sign in to comment.