add initial 2.6.28 support for brcm47xx target
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-2.6.23 / 610-ssb-watchdog-fix.patch
1 --- a/drivers/ssb/Kconfig
2 +++ b/drivers/ssb/Kconfig
3 @@ -105,6 +105,12 @@
4
5 If unsure, say N
6
7 +# Assumption: We are on embedded, if we compile the MIPS core.
8 +config SSB_EMBEDDED
9 + bool
10 + depends on SSB_DRIVER_MIPS
11 + default y
12 +
13 config SSB_DRIVER_EXTIF
14 bool "SSB Broadcom EXTIF core driver (EXPERIMENTAL)"
15 depends on SSB_DRIVER_MIPS && EXPERIMENTAL
16 --- a/drivers/ssb/Makefile
17 +++ b/drivers/ssb/Makefile
18 @@ -1,5 +1,6 @@
19 # core
20 ssb-y += main.o scan.o
21 +ssb-$(CONFIG_SSB_EMBEDDED) += embedded.o
22
23 # host support
24 ssb-$(CONFIG_SSB_PCIHOST) += pci.o pcihost_wrapper.o
25 --- a/drivers/ssb/driver_extif.c
26 +++ b/drivers/ssb/driver_extif.c
27 @@ -37,6 +37,12 @@
28 return value;
29 }
30
31 +void ssb_extif_watchdog_timer_set(struct ssb_extif *extif,
32 + u32 ticks)
33 +{
34 + extif_write32(extif, SSB_EXTIF_WATCHDOG, ticks);
35 +}
36 +
37 #ifdef CONFIG_SSB_SERIAL
38 static bool serial_exists(u8 *regs)
39 {
40 --- /dev/null
41 +++ b/drivers/ssb/embedded.c
42 @@ -0,0 +1,26 @@
43 +/*
44 + * Sonics Silicon Backplane
45 + * Embedded systems support code
46 + *
47 + * Copyright 2005-2008, Broadcom Corporation
48 + * Copyright 2006-2008, Michael Buesch <mb@bu3sch.de>
49 + *
50 + * Licensed under the GNU/GPL. See COPYING for details.
51 + */
52 +
53 +#include <linux/ssb/ssb.h>
54 +#include <linux/ssb/ssb_embedded.h>
55 +
56 +
57 +int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks)
58 +{
59 + if (ssb_chipco_available(&bus->chipco)) {
60 + ssb_chipco_watchdog_timer_set(&bus->chipco, ticks);
61 + return 0;
62 + }
63 + if (ssb_extif_available(&bus->extif)) {
64 + ssb_extif_watchdog_timer_set(&bus->extif, ticks);
65 + return 0;
66 + }
67 + return -ENODEV;
68 +}
69 --- a/include/linux/ssb/ssb_driver_chipcommon.h
70 +++ b/include/linux/ssb/ssb_driver_chipcommon.h
71 @@ -360,6 +360,11 @@
72 u16 fast_pwrup_delay;
73 };
74
75 +static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
76 +{
77 + return (cc->dev != NULL);
78 +}
79 +
80 extern void ssb_chipcommon_init(struct ssb_chipcommon *cc);
81
82 #include <linux/pm.h>
83 --- a/include/linux/ssb/ssb_driver_extif.h
84 +++ b/include/linux/ssb/ssb_driver_extif.h
85 @@ -178,6 +178,9 @@
86 u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value);
87 u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value);
88
89 +extern void ssb_extif_watchdog_timer_set(struct ssb_extif *extif,
90 + u32 ticks);
91 +
92 #ifdef CONFIG_SSB_SERIAL
93 extern int ssb_extif_serial_init(struct ssb_extif *extif,
94 struct ssb_serial_port *ports);
95 @@ -201,5 +204,11 @@
96 {
97 }
98
99 +static inline
100 +void ssb_extif_watchdog_timer_set(struct ssb_extif *extif,
101 + u32 ticks)
102 +{
103 +}
104 +
105 #endif /* CONFIG_SSB_DRIVER_EXTIF */
106 #endif /* LINUX_SSB_EXTIFCORE_H_ */
107 --- /dev/null
108 +++ b/include/linux/ssb/ssb_embedded.h
109 @@ -0,0 +1,10 @@
110 +#ifndef LINUX_SSB_EMBEDDED_H_
111 +#define LINUX_SSB_EMBEDDED_H_
112 +
113 +#include <linux/types.h>
114 +#include <linux/ssb/ssb.h>
115 +
116 +
117 +extern int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks);
118 +
119 +#endif /* LINUX_SSB_EMBEDDED_H_ */