diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2012-12-05 12:46:08 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-12-06 14:58:58 -0500 |
commit | bde327eff8a722df1198df9b14464f84f1adfb65 (patch) | |
tree | dde6282acfa1957a4fa310540a9206aeba277d57 /drivers | |
parent | 9f640a6376e54fa9ae834c32cbe92cefeec970dc (diff) |
ssb: register watchdog driver
Register the watchdog driver to the system if it is a SoC. Using the
watchdog on a non SoC device, like a PCI card, will make the PCI
card die when the timeout expired, but starting it again is not
supported by ssb.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ssb/embedded.c | 35 | ||||
-rw-r--r-- | drivers/ssb/main.c | 8 | ||||
-rw-r--r-- | drivers/ssb/ssb_private.h | 10 |
3 files changed, 53 insertions, 0 deletions
diff --git a/drivers/ssb/embedded.c b/drivers/ssb/embedded.c index 9ef124f9ee2d..bb18d76f9f2c 100644 --- a/drivers/ssb/embedded.c +++ b/drivers/ssb/embedded.c | |||
@@ -4,11 +4,13 @@ | |||
4 | * | 4 | * |
5 | * Copyright 2005-2008, Broadcom Corporation | 5 | * Copyright 2005-2008, Broadcom Corporation |
6 | * Copyright 2006-2008, Michael Buesch <m@bues.ch> | 6 | * Copyright 2006-2008, Michael Buesch <m@bues.ch> |
7 | * Copyright 2012, Hauke Mehrtens <hauke@hauke-m.de> | ||
7 | * | 8 | * |
8 | * Licensed under the GNU/GPL. See COPYING for details. | 9 | * Licensed under the GNU/GPL. See COPYING for details. |
9 | */ | 10 | */ |
10 | 11 | ||
11 | #include <linux/export.h> | 12 | #include <linux/export.h> |
13 | #include <linux/platform_device.h> | ||
12 | #include <linux/ssb/ssb.h> | 14 | #include <linux/ssb/ssb.h> |
13 | #include <linux/ssb/ssb_embedded.h> | 15 | #include <linux/ssb/ssb_embedded.h> |
14 | #include <linux/ssb/ssb_driver_pci.h> | 16 | #include <linux/ssb/ssb_driver_pci.h> |
@@ -32,6 +34,39 @@ int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks) | |||
32 | } | 34 | } |
33 | EXPORT_SYMBOL(ssb_watchdog_timer_set); | 35 | EXPORT_SYMBOL(ssb_watchdog_timer_set); |
34 | 36 | ||
37 | int ssb_watchdog_register(struct ssb_bus *bus) | ||
38 | { | ||
39 | struct bcm47xx_wdt wdt = {}; | ||
40 | struct platform_device *pdev; | ||
41 | |||
42 | if (ssb_chipco_available(&bus->chipco)) { | ||
43 | wdt.driver_data = &bus->chipco; | ||
44 | wdt.timer_set = ssb_chipco_watchdog_timer_set_wdt; | ||
45 | wdt.timer_set_ms = ssb_chipco_watchdog_timer_set_ms; | ||
46 | wdt.max_timer_ms = bus->chipco.max_timer_ms; | ||
47 | } else if (ssb_extif_available(&bus->extif)) { | ||
48 | wdt.driver_data = &bus->extif; | ||
49 | wdt.timer_set = ssb_extif_watchdog_timer_set_wdt; | ||
50 | wdt.timer_set_ms = ssb_extif_watchdog_timer_set_ms; | ||
51 | wdt.max_timer_ms = SSB_EXTIF_WATCHDOG_MAX_TIMER_MS; | ||
52 | } else { | ||
53 | return -ENODEV; | ||
54 | } | ||
55 | |||
56 | pdev = platform_device_register_data(NULL, "bcm47xx-wdt", | ||
57 | bus->busnumber, &wdt, | ||
58 | sizeof(wdt)); | ||
59 | if (IS_ERR(pdev)) { | ||
60 | ssb_dprintk(KERN_INFO PFX | ||
61 | "can not register watchdog device, err: %li\n", | ||
62 | PTR_ERR(pdev)); | ||
63 | return PTR_ERR(pdev); | ||
64 | } | ||
65 | |||
66 | bus->watchdog = pdev; | ||
67 | return 0; | ||
68 | } | ||
69 | |||
35 | u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask) | 70 | u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask) |
36 | { | 71 | { |
37 | unsigned long flags; | 72 | unsigned long flags; |
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index df0f145c22fc..58c7da29a37c 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/platform_device.h> | ||
16 | #include <linux/ssb/ssb.h> | 17 | #include <linux/ssb/ssb.h> |
17 | #include <linux/ssb/ssb_regs.h> | 18 | #include <linux/ssb/ssb_regs.h> |
18 | #include <linux/ssb/ssb_driver_gige.h> | 19 | #include <linux/ssb/ssb_driver_gige.h> |
@@ -433,6 +434,11 @@ static void ssb_devices_unregister(struct ssb_bus *bus) | |||
433 | if (sdev->dev) | 434 | if (sdev->dev) |
434 | device_unregister(sdev->dev); | 435 | device_unregister(sdev->dev); |
435 | } | 436 | } |
437 | |||
438 | #ifdef CONFIG_SSB_EMBEDDED | ||
439 | if (bus->bustype == SSB_BUSTYPE_SSB) | ||
440 | platform_device_unregister(bus->watchdog); | ||
441 | #endif | ||
436 | } | 442 | } |
437 | 443 | ||
438 | void ssb_bus_unregister(struct ssb_bus *bus) | 444 | void ssb_bus_unregister(struct ssb_bus *bus) |
@@ -561,6 +567,8 @@ static int __devinit ssb_attach_queued_buses(void) | |||
561 | if (err) | 567 | if (err) |
562 | goto error; | 568 | goto error; |
563 | ssb_pcicore_init(&bus->pcicore); | 569 | ssb_pcicore_init(&bus->pcicore); |
570 | if (bus->bustype == SSB_BUSTYPE_SSB) | ||
571 | ssb_watchdog_register(bus); | ||
564 | ssb_bus_may_powerdown(bus); | 572 | ssb_bus_may_powerdown(bus); |
565 | 573 | ||
566 | err = ssb_devices_register(bus); | 574 | err = ssb_devices_register(bus); |
diff --git a/drivers/ssb/ssb_private.h b/drivers/ssb/ssb_private.h index 50ea02877777..8942db1d855a 100644 --- a/drivers/ssb/ssb_private.h +++ b/drivers/ssb/ssb_private.h | |||
@@ -232,4 +232,14 @@ static inline u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, | |||
232 | return 0; | 232 | return 0; |
233 | } | 233 | } |
234 | #endif | 234 | #endif |
235 | |||
236 | #ifdef CONFIG_SSB_EMBEDDED | ||
237 | extern int ssb_watchdog_register(struct ssb_bus *bus); | ||
238 | #else /* CONFIG_SSB_EMBEDDED */ | ||
239 | static inline int ssb_watchdog_register(struct ssb_bus *bus) | ||
240 | { | ||
241 | return 0; | ||
242 | } | ||
243 | #endif /* CONFIG_SSB_EMBEDDED */ | ||
244 | |||
235 | #endif /* LINUX_SSB_PRIVATE_H_ */ | 245 | #endif /* LINUX_SSB_PRIVATE_H_ */ |