2011-05-18 08:06:36 +08:00
|
|
|
#ifndef B43_BUS_H_
|
|
|
|
#define B43_BUS_H_
|
|
|
|
|
|
|
|
enum b43_bus_type {
|
2011-07-06 21:45:26 +08:00
|
|
|
#ifdef CONFIG_B43_BCMA
|
2011-07-07 01:03:46 +08:00
|
|
|
B43_BUS_BCMA,
|
2011-07-06 21:45:26 +08:00
|
|
|
#endif
|
2014-05-11 01:52:18 +08:00
|
|
|
#ifdef CONFIG_B43_SSB
|
2011-05-18 08:06:36 +08:00
|
|
|
B43_BUS_SSB,
|
2014-05-11 01:52:18 +08:00
|
|
|
#endif
|
2011-05-18 08:06:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct b43_bus_dev {
|
|
|
|
enum b43_bus_type bus_type;
|
|
|
|
union {
|
2011-07-07 01:03:46 +08:00
|
|
|
struct bcma_device *bdev;
|
2011-05-18 08:06:36 +08:00
|
|
|
struct ssb_device *sdev;
|
|
|
|
};
|
2011-05-18 08:06:37 +08:00
|
|
|
|
2011-05-18 08:06:43 +08:00
|
|
|
int (*bus_may_powerdown)(struct b43_bus_dev *dev);
|
|
|
|
int (*bus_powerup)(struct b43_bus_dev *dev, bool dynamic_pctl);
|
|
|
|
int (*device_is_enabled)(struct b43_bus_dev *dev);
|
|
|
|
void (*device_enable)(struct b43_bus_dev *dev,
|
|
|
|
u32 core_specific_flags);
|
|
|
|
void (*device_disable)(struct b43_bus_dev *dev,
|
|
|
|
u32 core_specific_flags);
|
|
|
|
|
2011-05-18 08:06:37 +08:00
|
|
|
u16 (*read16)(struct b43_bus_dev *dev, u16 offset);
|
|
|
|
u32 (*read32)(struct b43_bus_dev *dev, u16 offset);
|
|
|
|
void (*write16)(struct b43_bus_dev *dev, u16 offset, u16 value);
|
|
|
|
void (*write32)(struct b43_bus_dev *dev, u16 offset, u32 value);
|
|
|
|
void (*block_read)(struct b43_bus_dev *dev, void *buffer,
|
|
|
|
size_t count, u16 offset, u8 reg_width);
|
|
|
|
void (*block_write)(struct b43_bus_dev *dev, const void *buffer,
|
|
|
|
size_t count, u16 offset, u8 reg_width);
|
2011-05-18 08:06:38 +08:00
|
|
|
|
2011-05-18 08:06:40 +08:00
|
|
|
struct device *dev;
|
|
|
|
struct device *dma_dev;
|
|
|
|
unsigned int irq;
|
|
|
|
|
2011-05-18 08:06:42 +08:00
|
|
|
u16 board_vendor;
|
|
|
|
u16 board_type;
|
|
|
|
u16 board_rev;
|
|
|
|
|
2011-05-18 08:06:41 +08:00
|
|
|
u16 chip_id;
|
|
|
|
u8 chip_rev;
|
|
|
|
u8 chip_pkg;
|
|
|
|
|
2011-05-18 08:06:39 +08:00
|
|
|
struct ssb_sprom *bus_sprom;
|
|
|
|
|
2011-05-18 08:06:38 +08:00
|
|
|
u16 core_id;
|
|
|
|
u8 core_rev;
|
2011-05-18 08:06:36 +08:00
|
|
|
};
|
|
|
|
|
2011-05-19 21:11:27 +08:00
|
|
|
static inline bool b43_bus_host_is_pcmcia(struct b43_bus_dev *dev)
|
|
|
|
{
|
2014-05-11 01:52:18 +08:00
|
|
|
#ifdef CONFIG_B43_SSB
|
2011-05-19 21:11:27 +08:00
|
|
|
return (dev->bus_type == B43_BUS_SSB &&
|
|
|
|
dev->sdev->bus->bustype == SSB_BUSTYPE_PCMCIA);
|
2014-05-11 01:52:18 +08:00
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
2011-05-19 21:11:27 +08:00
|
|
|
}
|
|
|
|
static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev)
|
|
|
|
{
|
2014-05-11 01:52:18 +08:00
|
|
|
#ifdef CONFIG_B43_SSB
|
2011-05-19 21:11:27 +08:00
|
|
|
return (dev->bus_type == B43_BUS_SSB &&
|
|
|
|
dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO);
|
2014-05-11 01:52:18 +08:00
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
2011-05-19 21:11:27 +08:00
|
|
|
}
|
|
|
|
|
2011-07-07 01:03:46 +08:00
|
|
|
struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core);
|
2011-05-18 08:06:36 +08:00
|
|
|
struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);
|
|
|
|
|
2011-07-06 21:45:28 +08:00
|
|
|
void *b43_bus_get_wldev(struct b43_bus_dev *dev);
|
|
|
|
void b43_bus_set_wldev(struct b43_bus_dev *dev, void *data);
|
|
|
|
|
2011-05-18 08:06:36 +08:00
|
|
|
#endif /* B43_BUS_H_ */
|