diff options
Diffstat (limited to 'arch/arm/mach-omap2/devices.c')
-rw-r--r-- | arch/arm/mach-omap2/devices.c | 149 |
1 files changed, 20 insertions, 129 deletions
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 1ec7f0597710..4269fc145698 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -504,140 +504,31 @@ static void omap_init_rng(void) | |||
504 | WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n"); | 504 | WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n"); |
505 | } | 505 | } |
506 | 506 | ||
507 | #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE) | 507 | static void __init omap_init_sham(void) |
508 | |||
509 | #ifdef CONFIG_ARCH_OMAP2 | ||
510 | static struct resource omap2_sham_resources[] = { | ||
511 | { | ||
512 | .start = OMAP24XX_SEC_SHA1MD5_BASE, | ||
513 | .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64, | ||
514 | .flags = IORESOURCE_MEM, | ||
515 | }, | ||
516 | { | ||
517 | .start = 51 + OMAP_INTC_START, | ||
518 | .flags = IORESOURCE_IRQ, | ||
519 | } | ||
520 | }; | ||
521 | static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources); | ||
522 | #else | ||
523 | #define omap2_sham_resources NULL | ||
524 | #define omap2_sham_resources_sz 0 | ||
525 | #endif | ||
526 | |||
527 | #ifdef CONFIG_ARCH_OMAP3 | ||
528 | static struct resource omap3_sham_resources[] = { | ||
529 | { | ||
530 | .start = OMAP34XX_SEC_SHA1MD5_BASE, | ||
531 | .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64, | ||
532 | .flags = IORESOURCE_MEM, | ||
533 | }, | ||
534 | { | ||
535 | .start = 49 + OMAP_INTC_START, | ||
536 | .flags = IORESOURCE_IRQ, | ||
537 | }, | ||
538 | { | ||
539 | .start = OMAP34XX_DMA_SHA1MD5_RX, | ||
540 | .flags = IORESOURCE_DMA, | ||
541 | } | ||
542 | }; | ||
543 | static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources); | ||
544 | #else | ||
545 | #define omap3_sham_resources NULL | ||
546 | #define omap3_sham_resources_sz 0 | ||
547 | #endif | ||
548 | |||
549 | static struct platform_device sham_device = { | ||
550 | .name = "omap-sham", | ||
551 | .id = -1, | ||
552 | }; | ||
553 | |||
554 | static void omap_init_sham(void) | ||
555 | { | 508 | { |
556 | if (cpu_is_omap24xx()) { | 509 | struct omap_hwmod *oh; |
557 | sham_device.resource = omap2_sham_resources; | 510 | struct platform_device *pdev; |
558 | sham_device.num_resources = omap2_sham_resources_sz; | ||
559 | } else if (cpu_is_omap34xx()) { | ||
560 | sham_device.resource = omap3_sham_resources; | ||
561 | sham_device.num_resources = omap3_sham_resources_sz; | ||
562 | } else { | ||
563 | pr_err("%s: platform not supported\n", __func__); | ||
564 | return; | ||
565 | } | ||
566 | platform_device_register(&sham_device); | ||
567 | } | ||
568 | #else | ||
569 | static inline void omap_init_sham(void) { } | ||
570 | #endif | ||
571 | |||
572 | #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE) | ||
573 | |||
574 | #ifdef CONFIG_ARCH_OMAP2 | ||
575 | static struct resource omap2_aes_resources[] = { | ||
576 | { | ||
577 | .start = OMAP24XX_SEC_AES_BASE, | ||
578 | .end = OMAP24XX_SEC_AES_BASE + 0x4C, | ||
579 | .flags = IORESOURCE_MEM, | ||
580 | }, | ||
581 | { | ||
582 | .start = OMAP24XX_DMA_AES_TX, | ||
583 | .flags = IORESOURCE_DMA, | ||
584 | }, | ||
585 | { | ||
586 | .start = OMAP24XX_DMA_AES_RX, | ||
587 | .flags = IORESOURCE_DMA, | ||
588 | } | ||
589 | }; | ||
590 | static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources); | ||
591 | #else | ||
592 | #define omap2_aes_resources NULL | ||
593 | #define omap2_aes_resources_sz 0 | ||
594 | #endif | ||
595 | 511 | ||
596 | #ifdef CONFIG_ARCH_OMAP3 | 512 | oh = omap_hwmod_lookup("sham"); |
597 | static struct resource omap3_aes_resources[] = { | 513 | if (!oh) |
598 | { | 514 | return; |
599 | .start = OMAP34XX_SEC_AES_BASE, | ||
600 | .end = OMAP34XX_SEC_AES_BASE + 0x4C, | ||
601 | .flags = IORESOURCE_MEM, | ||
602 | }, | ||
603 | { | ||
604 | .start = OMAP34XX_DMA_AES2_TX, | ||
605 | .flags = IORESOURCE_DMA, | ||
606 | }, | ||
607 | { | ||
608 | .start = OMAP34XX_DMA_AES2_RX, | ||
609 | .flags = IORESOURCE_DMA, | ||
610 | } | ||
611 | }; | ||
612 | static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources); | ||
613 | #else | ||
614 | #define omap3_aes_resources NULL | ||
615 | #define omap3_aes_resources_sz 0 | ||
616 | #endif | ||
617 | 515 | ||
618 | static struct platform_device aes_device = { | 516 | pdev = omap_device_build("omap-sham", -1, oh, NULL, 0); |
619 | .name = "omap-aes", | 517 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n"); |
620 | .id = -1, | 518 | } |
621 | }; | ||
622 | 519 | ||
623 | static void omap_init_aes(void) | 520 | static void __init omap_init_aes(void) |
624 | { | 521 | { |
625 | if (cpu_is_omap24xx()) { | 522 | struct omap_hwmod *oh; |
626 | aes_device.resource = omap2_aes_resources; | 523 | struct platform_device *pdev; |
627 | aes_device.num_resources = omap2_aes_resources_sz; | 524 | |
628 | } else if (cpu_is_omap34xx()) { | 525 | oh = omap_hwmod_lookup("aes"); |
629 | aes_device.resource = omap3_aes_resources; | 526 | if (!oh) |
630 | aes_device.num_resources = omap3_aes_resources_sz; | ||
631 | } else { | ||
632 | pr_err("%s: platform not supported\n", __func__); | ||
633 | return; | 527 | return; |
634 | } | ||
635 | platform_device_register(&aes_device); | ||
636 | } | ||
637 | 528 | ||
638 | #else | 529 | pdev = omap_device_build("omap-aes", -1, oh, NULL, 0); |
639 | static inline void omap_init_aes(void) { } | 530 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n"); |
640 | #endif | 531 | } |
641 | 532 | ||
642 | /*-------------------------------------------------------------------------*/ | 533 | /*-------------------------------------------------------------------------*/ |
643 | 534 | ||
@@ -764,11 +655,11 @@ static int __init omap2_init_devices(void) | |||
764 | omap_init_dmic(); | 655 | omap_init_dmic(); |
765 | omap_init_mcpdm(); | 656 | omap_init_mcpdm(); |
766 | omap_init_mcspi(); | 657 | omap_init_mcspi(); |
658 | omap_init_sham(); | ||
659 | omap_init_aes(); | ||
767 | } | 660 | } |
768 | omap_init_sti(); | 661 | omap_init_sti(); |
769 | omap_init_rng(); | 662 | omap_init_rng(); |
770 | omap_init_sham(); | ||
771 | omap_init_aes(); | ||
772 | omap_init_vout(); | 663 | omap_init_vout(); |
773 | omap_init_ocp2scp(); | 664 | omap_init_ocp2scp(); |
774 | 665 | ||