bfin-gpio-notes.txt 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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.