Skip to content

RFC omap: gpio: User generic (instead of custom) API

Sanjeev Premi u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3omap: gpio: Use generic APIarch/arm/cpu/armv7/omap-common/gpio.c arch/arm/include/asm/arch-omap3/gpio.h arch/arm/include/asm/omap_gpio.h+72 -340 replies
2/3omap: gpio: generic changes after changing APIarch/arm/cpu/armv7/omap4/clocks.c doc/README.omap3+12 -120 replies
3/3omap: gpio: Adapt board files to use generic APIboard/cm_t35/leds.c board/comelit/dig297/dig297.c board/isee/igep0020/igep0020.c +7 more+93 -931 reply

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by.

PatchLuca Ceresoli
SeriesT-b
1/3
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [U-Boot] [RFC 0/3] omap: gpio: User generic (instead of custom) API

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 attempts to adapt the current implementation to use generic API.

Since, the changes impact all OMAP boards, and I wouldn't be able to test on all, I decided to submit changes as RFC. Unless any major issue is found, I will be able to submit as formal patch by end of this week.

Following bash script was used to replace all occurences of the custom API with generic equivalent. After the changes, I have compile tested the OMAP3EVM only. Will be able to test changes only by FRI.

#!/bin/bash

list=search.lst

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

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

 sed -i '/\.sh$/d'    ${list}
 sed -i '/\.o$/d'     ${list}
 sed -i '/\.orig$/d'  ${list}
 sed -i '/\.rej$/d'   ${list}
 sed -i '/\.git/d'    ${list}
 sed -i '/patch/d'    ${list}
 sed -i '/diff/d'     ${list}
 sed -i '/save/d'     ${list}

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*1\)/gpio_direction_input(\1)/g' "$f"
        sed -r -i 's/omap_set_gpio_direction\s*\((\w+),\s*0\)/gpio_direction_output(\1)/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"

done

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  |   74 +++++++++++++++++++++++---------
 arch/arm/cpu/armv7/omap4/clocks.c      |    4 +-
 arch/arm/include/asm/arch-omap3/gpio.h |   19 ++++++++
 arch/arm/include/asm/omap_gpio.h       |   13 ------
 board/cm_t35/leds.c                    |    4 +-
 board/comelit/dig297/dig297.c          |   10 ++--
 board/isee/igep0020/igep0020.c         |   10 ++--
 board/logicpd/zoom2/debug_board.c      |    8 ++--
 board/logicpd/zoom2/led.c              |   36 ++++++++--------
 board/logicpd/zoom2/zoom2.c            |    8 ++--
 board/overo/overo.c                    |   52 +++++++++++-----------
 board/ti/beagle/beagle.c               |   34 +++++++-------
 board/ti/beagle/led.c                  |   12 +++---
 board/ti/evm/evm.c                     |   12 +++---
 doc/README.omap3                       |   20 ++++----
 15 files changed, 177 insertions(+), 139 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-omap3/gpio.h
Cc Sandeep Paulraj <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Luca Ceresoli <[email protected]>
Cc Enric Balletbo i Serra <[email protected]>
Cc Sunil Kumar <[email protected]>
Cc Shashi Ranjan <[email protected]>
Cc Nishanth Menon <[email protected]>
Cc Steve Sakoman <[email protected]>