Commit 42bfad4f71637c4eb4791aa8062063c4a8526522

Authored by Michael Buesch
Committed by John W. Linville
1 parent 58ff70d4fe

ssb: Fix watchdog access for devices without a chipcommon

This fixes the SSB watchdog access for devices without a chipcommon.
These devices have the watchdog on the extif.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 7 changed files with 63 additions and 0 deletions Side-by-side Diff

... ... @@ -105,6 +105,12 @@
105 105  
106 106 If unsure, say N
107 107  
  108 +# Assumption: We are on embedded, if we compile the MIPS core.
  109 +config SSB_EMBEDDED
  110 + bool
  111 + depends on SSB_DRIVER_MIPS
  112 + default y
  113 +
108 114 config SSB_DRIVER_EXTIF
109 115 bool "SSB Broadcom EXTIF core driver (EXPERIMENTAL)"
110 116 depends on SSB_DRIVER_MIPS && EXPERIMENTAL
drivers/ssb/Makefile
1 1 # core
2 2 ssb-y += main.o scan.o
  3 +ssb-$(CONFIG_SSB_EMBEDDED) += embedded.o
3 4  
4 5 # host support
5 6 ssb-$(CONFIG_SSB_PCIHOST) += pci.o pcihost_wrapper.o
drivers/ssb/driver_extif.c
... ... @@ -110,6 +110,12 @@
110 110 *m = extif_read32(extif, SSB_EXTIF_CLOCK_SB);
111 111 }
112 112  
  113 +void ssb_extif_watchdog_timer_set(struct ssb_extif *extif,
  114 + u32 ticks)
  115 +{
  116 + extif_write32(extif, SSB_EXTIF_WATCHDOG, ticks);
  117 +}
  118 +
113 119 u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask)
114 120 {
115 121 return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
drivers/ssb/embedded.c
  1 +/*
  2 + * Sonics Silicon Backplane
  3 + * Embedded systems support code
  4 + *
  5 + * Copyright 2005-2008, Broadcom Corporation
  6 + * Copyright 2006-2008, Michael Buesch <mb@bu3sch.de>
  7 + *
  8 + * Licensed under the GNU/GPL. See COPYING for details.
  9 + */
  10 +
  11 +#include <linux/ssb/ssb.h>
  12 +#include <linux/ssb/ssb_embedded.h>
  13 +
  14 +
  15 +int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks)
  16 +{
  17 + if (ssb_chipco_available(&bus->chipco)) {
  18 + ssb_chipco_watchdog_timer_set(&bus->chipco, ticks);
  19 + return 0;
  20 + }
  21 + if (ssb_extif_available(&bus->extif)) {
  22 + ssb_extif_watchdog_timer_set(&bus->extif, ticks);
  23 + return 0;
  24 + }
  25 + return -ENODEV;
  26 +}
include/linux/ssb/ssb_driver_chipcommon.h
... ... @@ -360,6 +360,11 @@
360 360 u16 fast_pwrup_delay;
361 361 };
362 362  
  363 +static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
  364 +{
  365 + return (cc->dev != NULL);
  366 +}
  367 +
363 368 extern void ssb_chipcommon_init(struct ssb_chipcommon *cc);
364 369  
365 370 #include <linux/pm.h>
include/linux/ssb/ssb_driver_extif.h
... ... @@ -171,6 +171,9 @@
171 171 extern void ssb_extif_timing_init(struct ssb_extif *extif,
172 172 unsigned long ns);
173 173  
  174 +extern void ssb_extif_watchdog_timer_set(struct ssb_extif *extif,
  175 + u32 ticks);
  176 +
174 177 u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask);
175 178  
176 179 void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value);
... ... @@ -197,6 +200,12 @@
197 200 static inline
198 201 void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
199 202 u32 *plltype, u32 *n, u32 *m)
  203 +{
  204 +}
  205 +
  206 +static inline
  207 +void ssb_extif_watchdog_timer_set(struct ssb_extif *extif,
  208 + u32 ticks)
200 209 {
201 210 }
202 211  
include/linux/ssb/ssb_embedded.h
  1 +#ifndef LINUX_SSB_EMBEDDED_H_
  2 +#define LINUX_SSB_EMBEDDED_H_
  3 +
  4 +#include <linux/types.h>
  5 +#include <linux/ssb/ssb.h>
  6 +
  7 +
  8 +extern int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks);
  9 +
  10 +#endif /* LINUX_SSB_EMBEDDED_H_ */