Based on kernel version 3.9. Page generated on 2013-05-02 22:55 EST.
1 /* 2 * File: Documentation/blackfin/bfin-gpio-notes.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 its 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 interrupt. 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