diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-07-14 21:55:27 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-07-14 21:55:27 -0400 |
commit | 5b0504c0d795d6b0a904ff861c043d7a231f67a4 (patch) | |
tree | c988e8b614c55d0dae2be4b750a03eb0a4f4d355 /arch/powerpc/sysdev | |
parent | 930074b6b9c4895d20cdadba5aff97907e28728d (diff) | |
parent | 77a76369475801ab8cbb338b9d8cfa92a491badb (diff) |
Merge commit 'gcl/gcl-next'
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/bestcomm/bestcomm.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/bestcomm/gen_bd.c | 95 | ||||
-rw-r--r-- | arch/powerpc/sysdev/bestcomm/gen_bd.h | 5 | ||||
-rw-r--r-- | arch/powerpc/sysdev/bestcomm/sram.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 133 |
5 files changed, 102 insertions, 135 deletions
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c index 64ec7d629363..446c9ea85b30 100644 --- a/arch/powerpc/sysdev/bestcomm/bestcomm.c +++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c | |||
@@ -443,7 +443,7 @@ mpc52xx_bcom_probe(struct of_device *op, const struct of_device_id *match) | |||
443 | 443 | ||
444 | /* Done ! */ | 444 | /* Done ! */ |
445 | printk(KERN_INFO "DMA: MPC52xx BestComm engine @%08lx ok !\n", | 445 | printk(KERN_INFO "DMA: MPC52xx BestComm engine @%08lx ok !\n", |
446 | bcom_eng->regs_base); | 446 | (long)bcom_eng->regs_base); |
447 | 447 | ||
448 | return 0; | 448 | return 0; |
449 | 449 | ||
diff --git a/arch/powerpc/sysdev/bestcomm/gen_bd.c b/arch/powerpc/sysdev/bestcomm/gen_bd.c index 8d33eafbb3f4..a3a134c35b0a 100644 --- a/arch/powerpc/sysdev/bestcomm/gen_bd.c +++ b/arch/powerpc/sysdev/bestcomm/gen_bd.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | 21 | ||
22 | #include <asm/mpc52xx.h> | 22 | #include <asm/mpc52xx.h> |
23 | #include <asm/mpc52xx_psc.h> | ||
23 | 24 | ||
24 | #include "bestcomm.h" | 25 | #include "bestcomm.h" |
25 | #include "bestcomm_priv.h" | 26 | #include "bestcomm_priv.h" |
@@ -253,6 +254,100 @@ bcom_gen_bd_tx_release(struct bcom_task *tsk) | |||
253 | } | 254 | } |
254 | EXPORT_SYMBOL_GPL(bcom_gen_bd_tx_release); | 255 | EXPORT_SYMBOL_GPL(bcom_gen_bd_tx_release); |
255 | 256 | ||
257 | /* --------------------------------------------------------------------- | ||
258 | * PSC support code | ||
259 | */ | ||
260 | |||
261 | /** | ||
262 | * bcom_psc_parameters - Bestcomm initialization value table for PSC devices | ||
263 | * | ||
264 | * This structure is only used internally. It is a lookup table for PSC | ||
265 | * specific parameters to bestcomm tasks. | ||
266 | */ | ||
267 | static struct bcom_psc_params { | ||
268 | int rx_initiator; | ||
269 | int rx_ipr; | ||
270 | int tx_initiator; | ||
271 | int tx_ipr; | ||
272 | } bcom_psc_params[] = { | ||
273 | [0] = { | ||
274 | .rx_initiator = BCOM_INITIATOR_PSC1_RX, | ||
275 | .rx_ipr = BCOM_IPR_PSC1_RX, | ||
276 | .tx_initiator = BCOM_INITIATOR_PSC1_TX, | ||
277 | .tx_ipr = BCOM_IPR_PSC1_TX, | ||
278 | }, | ||
279 | [1] = { | ||
280 | .rx_initiator = BCOM_INITIATOR_PSC2_RX, | ||
281 | .rx_ipr = BCOM_IPR_PSC2_RX, | ||
282 | .tx_initiator = BCOM_INITIATOR_PSC2_TX, | ||
283 | .tx_ipr = BCOM_IPR_PSC2_TX, | ||
284 | }, | ||
285 | [2] = { | ||
286 | .rx_initiator = BCOM_INITIATOR_PSC3_RX, | ||
287 | .rx_ipr = BCOM_IPR_PSC3_RX, | ||
288 | .tx_initiator = BCOM_INITIATOR_PSC3_TX, | ||
289 | .tx_ipr = BCOM_IPR_PSC3_TX, | ||
290 | }, | ||
291 | [3] = { | ||
292 | .rx_initiator = BCOM_INITIATOR_PSC4_RX, | ||
293 | .rx_ipr = BCOM_IPR_PSC4_RX, | ||
294 | .tx_initiator = BCOM_INITIATOR_PSC4_TX, | ||
295 | .tx_ipr = BCOM_IPR_PSC4_TX, | ||
296 | }, | ||
297 | [4] = { | ||
298 | .rx_initiator = BCOM_INITIATOR_PSC5_RX, | ||
299 | .rx_ipr = BCOM_IPR_PSC5_RX, | ||
300 | .tx_initiator = BCOM_INITIATOR_PSC5_TX, | ||
301 | .tx_ipr = BCOM_IPR_PSC5_TX, | ||
302 | }, | ||
303 | [5] = { | ||
304 | .rx_initiator = BCOM_INITIATOR_PSC6_RX, | ||
305 | .rx_ipr = BCOM_IPR_PSC6_RX, | ||
306 | .tx_initiator = BCOM_INITIATOR_PSC6_TX, | ||
307 | .tx_ipr = BCOM_IPR_PSC6_TX, | ||
308 | }, | ||
309 | }; | ||
310 | |||
311 | /** | ||
312 | * bcom_psc_gen_bd_rx_init - Allocate a receive bcom_task for a PSC port | ||
313 | * @psc_num: Number of the PSC to allocate a task for | ||
314 | * @queue_len: number of buffer descriptors to allocate for the task | ||
315 | * @fifo: physical address of FIFO register | ||
316 | * @maxbufsize: Maximum receive data size in bytes. | ||
317 | * | ||
318 | * Allocate a bestcomm task structure for receiving data from a PSC. | ||
319 | */ | ||
320 | struct bcom_task * bcom_psc_gen_bd_rx_init(unsigned psc_num, int queue_len, | ||
321 | phys_addr_t fifo, int maxbufsize) | ||
322 | { | ||
323 | if (psc_num >= MPC52xx_PSC_MAXNUM) | ||
324 | return NULL; | ||
325 | |||
326 | return bcom_gen_bd_rx_init(queue_len, fifo, | ||
327 | bcom_psc_params[psc_num].rx_initiator, | ||
328 | bcom_psc_params[psc_num].rx_ipr, | ||
329 | maxbufsize); | ||
330 | } | ||
331 | EXPORT_SYMBOL_GPL(bcom_psc_gen_bd_rx_init); | ||
332 | |||
333 | /** | ||
334 | * bcom_psc_gen_bd_tx_init - Allocate a transmit bcom_task for a PSC port | ||
335 | * @psc_num: Number of the PSC to allocate a task for | ||
336 | * @queue_len: number of buffer descriptors to allocate for the task | ||
337 | * @fifo: physical address of FIFO register | ||
338 | * | ||
339 | * Allocate a bestcomm task structure for transmitting data to a PSC. | ||
340 | */ | ||
341 | struct bcom_task * | ||
342 | bcom_psc_gen_bd_tx_init(unsigned psc_num, int queue_len, phys_addr_t fifo) | ||
343 | { | ||
344 | struct psc; | ||
345 | return bcom_gen_bd_tx_init(queue_len, fifo, | ||
346 | bcom_psc_params[psc_num].tx_initiator, | ||
347 | bcom_psc_params[psc_num].tx_ipr); | ||
348 | } | ||
349 | EXPORT_SYMBOL_GPL(bcom_psc_gen_bd_tx_init); | ||
350 | |||
256 | 351 | ||
257 | MODULE_DESCRIPTION("BestComm General Buffer Descriptor tasks driver"); | 352 | MODULE_DESCRIPTION("BestComm General Buffer Descriptor tasks driver"); |
258 | MODULE_AUTHOR("Jeff Gibbons <jeff.gibbons@appspec.com>"); | 353 | MODULE_AUTHOR("Jeff Gibbons <jeff.gibbons@appspec.com>"); |
diff --git a/arch/powerpc/sysdev/bestcomm/gen_bd.h b/arch/powerpc/sysdev/bestcomm/gen_bd.h index 5b6fa803c6aa..de47260e69da 100644 --- a/arch/powerpc/sysdev/bestcomm/gen_bd.h +++ b/arch/powerpc/sysdev/bestcomm/gen_bd.h | |||
@@ -44,5 +44,10 @@ extern void | |||
44 | bcom_gen_bd_tx_release(struct bcom_task *tsk); | 44 | bcom_gen_bd_tx_release(struct bcom_task *tsk); |
45 | 45 | ||
46 | 46 | ||
47 | /* PSC support utility wrappers */ | ||
48 | struct bcom_task * bcom_psc_gen_bd_rx_init(unsigned psc_num, int queue_len, | ||
49 | phys_addr_t fifo, int maxbufsize); | ||
50 | struct bcom_task * bcom_psc_gen_bd_tx_init(unsigned psc_num, int queue_len, | ||
51 | phys_addr_t fifo); | ||
47 | #endif /* __BESTCOMM_GEN_BD_H__ */ | 52 | #endif /* __BESTCOMM_GEN_BD_H__ */ |
48 | 53 | ||
diff --git a/arch/powerpc/sysdev/bestcomm/sram.c b/arch/powerpc/sysdev/bestcomm/sram.c index 99784383a843..5d74ef7a651f 100644 --- a/arch/powerpc/sysdev/bestcomm/sram.c +++ b/arch/powerpc/sysdev/bestcomm/sram.c | |||
@@ -86,7 +86,7 @@ int bcom_sram_init(struct device_node *sram_node, char *owner) | |||
86 | if (!bcom_sram->base_virt) { | 86 | if (!bcom_sram->base_virt) { |
87 | printk(KERN_ERR "%s: bcom_sram_init: " | 87 | printk(KERN_ERR "%s: bcom_sram_init: " |
88 | "Map error SRAM zone 0x%08lx (0x%0x)!\n", | 88 | "Map error SRAM zone 0x%08lx (0x%0x)!\n", |
89 | owner, bcom_sram->base_phys, bcom_sram->size ); | 89 | owner, (long)bcom_sram->base_phys, bcom_sram->size ); |
90 | rv = -ENOMEM; | 90 | rv = -ENOMEM; |
91 | goto error_release; | 91 | goto error_release; |
92 | } | 92 | } |
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index ca54563d5c7e..ebcec7362f95 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -414,139 +414,6 @@ err: | |||
414 | 414 | ||
415 | arch_initcall(gfar_of_init); | 415 | arch_initcall(gfar_of_init); |
416 | 416 | ||
417 | #ifdef CONFIG_I2C_BOARDINFO | ||
418 | #include <linux/i2c.h> | ||
419 | struct i2c_driver_device { | ||
420 | char *of_device; | ||
421 | char *i2c_type; | ||
422 | }; | ||
423 | |||
424 | static struct i2c_driver_device i2c_devices[] __initdata = { | ||
425 | {"ricoh,rs5c372a", "rs5c372a"}, | ||
426 | {"ricoh,rs5c372b", "rs5c372b"}, | ||
427 | {"ricoh,rv5c386", "rv5c386"}, | ||
428 | {"ricoh,rv5c387a", "rv5c387a"}, | ||
429 | {"dallas,ds1307", "ds1307"}, | ||
430 | {"dallas,ds1337", "ds1337"}, | ||
431 | {"dallas,ds1338", "ds1338"}, | ||
432 | {"dallas,ds1339", "ds1339"}, | ||
433 | {"dallas,ds1340", "ds1340"}, | ||
434 | {"stm,m41t00", "m41t00"}, | ||
435 | {"dallas,ds1374", "ds1374"}, | ||
436 | {"cirrus,cs4270", "cs4270"}, | ||
437 | }; | ||
438 | |||
439 | static int __init of_find_i2c_driver(struct device_node *node, | ||
440 | struct i2c_board_info *info) | ||
441 | { | ||
442 | int i; | ||
443 | |||
444 | for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) { | ||
445 | if (!of_device_is_compatible(node, i2c_devices[i].of_device)) | ||
446 | continue; | ||
447 | if (strlcpy(info->type, i2c_devices[i].i2c_type, | ||
448 | I2C_NAME_SIZE) >= I2C_NAME_SIZE) | ||
449 | return -ENOMEM; | ||
450 | return 0; | ||
451 | } | ||
452 | |||
453 | pr_warning("fsl_soc.c: unrecognized i2c node %s\n", | ||
454 | (const char *) of_get_property(node, "compatible", NULL)); | ||
455 | |||
456 | return -ENODEV; | ||
457 | } | ||
458 | |||
459 | static void __init of_register_i2c_devices(struct device_node *adap_node, | ||
460 | int bus_num) | ||
461 | { | ||
462 | struct device_node *node = NULL; | ||
463 | |||
464 | while ((node = of_get_next_child(adap_node, node))) { | ||
465 | struct i2c_board_info info = {}; | ||
466 | const u32 *addr; | ||
467 | int len; | ||
468 | |||
469 | addr = of_get_property(node, "reg", &len); | ||
470 | if (!addr || len < sizeof(int) || *addr > (1 << 10) - 1) { | ||
471 | printk(KERN_WARNING "fsl_soc.c: invalid i2c device entry\n"); | ||
472 | continue; | ||
473 | } | ||
474 | |||
475 | info.irq = irq_of_parse_and_map(node, 0); | ||
476 | if (info.irq == NO_IRQ) | ||
477 | info.irq = -1; | ||
478 | |||
479 | if (of_find_i2c_driver(node, &info) < 0) | ||
480 | continue; | ||
481 | |||
482 | info.addr = *addr; | ||
483 | |||
484 | i2c_register_board_info(bus_num, &info, 1); | ||
485 | } | ||
486 | } | ||
487 | |||
488 | static int __init fsl_i2c_of_init(void) | ||
489 | { | ||
490 | struct device_node *np; | ||
491 | unsigned int i = 0; | ||
492 | struct platform_device *i2c_dev; | ||
493 | int ret; | ||
494 | |||
495 | for_each_compatible_node(np, NULL, "fsl-i2c") { | ||
496 | struct resource r[2]; | ||
497 | struct fsl_i2c_platform_data i2c_data; | ||
498 | const unsigned char *flags = NULL; | ||
499 | int idx; | ||
500 | const u32 *iprop; | ||
501 | |||
502 | memset(&r, 0, sizeof(r)); | ||
503 | memset(&i2c_data, 0, sizeof(i2c_data)); | ||
504 | |||
505 | ret = of_address_to_resource(np, 0, &r[0]); | ||
506 | if (ret) | ||
507 | goto err; | ||
508 | |||
509 | of_irq_to_resource(np, 0, &r[1]); | ||
510 | |||
511 | iprop = of_get_property(np, "cell-index", NULL); | ||
512 | idx = iprop ? *iprop : i; | ||
513 | |||
514 | i2c_dev = platform_device_register_simple("fsl-i2c", idx, r, 2); | ||
515 | if (IS_ERR(i2c_dev)) { | ||
516 | ret = PTR_ERR(i2c_dev); | ||
517 | goto err; | ||
518 | } | ||
519 | |||
520 | i2c_data.device_flags = 0; | ||
521 | flags = of_get_property(np, "dfsrr", NULL); | ||
522 | if (flags) | ||
523 | i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR; | ||
524 | |||
525 | flags = of_get_property(np, "fsl5200-clocking", NULL); | ||
526 | if (flags) | ||
527 | i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200; | ||
528 | |||
529 | ret = | ||
530 | platform_device_add_data(i2c_dev, &i2c_data, | ||
531 | sizeof(struct | ||
532 | fsl_i2c_platform_data)); | ||
533 | if (ret) | ||
534 | goto unreg; | ||
535 | |||
536 | of_register_i2c_devices(np, idx); | ||
537 | i++; | ||
538 | } | ||
539 | |||
540 | return 0; | ||
541 | |||
542 | unreg: | ||
543 | platform_device_unregister(i2c_dev); | ||
544 | err: | ||
545 | return ret; | ||
546 | } | ||
547 | |||
548 | arch_initcall(fsl_i2c_of_init); | ||
549 | #endif | ||
550 | 417 | ||
551 | #ifdef CONFIG_PPC_83xx | 418 | #ifdef CONFIG_PPC_83xx |
552 | static int __init mpc83xx_wdt_init(void) | 419 | static int __init mpc83xx_wdt_init(void) |