OMAP3: SR: Remove redundant defines
[linux-ginger.git] / drivers / staging / rt3090 / rtmp_pci.h
blobc2fed29058f4cfbb8f73e7d186487065169e2c81
1 /*
2 *************************************************************************
3 * Ralink Tech Inc.
4 * 5F., No.36, Taiyuan St., Jhubei City,
5 * Hsinchu County 302,
6 * Taiwan, R.O.C.
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24 * *
25 *************************************************************************
29 #ifndef __RTMP_PCI_H__
30 #define __RTMP_PCI_H__
32 #define RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p) \
33 ((POS_COOKIE)handle)->pci_dev = dev_p;
36 #ifdef LINUX
37 // set driver data
38 #define RT28XX_DRVDATA_SET(_a) pci_set_drvdata(_a, net_dev);
40 #define RT28XX_PUT_DEVICE(dev_p)
42 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
43 #define SA_SHIRQ IRQF_SHARED
44 #endif
46 #ifdef PCI_MSI_SUPPORT
47 #define RTMP_MSI_ENABLE(_pAd) \
48 { POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \
49 (_pAd)->HaveMsi = pci_enable_msi(_pObj->pci_dev) == 0 ? TRUE : FALSE; }
51 #define RTMP_MSI_DISABLE(_pAd) \
52 { POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \
53 if (_pAd->HaveMsi == TRUE) \
54 pci_disable_msi(_pObj->pci_dev); \
55 _pAd->HaveMsi = FALSE; }
56 #else
57 #define RTMP_MSI_ENABLE(_pAd)
58 #define RTMP_MSI_DISABLE(_pAd)
59 #endif // PCI_MSI_SUPPORT //
62 #define RTMP_PCI_DEV_UNMAP() \
63 { if (net_dev->base_addr) { \
64 iounmap((void *)(net_dev->base_addr)); \
65 release_mem_region(pci_resource_start(dev_p, 0), \
66 pci_resource_len(dev_p, 0)); } \
67 if (net_dev->irq) pci_release_regions(dev_p); }
70 #define RTMP_IRQ_REQUEST(net_dev) \
71 { PRTMP_ADAPTER _pAd = (PRTMP_ADAPTER)(RTMP_OS_NETDEV_GET_PRIV(net_dev)); \
72 POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \
73 RTMP_MSI_ENABLE(_pAd); \
74 if ((retval = request_irq(_pObj->pci_dev->irq, \
75 rt2860_interrupt, SA_SHIRQ, \
76 (net_dev)->name, (net_dev)))) { \
77 DBGPRINT(RT_DEBUG_ERROR, ("request_irq error(%d)\n", retval)); \
78 return retval; } }
80 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
81 #define RTMP_IRQ_RELEASE(net_dev) \
82 { PRTMP_ADAPTER _pAd = (PRTMP_ADAPTER)(RTMP_OS_NETDEV_GET_PRIV(net_dev)); \
83 POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \
84 synchronize_irq(_pObj->pci_dev->irq); \
85 free_irq(_pObj->pci_dev->irq, (net_dev)); \
86 RTMP_MSI_DISABLE(_pAd); }
87 #else
88 #define RTMP_IRQ_RELEASE(net_dev) \
89 { PRTMP_ADAPTER _pAd = (PRTMP_ADAPTER)(RTMP_OS_NETDEV_GET_PRIV(net_dev)); \
90 POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \
91 free_irq(_pObj->pci_dev->irq, (net_dev)); \
92 RTMP_MSI_DISABLE(_pAd); }
93 #endif
95 #define PCI_REG_READ_WORD(pci_dev, offset, Configuration) \
96 if (pci_read_config_word(pci_dev, offset, &reg16) == 0) \
97 Configuration = le2cpu16(reg16); \
98 else \
99 Configuration = 0;
101 #define PCI_REG_WIRTE_WORD(pci_dev, offset, Configuration) \
102 reg16 = cpu2le16(Configuration); \
103 pci_write_config_word(pci_dev, offset, reg16); \
105 #endif // LINUX //
110 #endif // __RTMP_PCI_H__ //