Path: blob/master/Documentation/blackfin/bfin-gpio-notes.txt
10821 views
/*1* File: Documentation/blackfin/bfin-gpio-note.txt2* Based on:3* Author:4*5* Created: $Id: bfin-gpio-note.txt 2008-11-24 16:42 grafyang $6* Description: This file contains the notes in developing/using bfin-gpio.7*8*9* Rev:10*11* Modified:12* Copyright 2004-2008 Analog Devices Inc.13*14* Bugs: Enter bugs at http://blackfin.uclinux.org/15*16*/1718191. Blackfin GPIO introduction2021There are many GPIO pins on Blackfin. Most of these pins are muxed to22multi-functions. They can be configured as peripheral, or just as GPIO,23configured to input with interrupt enabled, or output.2425For detailed information, please see "arch/blackfin/kernel/bfin_gpio.c",26or the relevant HRM.2728292. Avoiding resource conflict3031Followed function groups are used to avoiding resource conflict,32- Use the pin as peripheral,33int peripheral_request(unsigned short per, const char *label);34int peripheral_request_list(const unsigned short per[], const char *label);35void peripheral_free(unsigned short per);36void peripheral_free_list(const unsigned short per[]);37- Use the pin as GPIO,38int bfin_gpio_request(unsigned gpio, const char *label);39void bfin_gpio_free(unsigned gpio);40- Use the pin as GPIO interrupt,41int bfin_gpio_irq_request(unsigned gpio, const char *label);42void bfin_gpio_irq_free(unsigned gpio);4344The request functions will record the function state for a certain pin,45the free functions will clear its function state.46Once a pin is requested, it can't be requested again before it is freed by47previous caller, otherwise kernel will dump stacks, and the request48function fail.49These functions are wrapped by other functions, most of the users need not50care.5152533. But there are some exceptions54- Kernel permit the identical GPIO be requested both as GPIO and GPIO55interrut.56Some drivers, like gpio-keys, need this behavior. Kernel only print out57warning messages like,58bfin-gpio: GPIO 24 is already reserved by gpio-keys: BTN0, and you are59configuring it as IRQ!6061Note: Consider the case that, if there are two drivers need the62identical GPIO, one of them use it as GPIO, the other use it as63GPIO interrupt. This will really cause resource conflict. So if64there is any abnormal driver behavior, please check the bfin-gpio65warning messages.6667- Kernel permit the identical GPIO be requested from the same driver twice.686970717273