[U-Boot] [PATCH 0/3] omap: gpio: Use generic API (instead of custom)

Sanjeev Premi premi at ti.com
Mon Sep 5 22:28:45 CEST 2011


The OMAP boards use a custom api for GPIO operations. While
it works, it doesn't help when when we don't know existence
of the customization.

I earlier encountered the problem when looking for GPIO
related changes when submitting prev set of patches. Since
the search for gpio_request() in omap sources returned empty,
I had assumed that it isn't supported.

This patchset aims to use generic API instead of custom one.
After making the API level changes, most of the board specific
files were updated via this bash script (to minimize errors).

  [script]
  list=search.lst

  [ -f ${list} ] && \rm -rf ${list}

  grep -l -R "omap_.*_gpio" . > ${list}

  sed -i '/\.sh$/d'    ${list}	# Protect this script

  sed -i '/\.o$/d'     ${list}	# Object files
  sed -i '/\.orig$/d'  ${list}	# ongoing merge
  sed -i '/\.rej$/d'   ${list}	# ongoing merge

  sed -i '/\.git/d'    ${list}	# git packs
  sed -i '/patch/d'    ${list}	# patches
  sed -i '/diff/d'     ${list}	# saved diffs
  sed -i '/save/d'     ${list}	# any specifically saved content

  for f in `cat ${list}` ;
  do
    echo "Fixing $f..."

    sed -r -i 's/omap_request_gpio\s*\((\w+)\)/gpio_request(\1, "")/g' "$f"
    sed -r -i 's/omap_free_gpio/gpio_free/g' "$f"
    sed -r -i 's/omap_set_gpio_direction\s*\((\w+)\s*,\s*1\)/gpio_direction_input(\1)/g' "$f"
    sed -r -i 's/omap_set_gpio_direction\s*\((\w+)\s*,\s*(\w+)\)/gpio_direction_output(\1, \2)/g' "$f"
    sed -r -i 's/omap_set_gpio_dataout/gpio_set_value/g' "$f"
    sed -r -i 's/omap_get_gpio_datain/gpio_get_value/g' "$f"
    sed -r -i 's/omap_get_gpio_dataout/gpio_get_value/g' "$f"
    sed -r -i 's/asm\/arch\/gpio.h/asm\/gpio.h/g' "$f"
  done
  [/script]

Few manual changes were still required to ensure that sources
compile without errors for all these configurations:
 - omap3_evm_config
 - am3517_evm_config
 - am3517_crane_config
 - omap4_panda_config
 - omap3_zoom1_config
 - omap4_sdp4430_config
 - igep0020_config
 - cm_t35_config
 - devkit8000_config
 - igep0030_config
 - dig297_config
 - omap3_beagle_config
 - omap3_pandora_config
 - omap3_sdp3430_config
 - omap3_zoom2_config
 - omap3_overo_config

 All these boards define "CONFIG_OMAP34XX" - therefore likely
 to be impacted with this change. The list was created using:
 grep -l -R "OMAP34XX" include/configs | cut -d "/" -f 3 | sed 's/\.h/_config/g'

 Some additional patches would be required for successful
 build. Some of them are under discussion, but they status
 shouldn't impact the contents of this patch set:
 1) http://marc.info/?l=u-boot&m=131515805732292&w=2
 2) http://marc.info/?l=u-boot&m=131521839308281&w=2

Changes since RFC[1]:
 1) While the original RFC was based against the master of
    u-boot.git. This series is based against master of
    u-boot-arm.git

 2) Used better logic to search and fix 'possibly' impacted
    files i.e. the script embedded above.

 3) In order to avoid rejection of patch series due to long
    recipent list, board maintainers will be sent separate
    (off-the-list) notification.

 [1] http://marc.info/?l=u-boot&m=131473403131657&w=2


Sanjeev Premi (3):
  omap: gpio: Use generic API
  omap: gpio: generic changes after changing API
  omap: gpio: Adapt board files to use generic API

 arch/arm/cpu/armv7/omap-common/gpio.c |  113 ++++++++++++++++++++++++---------
 arch/arm/cpu/armv7/omap4/clocks.c     |    5 +-
 arch/arm/include/asm/omap_gpio.h      |   15 -----
 board/cm_t35/leds.c                   |    6 +-
 board/comelit/dig297/dig297.c         |   12 ++--
 board/isee/igep0020/igep0020.c        |   12 ++--
 board/logicpd/zoom2/debug_board.c     |   10 ++--
 board/logicpd/zoom2/led.c             |   38 ++++++------
 board/logicpd/zoom2/zoom2.c           |   10 ++--
 board/overo/overo.c                   |   54 ++++++++--------
 board/ti/beagle/beagle.c              |   44 +++++++-------
 board/ti/beagle/led.c                 |   22 +++---
 board/ti/evm/evm.c                    |   12 ++--
 doc/README.omap3                      |   20 +++---
 14 files changed, 205 insertions(+), 168 deletions(-)



More information about the U-Boot mailing list