#include <linux/pci.h>
#include <linux/mmc/sdio.h>
#include <linux/mmc/sdio_func.h>
+#include <linux/mmc/card.h>
+#include <linux/mmc/host.h>
+
/* rfkill notification chain */
#define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill
/*
* e5899e1b7d73e67de758a32174a859cc2586c0b9 made pci_pme_capable() external,
* it was defined internally, some drivers want access to this information.
+ *
+ * Unfortunately the old kernels do not have ->pm_cap or ->pme_support so
+ * we have to call the PCI routines directly.
*/
/**
* pci_pme_capable - check the capability of PCI device to generate PME#
* @dev: PCI device to handle.
* @state: PCI state from which device will issue PME#.
+ *
+ * This is the backport code for older kernels for compat-wireless, we read stuff
+ * from the initialization stuff from pci_pm_init().
*/
bool pci_pme_capable(struct pci_dev *dev, pci_power_t state)
{
- if (!dev->pm_cap)
+ int pm;
+ u16 pmc = 0;
+ u16 pme_support; /* as from the pci dev */
+ /* find PCI PM capability in list */
+ pm = pci_find_capability(dev, PCI_CAP_ID_PM);
+ if (!pm)
+ return false;
+
+ if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
+ dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n",
+ pmc & PCI_PM_CAP_VER_MASK);
+ return false;
+ }
+
+ pmc &= PCI_PM_CAP_PME_MASK;
+
+ if (!pmc)
return false;
- return !!(dev->pme_support & (1 << state));
+ pme_support = pmc >> PCI_PM_CAP_PME_SHIFT;
+
+ /* Check device's ability to generate PME# */
+
+ return !!(pme_support & (1 << state));
}
+EXPORT_SYMBOL(pci_pme_capable);
/**
* mmc_align_data_size - pads a transfer size to a more optimal value
}
EXPORT_SYMBOL(mmc_align_data_size);
+/*
+ * Calculate the maximum byte mode transfer size
+ */
+static inline unsigned int sdio_max_byte_size(struct sdio_func *func)
+{
+ unsigned int mval = (unsigned int) min(func->card->host->max_seg_size,
+ func->card->host->max_blk_size);
+ mval = min(mval, func->max_blksize);
+ return min(mval, 512u); /* maximum size for byte mode */
+}
+
/**
* sdio_align_size - pads a transfer size to a more optimal value
* @func: SDIO function
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
#include <linux/list.h>
-#include <linux/rfkill.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/mmc/sdio.h>
#include <linux/mmc/sdio_func.h>
+#include <linux/netdevice.h>
#include <asm-generic/bug.h>
+#define PCI_PM_CAP_PME_SHIFT 11
+
+/*
+ * On older kernels we do not have net_device Multi Queue support, but
+ * since we no longer use MQ on mac80211 we can simply use the 0 queue.
+ * Note that if other fullmac drivers make use of this they then need
+ * to be backported somehow or deal with just 1 queueue from MQ.
+ */
+static inline void netif_tx_wake_all_queues(struct net_device *dev)
+{
+ netif_wake_queue(dev);
+}
+static inline void netif_tx_start_all_queues(struct net_device *dev)
+{
+ netif_start_queue(dev);
+}
+static inline void netif_tx_stop_all_queues(struct net_device *dev)
+{
+ netif_stop_queue(dev);
+}
+
bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
/*
#define dma_mapping_error(pdev, dma_addr) dma_mapping_error(dma_addr)
#define pci_dma_mapping_error(pdev, dma_addr) dma_mapping_error(pdev, dma_addr)
-/* This is from include/linux/rfkill.h */
-#define RFKILL_STATE_SOFT_BLOCKED RFKILL_STATE_OFF
-#define RFKILL_STATE_UNBLOCKED RFKILL_STATE_ON
-/* This one is new */
-#define RFKILL_STATE_HARD_BLOCKED 2
-
/* This is from include/linux/ieee80211.h */
#define IEEE80211_HT_CAP_DSSSCCK40 0x1000