@@ -1,99 +1,71 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" >
+ * File: Documentation/blackfin/bfin-gpio-note.txt
+ * Based on:
+ * Author:
+ * Created: $Id: bfin-gpio-note.txt 2008-11-24 16:42 grafyang $
+ * Description: This file contains the notes in developing/using bfin-gpio.
+ * Rev:
+ * Modified:
+ * Copyright 2004-2008 Analog Devices Inc.
+ * Bugs: Enter bugs at http://blackfin.uclinux.org/
- <title>Synchronous PPP and Cisco HDLC Programming Guide</title>
- <holder>Alan Cox</holder>
+1. Blackfin GPIO introduction
- This documentation is free software; you can redistribute
- it and/or modify it under the terms of the GNU General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later
- This program is distributed in the hope that it will be
- useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
- You should have received a copy of the GNU General Public
- License along with this program; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- MA 02111-1307 USA
- For more details see the file COPYING in the source
- distribution of Linux.
+ There are many GPIO pins on Blackfin. Most of these pins are muxed to
+ multi-functions. They can be configured as peripheral, or just as GPIO,
+ configured to input with interrupt enabled, or output.
+ For detailed information, please see "arch/blackfin/kernel/bfin_gpio.c",
+ or the relevant HRM.
- <chapter id="intro">
- The syncppp drivers in Linux provide a fairly complete
- implementation of Cisco HDLC and a minimal implementation of
- PPP. The longer term goal is to switch the PPP layer to the
- generic PPP interface that is new in Linux 2.3.x. The API should
- remain unchanged when this is done, but support will then be
- available for IPX, compression and other PPP features
- <chapter id="bugs">
- <title>Known Bugs And Assumptions</title>
- <varlistentry><term>PPP is minimal</term>
- The current PPP implementation is very basic, although sufficient
- for most wan usages.
- <varlistentry><term>Cisco HDLC Quirks</term>
- Currently we do not end all packets with the correct Cisco multicast
- or unicast flags. Nothing appears to mind too much but this should
- be corrected.
+2. Avoiding resource conflict
- <chapter id="pubfunctions">
- <title>Public Functions Provided</title>
+ Followed function groups are used to avoiding resource conflict,
+ - Use the pin as peripheral,
+ int peripheral_request(unsigned short per, const char *label);
+ int peripheral_request_list(const unsigned short per, const char *label);
+ void peripheral_free(unsigned short per);
+ void peripheral_free_list(const unsigned short per);
+ - Use the pin as GPIO,
+ int bfin_gpio_request(unsigned gpio, const char *label);
+ void bfin_gpio_free(unsigned gpio);
+ - Use the pin as GPIO interrupt,
+ int bfin_gpio_irq_request(unsigned gpio, const char *label);
+ void bfin_gpio_irq_free(unsigned gpio);
+ The request functions will record the function state for a certain pin,
+ the free functions will clear it's function state.
+ Once a pin is requested, it can't be requested again before it is freed by
+ previous caller, otherwise kernel will dump stacks, and the request
+ function fail.
+ These functions are wrapped by other functions, most of the users need not
+3. But there are some exceptions
+ - Kernel permit the identical GPIO be requested both as GPIO and GPIO
+ Some drivers, like gpio-keys, need this behavior. Kernel only print out
+ warning messages like,
+ bfin-gpio: GPIO 24 is already reserved by gpio-keys: BTN0, and you are
+configuring it as IRQ!
+ Note: Consider the case that, if there are two drivers need the
+ identical GPIO, one of them use it as GPIO, the other use it as
+ GPIO interrupt. This will really cause resource conflict. So if
+ there is any abnormal driver behavior, please check the bfin-gpio
+ warning messages.
+ - Kernel permit the identical GPIO be requested from the same driver twice.