aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma/host_pci.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2011-06-08 13:44:21 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-08 13:44:21 -0400
commitc0c33addcba2ce753b4e2746db99feaae2f82a85 (patch)
treedab480183ac0e64bfe9250e1f294705d1a424c78 /drivers/bcma/host_pci.c
parentffbc03bc75b39c7bd412e7cc6d2185c11b0ffedd (diff)
parent931749bf78b969c54de9bbc67cf29b13a40bb73b (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Diffstat (limited to 'drivers/bcma/host_pci.c')
-rw-r--r--drivers/bcma/host_pci.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
index 471a04013fe0..2a526bc3342f 100644
--- a/drivers/bcma/host_pci.c
+++ b/drivers/bcma/host_pci.c
@@ -65,6 +65,54 @@ static void bcma_host_pci_write32(struct bcma_device *core, u16 offset,
65 iowrite32(value, core->bus->mmio + offset); 65 iowrite32(value, core->bus->mmio + offset);
66} 66}
67 67
68#ifdef CONFIG_BCMA_BLOCKIO
69void bcma_host_pci_block_read(struct bcma_device *core, void *buffer,
70 size_t count, u16 offset, u8 reg_width)
71{
72 void __iomem *addr = core->bus->mmio + offset;
73 if (core->bus->mapped_core != core)
74 bcma_host_pci_switch_core(core);
75 switch (reg_width) {
76 case sizeof(u8):
77 ioread8_rep(addr, buffer, count);
78 break;
79 case sizeof(u16):
80 WARN_ON(count & 1);
81 ioread16_rep(addr, buffer, count >> 1);
82 break;
83 case sizeof(u32):
84 WARN_ON(count & 3);
85 ioread32_rep(addr, buffer, count >> 2);
86 break;
87 default:
88 WARN_ON(1);
89 }
90}
91
92void bcma_host_pci_block_write(struct bcma_device *core, const void *buffer,
93 size_t count, u16 offset, u8 reg_width)
94{
95 void __iomem *addr = core->bus->mmio + offset;
96 if (core->bus->mapped_core != core)
97 bcma_host_pci_switch_core(core);
98 switch (reg_width) {
99 case sizeof(u8):
100 iowrite8_rep(addr, buffer, count);
101 break;
102 case sizeof(u16):
103 WARN_ON(count & 1);
104 iowrite16_rep(addr, buffer, count >> 1);
105 break;
106 case sizeof(u32):
107 WARN_ON(count & 3);
108 iowrite32_rep(addr, buffer, count >> 2);
109 break;
110 default:
111 WARN_ON(1);
112 }
113}
114#endif
115
68static u32 bcma_host_pci_aread32(struct bcma_device *core, u16 offset) 116static u32 bcma_host_pci_aread32(struct bcma_device *core, u16 offset)
69{ 117{
70 if (core->bus->mapped_core != core) 118 if (core->bus->mapped_core != core)
@@ -87,6 +135,10 @@ const struct bcma_host_ops bcma_host_pci_ops = {
87 .write8 = bcma_host_pci_write8, 135 .write8 = bcma_host_pci_write8,
88 .write16 = bcma_host_pci_write16, 136 .write16 = bcma_host_pci_write16,
89 .write32 = bcma_host_pci_write32, 137 .write32 = bcma_host_pci_write32,
138#ifdef CONFIG_BCMA_BLOCKIO
139 .block_read = bcma_host_pci_block_read,
140 .block_write = bcma_host_pci_block_write,
141#endif
90 .aread32 = bcma_host_pci_aread32, 142 .aread32 = bcma_host_pci_aread32,
91 .awrite32 = bcma_host_pci_awrite32, 143 .awrite32 = bcma_host_pci_awrite32,
92}; 144};