]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
Merge remote-tracking branches 'spi/fix/doc', 'spi/fix/nuc900' and 'spi/fix/rspi...
[karo-tx-linux.git] / drivers / net / wireless / brcm80211 / brcmfmac / dhd_bus.h
index 6a54905528befd0238ce198acdbd6f9d642d1340..c4535616064e8389125b238a50fcc74d3c6d47da 100644 (file)
 #ifndef _BRCMF_BUS_H_
 #define _BRCMF_BUS_H_
 
+#include "dhd_dbg.h"
+
 /* The level of bus communication with the dongle */
 enum brcmf_bus_state {
+       BRCMF_BUS_UNKNOWN,      /* Not determined yet */
+       BRCMF_BUS_NOMEDIUM,     /* No medium access to dongle */
        BRCMF_BUS_DOWN,         /* Not ready for frame transfers */
        BRCMF_BUS_LOAD,         /* Download access only (CPU reset) */
        BRCMF_BUS_DATA          /* Ready for frame transfers */
 };
 
+/* The level of bus communication with the dongle */
+enum brcmf_bus_protocol_type {
+       BRCMF_PROTO_BCDC,
+       BRCMF_PROTO_MSGBUF
+};
+
 struct brcmf_bus_dcmd {
        char *name;
        char *param;
@@ -65,6 +75,7 @@ struct brcmf_bus_ops {
  * struct brcmf_bus - interface structure between common and bus layer
  *
  * @bus_priv: pointer to private bus device.
+ * @proto_type: protocol type, bcdc or msgbuf
  * @dev: device pointer of bus device.
  * @drvr: public driver information.
  * @state: operational state of the bus interface.
@@ -80,6 +91,7 @@ struct brcmf_bus {
                struct brcmf_sdio_dev *sdio;
                struct brcmf_usbdev *usb;
        } bus_priv;
+       enum brcmf_bus_protocol_type proto_type;
        struct device *dev;
        struct brcmf_pub *drvr;
        enum brcmf_bus_state state;
@@ -136,6 +148,23 @@ struct pktq *brcmf_bus_gettxq(struct brcmf_bus *bus)
 
        return bus->ops->gettxq(bus->dev);
 }
+
+static inline bool brcmf_bus_ready(struct brcmf_bus *bus)
+{
+       return bus->state == BRCMF_BUS_LOAD || bus->state == BRCMF_BUS_DATA;
+}
+
+static inline void brcmf_bus_change_state(struct brcmf_bus *bus,
+                                         enum brcmf_bus_state new_state)
+{
+       /* NOMEDIUM is permanent */
+       if (bus->state == BRCMF_BUS_NOMEDIUM)
+               return;
+
+       brcmf_dbg(TRACE, "%d -> %d\n", bus->state, new_state);
+       bus->state = new_state;
+}
+
 /*
  * interface functions from common layer
  */