aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/bcma/driver_chipcommon.c38
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h4
2 files changed, 39 insertions, 3 deletions
diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c
index 7c132e5eceb..117222697e1 100644
--- a/drivers/bcma/driver_chipcommon.c
+++ b/drivers/bcma/driver_chipcommon.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include "bcma_private.h" 12#include "bcma_private.h"
13#include <linux/bcm47xx_wdt.h>
13#include <linux/export.h> 14#include <linux/export.h>
14#include <linux/bcma/bcma.h> 15#include <linux/bcma/bcma.h>
15 16
@@ -52,6 +53,39 @@ static u32 bcma_chipco_watchdog_get_max_timer(struct bcma_drv_cc *cc)
52 return (1 << nb) - 1; 53 return (1 << nb) - 1;
53} 54}
54 55
56static u32 bcma_chipco_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt,
57 u32 ticks)
58{
59 struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt);
60
61 return bcma_chipco_watchdog_timer_set(cc, ticks);
62}
63
64static u32 bcma_chipco_watchdog_timer_set_ms_wdt(struct bcm47xx_wdt *wdt,
65 u32 ms)
66{
67 struct bcma_drv_cc *cc = bcm47xx_wdt_get_drvdata(wdt);
68 u32 ticks;
69
70 ticks = bcma_chipco_watchdog_timer_set(cc, cc->ticks_per_ms * ms);
71 return ticks / cc->ticks_per_ms;
72}
73
74static int bcma_chipco_watchdog_ticks_per_ms(struct bcma_drv_cc *cc)
75{
76 struct bcma_bus *bus = cc->core->bus;
77
78 if (cc->capabilities & BCMA_CC_CAP_PMU) {
79 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
80 /* 4706 CC and PMU watchdogs are clocked at 1/4 of ALP clock */
81 return bcma_chipco_alp_clock(cc) / 4000;
82 else
83 /* based on 32KHz ILP clock */
84 return 32;
85 } else {
86 return bcma_chipco_alp_clock(cc) / 1000;
87 }
88}
55 89
56void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc) 90void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc)
57{ 91{
@@ -100,12 +134,13 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
100 ((leddc_on << BCMA_CC_GPIOTIMER_ONTIME_SHIFT) | 134 ((leddc_on << BCMA_CC_GPIOTIMER_ONTIME_SHIFT) |
101 (leddc_off << BCMA_CC_GPIOTIMER_OFFTIME_SHIFT))); 135 (leddc_off << BCMA_CC_GPIOTIMER_OFFTIME_SHIFT)));
102 } 136 }
137 cc->ticks_per_ms = bcma_chipco_watchdog_ticks_per_ms(cc);
103 138
104 cc->setup_done = true; 139 cc->setup_done = true;
105} 140}
106 141
107/* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */ 142/* Set chip watchdog reset timer to fire in 'ticks' backplane cycles */
108void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks) 143u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks)
109{ 144{
110 u32 maxt; 145 u32 maxt;
111 enum bcma_clkmode clkmode; 146 enum bcma_clkmode clkmode;
@@ -125,6 +160,7 @@ void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks)
125 /* instant NMI */ 160 /* instant NMI */
126 bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks); 161 bcma_cc_write32(cc, BCMA_CC_WATCHDOG, ticks);
127 } 162 }
163 return ticks;
128} 164}
129 165
130void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value) 166void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value)
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 145f3c56227..2f9b01493a9 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -570,6 +570,7 @@ struct bcma_drv_cc {
570 int nr_serial_ports; 570 int nr_serial_ports;
571 struct bcma_serial_port serial_ports[4]; 571 struct bcma_serial_port serial_ports[4];
572#endif /* CONFIG_BCMA_DRIVER_MIPS */ 572#endif /* CONFIG_BCMA_DRIVER_MIPS */
573 u32 ticks_per_ms;
573}; 574};
574 575
575/* Register access */ 576/* Register access */
@@ -593,8 +594,7 @@ extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
593 594
594void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); 595void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
595 596
596extern void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, 597extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
597 u32 ticks);
598 598
599void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value); 599void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value);
600 600