Magellan Linux

Contents of /alx-src/trunk/kernel26-alx/linux/Documentation/arm/Samsung-S3C24XX/GPIO.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 628 - (show annotations) (download)
Wed Mar 4 10:48:58 2009 UTC (15 years, 1 month ago) by niro
File MIME type: text/plain
File size: 3351 byte(s)
import linux sources based on 2.6.12-alx-r9:
 -using linux-2.6.12.6
 -using 2.6.12-ck6 patch set
 -using fbsplash-0.9.2-r3
 -using vesafb-tng-0.9-rc7
 -using squashfs-2.2
 -added cddvd-cmdfilter-drop.patch as ck dropped it
 -added via-epia-dri (cle266) patch
 -added zd1211-svn-32 wlan driver (http://zd1211.ath.cx/download/)
 -added debian patches to zd1211 for wep256 etc

1 S3C2410 GPIO Control
2 ====================
3
4 Introduction
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
16 Headers
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
35 PIN 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
43 Configuring 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
60 Reading 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
71 Configuring 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
84 Getting 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
95 Setting 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
106 Getting 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
117 Authour
118 -------
119
120
121 Ben Dooks, 03 October 2004
122 (c) 2004 Ben Dooks, Simtec Electronics