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