diff options
Diffstat (limited to 'arch/sh/drivers/heartbeat.c')
-rw-r--r-- | arch/sh/drivers/heartbeat.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/arch/sh/drivers/heartbeat.c b/arch/sh/drivers/heartbeat.c index a9339a6174fc..2acbc793032d 100644 --- a/arch/sh/drivers/heartbeat.c +++ b/arch/sh/drivers/heartbeat.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Generic heartbeat driver for regular LED banks | 2 | * Generic heartbeat driver for regular LED banks |
3 | * | 3 | * |
4 | * Copyright (C) 2007 Paul Mundt | 4 | * Copyright (C) 2007 - 2010 Paul Mundt |
5 | * | 5 | * |
6 | * Most SH reference boards include a number of individual LEDs that can | 6 | * Most SH reference boards include a number of individual LEDs that can |
7 | * be independently controlled (either via a pre-defined hardware | 7 | * be independently controlled (either via a pre-defined hardware |
@@ -27,7 +27,7 @@ | |||
27 | #include <asm/heartbeat.h> | 27 | #include <asm/heartbeat.h> |
28 | 28 | ||
29 | #define DRV_NAME "heartbeat" | 29 | #define DRV_NAME "heartbeat" |
30 | #define DRV_VERSION "0.1.1" | 30 | #define DRV_VERSION "0.1.2" |
31 | 31 | ||
32 | static unsigned char default_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 }; | 32 | static unsigned char default_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 }; |
33 | 33 | ||
@@ -98,7 +98,7 @@ static int heartbeat_drv_probe(struct platform_device *pdev) | |||
98 | return -ENOMEM; | 98 | return -ENOMEM; |
99 | } | 99 | } |
100 | 100 | ||
101 | hd->base = ioremap_nocache(res->start, res->end - res->start + 1); | 101 | hd->base = ioremap_nocache(res->start, resource_size(res)); |
102 | if (unlikely(!hd->base)) { | 102 | if (unlikely(!hd->base)) { |
103 | dev_err(&pdev->dev, "ioremap failed\n"); | 103 | dev_err(&pdev->dev, "ioremap failed\n"); |
104 | 104 | ||
@@ -117,8 +117,20 @@ static int heartbeat_drv_probe(struct platform_device *pdev) | |||
117 | for (i = 0; i < hd->nr_bits; i++) | 117 | for (i = 0; i < hd->nr_bits; i++) |
118 | hd->mask |= (1 << hd->bit_pos[i]); | 118 | hd->mask |= (1 << hd->bit_pos[i]); |
119 | 119 | ||
120 | if (!hd->regsize) | 120 | if (!hd->regsize) { |
121 | hd->regsize = 8; /* default access size */ | 121 | switch (res->flags & IORESOURCE_MEM_TYPE_MASK) { |
122 | case IORESOURCE_MEM_32BIT: | ||
123 | hd->regsize = 32; | ||
124 | break; | ||
125 | case IORESOURCE_MEM_16BIT: | ||
126 | hd->regsize = 16; | ||
127 | break; | ||
128 | case IORESOURCE_MEM_8BIT: | ||
129 | default: | ||
130 | hd->regsize = 8; | ||
131 | break; | ||
132 | } | ||
133 | } | ||
122 | 134 | ||
123 | setup_timer(&hd->timer, heartbeat_timer, (unsigned long)hd); | 135 | setup_timer(&hd->timer, heartbeat_timer, (unsigned long)hd); |
124 | platform_set_drvdata(pdev, hd); | 136 | platform_set_drvdata(pdev, hd); |