diff options
author | Graf Yang <graf.yang@analog.com> | 2009-01-07 10:14:38 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2009-01-07 10:14:38 -0500 |
commit | 5e6d9f511e0188d34fa7a93ce2d0e6194442b0da (patch) | |
tree | bacabdb1365320f3becea3ff0f129cb7d88f280a | |
parent | d1a853057a13e63c40c9b8715e585af15f1b141a (diff) |
Blackfin arch: Add document about bfin-gpio
Add document about bfin-gpio when requesting a pin
both as gpio and gpio interrupt.
Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
-rw-r--r-- | Documentation/blackfin/00-INDEX | 3 | ||||
-rw-r--r-- | Documentation/blackfin/bfin-gpio-notes.txt | 71 |
2 files changed, 74 insertions, 0 deletions
diff --git a/Documentation/blackfin/00-INDEX b/Documentation/blackfin/00-INDEX index 7cb3b356b249..d6840a91e1e1 100644 --- a/Documentation/blackfin/00-INDEX +++ b/Documentation/blackfin/00-INDEX | |||
@@ -9,3 +9,6 @@ cachefeatures.txt | |||
9 | 9 | ||
10 | Filesystems | 10 | Filesystems |
11 | - Requirements for mounting the root file system. | 11 | - Requirements for mounting the root file system. |
12 | |||
13 | bfin-gpio-note.txt | ||
14 | - Notes in developing/using bfin-gpio driver. | ||
diff --git a/Documentation/blackfin/bfin-gpio-notes.txt b/Documentation/blackfin/bfin-gpio-notes.txt new file mode 100644 index 000000000000..9898c7ded7d3 --- /dev/null +++ b/Documentation/blackfin/bfin-gpio-notes.txt | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * File: Documentation/blackfin/bfin-gpio-note.txt | ||
3 | * Based on: | ||
4 | * Author: | ||
5 | * | ||
6 | * Created: $Id: bfin-gpio-note.txt 2008-11-24 16:42 grafyang $ | ||
7 | * Description: This file contains the notes in developing/using bfin-gpio. | ||
8 | * | ||
9 | * | ||
10 | * Rev: | ||
11 | * | ||
12 | * Modified: | ||
13 | * Copyright 2004-2008 Analog Devices Inc. | ||
14 | * | ||
15 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | |||
20 | 1. Blackfin GPIO introduction | ||
21 | |||
22 | There are many GPIO pins on Blackfin. Most of these pins are muxed to | ||
23 | multi-functions. They can be configured as peripheral, or just as GPIO, | ||
24 | configured to input with interrupt enabled, or output. | ||
25 | |||
26 | For detailed information, please see "arch/blackfin/kernel/bfin_gpio.c", | ||
27 | or the relevant HRM. | ||
28 | |||
29 | |||
30 | 2. Avoiding resource conflict | ||
31 | |||
32 | Followed function groups are used to avoiding resource conflict, | ||
33 | - Use the pin as peripheral, | ||
34 | int peripheral_request(unsigned short per, const char *label); | ||
35 | int peripheral_request_list(const unsigned short per[], const char *label); | ||
36 | void peripheral_free(unsigned short per); | ||
37 | void peripheral_free_list(const unsigned short per[]); | ||
38 | - Use the pin as GPIO, | ||
39 | int bfin_gpio_request(unsigned gpio, const char *label); | ||
40 | void bfin_gpio_free(unsigned gpio); | ||
41 | - Use the pin as GPIO interrupt, | ||
42 | int bfin_gpio_irq_request(unsigned gpio, const char *label); | ||
43 | void bfin_gpio_irq_free(unsigned gpio); | ||
44 | |||
45 | The request functions will record the function state for a certain pin, | ||
46 | the free functions will clear it's function state. | ||
47 | Once a pin is requested, it can't be requested again before it is freed by | ||
48 | previous caller, otherwise kernel will dump stacks, and the request | ||
49 | function fail. | ||
50 | These functions are wrapped by other functions, most of the users need not | ||
51 | care. | ||
52 | |||
53 | |||
54 | 3. But there are some exceptions | ||
55 | - Kernel permit the identical GPIO be requested both as GPIO and GPIO | ||
56 | interrut. | ||
57 | Some drivers, like gpio-keys, need this behavior. Kernel only print out | ||
58 | warning messages like, | ||
59 | bfin-gpio: GPIO 24 is already reserved by gpio-keys: BTN0, and you are | ||
60 | configuring it as IRQ! | ||
61 | |||
62 | Note: Consider the case that, if there are two drivers need the | ||
63 | identical GPIO, one of them use it as GPIO, the other use it as | ||
64 | GPIO interrupt. This will really cause resource conflict. So if | ||
65 | there is any abnormal driver behavior, please check the bfin-gpio | ||
66 | warning messages. | ||
67 | |||
68 | - Kernel permit the identical GPIO be requested from the same driver twice. | ||
69 | |||
70 | |||
71 | |||