1 --- a/drivers/bcma/driver_chipcommon.c
2 +++ b/drivers/bcma/driver_chipcommon.c
6 #include "bcma_private.h"
7 +#include <linux/bcm47xx_wdt.h>
8 #include <linux/export.h>
9 #include <linux/bcma/bcma.h>
11 @@ -52,6 +53,39 @@ static u32 bcma_chipco_watchdog_get_max_
15 +static u32 bcma_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt,
18 + struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt);
20 + return bcma_chipco_watchdog_timer_set(cc, ticks);
23 +static u32 bcma_chipco_watchdog_timer_set_ms_wdt(struct bcm47xx_wdt *wdt,
26 + struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt);
29 + ticks = bcma_chipco_watchdog_timer_set(cc, cc->ticks_per_ms * ms);
30 + return ticks / cc->ticks_per_ms;
33 +static int bcma_chipco_watchdog_ticks_per_ms(struct bcma_drv_cc *cc)
35 + struct bcma_bus *bus = cc->core->bus;
37 + if (cc->capabilities & BCMA_CC_CAP_PMU) {
38 + if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
39 + /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */
40 + return bcma_chipco_alp_clock(cc) / 4000;
42 + /* based on 32KHz ILP clock */
45 + return bcma_chipco_alp_clock(cc) / 1000;
49 void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc)
51 @@ -102,12 +136,13 @@ void bcma_core_chipcommon_init(struct bc
54 spin_lock_init(&cc->gpio_lock);
55 + cc->ticks_per_ms = bcma_chipco_watchdog_ticks_per_ms(cc);
57 cc->setup_done = true;
60 /* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */
61 -void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks)
62 +u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks)
65 enum bcma_clkmode clkmode;
66 @@ -126,6 +161,7 @@ void bcma_chipco_watchdog_timer_set(stru
68 bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks);
73 void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value)
74 --- a/include/linux/bcma/bcma_driver_chipcommon.h
75 +++ b/include/linux/bcma/bcma_driver_chipcommon.h
76 @@ -554,6 +554,7 @@ struct bcma_drv_cc {
78 /* Lock for GPIO register access. */
84 @@ -577,8 +578,7 @@ extern void bcma_chipco_resume(struct bc
86 void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
88 -extern void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc,
90 +extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
92 void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value);