2 * Sonics Silicon Backplane
3 * Embedded systems support code
5 * Copyright 2005-2008, Broadcom Corporation
6 * Copyright 2006-2008, Michael Buesch <mb@bu3sch.de>
8 * Licensed under the GNU/GPL. See COPYING for details.
11 #include <linux/ssb/ssb.h>
12 #include <linux/ssb/ssb_embedded.h>
14 #include "ssb_private.h"
17 int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks)
19 if (ssb_chipco_available(&bus->chipco)) {
20 ssb_chipco_watchdog_timer_set(&bus->chipco, ticks);
23 if (ssb_extif_available(&bus->extif)) {
24 ssb_extif_watchdog_timer_set(&bus->extif, ticks);
30 u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask)
35 spin_lock_irqsave(&bus->gpio_lock, flags);
36 if (ssb_chipco_available(&bus->chipco))
37 res = ssb_chipco_gpio_in(&bus->chipco, mask);
38 else if (ssb_extif_available(&bus->extif))
39 res = ssb_extif_gpio_in(&bus->extif, mask);
42 spin_unlock_irqrestore(&bus->gpio_lock, flags);
46 EXPORT_SYMBOL(ssb_gpio_in);
48 u32 ssb_gpio_out(struct ssb_bus *bus, u32 mask, u32 value)
53 spin_lock_irqsave(&bus->gpio_lock, flags);
54 if (ssb_chipco_available(&bus->chipco))
55 res = ssb_chipco_gpio_out(&bus->chipco, mask, value);
56 else if (ssb_extif_available(&bus->extif))
57 res = ssb_extif_gpio_out(&bus->extif, mask, value);
60 spin_unlock_irqrestore(&bus->gpio_lock, flags);
64 EXPORT_SYMBOL(ssb_gpio_out);
66 u32 ssb_gpio_outen(struct ssb_bus *bus, u32 mask, u32 value)
71 spin_lock_irqsave(&bus->gpio_lock, flags);
72 if (ssb_chipco_available(&bus->chipco))
73 res = ssb_chipco_gpio_outen(&bus->chipco, mask, value);
74 else if (ssb_extif_available(&bus->extif))
75 res = ssb_extif_gpio_outen(&bus->extif, mask, value);
78 spin_unlock_irqrestore(&bus->gpio_lock, flags);
82 EXPORT_SYMBOL(ssb_gpio_outen);
84 u32 ssb_gpio_control(struct ssb_bus *bus, u32 mask, u32 value)
89 spin_lock_irqsave(&bus->gpio_lock, flags);
90 if (ssb_chipco_available(&bus->chipco))
91 res = ssb_chipco_gpio_control(&bus->chipco, mask, value);
92 spin_unlock_irqrestore(&bus->gpio_lock, flags);
96 EXPORT_SYMBOL(ssb_gpio_control);
98 u32 ssb_gpio_intmask(struct ssb_bus *bus, u32 mask, u32 value)
103 spin_lock_irqsave(&bus->gpio_lock, flags);
104 if (ssb_chipco_available(&bus->chipco))
105 res = ssb_chipco_gpio_intmask(&bus->chipco, mask, value);
106 else if (ssb_extif_available(&bus->extif))
107 res = ssb_extif_gpio_intmask(&bus->extif, mask, value);
110 spin_unlock_irqrestore(&bus->gpio_lock, flags);
114 EXPORT_SYMBOL(ssb_gpio_intmask);
116 u32 ssb_gpio_polarity(struct ssb_bus *bus, u32 mask, u32 value)
121 spin_lock_irqsave(&bus->gpio_lock, flags);
122 if (ssb_chipco_available(&bus->chipco))
123 res = ssb_chipco_gpio_polarity(&bus->chipco, mask, value);
124 else if (ssb_extif_available(&bus->extif))
125 res = ssb_extif_gpio_polarity(&bus->extif, mask, value);
128 spin_unlock_irqrestore(&bus->gpio_lock, flags);
132 EXPORT_SYMBOL(ssb_gpio_polarity);