bfin-gpio-notes.txt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. 1. Blackfin GPIO introduction
  19. There are many GPIO pins on Blackfin. Most of these pins are muxed to
  20. multi-functions. They can be configured as peripheral, or just as GPIO,
  21. configured to input with interrupt enabled, or output.
  22. For detailed information, please see "arch/blackfin/kernel/bfin_gpio.c",
  23. or the relevant HRM.
  24. 2. Avoiding resource conflict
  25. Followed function groups are used to avoiding resource conflict,
  26. - Use the pin as peripheral,
  27. int peripheral_request(unsigned short per, const char *label);
  28. int peripheral_request_list(const unsigned short per[], const char *label);
  29. void peripheral_free(unsigned short per);
  30. void peripheral_free_list(const unsigned short per[]);
  31. - Use the pin as GPIO,
  32. int bfin_gpio_request(unsigned gpio, const char *label);
  33. void bfin_gpio_free(unsigned gpio);
  34. - Use the pin as GPIO interrupt,
  35. int bfin_gpio_irq_request(unsigned gpio, const char *label);
  36. void bfin_gpio_irq_free(unsigned gpio);
  37. The request functions will record the function state for a certain pin,
  38. the free functions will clear its function state.
  39. Once a pin is requested, it can't be requested again before it is freed by
  40. previous caller, otherwise kernel will dump stacks, and the request
  41. function fail.
  42. These functions are wrapped by other functions, most of the users need not
  43. care.
  44. 3. But there are some exceptions
  45. - Kernel permit the identical GPIO be requested both as GPIO and GPIO
  46. interrupt.
  47. Some drivers, like gpio-keys, need this behavior. Kernel only print out
  48. warning messages like,
  49. bfin-gpio: GPIO 24 is already reserved by gpio-keys: BTN0, and you are
  50. configuring it as IRQ!
  51. Note: Consider the case that, if there are two drivers need the
  52. identical GPIO, one of them use it as GPIO, the other use it as
  53. GPIO interrupt. This will really cause resource conflict. So if
  54. there is any abnormal driver behavior, please check the bfin-gpio
  55. warning messages.
  56. - Kernel permit the identical GPIO be requested from the same driver twice.