[tools] reenable squashfs4 for ar71xx, it needs both old and new
[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 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
9 #define ssb ssb_bcm47xx
10 #endif
11
12 extern struct ssb_bus ssb;
13
14
15 static inline u32 gpio_in(void)
16 {
17 return ssb_gpio_in(&ssb, ~0);
18 }
19
20 static inline u32 gpio_out(u32 mask, u32 value)
21 {
22 return ssb_gpio_out(&ssb, mask, value);
23 }
24
25 static inline u32 gpio_outen(u32 mask, u32 value)
26 {
27 return ssb_gpio_outen(&ssb, mask, value);
28 }
29
30 static inline u32 gpio_control(u32 mask, u32 value)
31 {
32 return ssb_gpio_control(&ssb, mask, value);
33 }
34
35 static inline u32 gpio_intmask(u32 mask, u32 value)
36 {
37 return ssb_gpio_intmask(&ssb, mask, value);
38 }
39
40 static inline u32 gpio_intpolarity(u32 mask, u32 value)
41 {
42 return ssb_gpio_polarity(&ssb, mask, value);
43 }
44
45 #else
46
47 #include <typedefs.h>
48 #include <osl.h>
49 #include <bcmdevs.h>
50 #include <sbutils.h>
51 #include <sbconfig.h>
52 #include <sbchipc.h>
53 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
54 #include <sbmips.h>
55 #else
56 #include <hndcpu.h>
57 #endif
58
59 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
60 #define sbh bcm947xx_sbh
61 #define sbh_lock bcm947xx_sbh_lock
62 #endif
63
64 extern void *sbh;
65 extern spinlock_t sbh_lock;
66
67 #define gpio_in() sb_gpioin(sbh)
68 #define gpio_out(mask, value) sb_gpioout(sbh, mask, ((value) & (mask)), GPIO_DRV_PRIORITY)
69 #define gpio_outen(mask, value) sb_gpioouten(sbh, mask, value, GPIO_DRV_PRIORITY)
70 #define gpio_control(mask, value) sb_gpiocontrol(sbh, mask, value, GPIO_DRV_PRIORITY)
71 #define gpio_intmask(mask, value) sb_gpiointmask(sbh, mask, value, GPIO_DRV_PRIORITY)
72 #define gpio_intpolarity(mask, value) sb_gpiointpolarity(sbh, mask, value, GPIO_DRV_PRIORITY)
73
74 #endif /* BCMDRIVER */
75 #endif /* __SWITCH_GPIO_H */
This page took 0.051589 seconds and 5 git commands to generate.