1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-01-12 17:10:14 +02:00
openwrt-xburst/package/switch/src/gpio-bcm947xx.h
hauke 7d9def4e2e switch: update for brcm47xx target
* remove suport for 2.4 kernel
* add support for bcma bus



git-svn-id: svn://svn.openwrt.org/openwrt/trunk@27904 3c298f89-4303-0410-b956-a3cf2f4a3e73
2011-08-04 20:07:58 +00:00

56 lines
1.2 KiB
C

#ifndef __SWITCH_GPIO_H
#define __SWITCH_GPIO_H
#include <linux/ssb/ssb_embedded.h>
#include <linux/bcma/bcma_driver_chipcommon.h>
#include <bcm47xx.h>
static inline u32 gpio_in(void)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
return ssb_gpio_in(&bcm47xx_bus.ssb, ~0);
#endif
#ifdef CONFIG_BCM47XX_BCMA
case BCM47XX_BUS_TYPE_BCMA:
return bcma_chipco_gpio_in(&bcm47xx_bus.bcma.bus.drv_cc, ~0);
#endif
}
return -EINVAL;
}
static inline u32 gpio_out(u32 mask, u32 value)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
return ssb_gpio_out(&bcm47xx_bus.ssb, mask, value);
#endif
#ifdef CONFIG_BCM47XX_BCMA
case BCM47XX_BUS_TYPE_BCMA:
return bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, mask, value);
#endif
}
return -EINVAL;
}
static inline u32 gpio_outen(u32 mask, u32 value)
{
switch (bcm47xx_bus_type) {
#ifdef CONFIG_BCM47XX_SSB
case BCM47XX_BUS_TYPE_SSB:
ssb_gpio_outen(&bcm47xx_bus.ssb, mask, value);
return 0;
#endif
#ifdef CONFIG_BCM47XX_BCMA
case BCM47XX_BUS_TYPE_BCMA:
bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, mask, value);
return 0;
#endif
}
return -EINVAL;
}
#endif /* __SWITCH_GPIO_H */