[brcm63xx] refresh kernel patches
[openwrt.git] / package / switch / src / gpio-bcm947xx.h
1 #ifndef __SWITCH_GPIO_H
2 #define __SWITCH_GPIO_H
3 #include <linux/interrupt.h>
4
5 #ifndef BCMDRIVER
6 #include <linux/ssb/ssb_embedded.h>
7
8 extern struct ssb_bus ssb;
9
10
11 static inline u32 gpio_in(void)
12 {
13 return ssb_gpio_in(&ssb, ~0);
14 }
15
16 static inline u32 gpio_out(u32 mask, u32 value)
17 {
18 return ssb_gpio_out(&ssb, mask, value);
19 }
20
21 static inline u32 gpio_outen(u32 mask, u32 value)
22 {
23 return ssb_gpio_outen(&ssb, mask, value);
24 }
25
26 static inline u32 gpio_control(u32 mask, u32 value)
27 {
28 return ssb_gpio_control(&ssb, mask, value);
29 }
30
31 static inline u32 gpio_intmask(u32 mask, u32 value)
32 {
33 return ssb_gpio_intmask(&ssb, mask, value);
34 }
35
36 static inline u32 gpio_intpolarity(u32 mask, u32 value)
37 {
38 return ssb_gpio_polarity(&ssb, mask, value);
39 }
40
41 #else
42
43 #include <typedefs.h>
44 #include <osl.h>
45 #include <bcmdevs.h>
46 #include <sbutils.h>
47 #include <sbconfig.h>
48 #include <sbchipc.h>
49 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
50 #include <sbmips.h>
51 #else
52 #include <hndcpu.h>
53 #endif
54
55 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
56 #define sbh bcm947xx_sbh
57 #define sbh_lock bcm947xx_sbh_lock
58 #endif
59
60 extern void *sbh;
61 extern spinlock_t sbh_lock;
62
63 #define gpio_in() sb_gpioin(sbh)
64 #define gpio_out(mask, value) sb_gpioout(sbh, mask, ((value) & (mask)), GPIO_DRV_PRIORITY)
65 #define gpio_outen(mask, value) sb_gpioouten(sbh, mask, value, GPIO_DRV_PRIORITY)
66 #define gpio_control(mask, value) sb_gpiocontrol(sbh, mask, value, GPIO_DRV_PRIORITY)
67 #define gpio_intmask(mask, value) sb_gpiointmask(sbh, mask, value, GPIO_DRV_PRIORITY)
68 #define gpio_intpolarity(mask, value) sb_gpiointpolarity(sbh, mask, value, GPIO_DRV_PRIORITY)
69
70 #endif /* BCMDRIVER */
71 #endif /* __SWITCH_GPIO_H */
This page took 0.050399 seconds and 5 git commands to generate.