|
18 | 18 | #include <linux/delay.h>
|
19 | 19 | #include <linux/of_address.h>
|
20 | 20 | #include <linux/of_irq.h>
|
| 21 | +#include <linux/platform_device.h> |
21 | 22 | /* Goes away with OF conversion */
|
22 | 23 | #include <linux/platform_data/timer-ixp4xx.h>
|
23 | 24 |
|
|
29 | 30 | #define IXP4XX_OSRT1_OFFSET 0x08 /* Timer 1 Reload */
|
30 | 31 | #define IXP4XX_OST2_OFFSET 0x0C /* Timer 2 Timestamp */
|
31 | 32 | #define IXP4XX_OSRT2_OFFSET 0x10 /* Timer 2 Reload */
|
32 |
| -#define IXP4XX_OSWT_OFFSET 0x14 /* Watchdog Timer */ |
33 |
| -#define IXP4XX_OSWE_OFFSET 0x18 /* Watchdog Enable */ |
34 |
| -#define IXP4XX_OSWK_OFFSET 0x1C /* Watchdog Key */ |
35 | 33 | #define IXP4XX_OSST_OFFSET 0x20 /* Timer Status */
|
36 | 34 |
|
37 | 35 | /*
|
|
45 | 43 | #define IXP4XX_OSST_TIMER_1_PEND 0x00000001
|
46 | 44 | #define IXP4XX_OSST_TIMER_2_PEND 0x00000002
|
47 | 45 | #define IXP4XX_OSST_TIMER_TS_PEND 0x00000004
|
48 |
| -#define IXP4XX_OSST_TIMER_WDOG_PEND 0x00000008 |
49 |
| -#define IXP4XX_OSST_TIMER_WARM_RESET 0x00000010 |
50 |
| - |
51 |
| -#define IXP4XX_WDT_KEY 0x0000482E |
52 |
| -#define IXP4XX_WDT_RESET_ENABLE 0x00000001 |
53 |
| -#define IXP4XX_WDT_IRQ_ENABLE 0x00000002 |
54 |
| -#define IXP4XX_WDT_COUNT_ENABLE 0x00000004 |
| 46 | +/* Remaining registers are for the watchdog and defined in the watchdog driver */ |
55 | 47 |
|
56 | 48 | struct ixp4xx_timer {
|
57 | 49 | void __iomem *base;
|
58 |
| - unsigned int tick_rate; |
59 | 50 | u32 latch;
|
60 | 51 | struct clock_event_device clkevt;
|
61 | 52 | #ifdef CONFIG_ARM
|
@@ -181,7 +172,6 @@ static __init int ixp4xx_timer_register(void __iomem *base,
|
181 | 172 | if (!tmr)
|
182 | 173 | return -ENOMEM;
|
183 | 174 | tmr->base = base;
|
184 |
| - tmr->tick_rate = timer_freq; |
185 | 175 |
|
186 | 176 | /*
|
187 | 177 | * The timer register doesn't allow to specify the two least
|
@@ -239,6 +229,40 @@ static __init int ixp4xx_timer_register(void __iomem *base,
|
239 | 229 | return 0;
|
240 | 230 | }
|
241 | 231 |
|
| 232 | +static struct platform_device ixp4xx_watchdog_device = { |
| 233 | + .name = "ixp4xx-watchdog", |
| 234 | + .id = -1, |
| 235 | +}; |
| 236 | + |
| 237 | +/* |
| 238 | + * This probe gets called after the timer is already up and running. The main |
| 239 | + * function on this platform is to spawn the watchdog device as a child. |
| 240 | + */ |
| 241 | +static int ixp4xx_timer_probe(struct platform_device *pdev) |
| 242 | +{ |
| 243 | + struct device *dev = &pdev->dev; |
| 244 | + |
| 245 | + /* Pass the base address as platform data and nothing else */ |
| 246 | + ixp4xx_watchdog_device.dev.platform_data = local_ixp4xx_timer->base; |
| 247 | + ixp4xx_watchdog_device.dev.parent = dev; |
| 248 | + return platform_device_register(&ixp4xx_watchdog_device); |
| 249 | +} |
| 250 | + |
| 251 | +static const struct of_device_id ixp4xx_timer_dt_id[] = { |
| 252 | + { .compatible = "intel,ixp4xx-timer", }, |
| 253 | + { /* sentinel */ }, |
| 254 | +}; |
| 255 | + |
| 256 | +static struct platform_driver ixp4xx_timer_driver = { |
| 257 | + .probe = ixp4xx_timer_probe, |
| 258 | + .driver = { |
| 259 | + .name = "ixp4xx-timer", |
| 260 | + .of_match_table = ixp4xx_timer_dt_id, |
| 261 | + .suppress_bind_attrs = true, |
| 262 | + }, |
| 263 | +}; |
| 264 | +builtin_platform_driver(ixp4xx_timer_driver); |
| 265 | + |
242 | 266 | /**
|
243 | 267 | * ixp4xx_timer_setup() - Timer setup function to be called from boardfiles
|
244 | 268 | * @timerbase: physical base of timer block
|
|
0 commit comments