diff options
Diffstat (limited to 'Documentation/arm/Samsung-S3C24XX/GPIO.txt')
-rw-r--r-- | Documentation/arm/Samsung-S3C24XX/GPIO.txt | 82 |
1 files changed, 25 insertions, 57 deletions
diff --git a/Documentation/arm/Samsung-S3C24XX/GPIO.txt b/Documentation/arm/Samsung-S3C24XX/GPIO.txt index 816d6071669e..8b46c79679c4 100644 --- a/Documentation/arm/Samsung-S3C24XX/GPIO.txt +++ b/Documentation/arm/Samsung-S3C24XX/GPIO.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | S3C2410 GPIO Control | 1 | S3C24XX GPIO Control |
2 | ==================== | 2 | ==================== |
3 | 3 | ||
4 | Introduction | 4 | Introduction |
@@ -12,7 +12,7 @@ Introduction | |||
12 | of the s3c2410 GPIO system, please read the Samsung provided | 12 | of the s3c2410 GPIO system, please read the Samsung provided |
13 | data-sheet/users manual to find out the complete list. | 13 | data-sheet/users manual to find out the complete list. |
14 | 14 | ||
15 | See Documentation/arm/Samsung/GPIO.txt for the core implemetation. | 15 | See Documentation/arm/Samsung/GPIO.txt for the core implementation. |
16 | 16 | ||
17 | 17 | ||
18 | GPIOLIB | 18 | GPIOLIB |
@@ -41,8 +41,8 @@ GPIOLIB | |||
41 | GPIOLIB conversion | 41 | GPIOLIB conversion |
42 | ------------------ | 42 | ------------------ |
43 | 43 | ||
44 | If you need to convert your board or driver to use gpiolib from the exiting | 44 | If you need to convert your board or driver to use gpiolib from the phased |
45 | s3c2410 api, then here are some notes on the process. | 45 | out s3c2410 API, then here are some notes on the process. |
46 | 46 | ||
47 | 1) If your board is exclusively using an GPIO, say to control peripheral | 47 | 1) If your board is exclusively using an GPIO, say to control peripheral |
48 | power, then it will require to claim the gpio with gpio_request() before | 48 | power, then it will require to claim the gpio with gpio_request() before |
@@ -55,7 +55,7 @@ s3c2410 api, then here are some notes on the process. | |||
55 | as they have the same arguments, and can either take the pin specific | 55 | as they have the same arguments, and can either take the pin specific |
56 | values, or the more generic special-function-number arguments. | 56 | values, or the more generic special-function-number arguments. |
57 | 57 | ||
58 | 3) s3c2410_gpio_pullup() changs have the problem that whilst the | 58 | 3) s3c2410_gpio_pullup() changes have the problem that whilst the |
59 | s3c2410_gpio_pullup(x, 1) can be easily translated to the | 59 | s3c2410_gpio_pullup(x, 1) can be easily translated to the |
60 | s3c_gpio_setpull(x, S3C_GPIO_PULL_NONE), the s3c2410_gpio_pullup(x, 0) | 60 | s3c_gpio_setpull(x, S3C_GPIO_PULL_NONE), the s3c2410_gpio_pullup(x, 0) |
61 | are not so easy. | 61 | are not so easy. |
@@ -74,7 +74,7 @@ s3c2410 api, then here are some notes on the process. | |||
74 | when using gpio_get_value() on an output pin (s3c2410_gpio_getpin | 74 | when using gpio_get_value() on an output pin (s3c2410_gpio_getpin |
75 | would return the value the pin is supposed to be outputting). | 75 | would return the value the pin is supposed to be outputting). |
76 | 76 | ||
77 | 6) s3c2410_gpio_getirq() should be directly replacable with the | 77 | 6) s3c2410_gpio_getirq() should be directly replaceable with the |
78 | gpio_to_irq() call. | 78 | gpio_to_irq() call. |
79 | 79 | ||
80 | The s3c2410_gpio and gpio_ calls have always operated on the same gpio | 80 | The s3c2410_gpio and gpio_ calls have always operated on the same gpio |
@@ -105,7 +105,7 @@ PIN Numbers | |||
105 | ----------- | 105 | ----------- |
106 | 106 | ||
107 | Each pin has an unique number associated with it in regs-gpio.h, | 107 | Each pin has an unique number associated with it in regs-gpio.h, |
108 | eg S3C2410_GPA(0) or S3C2410_GPF(1). These defines are used to tell | 108 | e.g. S3C2410_GPA(0) or S3C2410_GPF(1). These defines are used to tell |
109 | the GPIO functions which pin is to be used. | 109 | the GPIO functions which pin is to be used. |
110 | 110 | ||
111 | With the conversion to gpiolib, there is no longer a direct conversion | 111 | With the conversion to gpiolib, there is no longer a direct conversion |
@@ -120,31 +120,27 @@ Configuring a pin | |||
120 | The following function allows the configuration of a given pin to | 120 | The following function allows the configuration of a given pin to |
121 | be changed. | 121 | be changed. |
122 | 122 | ||
123 | void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function); | 123 | void s3c_gpio_cfgpin(unsigned int pin, unsigned int function); |
124 | 124 | ||
125 | Eg: | 125 | e.g.: |
126 | 126 | ||
127 | s3c2410_gpio_cfgpin(S3C2410_GPA(0), S3C2410_GPA0_ADDR0); | 127 | s3c_gpio_cfgpin(S3C2410_GPA(0), S3C_GPIO_SFN(1)); |
128 | s3c2410_gpio_cfgpin(S3C2410_GPE(8), S3C2410_GPE8_SDDAT1); | 128 | s3c_gpio_cfgpin(S3C2410_GPE(8), S3C_GPIO_SFN(2)); |
129 | 129 | ||
130 | which would turn GPA(0) into the lowest Address line A0, and set | 130 | which would turn GPA(0) into the lowest Address line A0, and set |
131 | GPE(8) to be connected to the SDIO/MMC controller's SDDAT1 line. | 131 | GPE(8) to be connected to the SDIO/MMC controller's SDDAT1 line. |
132 | 132 | ||
133 | The s3c_gpio_cfgpin() call is a functional replacement for this call. | ||
134 | |||
135 | 133 | ||
136 | Reading the current configuration | 134 | Reading the current configuration |
137 | --------------------------------- | 135 | --------------------------------- |
138 | 136 | ||
139 | The current configuration of a pin can be read by using: | 137 | The current configuration of a pin can be read by using standard |
138 | gpiolib function: | ||
140 | 139 | ||
141 | s3c2410_gpio_getcfg(unsigned int pin); | 140 | s3c_gpio_getcfg(unsigned int pin); |
142 | 141 | ||
143 | The return value will be from the same set of values which can be | 142 | The return value will be from the same set of values which can be |
144 | passed to s3c2410_gpio_cfgpin(). | 143 | passed to s3c_gpio_cfgpin(). |
145 | |||
146 | The s3c_gpio_getcfg() call should be a functional replacement for | ||
147 | this call. | ||
148 | 144 | ||
149 | 145 | ||
150 | Configuring a pull-up resistor | 146 | Configuring a pull-up resistor |
@@ -154,61 +150,33 @@ Configuring a pull-up resistor | |||
154 | pull-up resistors enabled. This can be configured by the following | 150 | pull-up resistors enabled. This can be configured by the following |
155 | function: | 151 | function: |
156 | 152 | ||
157 | void s3c2410_gpio_pullup(unsigned int pin, unsigned int to); | 153 | void s3c_gpio_setpull(unsigned int pin, unsigned int to); |
158 | |||
159 | Where the to value is zero to set the pull-up off, and 1 to enable | ||
160 | the specified pull-up. Any other values are currently undefined. | ||
161 | |||
162 | The s3c_gpio_setpull() offers similar functionality, but with the | ||
163 | ability to encode whether the pull is up or down. Currently there | ||
164 | is no 'just on' state, so up or down must be selected. | ||
165 | |||
166 | |||
167 | Getting the state of a PIN | ||
168 | -------------------------- | ||
169 | |||
170 | The state of a pin can be read by using the function: | ||
171 | |||
172 | unsigned int s3c2410_gpio_getpin(unsigned int pin); | ||
173 | 154 | ||
174 | This will return either zero or non-zero. Do not count on this | 155 | Where the to value is S3C_GPIO_PULL_NONE to set the pull-up off, |
175 | function returning 1 if the pin is set. | 156 | and S3C_GPIO_PULL_UP to enable the specified pull-up. Any other |
157 | values are currently undefined. | ||
176 | 158 | ||
177 | This call is now implemented by the relevant gpiolib calls, convert | ||
178 | your board or driver to use gpiolib. | ||
179 | |||
180 | |||
181 | Setting the state of a PIN | ||
182 | -------------------------- | ||
183 | |||
184 | The value an pin is outputing can be modified by using the following: | ||
185 | 159 | ||
186 | void s3c2410_gpio_setpin(unsigned int pin, unsigned int to); | 160 | Getting and setting the state of a PIN |
161 | -------------------------------------- | ||
187 | 162 | ||
188 | Which sets the given pin to the value. Use 0 to write 0, and 1 to | 163 | These calls are now implemented by the relevant gpiolib calls, convert |
189 | set the output to 1. | ||
190 | |||
191 | This call is now implemented by the relevant gpiolib calls, convert | ||
192 | your board or driver to use gpiolib. | 164 | your board or driver to use gpiolib. |
193 | 165 | ||
194 | 166 | ||
195 | Getting the IRQ number associated with a PIN | 167 | Getting the IRQ number associated with a PIN |
196 | -------------------------------------------- | 168 | -------------------------------------------- |
197 | 169 | ||
198 | The following function can map the given pin number to an IRQ | 170 | A standard gpiolib function can map the given pin number to an IRQ |
199 | number to pass to the IRQ system. | 171 | number to pass to the IRQ system. |
200 | 172 | ||
201 | int s3c2410_gpio_getirq(unsigned int pin); | 173 | int gpio_to_irq(unsigned int pin); |
202 | 174 | ||
203 | Note, not all pins have an IRQ. | 175 | Note, not all pins have an IRQ. |
204 | 176 | ||
205 | This call is now implemented by the relevant gpiolib calls, convert | ||
206 | your board or driver to use gpiolib. | ||
207 | |||
208 | 177 | ||
209 | Authour | 178 | Author |
210 | ------- | 179 | ------- |
211 | 180 | ||
212 | |||
213 | Ben Dooks, 03 October 2004 | 181 | Ben Dooks, 03 October 2004 |
214 | Copyright 2004 Ben Dooks, Simtec Electronics | 182 | Copyright 2004 Ben Dooks, Simtec Electronics |