aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2012-12-05 12:46:02 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-12-06 14:58:57 -0500
commita4855f39d4eb3f550ca5f4aac79bd999da42dc54 (patch)
treec334a19f43462a6def7abfca4c372385ce2bbdea
parenta22a3114a820ca3eadee6af53d90736e5ca68fa1 (diff)
bcma: register watchdog driver
Register the watchdog driver to the system if this is a SoC. Using the watchdog on a non SoC device, like a PCIe card, will make the PCIe card die when the timeout expired, but starting it again is not supported by bcma. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/bcma/bcma_private.h2
-rw-r--r--drivers/bcma/driver_chipcommon.c22
-rw-r--r--drivers/bcma/main.c8
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h3
4 files changed, 35 insertions, 0 deletions
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
index 169fc58427d3..bcb830ec4bb4 100644
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
@@ -84,6 +84,8 @@ extern void __exit bcma_host_pci_exit(void);
84/* driver_pci.c */ 84/* driver_pci.c */
85u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address); 85u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
86 86
87extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
88
87#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE 89#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
88bool __devinit bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc); 90bool __devinit bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc);
89void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); 91void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc);
diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c
index 117222697e1f..d017f2512275 100644
--- a/drivers/bcma/driver_chipcommon.c
+++ b/drivers/bcma/driver_chipcommon.c
@@ -12,6 +12,7 @@
12#include "bcma_private.h" 12#include "bcma_private.h"
13#include <linux/bcm47xx_wdt.h> 13#include <linux/bcm47xx_wdt.h>
14#include <linux/export.h> 14#include <linux/export.h>
15#include <linux/platform_device.h>
15#include <linux/bcma/bcma.h> 16#include <linux/bcma/bcma.h>
16 17
17static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset, 18static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
@@ -87,6 +88,27 @@ static int bcma_chipco_watchdog_ticks_per_ms(struct bcma_drv_cc *cc)
87 } 88 }
88} 89}
89 90
91int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc)
92{
93 struct bcm47xx_wdt wdt = {};
94 struct platform_device *pdev;
95
96 wdt.driver_data = cc;
97 wdt.timer_set = bcma_chipco_watchdog_timer_set_wdt;
98 wdt.timer_set_ms = bcma_chipco_watchdog_timer_set_ms_wdt;
99 wdt.max_timer_ms = bcma_chipco_watchdog_get_max_timer(cc) / cc->ticks_per_ms;
100
101 pdev = platform_device_register_data(NULL, "bcm47xx-wdt",
102 cc->core->bus->num, &wdt,
103 sizeof(wdt));
104 if (IS_ERR(pdev))
105 return PTR_ERR(pdev);
106
107 cc->watchdog = pdev;
108
109 return 0;
110}
111
90void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) 112void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc)
91{ 113{
92 if (cc->early_setup_done) 114 if (cc->early_setup_done)
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index a9718893000b..debd4f142f93 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -165,6 +165,12 @@ static int bcma_register_cores(struct bcma_bus *bus)
165 } 165 }
166#endif 166#endif
167 167
168 if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
169 err = bcma_chipco_watchdog_register(&bus->drv_cc);
170 if (err)
171 bcma_err(bus, "Error registering watchdog driver\n");
172 }
173
168 return 0; 174 return 0;
169} 175}
170 176
@@ -177,6 +183,8 @@ static void bcma_unregister_cores(struct bcma_bus *bus)
177 if (core->dev_registered) 183 if (core->dev_registered)
178 device_unregister(&core->dev); 184 device_unregister(&core->dev);
179 } 185 }
186 if (bus->hosttype == BCMA_HOSTTYPE_SOC)
187 platform_device_unregister(bus->drv_cc.watchdog);
180} 188}
181 189
182int __devinit bcma_bus_register(struct bcma_bus *bus) 190int __devinit bcma_bus_register(struct bcma_bus *bus)
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 2f9b01493a90..e51359180b6f 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -1,6 +1,8 @@
1#ifndef LINUX_BCMA_DRIVER_CC_H_ 1#ifndef LINUX_BCMA_DRIVER_CC_H_
2#define LINUX_BCMA_DRIVER_CC_H_ 2#define LINUX_BCMA_DRIVER_CC_H_
3 3
4#include <linux/platform_device.h>
5
4/** ChipCommon core registers. **/ 6/** ChipCommon core registers. **/
5#define BCMA_CC_ID 0x0000 7#define BCMA_CC_ID 0x0000
6#define BCMA_CC_ID_ID 0x0000FFFF 8#define BCMA_CC_ID_ID 0x0000FFFF
@@ -571,6 +573,7 @@ struct bcma_drv_cc {
571 struct bcma_serial_port serial_ports[4]; 573 struct bcma_serial_port serial_ports[4];
572#endif /* CONFIG_BCMA_DRIVER_MIPS */ 574#endif /* CONFIG_BCMA_DRIVER_MIPS */
573 u32 ticks_per_ms; 575 u32 ticks_per_ms;
576 struct platform_device *watchdog;
574}; 577};
575 578
576/* Register access */ 579/* Register access */