aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2011-05-19 21:27:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-01 15:12:28 -0400
commit9d75ef0f8f6d2e31ed940b3057a42a25f07076fb (patch)
tree712c09addf9f229bf25593e6f9f8a8d7d6d94859 /drivers/bcma
parent505fb019d4924e425bb1024eb603a7bc7fe7fe63 (diff)
bcma: host pci: implement block R/W operations
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma')
-rw-r--r--drivers/bcma/Kconfig5
-rw-r--r--drivers/bcma/host_pci.c52
2 files changed, 57 insertions, 0 deletions
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig
index 353781b5b78b..83e9adf46441 100644
--- a/drivers/bcma/Kconfig
+++ b/drivers/bcma/Kconfig
@@ -13,6 +13,11 @@ config BCMA
13 Bus driver for Broadcom specific Advanced Microcontroller Bus 13 Bus driver for Broadcom specific Advanced Microcontroller Bus
14 Architecture. 14 Architecture.
15 15
16# Support for Block-I/O. SELECT this from the driver that needs it.
17config BCMA_BLOCKIO
18 bool
19 depends on BCMA
20
16config BCMA_HOST_PCI_POSSIBLE 21config BCMA_HOST_PCI_POSSIBLE
17 bool 22 bool
18 depends on BCMA && PCI = y 23 depends on BCMA && PCI = y
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
index ffd8797faf4f..279bf50f6d8e 100644
--- a/drivers/bcma/host_pci.c
+++ b/drivers/bcma/host_pci.c
@@ -64,6 +64,54 @@ static void bcma_host_pci_write32(struct bcma_device *core, u16 offset,
64 iowrite32(value, core->bus->mmio + offset); 64 iowrite32(value, core->bus->mmio + offset);
65} 65}
66 66
67#ifdef CONFIG_BCMA_BLOCKIO
68void bcma_host_pci_block_read(struct bcma_device *core, void *buffer,
69 size_t count, u16 offset, u8 reg_width)
70{
71 void __iomem *addr = core->bus->mmio + offset;
72 if (core->bus->mapped_core != core)
73 bcma_host_pci_switch_core(core);
74 switch (reg_width) {
75 case sizeof(u8):
76 ioread8_rep(addr, buffer, count);
77 break;
78 case sizeof(u16):
79 WARN_ON(count & 1);
80 ioread16_rep(addr, buffer, count >> 1);
81 break;
82 case sizeof(u32):
83 WARN_ON(count & 3);
84 ioread32_rep(addr, buffer, count >> 2);
85 break;
86 default:
87 WARN_ON(1);
88 }
89}
90
91void bcma_host_pci_block_write(struct bcma_device *core, const void *buffer,
92 size_t count, u16 offset, u8 reg_width)
93{
94 void __iomem *addr = core->bus->mmio + offset;
95 if (core->bus->mapped_core != core)
96 bcma_host_pci_switch_core(core);
97 switch (reg_width) {
98 case sizeof(u8):
99 iowrite8_rep(addr, buffer, count);
100 break;
101 case sizeof(u16):
102 WARN_ON(count & 1);
103 iowrite16_rep(addr, buffer, count >> 1);
104 break;
105 case sizeof(u32):
106 WARN_ON(count & 3);
107 iowrite32_rep(addr, buffer, count >> 2);
108 break;
109 default:
110 WARN_ON(1);
111 }
112}
113#endif
114
67static u32 bcma_host_pci_aread32(struct bcma_device *core, u16 offset) 115static u32 bcma_host_pci_aread32(struct bcma_device *core, u16 offset)
68{ 116{
69 if (core->bus->mapped_core != core) 117 if (core->bus->mapped_core != core)
@@ -86,6 +134,10 @@ const struct bcma_host_ops bcma_host_pci_ops = {
86 .write8 = bcma_host_pci_write8, 134 .write8 = bcma_host_pci_write8,
87 .write16 = bcma_host_pci_write16, 135 .write16 = bcma_host_pci_write16,
88 .write32 = bcma_host_pci_write32, 136 .write32 = bcma_host_pci_write32,
137#ifdef CONFIG_BCMA_BLOCKIO
138 .block_read = bcma_host_pci_block_read,
139 .block_write = bcma_host_pci_block_write,
140#endif
89 .aread32 = bcma_host_pci_aread32, 141 .aread32 = bcma_host_pci_aread32,
90 .awrite32 = bcma_host_pci_awrite32, 142 .awrite32 = bcma_host_pci_awrite32,
91}; 143};