aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 14:15:23 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 14:15:23 -0500
commit3f00d3e8fb963968a922d821a9a53b503b687e81 (patch)
treedfac1c73ae63f8d48340f3bbb77ee53b322c59e9 /include/asm-mips
parent407cf84f956ee4b52da5508d5357b8ae212ff77c (diff)
parenta637a114f36b94a1ad8b9867f43bac0414958420 (diff)
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
Diffstat (limited to 'include/asm-mips')
-rw-r--r--include/asm-mips/.gitignore1
-rw-r--r--include/asm-mips/delay.h9
-rw-r--r--include/asm-mips/errno.h4
-rw-r--r--include/asm-mips/ip32/mace.h26
-rw-r--r--include/asm-mips/mach-generic/ide.h4
-rw-r--r--include/asm-mips/mc146818-time.h24
-rw-r--r--include/asm-mips/module.h38
-rw-r--r--include/asm-mips/rtc.h7
-rw-r--r--include/asm-mips/rtlx.h28
-rw-r--r--include/asm-mips/time.h3
10 files changed, 95 insertions, 49 deletions
diff --git a/include/asm-mips/.gitignore b/include/asm-mips/.gitignore
new file mode 100644
index 000000000000..4ec57ad5bc3c
--- /dev/null
+++ b/include/asm-mips/.gitignore
@@ -0,0 +1 @@
asm_offsets.h
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index 85435a8d4e52..48d00cccdafa 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -84,4 +84,13 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
84 84
85#define udelay(usecs) __udelay((usecs),__udelay_val) 85#define udelay(usecs) __udelay((usecs),__udelay_val)
86 86
87/* make sure "usecs *= ..." in udelay do not overflow. */
88#if HZ >= 1000
89#define MAX_UDELAY_MS 1
90#elif HZ <= 200
91#define MAX_UDELAY_MS 5
92#else
93#define MAX_UDELAY_MS (1000 / HZ)
94#endif
95
87#endif /* _ASM_DELAY_H */ 96#endif /* _ASM_DELAY_H */
diff --git a/include/asm-mips/errno.h b/include/asm-mips/errno.h
index 9d3e6e7cdb92..3c0d840e4577 100644
--- a/include/asm-mips/errno.h
+++ b/include/asm-mips/errno.h
@@ -119,10 +119,6 @@
119#define EOWNERDEAD 165 /* Owner died */ 119#define EOWNERDEAD 165 /* Owner died */
120#define ENOTRECOVERABLE 166 /* State not recoverable */ 120#define ENOTRECOVERABLE 166 /* State not recoverable */
121 121
122/* for robust mutexes */
123#define EOWNERDEAD 165 /* Owner died */
124#define ENOTRECOVERABLE 166 /* State not recoverable */
125
126#define EDQUOT 1133 /* Quota exceeded */ 122#define EDQUOT 1133 /* Quota exceeded */
127 123
128#ifdef __KERNEL__ 124#ifdef __KERNEL__
diff --git a/include/asm-mips/ip32/mace.h b/include/asm-mips/ip32/mace.h
index 432011b16c26..5bdc51d85b6c 100644
--- a/include/asm-mips/ip32/mace.h
+++ b/include/asm-mips/ip32/mace.h
@@ -147,6 +147,29 @@ struct mace_audio {
147 } chan[3]; 147 } chan[3];
148}; 148};
149 149
150
151/* register definitions for parallel port DMA */
152struct mace_parport {
153/* 0 - do nothing, 1 - pulse terminal count to the device after buffer is drained */
154#define MACEPAR_CONTEXT_LASTFLAG BIT(63)
155/* Should not cross 4K page boundary */
156#define MACEPAR_CONTEXT_DATALEN_MASK 0xfff00000000
157/* Can be arbitrarily aligned on any byte boundary on output, 64 byte aligned on input */
158#define MACEPAR_CONTEXT_BASEADDR_MASK 0xffffffff
159 volatile u64 context_a;
160 volatile u64 context_b;
161#define MACEPAR_CTLSTAT_DIRECTION BIT(0) /* 0 - mem->device, 1 - device->mem */
162#define MACEPAR_CTLSTAT_ENABLE BIT(1) /* 0 - channel frozen, 1 - channel enabled */
163#define MACEPAR_CTLSTAT_RESET BIT(2) /* 0 - channel active, 1 - complete channel reset */
164#define MACEPAR_CTLSTAT_CTXB_VALID BIT(3)
165#define MACEPAR_CTLSTAT_CTXA_VALID BIT(4)
166 volatile u64 cntlstat; /* Control/Status register */
167#define MACEPAR_DIAG_CTXINUSE BIT(1)
168#define MACEPAR_DIAG_DMACTIVE BIT(2) /* 1 - Dma engine is enabled and processing something */
169#define MACEPAR_DIAG_CTRMASK 0x3ffc /* Counter of bytes left */
170 volatile u64 diagnostic; /* RO: diagnostic register */
171};
172
150/* ISA Control and DMA registers */ 173/* ISA Control and DMA registers */
151struct mace_isactrl { 174struct mace_isactrl {
152 volatile unsigned long ringbase; 175 volatile unsigned long ringbase;
@@ -199,6 +222,7 @@ struct mace_isactrl {
199 volatile unsigned long _pad[0x2000/8 - 4]; 222 volatile unsigned long _pad[0x2000/8 - 4];
200 223
201 volatile unsigned long dp_ram[0x400]; 224 volatile unsigned long dp_ram[0x400];
225 struct mace_parport parport;
202}; 226};
203 227
204/* Keyboard & Mouse registers 228/* Keyboard & Mouse registers
@@ -277,7 +301,7 @@ struct mace_perif {
277 */ 301 */
278 302
279/* Parallel port */ 303/* Parallel port */
280struct mace_parallel { /* later... */ 304struct mace_parallel {
281}; 305};
282 306
283struct mace_ecp1284 { /* later... */ 307struct mace_ecp1284 { /* later... */
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
index 961006948c7c..550979a9ea9d 100644
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -168,8 +168,12 @@ static inline void __ide_mm_outsl(void __iomem * port, void *addr, u32 count)
168/* ide_insw calls insw, not __ide_insw. Why? */ 168/* ide_insw calls insw, not __ide_insw. Why? */
169#undef insw 169#undef insw
170#undef insl 170#undef insl
171#undef outsw
172#undef outsl
171#define insw(port, addr, count) __ide_insw(port, addr, count) 173#define insw(port, addr, count) __ide_insw(port, addr, count)
172#define insl(port, addr, count) __ide_insl(port, addr, count) 174#define insl(port, addr, count) __ide_insl(port, addr, count)
175#define outsw(port, addr, count) __ide_outsw(port, addr, count)
176#define outsl(port, addr, count) __ide_outsl(port, addr, count)
173 177
174#endif /* __KERNEL__ */ 178#endif /* __KERNEL__ */
175 179
diff --git a/include/asm-mips/mc146818-time.h b/include/asm-mips/mc146818-time.h
index a2c2d2c24303..47214861093b 100644
--- a/include/asm-mips/mc146818-time.h
+++ b/include/asm-mips/mc146818-time.h
@@ -33,7 +33,9 @@ static inline int mc146818_set_rtc_mmss(unsigned long nowtime)
33 int real_seconds, real_minutes, cmos_minutes; 33 int real_seconds, real_minutes, cmos_minutes;
34 unsigned char save_control, save_freq_select; 34 unsigned char save_control, save_freq_select;
35 int retval = 0; 35 int retval = 0;
36 unsigned long flags;
36 37
38 spin_lock_irqsave(&rtc_lock, flags);
37 save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */ 39 save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */
38 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); 40 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
39 41
@@ -79,14 +81,30 @@ static inline int mc146818_set_rtc_mmss(unsigned long nowtime)
79 */ 81 */
80 CMOS_WRITE(save_control, RTC_CONTROL); 82 CMOS_WRITE(save_control, RTC_CONTROL);
81 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); 83 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
84 spin_unlock_irqrestore(&rtc_lock, flags);
82 85
83 return retval; 86 return retval;
84} 87}
85 88
89/*
90 * Returns true if a clock update is in progress
91 */
92static inline unsigned char rtc_is_updating(void)
93{
94 unsigned char uip;
95 unsigned long flags;
96
97 spin_lock_irqsave(&rtc_lock, flags);
98 uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
99 spin_unlock_irqrestore(&rtc_lock, flags);
100 return uip;
101}
102
86static inline unsigned long mc146818_get_cmos_time(void) 103static inline unsigned long mc146818_get_cmos_time(void)
87{ 104{
88 unsigned int year, mon, day, hour, min, sec; 105 unsigned int year, mon, day, hour, min, sec;
89 int i; 106 int i;
107 unsigned long flags;
90 108
91 /* 109 /*
92 * The Linux interpretation of the CMOS clock register contents: 110 * The Linux interpretation of the CMOS clock register contents:
@@ -97,12 +115,13 @@ static inline unsigned long mc146818_get_cmos_time(void)
97 115
98 /* read RTC exactly on falling edge of update flag */ 116 /* read RTC exactly on falling edge of update flag */
99 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ 117 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
100 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) 118 if (rtc_is_updating())
101 break; 119 break;
102 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */ 120 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
103 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) 121 if (!rtc_is_updating())
104 break; 122 break;
105 123
124 spin_lock_irqsave(&rtc_lock, flags);
106 do { /* Isn't this overkill ? UIP above should guarantee consistency */ 125 do { /* Isn't this overkill ? UIP above should guarantee consistency */
107 sec = CMOS_READ(RTC_SECONDS); 126 sec = CMOS_READ(RTC_SECONDS);
108 min = CMOS_READ(RTC_MINUTES); 127 min = CMOS_READ(RTC_MINUTES);
@@ -120,6 +139,7 @@ static inline unsigned long mc146818_get_cmos_time(void)
120 BCD_TO_BIN(mon); 139 BCD_TO_BIN(mon);
121 BCD_TO_BIN(year); 140 BCD_TO_BIN(year);
122 } 141 }
142 spin_unlock_irqrestore(&rtc_lock, flags);
123 year = mc146818_decode_year(year); 143 year = mc146818_decode_year(year);
124 144
125 return mktime(year, mon, day, hour, min, sec); 145 return mktime(year, mon, day, hour, min, sec);
diff --git a/include/asm-mips/module.h b/include/asm-mips/module.h
index 2be399311eec..2af496c78c12 100644
--- a/include/asm-mips/module.h
+++ b/include/asm-mips/module.h
@@ -76,43 +76,43 @@ search_module_dbetables(unsigned long addr)
76#endif 76#endif
77 77
78#ifdef CONFIG_CPU_MIPS32_R1 78#ifdef CONFIG_CPU_MIPS32_R1
79#define MODULE_PROC_FAMILY "MIPS32_R1" 79#define MODULE_PROC_FAMILY "MIPS32_R1 "
80#elif defined CONFIG_CPU_MIPS32_R2 80#elif defined CONFIG_CPU_MIPS32_R2
81#define MODULE_PROC_FAMILY "MIPS32_R2" 81#define MODULE_PROC_FAMILY "MIPS32_R2 "
82#elif defined CONFIG_CPU_MIPS64_R1 82#elif defined CONFIG_CPU_MIPS64_R1
83#define MODULE_PROC_FAMILY "MIPS64_R1" 83#define MODULE_PROC_FAMILY "MIPS64_R1 "
84#elif defined CONFIG_CPU_MIPS64_R2 84#elif defined CONFIG_CPU_MIPS64_R2
85#define MODULE_PROC_FAMILY "MIPS64_R2" 85#define MODULE_PROC_FAMILY "MIPS64_R2 "
86#elif defined CONFIG_CPU_R3000 86#elif defined CONFIG_CPU_R3000
87#define MODULE_PROC_FAMILY "R3000" 87#define MODULE_PROC_FAMILY "R3000 "
88#elif defined CONFIG_CPU_TX39XX 88#elif defined CONFIG_CPU_TX39XX
89#define MODULE_PROC_FAMILY "TX39XX" 89#define MODULE_PROC_FAMILY "TX39XX "
90#elif defined CONFIG_CPU_VR41XX 90#elif defined CONFIG_CPU_VR41XX
91#define MODULE_PROC_FAMILY "VR41XX" 91#define MODULE_PROC_FAMILY "VR41XX "
92#elif defined CONFIG_CPU_R4300 92#elif defined CONFIG_CPU_R4300
93#define MODULE_PROC_FAMILY "R4300" 93#define MODULE_PROC_FAMILY "R4300 "
94#elif defined CONFIG_CPU_R4X00 94#elif defined CONFIG_CPU_R4X00
95#define MODULE_PROC_FAMILY "R4X00" 95#define MODULE_PROC_FAMILY "R4X00 "
96#elif defined CONFIG_CPU_TX49XX 96#elif defined CONFIG_CPU_TX49XX
97#define MODULE_PROC_FAMILY "TX49XX" 97#define MODULE_PROC_FAMILY "TX49XX "
98#elif defined CONFIG_CPU_R5000 98#elif defined CONFIG_CPU_R5000
99#define MODULE_PROC_FAMILY "R5000" 99#define MODULE_PROC_FAMILY "R5000 "
100#elif defined CONFIG_CPU_R5432 100#elif defined CONFIG_CPU_R5432
101#define MODULE_PROC_FAMILY "R5432" 101#define MODULE_PROC_FAMILY "R5432 "
102#elif defined CONFIG_CPU_R6000 102#elif defined CONFIG_CPU_R6000
103#define MODULE_PROC_FAMILY "R6000" 103#define MODULE_PROC_FAMILY "R6000 "
104#elif defined CONFIG_CPU_NEVADA 104#elif defined CONFIG_CPU_NEVADA
105#define MODULE_PROC_FAMILY "NEVADA" 105#define MODULE_PROC_FAMILY "NEVADA "
106#elif defined CONFIG_CPU_R8000 106#elif defined CONFIG_CPU_R8000
107#define MODULE_PROC_FAMILY "R8000" 107#define MODULE_PROC_FAMILY "R8000 "
108#elif defined CONFIG_CPU_R10000 108#elif defined CONFIG_CPU_R10000
109#define MODULE_PROC_FAMILY "R10000" 109#define MODULE_PROC_FAMILY "R10000 "
110#elif defined CONFIG_CPU_RM7000 110#elif defined CONFIG_CPU_RM7000
111#define MODULE_PROC_FAMILY "RM7000" 111#define MODULE_PROC_FAMILY "RM7000 "
112#elif defined CONFIG_CPU_RM9000 112#elif defined CONFIG_CPU_RM9000
113#define MODULE_PROC_FAMILY "RM9000" 113#define MODULE_PROC_FAMILY "RM9000 "
114#elif defined CONFIG_CPU_SB1 114#elif defined CONFIG_CPU_SB1
115#define MODULE_PROC_FAMILY "SB1" 115#define MODULE_PROC_FAMILY "SB1 "
116#else 116#else
117#error MODULE_PROC_FAMILY undefined for your processor configuration 117#error MODULE_PROC_FAMILY undefined for your processor configuration
118#endif 118#endif
diff --git a/include/asm-mips/rtc.h b/include/asm-mips/rtc.h
index a60e0dc7c9b9..a2abc4572b63 100644
--- a/include/asm-mips/rtc.h
+++ b/include/asm-mips/rtc.h
@@ -14,7 +14,6 @@
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16 16
17#include <linux/spinlock.h>
18#include <linux/rtc.h> 17#include <linux/rtc.h>
19#include <asm/time.h> 18#include <asm/time.h>
20 19
@@ -29,17 +28,13 @@
29#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ 28#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
30#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ 29#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
31 30
32static DEFINE_SPINLOCK(mips_rtc_lock);
33
34static inline unsigned int get_rtc_time(struct rtc_time *time) 31static inline unsigned int get_rtc_time(struct rtc_time *time)
35{ 32{
36 unsigned long nowtime; 33 unsigned long nowtime;
37 34
38 spin_lock(&mips_rtc_lock);
39 nowtime = rtc_get_time(); 35 nowtime = rtc_get_time();
40 to_tm(nowtime, time); 36 to_tm(nowtime, time);
41 time->tm_year -= 1900; 37 time->tm_year -= 1900;
42 spin_unlock(&mips_rtc_lock);
43 38
44 return RTC_24H; 39 return RTC_24H;
45} 40}
@@ -49,12 +44,10 @@ static inline int set_rtc_time(struct rtc_time *time)
49 unsigned long nowtime; 44 unsigned long nowtime;
50 int ret; 45 int ret;
51 46
52 spin_lock(&mips_rtc_lock);
53 nowtime = mktime(time->tm_year+1900, time->tm_mon+1, 47 nowtime = mktime(time->tm_year+1900, time->tm_mon+1,
54 time->tm_mday, time->tm_hour, time->tm_min, 48 time->tm_mday, time->tm_hour, time->tm_min,
55 time->tm_sec); 49 time->tm_sec);
56 ret = rtc_set_time(nowtime); 50 ret = rtc_set_time(nowtime);
57 spin_unlock(&mips_rtc_lock);
58 51
59 return ret; 52 return ret;
60} 53}
diff --git a/include/asm-mips/rtlx.h b/include/asm-mips/rtlx.h
index 83cdf6ab0d1f..1298c3fdf6c9 100644
--- a/include/asm-mips/rtlx.h
+++ b/include/asm-mips/rtlx.h
@@ -16,21 +16,19 @@
16#define RTLX_ID (RTLX_xID | RTLX_VERSION) 16#define RTLX_ID (RTLX_xID | RTLX_VERSION)
17#define RTLX_CHANNELS 8 17#define RTLX_CHANNELS 8
18 18
19enum rtlx_state {
20 RTLX_STATE_UNUSED = 0,
21 RTLX_STATE_INITIALISED,
22 RTLX_STATE_REMOTE_READY,
23 RTLX_STATE_OPENED
24};
25
26#define RTLX_BUFFER_SIZE 1024 19#define RTLX_BUFFER_SIZE 1024
20
21/*
22 * lx_state bits
23 */
24#define RTLX_STATE_OPENED 1UL
25
27/* each channel supports read and write. 26/* each channel supports read and write.
28 linux (vpe0) reads lx_buffer and writes rt_buffer 27 linux (vpe0) reads lx_buffer and writes rt_buffer
29 SP (vpe1) reads rt_buffer and writes lx_buffer 28 SP (vpe1) reads rt_buffer and writes lx_buffer
30*/ 29*/
31typedef struct rtlx_channel { 30struct rtlx_channel {
32 enum rtlx_state rt_state; 31 unsigned long lx_state;
33 enum rtlx_state lx_state;
34 32
35 int buffer_size; 33 int buffer_size;
36 34
@@ -43,14 +41,12 @@ typedef struct rtlx_channel {
43 41
44 void *queues; 42 void *queues;
45 43
46} rtlx_channel_t; 44};
47 45
48typedef struct rtlx_info { 46struct rtlx_info {
49 unsigned long id; 47 unsigned long id;
50 enum rtlx_state state;
51 48
52 struct rtlx_channel channel[RTLX_CHANNELS]; 49 struct rtlx_channel channel[RTLX_CHANNELS];
50};
53 51
54} rtlx_info_t; 52#endif /* _RTLX_H_ */
55
56#endif
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index e22a20665871..9cc3564cc2c9 100644
--- a/include/asm-mips/time.h
+++ b/include/asm-mips/time.h
@@ -20,6 +20,9 @@
20#include <linux/linkage.h> 20#include <linux/linkage.h>
21#include <linux/ptrace.h> 21#include <linux/ptrace.h>
22#include <linux/rtc.h> 22#include <linux/rtc.h>
23#include <linux/spinlock.h>
24
25extern spinlock_t rtc_lock;
23 26
24/* 27/*
25 * RTC ops. By default, they point to no-RTC functions. 28 * RTC ops. By default, they point to no-RTC functions.