diff options
author | Victor Kamensky <victor.kamensky@linaro.org> | 2013-11-15 19:01:05 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2013-11-17 13:42:38 -0500 |
commit | 4a7e94a0637da7e1ddce748da49ae780c370eeef (patch) | |
tree | 561c2e0628f2d4851593e57bb48f45facb7b2a70 | |
parent | b0df38dd3554d47fcfd5c1183951c2fe7dd07eda (diff) |
watchdog: omap_wdt: raw read and write endian fix
All OMAP IP blocks expect LE data, but CPU may operate in BE mode.
Need to use endian neutral functions to read/write h/w registers.
I.e instead of __raw_read[lw] and __raw_write[lw] functions code
need to use read[lw]_relaxed and write[lw]_relaxed functions.
If the first simply reads/writes register, the second will byteswap
it if host operates in BE mode.
Changes are trivial sed like replacement of __raw_xxx functions
with xxx_relaxed variant.
Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | drivers/watchdog/omap_wdt.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 7b79ca093e89..09cf0135e8ac 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c | |||
@@ -68,14 +68,14 @@ static void omap_wdt_reload(struct omap_wdt_dev *wdev) | |||
68 | void __iomem *base = wdev->base; | 68 | void __iomem *base = wdev->base; |
69 | 69 | ||
70 | /* wait for posted write to complete */ | 70 | /* wait for posted write to complete */ |
71 | while ((__raw_readl(base + OMAP_WATCHDOG_WPS)) & 0x08) | 71 | while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x08) |
72 | cpu_relax(); | 72 | cpu_relax(); |
73 | 73 | ||
74 | wdev->wdt_trgr_pattern = ~wdev->wdt_trgr_pattern; | 74 | wdev->wdt_trgr_pattern = ~wdev->wdt_trgr_pattern; |
75 | __raw_writel(wdev->wdt_trgr_pattern, (base + OMAP_WATCHDOG_TGR)); | 75 | writel_relaxed(wdev->wdt_trgr_pattern, (base + OMAP_WATCHDOG_TGR)); |
76 | 76 | ||
77 | /* wait for posted write to complete */ | 77 | /* wait for posted write to complete */ |
78 | while ((__raw_readl(base + OMAP_WATCHDOG_WPS)) & 0x08) | 78 | while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x08) |
79 | cpu_relax(); | 79 | cpu_relax(); |
80 | /* reloaded WCRR from WLDR */ | 80 | /* reloaded WCRR from WLDR */ |
81 | } | 81 | } |
@@ -85,12 +85,12 @@ static void omap_wdt_enable(struct omap_wdt_dev *wdev) | |||
85 | void __iomem *base = wdev->base; | 85 | void __iomem *base = wdev->base; |
86 | 86 | ||
87 | /* Sequence to enable the watchdog */ | 87 | /* Sequence to enable the watchdog */ |
88 | __raw_writel(0xBBBB, base + OMAP_WATCHDOG_SPR); | 88 | writel_relaxed(0xBBBB, base + OMAP_WATCHDOG_SPR); |
89 | while ((__raw_readl(base + OMAP_WATCHDOG_WPS)) & 0x10) | 89 | while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x10) |
90 | cpu_relax(); | 90 | cpu_relax(); |
91 | 91 | ||
92 | __raw_writel(0x4444, base + OMAP_WATCHDOG_SPR); | 92 | writel_relaxed(0x4444, base + OMAP_WATCHDOG_SPR); |
93 | while ((__raw_readl(base + OMAP_WATCHDOG_WPS)) & 0x10) | 93 | while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x10) |
94 | cpu_relax(); | 94 | cpu_relax(); |
95 | } | 95 | } |
96 | 96 | ||
@@ -99,12 +99,12 @@ static void omap_wdt_disable(struct omap_wdt_dev *wdev) | |||
99 | void __iomem *base = wdev->base; | 99 | void __iomem *base = wdev->base; |
100 | 100 | ||
101 | /* sequence required to disable watchdog */ | 101 | /* sequence required to disable watchdog */ |
102 | __raw_writel(0xAAAA, base + OMAP_WATCHDOG_SPR); /* TIMER_MODE */ | 102 | writel_relaxed(0xAAAA, base + OMAP_WATCHDOG_SPR); /* TIMER_MODE */ |
103 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x10) | 103 | while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x10) |
104 | cpu_relax(); | 104 | cpu_relax(); |
105 | 105 | ||
106 | __raw_writel(0x5555, base + OMAP_WATCHDOG_SPR); /* TIMER_MODE */ | 106 | writel_relaxed(0x5555, base + OMAP_WATCHDOG_SPR); /* TIMER_MODE */ |
107 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x10) | 107 | while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x10) |
108 | cpu_relax(); | 108 | cpu_relax(); |
109 | } | 109 | } |
110 | 110 | ||
@@ -115,11 +115,11 @@ static void omap_wdt_set_timer(struct omap_wdt_dev *wdev, | |||
115 | void __iomem *base = wdev->base; | 115 | void __iomem *base = wdev->base; |
116 | 116 | ||
117 | /* just count up at 32 KHz */ | 117 | /* just count up at 32 KHz */ |
118 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x04) | 118 | while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x04) |
119 | cpu_relax(); | 119 | cpu_relax(); |
120 | 120 | ||
121 | __raw_writel(pre_margin, base + OMAP_WATCHDOG_LDR); | 121 | writel_relaxed(pre_margin, base + OMAP_WATCHDOG_LDR); |
122 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x04) | 122 | while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x04) |
123 | cpu_relax(); | 123 | cpu_relax(); |
124 | } | 124 | } |
125 | 125 | ||
@@ -135,11 +135,11 @@ static int omap_wdt_start(struct watchdog_device *wdog) | |||
135 | pm_runtime_get_sync(wdev->dev); | 135 | pm_runtime_get_sync(wdev->dev); |
136 | 136 | ||
137 | /* initialize prescaler */ | 137 | /* initialize prescaler */ |
138 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) | 138 | while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x01) |
139 | cpu_relax(); | 139 | cpu_relax(); |
140 | 140 | ||
141 | __raw_writel((1 << 5) | (PTV << 2), base + OMAP_WATCHDOG_CNTRL); | 141 | writel_relaxed((1 << 5) | (PTV << 2), base + OMAP_WATCHDOG_CNTRL); |
142 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) | 142 | while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x01) |
143 | cpu_relax(); | 143 | cpu_relax(); |
144 | 144 | ||
145 | omap_wdt_set_timer(wdev, wdog->timeout); | 145 | omap_wdt_set_timer(wdev, wdog->timeout); |
@@ -275,7 +275,7 @@ static int omap_wdt_probe(struct platform_device *pdev) | |||
275 | } | 275 | } |
276 | 276 | ||
277 | pr_info("OMAP Watchdog Timer Rev 0x%02x: initial timeout %d sec\n", | 277 | pr_info("OMAP Watchdog Timer Rev 0x%02x: initial timeout %d sec\n", |
278 | __raw_readl(wdev->base + OMAP_WATCHDOG_REV) & 0xFF, | 278 | readl_relaxed(wdev->base + OMAP_WATCHDOG_REV) & 0xFF, |
279 | omap_wdt->timeout); | 279 | omap_wdt->timeout); |
280 | 280 | ||
281 | pm_runtime_put_sync(wdev->dev); | 281 | pm_runtime_put_sync(wdev->dev); |