diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /arch/powerpc/sysdev/qe_lib | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/powerpc/sysdev/qe_lib')
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/gpio.c | 1 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe.c | 61 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe_ic.c | 20 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe_io.c | 8 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/ucc.c | 1 |
5 files changed, 57 insertions, 34 deletions
diff --git a/arch/powerpc/sysdev/qe_lib/gpio.c b/arch/powerpc/sysdev/qe_lib/gpio.c index 8e7a7767dd5c..dc8f8d618074 100644 --- a/arch/powerpc/sysdev/qe_lib/gpio.c +++ b/arch/powerpc/sysdev/qe_lib/gpio.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/of.h> | 19 | #include <linux/of.h> |
20 | #include <linux/of_gpio.h> | 20 | #include <linux/of_gpio.h> |
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | #include <linux/slab.h> | ||
22 | #include <asm/qe.h> | 23 | #include <asm/qe.h> |
23 | 24 | ||
24 | struct qe_gpio_chip { | 25 | struct qe_gpio_chip { |
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 464271bea6c9..149393c02c3f 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/ioport.h> | 28 | #include <linux/ioport.h> |
29 | #include <linux/crc32.h> | 29 | #include <linux/crc32.h> |
30 | #include <linux/mod_devicetable.h> | ||
31 | #include <linux/of_platform.h> | ||
30 | #include <asm/irq.h> | 32 | #include <asm/irq.h> |
31 | #include <asm/page.h> | 33 | #include <asm/page.h> |
32 | #include <asm/pgtable.h> | 34 | #include <asm/pgtable.h> |
@@ -65,19 +67,6 @@ static unsigned int qe_num_of_snum; | |||
65 | 67 | ||
66 | static phys_addr_t qebase = -1; | 68 | static phys_addr_t qebase = -1; |
67 | 69 | ||
68 | int qe_alive_during_sleep(void) | ||
69 | { | ||
70 | static int ret = -1; | ||
71 | |||
72 | if (ret != -1) | ||
73 | return ret; | ||
74 | |||
75 | ret = !of_find_compatible_node(NULL, NULL, "fsl,mpc8569-pmc"); | ||
76 | |||
77 | return ret; | ||
78 | } | ||
79 | EXPORT_SYMBOL(qe_alive_during_sleep); | ||
80 | |||
81 | phys_addr_t get_qe_base(void) | 70 | phys_addr_t get_qe_base(void) |
82 | { | 71 | { |
83 | struct device_node *qe; | 72 | struct device_node *qe; |
@@ -104,7 +93,7 @@ phys_addr_t get_qe_base(void) | |||
104 | 93 | ||
105 | EXPORT_SYMBOL(get_qe_base); | 94 | EXPORT_SYMBOL(get_qe_base); |
106 | 95 | ||
107 | void __init qe_reset(void) | 96 | void qe_reset(void) |
108 | { | 97 | { |
109 | if (qe_immr == NULL) | 98 | if (qe_immr == NULL) |
110 | qe_immr = ioremap(get_qe_base(), QE_IMMAP_SIZE); | 99 | qe_immr = ioremap(get_qe_base(), QE_IMMAP_SIZE); |
@@ -330,16 +319,18 @@ EXPORT_SYMBOL(qe_put_snum); | |||
330 | static int qe_sdma_init(void) | 319 | static int qe_sdma_init(void) |
331 | { | 320 | { |
332 | struct sdma __iomem *sdma = &qe_immr->sdma; | 321 | struct sdma __iomem *sdma = &qe_immr->sdma; |
333 | unsigned long sdma_buf_offset; | 322 | static unsigned long sdma_buf_offset = (unsigned long)-ENOMEM; |
334 | 323 | ||
335 | if (!sdma) | 324 | if (!sdma) |
336 | return -ENODEV; | 325 | return -ENODEV; |
337 | 326 | ||
338 | /* allocate 2 internal temporary buffers (512 bytes size each) for | 327 | /* allocate 2 internal temporary buffers (512 bytes size each) for |
339 | * the SDMA */ | 328 | * the SDMA */ |
340 | sdma_buf_offset = qe_muram_alloc(512 * 2, 4096); | 329 | if (IS_ERR_VALUE(sdma_buf_offset)) { |
341 | if (IS_ERR_VALUE(sdma_buf_offset)) | 330 | sdma_buf_offset = qe_muram_alloc(512 * 2, 4096); |
342 | return -ENOMEM; | 331 | if (IS_ERR_VALUE(sdma_buf_offset)) |
332 | return -ENOMEM; | ||
333 | } | ||
343 | 334 | ||
344 | out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK); | 335 | out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK); |
345 | out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | | 336 | out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | |
@@ -349,7 +340,7 @@ static int qe_sdma_init(void) | |||
349 | } | 340 | } |
350 | 341 | ||
351 | /* The maximum number of RISCs we support */ | 342 | /* The maximum number of RISCs we support */ |
352 | #define MAX_QE_RISC 2 | 343 | #define MAX_QE_RISC 4 |
353 | 344 | ||
354 | /* Firmware information stored here for qe_get_firmware_info() */ | 345 | /* Firmware information stored here for qe_get_firmware_info() */ |
355 | static struct qe_firmware_info qe_firmware_info; | 346 | static struct qe_firmware_info qe_firmware_info; |
@@ -658,3 +649,35 @@ unsigned int qe_get_num_of_snums(void) | |||
658 | return num_of_snums; | 649 | return num_of_snums; |
659 | } | 650 | } |
660 | EXPORT_SYMBOL(qe_get_num_of_snums); | 651 | EXPORT_SYMBOL(qe_get_num_of_snums); |
652 | |||
653 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) | ||
654 | static int qe_resume(struct of_device *ofdev) | ||
655 | { | ||
656 | if (!qe_alive_during_sleep()) | ||
657 | qe_reset(); | ||
658 | return 0; | ||
659 | } | ||
660 | |||
661 | static int qe_probe(struct of_device *ofdev, const struct of_device_id *id) | ||
662 | { | ||
663 | return 0; | ||
664 | } | ||
665 | |||
666 | static const struct of_device_id qe_ids[] = { | ||
667 | { .compatible = "fsl,qe", }, | ||
668 | { }, | ||
669 | }; | ||
670 | |||
671 | static struct of_platform_driver qe_driver = { | ||
672 | .driver.name = "fsl-qe", | ||
673 | .match_table = qe_ids, | ||
674 | .probe = qe_probe, | ||
675 | .resume = qe_resume, | ||
676 | }; | ||
677 | |||
678 | static int __init qe_drv_init(void) | ||
679 | { | ||
680 | return of_register_platform_driver(&qe_driver); | ||
681 | } | ||
682 | device_initcall(qe_drv_init); | ||
683 | #endif /* defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) */ | ||
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c index 3faa42e03a85..541ba9863647 100644 --- a/arch/powerpc/sysdev/qe_lib/qe_ic.c +++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | #include "qe_ic.h" | 34 | #include "qe_ic.h" |
35 | 35 | ||
36 | static DEFINE_SPINLOCK(qe_ic_lock); | 36 | static DEFINE_RAW_SPINLOCK(qe_ic_lock); |
37 | 37 | ||
38 | static struct qe_ic_info qe_ic_info[] = { | 38 | static struct qe_ic_info qe_ic_info[] = { |
39 | [1] = { | 39 | [1] = { |
@@ -189,7 +189,7 @@ static inline void qe_ic_write(volatile __be32 __iomem * base, unsigned int reg | |||
189 | 189 | ||
190 | static inline struct qe_ic *qe_ic_from_irq(unsigned int virq) | 190 | static inline struct qe_ic *qe_ic_from_irq(unsigned int virq) |
191 | { | 191 | { |
192 | return irq_desc[virq].chip_data; | 192 | return irq_to_desc(virq)->chip_data; |
193 | } | 193 | } |
194 | 194 | ||
195 | #define virq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq) | 195 | #define virq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq) |
@@ -201,13 +201,13 @@ static void qe_ic_unmask_irq(unsigned int virq) | |||
201 | unsigned long flags; | 201 | unsigned long flags; |
202 | u32 temp; | 202 | u32 temp; |
203 | 203 | ||
204 | spin_lock_irqsave(&qe_ic_lock, flags); | 204 | raw_spin_lock_irqsave(&qe_ic_lock, flags); |
205 | 205 | ||
206 | temp = qe_ic_read(qe_ic->regs, qe_ic_info[src].mask_reg); | 206 | temp = qe_ic_read(qe_ic->regs, qe_ic_info[src].mask_reg); |
207 | qe_ic_write(qe_ic->regs, qe_ic_info[src].mask_reg, | 207 | qe_ic_write(qe_ic->regs, qe_ic_info[src].mask_reg, |
208 | temp | qe_ic_info[src].mask); | 208 | temp | qe_ic_info[src].mask); |
209 | 209 | ||
210 | spin_unlock_irqrestore(&qe_ic_lock, flags); | 210 | raw_spin_unlock_irqrestore(&qe_ic_lock, flags); |
211 | } | 211 | } |
212 | 212 | ||
213 | static void qe_ic_mask_irq(unsigned int virq) | 213 | static void qe_ic_mask_irq(unsigned int virq) |
@@ -217,7 +217,7 @@ static void qe_ic_mask_irq(unsigned int virq) | |||
217 | unsigned long flags; | 217 | unsigned long flags; |
218 | u32 temp; | 218 | u32 temp; |
219 | 219 | ||
220 | spin_lock_irqsave(&qe_ic_lock, flags); | 220 | raw_spin_lock_irqsave(&qe_ic_lock, flags); |
221 | 221 | ||
222 | temp = qe_ic_read(qe_ic->regs, qe_ic_info[src].mask_reg); | 222 | temp = qe_ic_read(qe_ic->regs, qe_ic_info[src].mask_reg); |
223 | qe_ic_write(qe_ic->regs, qe_ic_info[src].mask_reg, | 223 | qe_ic_write(qe_ic->regs, qe_ic_info[src].mask_reg, |
@@ -233,11 +233,11 @@ static void qe_ic_mask_irq(unsigned int virq) | |||
233 | */ | 233 | */ |
234 | mb(); | 234 | mb(); |
235 | 235 | ||
236 | spin_unlock_irqrestore(&qe_ic_lock, flags); | 236 | raw_spin_unlock_irqrestore(&qe_ic_lock, flags); |
237 | } | 237 | } |
238 | 238 | ||
239 | static struct irq_chip qe_ic_irq_chip = { | 239 | static struct irq_chip qe_ic_irq_chip = { |
240 | .typename = " QEIC ", | 240 | .name = "QEIC", |
241 | .unmask = qe_ic_unmask_irq, | 241 | .unmask = qe_ic_unmask_irq, |
242 | .mask = qe_ic_mask_irq, | 242 | .mask = qe_ic_mask_irq, |
243 | .mask_ack = qe_ic_mask_irq, | 243 | .mask_ack = qe_ic_mask_irq, |
@@ -256,14 +256,14 @@ static int qe_ic_host_map(struct irq_host *h, unsigned int virq, | |||
256 | struct irq_chip *chip; | 256 | struct irq_chip *chip; |
257 | 257 | ||
258 | if (qe_ic_info[hw].mask == 0) { | 258 | if (qe_ic_info[hw].mask == 0) { |
259 | printk(KERN_ERR "Can't map reserved IRQ \n"); | 259 | printk(KERN_ERR "Can't map reserved IRQ\n"); |
260 | return -EINVAL; | 260 | return -EINVAL; |
261 | } | 261 | } |
262 | /* Default chip */ | 262 | /* Default chip */ |
263 | chip = &qe_ic->hc_irq; | 263 | chip = &qe_ic->hc_irq; |
264 | 264 | ||
265 | set_irq_chip_data(virq, qe_ic); | 265 | set_irq_chip_data(virq, qe_ic); |
266 | get_irq_desc(virq)->status |= IRQ_LEVEL; | 266 | irq_to_desc(virq)->status |= IRQ_LEVEL; |
267 | 267 | ||
268 | set_irq_chip_and_handler(virq, chip, handle_level_irq); | 268 | set_irq_chip_and_handler(virq, chip, handle_level_irq); |
269 | 269 | ||
@@ -271,7 +271,7 @@ static int qe_ic_host_map(struct irq_host *h, unsigned int virq, | |||
271 | } | 271 | } |
272 | 272 | ||
273 | static int qe_ic_host_xlate(struct irq_host *h, struct device_node *ct, | 273 | static int qe_ic_host_xlate(struct irq_host *h, struct device_node *ct, |
274 | u32 * intspec, unsigned int intsize, | 274 | const u32 * intspec, unsigned int intsize, |
275 | irq_hw_number_t * out_hwirq, | 275 | irq_hw_number_t * out_hwirq, |
276 | unsigned int *out_flags) | 276 | unsigned int *out_flags) |
277 | { | 277 | { |
diff --git a/arch/powerpc/sysdev/qe_lib/qe_io.c b/arch/powerpc/sysdev/qe_lib/qe_io.c index 7c87460179ef..77e4934b88c5 100644 --- a/arch/powerpc/sysdev/qe_lib/qe_io.c +++ b/arch/powerpc/sysdev/qe_lib/qe_io.c | |||
@@ -157,13 +157,13 @@ int par_io_of_config(struct device_node *np) | |||
157 | const unsigned int *pio_map; | 157 | const unsigned int *pio_map; |
158 | 158 | ||
159 | if (par_io == NULL) { | 159 | if (par_io == NULL) { |
160 | printk(KERN_ERR "par_io not initialized \n"); | 160 | printk(KERN_ERR "par_io not initialized\n"); |
161 | return -1; | 161 | return -1; |
162 | } | 162 | } |
163 | 163 | ||
164 | ph = of_get_property(np, "pio-handle", NULL); | 164 | ph = of_get_property(np, "pio-handle", NULL); |
165 | if (ph == NULL) { | 165 | if (ph == NULL) { |
166 | printk(KERN_ERR "pio-handle not available \n"); | 166 | printk(KERN_ERR "pio-handle not available\n"); |
167 | return -1; | 167 | return -1; |
168 | } | 168 | } |
169 | 169 | ||
@@ -171,12 +171,12 @@ int par_io_of_config(struct device_node *np) | |||
171 | 171 | ||
172 | pio_map = of_get_property(pio, "pio-map", &pio_map_len); | 172 | pio_map = of_get_property(pio, "pio-map", &pio_map_len); |
173 | if (pio_map == NULL) { | 173 | if (pio_map == NULL) { |
174 | printk(KERN_ERR "pio-map is not set! \n"); | 174 | printk(KERN_ERR "pio-map is not set!\n"); |
175 | return -1; | 175 | return -1; |
176 | } | 176 | } |
177 | pio_map_len /= sizeof(unsigned int); | 177 | pio_map_len /= sizeof(unsigned int); |
178 | if ((pio_map_len % 6) != 0) { | 178 | if ((pio_map_len % 6) != 0) { |
179 | printk(KERN_ERR "pio-map format wrong! \n"); | 179 | printk(KERN_ERR "pio-map format wrong!\n"); |
180 | return -1; | 180 | return -1; |
181 | } | 181 | } |
182 | 182 | ||
diff --git a/arch/powerpc/sysdev/qe_lib/ucc.c b/arch/powerpc/sysdev/qe_lib/ucc.c index ebb442ea1917..fa589b21dbcd 100644 --- a/arch/powerpc/sysdev/qe_lib/ucc.c +++ b/arch/powerpc/sysdev/qe_lib/ucc.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
19 | #include <linux/slab.h> | ||
20 | #include <linux/stddef.h> | 19 | #include <linux/stddef.h> |
21 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
22 | #include <linux/module.h> | 21 | #include <linux/module.h> |