[ar71xx] create firmware image for the Ubiquiti LS-SR71 board
[openwrt.git] / target / linux / rb532 / files-2.6.23 / include / asm-mips / rc32434 / rc32434.h
1 /*
2 ***************************************************************************
3 * Definitions for IDT RC323434 CPU.
4 *
5 ****************************************************************************
6 * Kiran Rao
7 *
8 * Original form
9 ****************************************************************************
10 * P. Sadik Oct 08, 2003
11 *
12 * Started revision history
13 * Made IDT_BUS_FREQ a kernel configuration parameter
14 ****************************************************************************
15 * P. Sadik Oct 10, 2003
16 *
17 * Removed IDT_BUS_FREQ, since this parameter is no longer required. Instead
18 * idt_cpu_freq is used everywhere
19 ****************************************************************************
20 * P. Sadik Oct 20, 2003
21 *
22 * Removed RC32434_BASE_BAUD
23 ****************************************************************************
24 */
25 #ifndef _RC32434_H_
26 #define _RC32434_H_
27
28 #include <linux/autoconf.h>
29 #include <linux/delay.h>
30 #include <asm/io.h>
31
32 #define RC32434_REG_BASE 0x18000000
33
34 #define interrupt ((volatile INT_t ) INT0_VirtualAddress)
35
36
37 #define IDT_CLOCK_MULT 2
38 #define MIPS_CPU_TIMER_IRQ 7
39 /* Interrupt Controller */
40 #define IC_GROUP0_PEND (RC32434_REG_BASE + 0x38000)
41 #define IC_GROUP0_MASK (RC32434_REG_BASE + 0x38008)
42 #define IC_GROUP_OFFSET 0x0C
43
44 #define NUM_INTR_GROUPS 5
45 /* 16550 UARTs */
46
47 #define GROUP0_IRQ_BASE 8 /* GRP2 IRQ numbers start here */
48 #define GROUP1_IRQ_BASE (GROUP0_IRQ_BASE + 32) /* GRP3 IRQ numbers start here */
49 #define GROUP2_IRQ_BASE (GROUP1_IRQ_BASE + 32) /* GRP4 IRQ numbers start here */
50 #define GROUP3_IRQ_BASE (GROUP2_IRQ_BASE + 32) /* GRP5 IRQ numbers start here */
51 #define GROUP4_IRQ_BASE (GROUP3_IRQ_BASE + 32)
52
53
54 #ifdef __MIPSEB__
55 #define RC32434_UART0_BASE (RC32434_REG_BASE + 0x58003)
56 #else
57 #define RC32434_UART0_BASE (RC32434_REG_BASE + 0x58000)
58 #endif
59
60 #define RC32434_UART0_IRQ GROUP3_IRQ_BASE + 0
61 // #define EB434_UART1_IRQ GROUP4_IRQ_BASE + 11
62
63 #define local_readl(addr) __raw_readl(addr)
64 #define local_writel(l,addr) __raw_writel(l,addr)
65
66 /* cpu pipeline flush */
67 static inline void rc32434_sync(void)
68 {
69 __asm__ volatile ("sync");
70 }
71
72 static inline void rc32434_sync_udelay(int us)
73 {
74 __asm__ volatile ("sync");
75 udelay(us);
76 }
77
78 static inline void rc32434_sync_delay(int ms)
79 {
80 __asm__ volatile ("sync");
81 mdelay(ms);
82 }
83
84 /*
85 * C access to CLZ and CLO instructions
86 * (count leading zeroes/ones).
87 */
88 static inline int rc32434_clz(unsigned long val)
89 {
90 int ret;
91 __asm__ volatile (
92 ".set\tnoreorder\n\t"
93 ".set\tnoat\n\t"
94 ".set\tmips32\n\t"
95 "clz\t%0,%1\n\t"
96 ".set\tmips0\n\t"
97 ".set\tat\n\t"
98 ".set\treorder"
99 : "=r" (ret)
100 : "r" (val));
101
102 return ret;
103 }
104 static inline int rc32434_clo(unsigned long val)
105 {
106 int ret;
107 __asm__ volatile (
108 ".set\tnoreorder\n\t"
109 ".set\tnoat\n\t"
110 ".set\tmips32\n\t"
111 "clo\t%0,%1\n\t"
112 ".set\tmips0\n\t"
113 ".set\tat\n\t"
114 ".set\treorder"
115 : "=r" (ret)
116 : "r" (val));
117
118 return ret;
119 }
120
121 #endif /* _RC32434_H_ */
This page took 0.048935 seconds and 5 git commands to generate.