1 --- a/drivers/ssb/embedded.c
2 +++ b/drivers/ssb/embedded.c
5 * Copyright 2005-2008, Broadcom Corporation
6 * Copyright 2006-2008, Michael Buesch <m@bues.ch>
7 + * Copyright 2012, Hauke Mehrtens <hauke@hauke-m.de>
9 * Licensed under the GNU/GPL. See COPYING for details.
12 #include <linux/export.h>
13 +#include <linux/platform_device.h>
14 #include <linux/ssb/ssb.h>
15 #include <linux/ssb/ssb_embedded.h>
16 #include <linux/ssb/ssb_driver_pci.h>
17 @@ -32,6 +34,39 @@ int ssb_watchdog_timer_set(struct ssb_bu
19 EXPORT_SYMBOL(ssb_watchdog_timer_set);
21 +int ssb_watchdog_register(struct ssb_bus *bus)
23 + struct bcm47xx_wdt wdt = {};
24 + struct platform_device *pdev;
26 + if (ssb_chipco_available(&bus->chipco)) {
27 + wdt.driver_data = &bus->chipco;
28 + wdt.timer_set = ssb_chipco_watchdog_timer_set_wdt;
29 + wdt.timer_set_ms = ssb_chipco_watchdog_timer_set_ms;
30 + wdt.max_timer_ms = bus->chipco.max_timer_ms;
31 + } else if (ssb_extif_available(&bus->extif)) {
32 + wdt.driver_data = &bus->extif;
33 + wdt.timer_set = ssb_extif_watchdog_timer_set_wdt;
34 + wdt.timer_set_ms = ssb_extif_watchdog_timer_set_ms;
35 + wdt.max_timer_ms = SSB_EXTIF_WATCHDOG_MAX_TIMER_MS;
40 + pdev = platform_device_register_data(NULL, "bcm47xx-wdt",
41 + bus->busnumber, &wdt,
44 + ssb_dprintk(KERN_INFO PFX
45 + "can not register watchdog device, err: %li\n",
47 + return PTR_ERR(pdev);
50 + bus->watchdog = pdev;
54 u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask)
57 --- a/drivers/ssb/main.c
58 +++ b/drivers/ssb/main.c
60 #include <linux/delay.h>
62 #include <linux/module.h>
63 +#include <linux/platform_device.h>
64 #include <linux/ssb/ssb.h>
65 #include <linux/ssb/ssb_regs.h>
66 #include <linux/ssb/ssb_driver_gige.h>
67 @@ -434,6 +435,11 @@ static void ssb_devices_unregister(struc
69 device_unregister(sdev->dev);
72 +#ifdef CONFIG_SSB_EMBEDDED
73 + if (bus->bustype == SSB_BUSTYPE_SSB)
74 + platform_device_unregister(bus->watchdog);
78 void ssb_bus_unregister(struct ssb_bus *bus)
79 @@ -579,6 +585,8 @@ static int __devinit ssb_attach_queued_b
82 ssb_pcicore_init(&bus->pcicore);
83 + if (bus->bustype == SSB_BUSTYPE_SSB)
84 + ssb_watchdog_register(bus);
85 ssb_bus_may_powerdown(bus);
87 err = ssb_devices_register(bus);
88 --- a/drivers/ssb/ssb_private.h
89 +++ b/drivers/ssb/ssb_private.h
90 @@ -246,4 +246,14 @@ static inline u32 ssb_extif_watchdog_tim
95 +#ifdef CONFIG_SSB_EMBEDDED
96 +extern int ssb_watchdog_register(struct ssb_bus *bus);
97 +#else /* CONFIG_SSB_EMBEDDED */
98 +static inline int ssb_watchdog_register(struct ssb_bus *bus)
102 +#endif /* CONFIG_SSB_EMBEDDED */
104 #endif /* LINUX_SSB_PRIVATE_H_ */
105 --- a/include/linux/ssb/ssb.h
106 +++ b/include/linux/ssb/ssb.h
108 #include <linux/pci.h>
109 #include <linux/mod_devicetable.h>
110 #include <linux/dma-mapping.h>
111 +#include <linux/platform_device.h>
113 #include <linux/ssb/ssb_regs.h>
115 @@ -432,6 +433,7 @@ struct ssb_bus {
116 #ifdef CONFIG_SSB_EMBEDDED
117 /* Lock for GPIO register access. */
118 spinlock_t gpio_lock;
119 + struct platform_device *watchdog;
120 #endif /* EMBEDDED */
122 /* Internal-only stuff follows. Do not touch. */