aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/include/asm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-08 13:08:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-08 13:08:26 -0400
commit53bcef60633086ad73683d01a4ef9ca678484d2d (patch)
tree8b14cc031124d0aa0da6cd3b60115bc7eaa80061 /arch/cris/include/asm
parent4fd6c6bf83cb16321e9902b00e2af79054f4e0d6 (diff)
parent85d9865721c62a551547984e6cc8bd3ba732e294 (diff)
Merge branch 'for-linus' of git://www.jni.nu/cris
* 'for-linus' of git://www.jni.nu/cris: (51 commits) CRIS: Fix alignment problem for older ld CRIS: Always dump registers for segfaulting process. CRIS: Add config for pausing a seg-faulting process CRIS: Don't take faults while in_atomic CRIS: Fixup lookup for delay slot faults CRIS: Discard exit.text and .data at runtime CRIS: Add cache aligned and read mostly data sections CRIS: Return something from profile write CRIS: Add ARTPEC-3 and timestamps for sync-serial CRIS: Better ARTPEC-3 support for gpio CRIS: Add include guard CRIS: Better handling of pinmux settings CRIS: New DMA defines for ARTPEC-3 CRIS: __do_strncpy_from_user: Don't read the byte beyond the nil CRIS: Pagetable for ARTPEC-3 CRIS: Machine dependent memmap.h CRIS: Check if pointer is set before using it CRIS: Machine dependent dma.h CRIS: Define __read_mostly for CRISv32 CRIS: Discard .note.gnu.build-id section ...
Diffstat (limited to 'arch/cris/include/asm')
-rw-r--r--arch/cris/include/asm/etraxgpio.h96
-rw-r--r--arch/cris/include/asm/sync_serial.h27
2 files changed, 104 insertions, 19 deletions
diff --git a/arch/cris/include/asm/etraxgpio.h b/arch/cris/include/asm/etraxgpio.h
index 38f1c8e1770c..d474818a537e 100644
--- a/arch/cris/include/asm/etraxgpio.h
+++ b/arch/cris/include/asm/etraxgpio.h
@@ -21,31 +21,35 @@
21 * /dev/leds minor 2, Access to leds depending on kernelconfig 21 * /dev/leds minor 2, Access to leds depending on kernelconfig
22 * 22 *
23 * For ARTPEC-3 (CONFIG_CRIS_MACH_ARTPEC3): 23 * For ARTPEC-3 (CONFIG_CRIS_MACH_ARTPEC3):
24 * /dev/gpioa minor 0, 8 bit GPIO, each bit can change direction 24 * /dev/gpioa minor 0, 32 bit GPIO, each bit can change direction
25 * /dev/gpiob minor 1, 18 bit GPIO, each bit can change direction 25 * /dev/gpiob minor 1, 32 bit GPIO, each bit can change direction
26 * /dev/gpioc minor 3, 18 bit GPIO, each bit can change direction 26 * /dev/gpioc minor 3, 16 bit GPIO, each bit can change direction
27 * /dev/gpiod minor 4, 18 bit GPIO, each bit can change direction 27 * /dev/gpiod minor 4, 32 bit GPIO, input only
28 * /dev/leds minor 2, Access to leds depending on kernelconfig 28 * /dev/leds minor 2, Access to leds depending on kernelconfig
29 * /dev/pwm0 minor 16, PWM channel 0 on PA30 29 * /dev/pwm0 minor 16, PWM channel 0 on PA30
30 * /dev/pwm1 minor 17, PWM channel 1 on PA31 30 * /dev/pwm1 minor 17, PWM channel 1 on PA31
31 * /dev/pwm2 minor 18, PWM channel 2 on PB26 31 * /dev/pwm2 minor 18, PWM channel 2 on PB26
32 * /dev/ppwm minor 19, PPWM channel
32 * 33 *
33 */ 34 */
34#ifndef _ASM_ETRAXGPIO_H 35#ifndef _ASM_ETRAXGPIO_H
35#define _ASM_ETRAXGPIO_H 36#define _ASM_ETRAXGPIO_H
36 37
38#define GPIO_MINOR_FIRST 0
39
40#define ETRAXGPIO_IOCTYPE 43
41
37/* etraxgpio _IOC_TYPE, bits 8 to 15 in ioctl cmd */ 42/* etraxgpio _IOC_TYPE, bits 8 to 15 in ioctl cmd */
38#ifdef CONFIG_ETRAX_ARCH_V10 43#ifdef CONFIG_ETRAX_ARCH_V10
39#define ETRAXGPIO_IOCTYPE 43
40#define GPIO_MINOR_A 0 44#define GPIO_MINOR_A 0
41#define GPIO_MINOR_B 1 45#define GPIO_MINOR_B 1
42#define GPIO_MINOR_LEDS 2 46#define GPIO_MINOR_LEDS 2
43#define GPIO_MINOR_G 3 47#define GPIO_MINOR_G 3
44#define GPIO_MINOR_LAST 3 48#define GPIO_MINOR_LAST 3
49#define GPIO_MINOR_LAST_REAL GPIO_MINOR_LAST
45#endif 50#endif
46 51
47#ifdef CONFIG_ETRAXFS 52#ifdef CONFIG_ETRAXFS
48#define ETRAXGPIO_IOCTYPE 43
49#define GPIO_MINOR_A 0 53#define GPIO_MINOR_A 0
50#define GPIO_MINOR_B 1 54#define GPIO_MINOR_B 1
51#define GPIO_MINOR_LEDS 2 55#define GPIO_MINOR_LEDS 2
@@ -58,10 +62,10 @@
58#else 62#else
59#define GPIO_MINOR_LAST 5 63#define GPIO_MINOR_LAST 5
60#endif 64#endif
65#define GPIO_MINOR_LAST_REAL GPIO_MINOR_LAST
61#endif 66#endif
62 67
63#ifdef CONFIG_CRIS_MACH_ARTPEC3 68#ifdef CONFIG_CRIS_MACH_ARTPEC3
64#define ETRAXGPIO_IOCTYPE 43
65#define GPIO_MINOR_A 0 69#define GPIO_MINOR_A 0
66#define GPIO_MINOR_B 1 70#define GPIO_MINOR_B 1
67#define GPIO_MINOR_LEDS 2 71#define GPIO_MINOR_LEDS 2
@@ -73,12 +77,17 @@
73#else 77#else
74#define GPIO_MINOR_LAST 4 78#define GPIO_MINOR_LAST 4
75#endif 79#endif
76#define GPIO_MINOR_PWM0 16 80#define GPIO_MINOR_FIRST_PWM 16
77#define GPIO_MINOR_PWM1 17 81#define GPIO_MINOR_PWM0 (GPIO_MINOR_FIRST_PWM+0)
78#define GPIO_MINOR_PWM2 18 82#define GPIO_MINOR_PWM1 (GPIO_MINOR_FIRST_PWM+1)
79#define GPIO_MINOR_LAST_PWM GPIO_MINOR_PWM2 83#define GPIO_MINOR_PWM2 (GPIO_MINOR_FIRST_PWM+2)
84#define GPIO_MINOR_PPWM (GPIO_MINOR_FIRST_PWM+3)
85#define GPIO_MINOR_LAST_PWM GPIO_MINOR_PPWM
86#define GPIO_MINOR_LAST_REAL GPIO_MINOR_LAST_PWM
80#endif 87#endif
81 88
89
90
82/* supported ioctl _IOC_NR's */ 91/* supported ioctl _IOC_NR's */
83 92
84#define IO_READBITS 0x1 /* read and return current port bits (obsolete) */ 93#define IO_READBITS 0x1 /* read and return current port bits (obsolete) */
@@ -125,12 +134,10 @@
125 */ 134 */
126#define IO_READ_INBITS 0x10 /* *arg is result of reading the input pins */ 135#define IO_READ_INBITS 0x10 /* *arg is result of reading the input pins */
127#define IO_READ_OUTBITS 0x11 /* *arg is result of reading the output shadow */ 136#define IO_READ_OUTBITS 0x11 /* *arg is result of reading the output shadow */
128#define IO_SETGET_INPUT 0x12 /* bits set in *arg is set to input, 137#define IO_SETGET_INPUT 0x12 /* bits set in *arg is set to input, */
129 * *arg updated with current input pins. 138 /* *arg updated with current input pins. */
130 */ 139#define IO_SETGET_OUTPUT 0x13 /* bits set in *arg is set to output, */
131#define IO_SETGET_OUTPUT 0x13 /* bits set in *arg is set to output, 140 /* *arg updated with current output pins. */
132 * *arg updated with current output pins.
133 */
134 141
135/* The following ioctl's are applicable to the PWM channels only */ 142/* The following ioctl's are applicable to the PWM channels only */
136 143
@@ -140,7 +147,8 @@ enum io_pwm_mode {
140 PWM_OFF = 0, /* disabled, deallocated */ 147 PWM_OFF = 0, /* disabled, deallocated */
141 PWM_STANDARD = 1, /* 390 kHz, duty cycle 0..255/256 */ 148 PWM_STANDARD = 1, /* 390 kHz, duty cycle 0..255/256 */
142 PWM_FAST = 2, /* variable freq, w/ 10ns active pulse len */ 149 PWM_FAST = 2, /* variable freq, w/ 10ns active pulse len */
143 PWM_VARFREQ = 3 /* individually configurable high/low periods */ 150 PWM_VARFREQ = 3, /* individually configurable high/low periods */
151 PWM_SOFT = 4 /* software generated */
144}; 152};
145 153
146struct io_pwm_set_mode { 154struct io_pwm_set_mode {
@@ -176,4 +184,56 @@ struct io_pwm_set_duty {
176 int duty; /* 0..255 */ 184 int duty; /* 0..255 */
177}; 185};
178 186
187/* Returns information about the latest PWM pulse.
188 * lo: Length of the latest low period, in units of 10ns.
189 * hi: Length of the latest high period, in units of 10ns.
190 * cnt: Time since last detected edge, in units of 10ns.
191 *
192 * The input source to PWM is decied by IO_PWM_SET_INPUT_SRC.
193 *
194 * NOTE: All PWM devices is connected to the same input source.
195 */
196#define IO_PWM_GET_PERIOD 0x23
197
198struct io_pwm_get_period {
199 unsigned int lo;
200 unsigned int hi;
201 unsigned int cnt;
202};
203
204/* Sets the input source for the PWM input. For the src value see the
205 * register description for gio:rw_pwm_in_cfg.
206 *
207 * NOTE: All PWM devices is connected to the same input source.
208 */
209#define IO_PWM_SET_INPUT_SRC 0x24
210struct io_pwm_set_input_src {
211 unsigned int src; /* 0..7 */
212};
213
214/* Sets the duty cycles in steps of 1/256, 0 = 0%, 255 = 100% duty cycle */
215#define IO_PPWM_SET_DUTY 0x25
216
217struct io_ppwm_set_duty {
218 int duty; /* 0..255 */
219};
220
221/* Configuraton struct for the IO_PWMCLK_SET_CONFIG ioctl to configure
222 * PWM capable gpio pins:
223 */
224#define IO_PWMCLK_SETGET_CONFIG 0x26
225struct gpio_pwmclk_conf {
226 unsigned int gpiopin; /* The pin number based on the opened device */
227 unsigned int baseclk; /* The base clock to use, or sw will select one close*/
228 unsigned int low; /* The number of low periods of the baseclk */
229 unsigned int high; /* The number of high periods of the baseclk */
230};
231
232/* Examples:
233 * To get a symmetric 12 MHz clock without knowing anything about the hardware:
234 * baseclk = 12000000, low = 0, high = 0
235 * To just get info of current setting:
236 * baseclk = 0, low = 0, high = 0, the values will be updated by driver.
237 */
238
179#endif 239#endif
diff --git a/arch/cris/include/asm/sync_serial.h b/arch/cris/include/asm/sync_serial.h
index d87c24df2b38..7f827fea30e7 100644
--- a/arch/cris/include/asm/sync_serial.h
+++ b/arch/cris/include/asm/sync_serial.h
@@ -19,6 +19,7 @@
19#define SSP_OPOLARITY _IOR('S', 4, unsigned int) 19#define SSP_OPOLARITY _IOR('S', 4, unsigned int)
20#define SSP_SPI _IOR('S', 5, unsigned int) 20#define SSP_SPI _IOR('S', 5, unsigned int)
21#define SSP_INBUFCHUNK _IOR('S', 6, unsigned int) 21#define SSP_INBUFCHUNK _IOR('S', 6, unsigned int)
22#define SSP_INPUT _IOR('S', 7, unsigned int)
22 23
23/* Values for SSP_SPEED */ 24/* Values for SSP_SPEED */
24#define SSP150 0 25#define SSP150 0
@@ -37,6 +38,7 @@
37#define SSP921600 13 38#define SSP921600 13
38#define SSP3125000 14 39#define SSP3125000 14
39#define CODEC 15 40#define CODEC 15
41#define CODEC_f32768 16
40 42
41#define FREQ_4MHz 0 43#define FREQ_4MHz 0
42#define FREQ_2MHz 1 44#define FREQ_2MHz 1
@@ -46,9 +48,14 @@
46#define FREQ_128kHz 5 48#define FREQ_128kHz 5
47#define FREQ_64kHz 6 49#define FREQ_64kHz 6
48#define FREQ_32kHz 7 50#define FREQ_32kHz 7
51/* FREQ_* with values where bit (value & 0x10) is set are */
52/* used for CODEC_f32768 */
53#define FREQ_4096kHz 16 /* CODEC_f32768 */
49 54
50/* Used by application to set CODEC divider, word rate and frame rate */ 55/* Used by application to set CODEC divider, word rate and frame rate */
51#define CODEC_VAL(freq, clk_per_sync, sync_per_frame) (CODEC | (freq << 8) | (clk_per_sync << 16) | (sync_per_frame << 28)) 56#define CODEC_VAL(freq, clk_per_sync, sync_per_frame) \
57 ((CODEC + ((freq & 0x10) >> 4)) | (freq << 8) | \
58 (clk_per_sync << 16) | (sync_per_frame << 28))
52 59
53/* Used by driver to extract speed */ 60/* Used by driver to extract speed */
54#define GET_SPEED(x) (x & 0xff) 61#define GET_SPEED(x) (x & 0xff)
@@ -68,6 +75,7 @@
68#define NORMAL_SYNC 1 75#define NORMAL_SYNC 1
69#define EARLY_SYNC 2 76#define EARLY_SYNC 2
70#define SECOND_WORD_SYNC 0x40000 77#define SECOND_WORD_SYNC 0x40000
78#define LATE_SYNC 0x80000
71 79
72#define BIT_SYNC 4 80#define BIT_SYNC 4
73#define WORD_SYNC 8 81#define WORD_SYNC 8
@@ -104,4 +112,21 @@
104/* Values for SSP_INBUFCHUNK */ 112/* Values for SSP_INBUFCHUNK */
105/* plain integer with the size of DMA chunks */ 113/* plain integer with the size of DMA chunks */
106 114
115/* To ensure that the timestamps are aligned with the data being read
116 * the read length MUST be a multiple of the length of the DMA buffers.
117 *
118 * Use a multiple of SSP_INPUT_CHUNK_SIZE defined below.
119 */
120#define SSP_INPUT_CHUNK_SIZE 256
121
122/* Request struct to pass through the ioctl interface to read
123 * data with timestamps.
124 */
125struct ssp_request {
126 char __user *buf; /* Where to put the data. */
127 size_t len; /* Size of buf. MUST be a multiple of */
128 /* SSP_INPUT_CHUNK_SIZE! */
129 struct timespec ts; /* The time the data was sampled. */
130};
131
107#endif 132#endif