diff options
Diffstat (limited to 'arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h')
-rw-r--r-- | arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 198 |
1 files changed, 35 insertions, 163 deletions
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h index 3112f08f0c72..56bb19219d48 100644 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | |||
@@ -19,118 +19,68 @@ | |||
19 | #define BCM6368_CPU_ID 0x6368 | 19 | #define BCM6368_CPU_ID 0x6368 |
20 | 20 | ||
21 | void __init bcm63xx_cpu_init(void); | 21 | void __init bcm63xx_cpu_init(void); |
22 | u16 __bcm63xx_get_cpu_id(void); | ||
23 | u8 bcm63xx_get_cpu_rev(void); | 22 | u8 bcm63xx_get_cpu_rev(void); |
24 | unsigned int bcm63xx_get_cpu_freq(void); | 23 | unsigned int bcm63xx_get_cpu_freq(void); |
25 | 24 | ||
25 | static inline u16 __pure __bcm63xx_get_cpu_id(const u16 cpu_id) | ||
26 | { | ||
27 | switch (cpu_id) { | ||
26 | #ifdef CONFIG_BCM63XX_CPU_3368 | 28 | #ifdef CONFIG_BCM63XX_CPU_3368 |
27 | # ifdef bcm63xx_get_cpu_id | 29 | case BCM3368_CPU_ID: |
28 | # undef bcm63xx_get_cpu_id | ||
29 | # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id() | ||
30 | # define BCMCPU_RUNTIME_DETECT | ||
31 | # else | ||
32 | # define bcm63xx_get_cpu_id() BCM3368_CPU_ID | ||
33 | # endif | ||
34 | # define BCMCPU_IS_3368() (bcm63xx_get_cpu_id() == BCM3368_CPU_ID) | ||
35 | #else | ||
36 | # define BCMCPU_IS_3368() (0) | ||
37 | #endif | 30 | #endif |
38 | 31 | ||
39 | #ifdef CONFIG_BCM63XX_CPU_6328 | 32 | #ifdef CONFIG_BCM63XX_CPU_6328 |
40 | # ifdef bcm63xx_get_cpu_id | 33 | case BCM6328_CPU_ID: |
41 | # undef bcm63xx_get_cpu_id | ||
42 | # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id() | ||
43 | # define BCMCPU_RUNTIME_DETECT | ||
44 | # else | ||
45 | # define bcm63xx_get_cpu_id() BCM6328_CPU_ID | ||
46 | # endif | ||
47 | # define BCMCPU_IS_6328() (bcm63xx_get_cpu_id() == BCM6328_CPU_ID) | ||
48 | #else | ||
49 | # define BCMCPU_IS_6328() (0) | ||
50 | #endif | 34 | #endif |
51 | 35 | ||
52 | #ifdef CONFIG_BCM63XX_CPU_6338 | 36 | #ifdef CONFIG_BCM63XX_CPU_6338 |
53 | # ifdef bcm63xx_get_cpu_id | 37 | case BCM6338_CPU_ID: |
54 | # undef bcm63xx_get_cpu_id | ||
55 | # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id() | ||
56 | # define BCMCPU_RUNTIME_DETECT | ||
57 | # else | ||
58 | # define bcm63xx_get_cpu_id() BCM6338_CPU_ID | ||
59 | # endif | ||
60 | # define BCMCPU_IS_6338() (bcm63xx_get_cpu_id() == BCM6338_CPU_ID) | ||
61 | #else | ||
62 | # define BCMCPU_IS_6338() (0) | ||
63 | #endif | 38 | #endif |
64 | 39 | ||
65 | #ifdef CONFIG_BCM63XX_CPU_6345 | 40 | #ifdef CONFIG_BCM63XX_CPU_6345 |
66 | # ifdef bcm63xx_get_cpu_id | 41 | case BCM6345_CPU_ID: |
67 | # undef bcm63xx_get_cpu_id | ||
68 | # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id() | ||
69 | # define BCMCPU_RUNTIME_DETECT | ||
70 | # else | ||
71 | # define bcm63xx_get_cpu_id() BCM6345_CPU_ID | ||
72 | # endif | ||
73 | # define BCMCPU_IS_6345() (bcm63xx_get_cpu_id() == BCM6345_CPU_ID) | ||
74 | #else | ||
75 | # define BCMCPU_IS_6345() (0) | ||
76 | #endif | 42 | #endif |
77 | 43 | ||
78 | #ifdef CONFIG_BCM63XX_CPU_6348 | 44 | #ifdef CONFIG_BCM63XX_CPU_6348 |
79 | # ifdef bcm63xx_get_cpu_id | 45 | case BCM6348_CPU_ID: |
80 | # undef bcm63xx_get_cpu_id | ||
81 | # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id() | ||
82 | # define BCMCPU_RUNTIME_DETECT | ||
83 | # else | ||
84 | # define bcm63xx_get_cpu_id() BCM6348_CPU_ID | ||
85 | # endif | ||
86 | # define BCMCPU_IS_6348() (bcm63xx_get_cpu_id() == BCM6348_CPU_ID) | ||
87 | #else | ||
88 | # define BCMCPU_IS_6348() (0) | ||
89 | #endif | 46 | #endif |
90 | 47 | ||
91 | #ifdef CONFIG_BCM63XX_CPU_6358 | 48 | #ifdef CONFIG_BCM63XX_CPU_6358 |
92 | # ifdef bcm63xx_get_cpu_id | 49 | case BCM6358_CPU_ID: |
93 | # undef bcm63xx_get_cpu_id | ||
94 | # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id() | ||
95 | # define BCMCPU_RUNTIME_DETECT | ||
96 | # else | ||
97 | # define bcm63xx_get_cpu_id() BCM6358_CPU_ID | ||
98 | # endif | ||
99 | # define BCMCPU_IS_6358() (bcm63xx_get_cpu_id() == BCM6358_CPU_ID) | ||
100 | #else | ||
101 | # define BCMCPU_IS_6358() (0) | ||
102 | #endif | 50 | #endif |
103 | 51 | ||
104 | #ifdef CONFIG_BCM63XX_CPU_6362 | 52 | #ifdef CONFIG_BCM63XX_CPU_6362 |
105 | # ifdef bcm63xx_get_cpu_id | 53 | case BCM6362_CPU_ID: |
106 | # undef bcm63xx_get_cpu_id | ||
107 | # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id() | ||
108 | # define BCMCPU_RUNTIME_DETECT | ||
109 | # else | ||
110 | # define bcm63xx_get_cpu_id() BCM6362_CPU_ID | ||
111 | # endif | ||
112 | # define BCMCPU_IS_6362() (bcm63xx_get_cpu_id() == BCM6362_CPU_ID) | ||
113 | #else | ||
114 | # define BCMCPU_IS_6362() (0) | ||
115 | #endif | 54 | #endif |
116 | 55 | ||
117 | |||
118 | #ifdef CONFIG_BCM63XX_CPU_6368 | 56 | #ifdef CONFIG_BCM63XX_CPU_6368 |
119 | # ifdef bcm63xx_get_cpu_id | 57 | case BCM6368_CPU_ID: |
120 | # undef bcm63xx_get_cpu_id | ||
121 | # define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id() | ||
122 | # define BCMCPU_RUNTIME_DETECT | ||
123 | # else | ||
124 | # define bcm63xx_get_cpu_id() BCM6368_CPU_ID | ||
125 | # endif | ||
126 | # define BCMCPU_IS_6368() (bcm63xx_get_cpu_id() == BCM6368_CPU_ID) | ||
127 | #else | ||
128 | # define BCMCPU_IS_6368() (0) | ||
129 | #endif | 58 | #endif |
59 | break; | ||
60 | default: | ||
61 | unreachable(); | ||
62 | } | ||
130 | 63 | ||
131 | #ifndef bcm63xx_get_cpu_id | 64 | return cpu_id; |
132 | #error "No CPU support configured" | 65 | } |
133 | #endif | 66 | |
67 | extern u16 bcm63xx_cpu_id; | ||
68 | |||
69 | static inline u16 __pure bcm63xx_get_cpu_id(void) | ||
70 | { | ||
71 | const u16 cpu_id = bcm63xx_cpu_id; | ||
72 | |||
73 | return __bcm63xx_get_cpu_id(cpu_id); | ||
74 | } | ||
75 | |||
76 | #define BCMCPU_IS_3368() (bcm63xx_get_cpu_id() == BCM3368_CPU_ID) | ||
77 | #define BCMCPU_IS_6328() (bcm63xx_get_cpu_id() == BCM6328_CPU_ID) | ||
78 | #define BCMCPU_IS_6338() (bcm63xx_get_cpu_id() == BCM6338_CPU_ID) | ||
79 | #define BCMCPU_IS_6345() (bcm63xx_get_cpu_id() == BCM6345_CPU_ID) | ||
80 | #define BCMCPU_IS_6348() (bcm63xx_get_cpu_id() == BCM6348_CPU_ID) | ||
81 | #define BCMCPU_IS_6358() (bcm63xx_get_cpu_id() == BCM6358_CPU_ID) | ||
82 | #define BCMCPU_IS_6362() (bcm63xx_get_cpu_id() == BCM6362_CPU_ID) | ||
83 | #define BCMCPU_IS_6368() (bcm63xx_get_cpu_id() == BCM6368_CPU_ID) | ||
134 | 84 | ||
135 | /* | 85 | /* |
136 | * While registers sets are (mostly) the same across 63xx CPU, base | 86 | * While registers sets are (mostly) the same across 63xx CPU, base |
@@ -598,55 +548,6 @@ enum bcm63xx_regs_set { | |||
598 | 548 | ||
599 | extern const unsigned long *bcm63xx_regs_base; | 549 | extern const unsigned long *bcm63xx_regs_base; |
600 | 550 | ||
601 | #define __GEN_RSET_BASE(__cpu, __rset) \ | ||
602 | case RSET_## __rset : \ | ||
603 | return BCM_## __cpu ##_## __rset ##_BASE; | ||
604 | |||
605 | #define __GEN_RSET(__cpu) \ | ||
606 | switch (set) { \ | ||
607 | __GEN_RSET_BASE(__cpu, DSL_LMEM) \ | ||
608 | __GEN_RSET_BASE(__cpu, PERF) \ | ||
609 | __GEN_RSET_BASE(__cpu, TIMER) \ | ||
610 | __GEN_RSET_BASE(__cpu, WDT) \ | ||
611 | __GEN_RSET_BASE(__cpu, UART0) \ | ||
612 | __GEN_RSET_BASE(__cpu, UART1) \ | ||
613 | __GEN_RSET_BASE(__cpu, GPIO) \ | ||
614 | __GEN_RSET_BASE(__cpu, SPI) \ | ||
615 | __GEN_RSET_BASE(__cpu, HSSPI) \ | ||
616 | __GEN_RSET_BASE(__cpu, UDC0) \ | ||
617 | __GEN_RSET_BASE(__cpu, OHCI0) \ | ||
618 | __GEN_RSET_BASE(__cpu, OHCI_PRIV) \ | ||
619 | __GEN_RSET_BASE(__cpu, USBH_PRIV) \ | ||
620 | __GEN_RSET_BASE(__cpu, USBD) \ | ||
621 | __GEN_RSET_BASE(__cpu, USBDMA) \ | ||
622 | __GEN_RSET_BASE(__cpu, MPI) \ | ||
623 | __GEN_RSET_BASE(__cpu, PCMCIA) \ | ||
624 | __GEN_RSET_BASE(__cpu, PCIE) \ | ||
625 | __GEN_RSET_BASE(__cpu, DSL) \ | ||
626 | __GEN_RSET_BASE(__cpu, ENET0) \ | ||
627 | __GEN_RSET_BASE(__cpu, ENET1) \ | ||
628 | __GEN_RSET_BASE(__cpu, ENETDMA) \ | ||
629 | __GEN_RSET_BASE(__cpu, ENETDMAC) \ | ||
630 | __GEN_RSET_BASE(__cpu, ENETDMAS) \ | ||
631 | __GEN_RSET_BASE(__cpu, ENETSW) \ | ||
632 | __GEN_RSET_BASE(__cpu, EHCI0) \ | ||
633 | __GEN_RSET_BASE(__cpu, SDRAM) \ | ||
634 | __GEN_RSET_BASE(__cpu, MEMC) \ | ||
635 | __GEN_RSET_BASE(__cpu, DDR) \ | ||
636 | __GEN_RSET_BASE(__cpu, M2M) \ | ||
637 | __GEN_RSET_BASE(__cpu, ATM) \ | ||
638 | __GEN_RSET_BASE(__cpu, XTM) \ | ||
639 | __GEN_RSET_BASE(__cpu, XTMDMA) \ | ||
640 | __GEN_RSET_BASE(__cpu, XTMDMAC) \ | ||
641 | __GEN_RSET_BASE(__cpu, XTMDMAS) \ | ||
642 | __GEN_RSET_BASE(__cpu, PCM) \ | ||
643 | __GEN_RSET_BASE(__cpu, PCMDMA) \ | ||
644 | __GEN_RSET_BASE(__cpu, PCMDMAC) \ | ||
645 | __GEN_RSET_BASE(__cpu, PCMDMAS) \ | ||
646 | __GEN_RSET_BASE(__cpu, RNG) \ | ||
647 | __GEN_RSET_BASE(__cpu, MISC) \ | ||
648 | } | ||
649 | |||
650 | #define __GEN_CPU_REGS_TABLE(__cpu) \ | 551 | #define __GEN_CPU_REGS_TABLE(__cpu) \ |
651 | [RSET_DSL_LMEM] = BCM_## __cpu ##_DSL_LMEM_BASE, \ | 552 | [RSET_DSL_LMEM] = BCM_## __cpu ##_DSL_LMEM_BASE, \ |
652 | [RSET_PERF] = BCM_## __cpu ##_PERF_BASE, \ | 553 | [RSET_PERF] = BCM_## __cpu ##_PERF_BASE, \ |
@@ -693,36 +594,7 @@ extern const unsigned long *bcm63xx_regs_base; | |||
693 | 594 | ||
694 | static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set) | 595 | static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set) |
695 | { | 596 | { |
696 | #ifdef BCMCPU_RUNTIME_DETECT | ||
697 | return bcm63xx_regs_base[set]; | 597 | return bcm63xx_regs_base[set]; |
698 | #else | ||
699 | #ifdef CONFIG_BCM63XX_CPU_3368 | ||
700 | __GEN_RSET(3368) | ||
701 | #endif | ||
702 | #ifdef CONFIG_BCM63XX_CPU_6328 | ||
703 | __GEN_RSET(6328) | ||
704 | #endif | ||
705 | #ifdef CONFIG_BCM63XX_CPU_6338 | ||
706 | __GEN_RSET(6338) | ||
707 | #endif | ||
708 | #ifdef CONFIG_BCM63XX_CPU_6345 | ||
709 | __GEN_RSET(6345) | ||
710 | #endif | ||
711 | #ifdef CONFIG_BCM63XX_CPU_6348 | ||
712 | __GEN_RSET(6348) | ||
713 | #endif | ||
714 | #ifdef CONFIG_BCM63XX_CPU_6358 | ||
715 | __GEN_RSET(6358) | ||
716 | #endif | ||
717 | #ifdef CONFIG_BCM63XX_CPU_6362 | ||
718 | __GEN_RSET(6362) | ||
719 | #endif | ||
720 | #ifdef CONFIG_BCM63XX_CPU_6368 | ||
721 | __GEN_RSET(6368) | ||
722 | #endif | ||
723 | #endif | ||
724 | /* unreached */ | ||
725 | return 0; | ||
726 | } | 598 | } |
727 | 599 | ||
728 | /* | 600 | /* |