aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/arm/Samsung-S3C24XX/GPIO.txt
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /Documentation/arm/Samsung-S3C24XX/GPIO.txt
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'Documentation/arm/Samsung-S3C24XX/GPIO.txt')
-rw-r--r--Documentation/arm/Samsung-S3C24XX/GPIO.txt122
1 files changed, 122 insertions, 0 deletions
diff --git a/Documentation/arm/Samsung-S3C24XX/GPIO.txt b/Documentation/arm/Samsung-S3C24XX/GPIO.txt
new file mode 100644
index 000000000000..0822764ec270
--- /dev/null
+++ b/Documentation/arm/Samsung-S3C24XX/GPIO.txt
@@ -0,0 +1,122 @@
1 S3C2410 GPIO Control
2 ====================
3
4Introduction
5------------
6
7 The s3c2410 kernel provides an interface to configure and
8 manipulate the state of the GPIO pins, and find out other
9 information about them.
10
11 There are a number of conditions attached to the configuration
12 of the s3c2410 GPIO system, please read the Samsung provided
13 data-sheet/users manual to find out the complete list.
14
15
16Headers
17-------
18
19 See include/asm-arm/arch-s3c2410/regs-gpio.h for the list
20 of GPIO pins, and the configuration values for them. This
21 is included by using #include <asm/arch/regs-gpio.h>
22
23 The GPIO management functions are defined in the hardware
24 header include/asm-arm/arch-s3c2410/hardware.h which can be
25 included by #include <asm/arch/hardware.h>
26
27 A useful ammount of documentation can be found in the hardware
28 header on how the GPIO functions (and others) work.
29
30 Whilst a number of these functions do make some checks on what
31 is passed to them, for speed of use, they may not always ensure
32 that the user supplied data to them is correct.
33
34
35PIN Numbers
36-----------
37
38 Each pin has an unique number associated with it in regs-gpio.h,
39 eg S3C2410_GPA0 or S3C2410_GPF1. These defines are used to tell
40 the GPIO functions which pin is to be used.
41
42
43Configuring a pin
44-----------------
45
46 The following function allows the configuration of a given pin to
47 be changed.
48
49 void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function);
50
51 Eg:
52
53 s3c2410_gpio_cfgpin(S3C2410_GPA0, S3C2410_GPA0_ADDR0);
54 s3c2410_gpio_cfgpin(S3C2410_GPE8, S3C2410_GPE8_SDDAT1);
55
56 which would turn GPA0 into the lowest Address line A0, and set
57 GPE8 to be connected to the SDIO/MMC controller's SDDAT1 line.
58
59
60Reading the current configuration
61---------------------------------
62
63 The current configuration of a pin can be read by using:
64
65 s3c2410_gpio_getcfg(unsigned int pin);
66
67 The return value will be from the same set of values which can be
68 passed to s3c2410_gpio_cfgpin().
69
70
71Configuring a pull-up resistor
72------------------------------
73
74 A large proportion of the GPIO pins on the S3C2410 can have weak
75 pull-up resistors enabled. This can be configured by the following
76 function:
77
78 void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);
79
80 Where the to value is zero to set the pull-up off, and 1 to enable
81 the specified pull-up. Any other values are currently undefined.
82
83
84Getting the state of a PIN
85--------------------------
86
87 The state of a pin can be read by using the function:
88
89 unsigned int s3c2410_gpio_getpin(unsigned int pin);
90
91 This will return either zero or non-zero. Do not count on this
92 function returning 1 if the pin is set.
93
94
95Setting the state of a PIN
96--------------------------
97
98 The value an pin is outputing can be modified by using the following:
99
100 void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);
101
102 Which sets the given pin to the value. Use 0 to write 0, and 1 to
103 set the output to 1.
104
105
106Getting the IRQ number associated with a PIN
107--------------------------------------------
108
109 The following function can map the given pin number to an IRQ
110 number to pass to the IRQ system.
111
112 int s3c2410_gpio_getirq(unsigned int pin);
113
114 Note, not all pins have an IRQ.
115
116
117Authour
118-------
119
120
121Ben Dooks, 03 October 2004
122(c) 2004 Ben Dooks, Simtec Electronics