diff options
author | Andrew Lunn <andrew@lunn.ch> | 2011-05-15 07:32:48 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2011-05-16 15:10:50 -0400 |
commit | ee9627234dae8d1b8059b2ac39c961ee0932b803 (patch) | |
tree | 1a2dfea66908b45439d322729cb6e34a59330682 /arch/arm/plat-orion | |
parent | 5e00d3783dd362a34c9816bb582103c9833e4643 (diff) |
ARM: orion: Consolidate the XOR platform setup code.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/arm/plat-orion')
-rw-r--r-- | arch/arm/plat-orion/common.c | 215 | ||||
-rw-r--r-- | arch/arm/plat-orion/include/plat/common.h | 11 |
2 files changed, 226 insertions, 0 deletions
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c index 65022094747a..0a2face7109e 100644 --- a/arch/arm/plat-orion/common.c +++ b/arch/arm/plat-orion/common.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <net/dsa.h> | 19 | #include <net/dsa.h> |
20 | #include <linux/spi/orion_spi.h> | 20 | #include <linux/spi/orion_spi.h> |
21 | #include <plat/orion_wdt.h> | 21 | #include <plat/orion_wdt.h> |
22 | #include <plat/mv_xor.h> | ||
22 | 23 | ||
23 | /* Fill in the resources structure and link it into the platform | 24 | /* Fill in the resources structure and link it into the platform |
24 | device structure. There is always a memory region, and nearly | 25 | device structure. There is always a memory region, and nearly |
@@ -585,3 +586,217 @@ void __init orion_wdt_init(unsigned long tclk) | |||
585 | orion_wdt_data.tclk = tclk; | 586 | orion_wdt_data.tclk = tclk; |
586 | platform_device_register(&orion_wdt_device); | 587 | platform_device_register(&orion_wdt_device); |
587 | } | 588 | } |
589 | |||
590 | /***************************************************************************** | ||
591 | * XOR | ||
592 | ****************************************************************************/ | ||
593 | static struct mv_xor_platform_shared_data orion_xor_shared_data; | ||
594 | |||
595 | static u64 orion_xor_dmamask = DMA_BIT_MASK(32); | ||
596 | |||
597 | void __init orion_xor_init_channels( | ||
598 | struct mv_xor_platform_data *orion_xor0_data, | ||
599 | struct platform_device *orion_xor0_channel, | ||
600 | struct mv_xor_platform_data *orion_xor1_data, | ||
601 | struct platform_device *orion_xor1_channel) | ||
602 | { | ||
603 | /* | ||
604 | * two engines can't do memset simultaneously, this limitation | ||
605 | * satisfied by removing memset support from one of the engines. | ||
606 | */ | ||
607 | dma_cap_set(DMA_MEMCPY, orion_xor0_data->cap_mask); | ||
608 | dma_cap_set(DMA_XOR, orion_xor0_data->cap_mask); | ||
609 | platform_device_register(orion_xor0_channel); | ||
610 | |||
611 | dma_cap_set(DMA_MEMCPY, orion_xor1_data->cap_mask); | ||
612 | dma_cap_set(DMA_MEMSET, orion_xor1_data->cap_mask); | ||
613 | dma_cap_set(DMA_XOR, orion_xor1_data->cap_mask); | ||
614 | platform_device_register(orion_xor1_channel); | ||
615 | } | ||
616 | |||
617 | /***************************************************************************** | ||
618 | * XOR0 | ||
619 | ****************************************************************************/ | ||
620 | static struct resource orion_xor0_shared_resources[] = { | ||
621 | { | ||
622 | .name = "xor 0 low", | ||
623 | .flags = IORESOURCE_MEM, | ||
624 | }, { | ||
625 | .name = "xor 0 high", | ||
626 | .flags = IORESOURCE_MEM, | ||
627 | }, | ||
628 | }; | ||
629 | |||
630 | static struct platform_device orion_xor0_shared = { | ||
631 | .name = MV_XOR_SHARED_NAME, | ||
632 | .id = 0, | ||
633 | .dev = { | ||
634 | .platform_data = &orion_xor_shared_data, | ||
635 | }, | ||
636 | .num_resources = ARRAY_SIZE(orion_xor0_shared_resources), | ||
637 | .resource = orion_xor0_shared_resources, | ||
638 | }; | ||
639 | |||
640 | static struct resource orion_xor00_resources[] = { | ||
641 | [0] = { | ||
642 | .flags = IORESOURCE_IRQ, | ||
643 | }, | ||
644 | }; | ||
645 | |||
646 | static struct mv_xor_platform_data orion_xor00_data = { | ||
647 | .shared = &orion_xor0_shared, | ||
648 | .hw_id = 0, | ||
649 | .pool_size = PAGE_SIZE, | ||
650 | }; | ||
651 | |||
652 | static struct platform_device orion_xor00_channel = { | ||
653 | .name = MV_XOR_NAME, | ||
654 | .id = 0, | ||
655 | .num_resources = ARRAY_SIZE(orion_xor00_resources), | ||
656 | .resource = orion_xor00_resources, | ||
657 | .dev = { | ||
658 | .dma_mask = &orion_xor_dmamask, | ||
659 | .coherent_dma_mask = DMA_BIT_MASK(64), | ||
660 | .platform_data = &orion_xor00_data, | ||
661 | }, | ||
662 | }; | ||
663 | |||
664 | static struct resource orion_xor01_resources[] = { | ||
665 | [0] = { | ||
666 | .flags = IORESOURCE_IRQ, | ||
667 | }, | ||
668 | }; | ||
669 | |||
670 | static struct mv_xor_platform_data orion_xor01_data = { | ||
671 | .shared = &orion_xor0_shared, | ||
672 | .hw_id = 1, | ||
673 | .pool_size = PAGE_SIZE, | ||
674 | }; | ||
675 | |||
676 | static struct platform_device orion_xor01_channel = { | ||
677 | .name = MV_XOR_NAME, | ||
678 | .id = 1, | ||
679 | .num_resources = ARRAY_SIZE(orion_xor01_resources), | ||
680 | .resource = orion_xor01_resources, | ||
681 | .dev = { | ||
682 | .dma_mask = &orion_xor_dmamask, | ||
683 | .coherent_dma_mask = DMA_BIT_MASK(64), | ||
684 | .platform_data = &orion_xor01_data, | ||
685 | }, | ||
686 | }; | ||
687 | |||
688 | void __init orion_xor0_init(struct mbus_dram_target_info *mbus_dram_info, | ||
689 | unsigned long mapbase_low, | ||
690 | unsigned long mapbase_high, | ||
691 | unsigned long irq_0, | ||
692 | unsigned long irq_1) | ||
693 | { | ||
694 | orion_xor_shared_data.dram = mbus_dram_info; | ||
695 | |||
696 | orion_xor0_shared_resources[0].start = mapbase_low; | ||
697 | orion_xor0_shared_resources[0].end = mapbase_low + 0xff; | ||
698 | orion_xor0_shared_resources[1].start = mapbase_high; | ||
699 | orion_xor0_shared_resources[1].end = mapbase_high + 0xff; | ||
700 | |||
701 | orion_xor00_resources[0].start = irq_0; | ||
702 | orion_xor00_resources[0].end = irq_0; | ||
703 | orion_xor01_resources[0].start = irq_1; | ||
704 | orion_xor01_resources[0].end = irq_1; | ||
705 | |||
706 | platform_device_register(&orion_xor0_shared); | ||
707 | |||
708 | orion_xor_init_channels(&orion_xor00_data, &orion_xor00_channel, | ||
709 | &orion_xor01_data, &orion_xor01_channel); | ||
710 | } | ||
711 | |||
712 | /***************************************************************************** | ||
713 | * XOR1 | ||
714 | ****************************************************************************/ | ||
715 | static struct resource orion_xor1_shared_resources[] = { | ||
716 | { | ||
717 | .name = "xor 1 low", | ||
718 | .flags = IORESOURCE_MEM, | ||
719 | }, { | ||
720 | .name = "xor 1 high", | ||
721 | .flags = IORESOURCE_MEM, | ||
722 | }, | ||
723 | }; | ||
724 | |||
725 | static struct platform_device orion_xor1_shared = { | ||
726 | .name = MV_XOR_SHARED_NAME, | ||
727 | .id = 1, | ||
728 | .dev = { | ||
729 | .platform_data = &orion_xor_shared_data, | ||
730 | }, | ||
731 | .num_resources = ARRAY_SIZE(orion_xor1_shared_resources), | ||
732 | .resource = orion_xor1_shared_resources, | ||
733 | }; | ||
734 | |||
735 | static struct resource orion_xor10_resources[] = { | ||
736 | [0] = { | ||
737 | .flags = IORESOURCE_IRQ, | ||
738 | }, | ||
739 | }; | ||
740 | |||
741 | static struct mv_xor_platform_data orion_xor10_data = { | ||
742 | .shared = &orion_xor1_shared, | ||
743 | .hw_id = 0, | ||
744 | .pool_size = PAGE_SIZE, | ||
745 | }; | ||
746 | |||
747 | static struct platform_device orion_xor10_channel = { | ||
748 | .name = MV_XOR_NAME, | ||
749 | .id = 2, | ||
750 | .num_resources = ARRAY_SIZE(orion_xor10_resources), | ||
751 | .resource = orion_xor10_resources, | ||
752 | .dev = { | ||
753 | .dma_mask = &orion_xor_dmamask, | ||
754 | .coherent_dma_mask = DMA_BIT_MASK(64), | ||
755 | .platform_data = &orion_xor10_data, | ||
756 | }, | ||
757 | }; | ||
758 | |||
759 | static struct resource orion_xor11_resources[] = { | ||
760 | [0] = { | ||
761 | .flags = IORESOURCE_IRQ, | ||
762 | }, | ||
763 | }; | ||
764 | |||
765 | static struct mv_xor_platform_data orion_xor11_data = { | ||
766 | .shared = &orion_xor1_shared, | ||
767 | .hw_id = 1, | ||
768 | .pool_size = PAGE_SIZE, | ||
769 | }; | ||
770 | |||
771 | static struct platform_device orion_xor11_channel = { | ||
772 | .name = MV_XOR_NAME, | ||
773 | .id = 3, | ||
774 | .num_resources = ARRAY_SIZE(orion_xor11_resources), | ||
775 | .resource = orion_xor11_resources, | ||
776 | .dev = { | ||
777 | .dma_mask = &orion_xor_dmamask, | ||
778 | .coherent_dma_mask = DMA_BIT_MASK(64), | ||
779 | .platform_data = &orion_xor11_data, | ||
780 | }, | ||
781 | }; | ||
782 | |||
783 | void __init orion_xor1_init(unsigned long mapbase_low, | ||
784 | unsigned long mapbase_high, | ||
785 | unsigned long irq_0, | ||
786 | unsigned long irq_1) | ||
787 | { | ||
788 | orion_xor1_shared_resources[0].start = mapbase_low; | ||
789 | orion_xor1_shared_resources[0].end = mapbase_low + 0xff; | ||
790 | orion_xor1_shared_resources[1].start = mapbase_high; | ||
791 | orion_xor1_shared_resources[1].end = mapbase_high + 0xff; | ||
792 | |||
793 | orion_xor10_resources[0].start = irq_0; | ||
794 | orion_xor10_resources[0].end = irq_0; | ||
795 | orion_xor11_resources[0].start = irq_1; | ||
796 | orion_xor11_resources[0].end = irq_1; | ||
797 | |||
798 | platform_device_register(&orion_xor1_shared); | ||
799 | |||
800 | orion_xor_init_channels(&orion_xor10_data, &orion_xor10_channel, | ||
801 | &orion_xor11_data, &orion_xor11_channel); | ||
802 | } | ||
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h index 38ae4bfd22a4..0e11ca5acd02 100644 --- a/arch/arm/plat-orion/include/plat/common.h +++ b/arch/arm/plat-orion/include/plat/common.h | |||
@@ -81,4 +81,15 @@ void __init orion_spi_1_init(unsigned long mapbase, | |||
81 | unsigned long tclk); | 81 | unsigned long tclk); |
82 | 82 | ||
83 | void __init orion_wdt_init(unsigned long tclk); | 83 | void __init orion_wdt_init(unsigned long tclk); |
84 | |||
85 | void __init orion_xor0_init(struct mbus_dram_target_info *mbus_dram_info, | ||
86 | unsigned long mapbase_low, | ||
87 | unsigned long mapbase_high, | ||
88 | unsigned long irq_0, | ||
89 | unsigned long irq_1); | ||
90 | |||
91 | void __init orion_xor1_init(unsigned long mapbase_low, | ||
92 | unsigned long mapbase_high, | ||
93 | unsigned long irq_0, | ||
94 | unsigned long irq_1); | ||
84 | #endif | 95 | #endif |