diff options
Diffstat (limited to 'arch/arm/mach-ixp4xx/ixp4xx_qmgr.c')
-rw-r--r-- | arch/arm/mach-ixp4xx/ixp4xx_qmgr.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c index 444c2ae21db4..bfddc73d0a20 100644 --- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c +++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c | |||
@@ -14,8 +14,6 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <mach/qmgr.h> | 15 | #include <mach/qmgr.h> |
16 | 16 | ||
17 | #define DEBUG 0 | ||
18 | |||
19 | struct qmgr_regs __iomem *qmgr_regs; | 17 | struct qmgr_regs __iomem *qmgr_regs; |
20 | static struct resource *mem_res; | 18 | static struct resource *mem_res; |
21 | static spinlock_t qmgr_lock; | 19 | static spinlock_t qmgr_lock; |
@@ -23,6 +21,10 @@ static u32 used_sram_bitmap[4]; /* 128 16-dword pages */ | |||
23 | static void (*irq_handlers[HALF_QUEUES])(void *pdev); | 21 | static void (*irq_handlers[HALF_QUEUES])(void *pdev); |
24 | static void *irq_pdevs[HALF_QUEUES]; | 22 | static void *irq_pdevs[HALF_QUEUES]; |
25 | 23 | ||
24 | #if DEBUG_QMGR | ||
25 | char qmgr_queue_descs[QUEUES][32]; | ||
26 | #endif | ||
27 | |||
26 | void qmgr_set_irq(unsigned int queue, int src, | 28 | void qmgr_set_irq(unsigned int queue, int src, |
27 | void (*handler)(void *pdev), void *pdev) | 29 | void (*handler)(void *pdev), void *pdev) |
28 | { | 30 | { |
@@ -82,9 +84,16 @@ static inline void shift_mask(u32 *mask) | |||
82 | mask[0] <<= 1; | 84 | mask[0] <<= 1; |
83 | } | 85 | } |
84 | 86 | ||
87 | #if DEBUG_QMGR | ||
85 | int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, | 88 | int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, |
86 | unsigned int nearly_empty_watermark, | 89 | unsigned int nearly_empty_watermark, |
87 | unsigned int nearly_full_watermark) | 90 | unsigned int nearly_full_watermark, |
91 | const char *desc_format, const char* name) | ||
92 | #else | ||
93 | int __qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, | ||
94 | unsigned int nearly_empty_watermark, | ||
95 | unsigned int nearly_full_watermark) | ||
96 | #endif | ||
88 | { | 97 | { |
89 | u32 cfg, addr = 0, mask[4]; /* in 16-dwords */ | 98 | u32 cfg, addr = 0, mask[4]; /* in 16-dwords */ |
90 | int err; | 99 | int err; |
@@ -152,12 +161,13 @@ int qmgr_request_queue(unsigned int queue, unsigned int len /* dwords */, | |||
152 | used_sram_bitmap[2] |= mask[2]; | 161 | used_sram_bitmap[2] |= mask[2]; |
153 | used_sram_bitmap[3] |= mask[3]; | 162 | used_sram_bitmap[3] |= mask[3]; |
154 | __raw_writel(cfg | (addr << 14), &qmgr_regs->sram[queue]); | 163 | __raw_writel(cfg | (addr << 14), &qmgr_regs->sram[queue]); |
155 | spin_unlock_irq(&qmgr_lock); | 164 | #if DEBUG_QMGR |
156 | 165 | snprintf(qmgr_queue_descs[queue], sizeof(qmgr_queue_descs[0]), | |
157 | #if DEBUG | 166 | desc_format, name); |
158 | printk(KERN_DEBUG "qmgr: requested queue %i, addr = 0x%02X\n", | 167 | printk(KERN_DEBUG "qmgr: requested queue %s(%i) addr = 0x%02X\n", |
159 | queue, addr); | 168 | qmgr_queue_descs[queue], queue, addr); |
160 | #endif | 169 | #endif |
170 | spin_unlock_irq(&qmgr_lock); | ||
161 | return 0; | 171 | return 0; |
162 | 172 | ||
163 | err: | 173 | err: |
@@ -190,6 +200,11 @@ void qmgr_release_queue(unsigned int queue) | |||
190 | while (addr--) | 200 | while (addr--) |
191 | shift_mask(mask); | 201 | shift_mask(mask); |
192 | 202 | ||
203 | #if DEBUG_QMGR | ||
204 | printk(KERN_DEBUG "qmgr: releasing queue %s(%i)\n", | ||
205 | qmgr_queue_descs[queue], queue); | ||
206 | qmgr_queue_descs[queue][0] = '\x0'; | ||
207 | #endif | ||
193 | __raw_writel(0, &qmgr_regs->sram[queue]); | 208 | __raw_writel(0, &qmgr_regs->sram[queue]); |
194 | 209 | ||
195 | used_sram_bitmap[0] &= ~mask[0]; | 210 | used_sram_bitmap[0] &= ~mask[0]; |
@@ -202,11 +217,8 @@ void qmgr_release_queue(unsigned int queue) | |||
202 | module_put(THIS_MODULE); | 217 | module_put(THIS_MODULE); |
203 | 218 | ||
204 | while ((addr = qmgr_get_entry(queue))) | 219 | while ((addr = qmgr_get_entry(queue))) |
205 | printk(KERN_ERR "qmgr: released queue %d not empty: 0x%08X\n", | 220 | printk(KERN_ERR "qmgr: released queue %i not empty: 0x%08X\n", |
206 | queue, addr); | 221 | queue, addr); |
207 | #if DEBUG | ||
208 | printk(KERN_DEBUG "qmgr: released queue %i\n", queue); | ||
209 | #endif | ||
210 | } | 222 | } |
211 | 223 | ||
212 | static int qmgr_init(void) | 224 | static int qmgr_init(void) |
@@ -277,5 +289,10 @@ EXPORT_SYMBOL(qmgr_regs); | |||
277 | EXPORT_SYMBOL(qmgr_set_irq); | 289 | EXPORT_SYMBOL(qmgr_set_irq); |
278 | EXPORT_SYMBOL(qmgr_enable_irq); | 290 | EXPORT_SYMBOL(qmgr_enable_irq); |
279 | EXPORT_SYMBOL(qmgr_disable_irq); | 291 | EXPORT_SYMBOL(qmgr_disable_irq); |
292 | #if DEBUG_QMGR | ||
293 | EXPORT_SYMBOL(qmgr_queue_descs); | ||
280 | EXPORT_SYMBOL(qmgr_request_queue); | 294 | EXPORT_SYMBOL(qmgr_request_queue); |
295 | #else | ||
296 | EXPORT_SYMBOL(__qmgr_request_queue); | ||
297 | #endif | ||
281 | EXPORT_SYMBOL(qmgr_release_queue); | 298 | EXPORT_SYMBOL(qmgr_release_queue); |