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

Premi, Sanjeev premi at ti.com
Fri Sep 2 07:50:24 CEST 2011


> -----Original Message-----
> From: Premi, Sanjeev 
> Sent: Wednesday, August 31, 2011 1:23 AM
> To: u-boot at lists.denx.de
> Cc: Premi, Sanjeev; Paulraj, Sandeep; Igor Grinberg; Luca 
> Ceresoli; Enric Balletbo i Serra; Sunil Kumar; Shashi Ranjan; 
> Menon, Nishanth; Steve Sakoman
> Subject: [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_inp
> ut(\1)/g' "$f"
>         sed -r -i 
> 's/omap_set_gpio_direction\s*\((\w+),\s*0\)/gpio_direction_out
> put(\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 <s-paulraj at ti.com>
> Cc: Igor Grinberg <grinberg at compulab.co.il>
> Cc: Luca Ceresoli <luca.ceresoli at comelit.it>
> Cc: Enric Balletbo i Serra <eballetbo at gmail.com>
> Cc: Sunil Kumar <sunilsaini05 at gmail.com>
> Cc: Shashi Ranjan <shashiranjanmca05 at gmail.com>
> Cc: Nishanth Menon <nm at ti.com>
> Cc: Steve Sakoman <steve at sakoman.com>
> 
> 

Tested working on the OMAP3EVM.

[bootlog]
U-Boot 2011.06-00396-gfa7a454 (Sep 02 2011 - 10:36:54)

OMAP3630/3730-GP ES2.1, CPU-OPP2, L3-165MHz, Max CPU Clock 1 Ghz
OMAP3 EVM board + LPDDR/NAND
I2C:   ready
DRAM:  384 MiB
NAND:  512 MiB
NAND read from offset 260000 failed -74
*** Warning - readenv() failed, using default environment

In:    serial
Out:   serial
Err:   serial
Read back SMSC id 0x92200000
Die ID #374000029ff80000015f02690c020022
Net:   smc911x-0Warning: failed to set MAC address

Hit any key to stop autoboot:  0
OMAP3_EVM #
[/bootlog]

I was concerned that 2 failures during boot were due to the changes
in this patch set, but foud that they exist on the mainline as well.

Details:
  At this commit, omap3_evm_config fails to build:
    commit bd061a5214e60c9d1bb24393933323bd1a2dae19
    Merge: 98e99e5 fe0ddff
    Author: Wolfgang Denk <wd at denx.de>
    Date:   Fri Aug 26 15:55:03 2011 +0200

  Error is:
    make[1]: Entering directory `/home/premi/u-boot/board/ti/evm'
    evm.c:36:32: fatal error: asm/arch/omap_gpio.h: No such file or directory
    compilation terminated.

  This temporary patch patch was required to fix the build issue on the
  master branch:

    premi # git diff
    diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
    index 30c1c57..4160cdd 100644
    --- a/board/ti/evm/evm.c
    +++ b/board/ti/evm/evm.c
    @@ -33,7 +33,7 @@
     #include <asm/arch/mem.h>
     #include <asm/arch/mux.h>
     #include <asm/arch/sys_proto.h>
    -#include <asm/arch/gpio.h>
    +#include <asm/omap_gpio.h>
     #include <i2c.h>
     #include <asm/mach-types.h>
     #include "evm.h"
    premi # git log

  I do have a comment/query regarding this, in 1/1 of my patchset)

[bootlog]
U-Boot 2011.06-00393-gbd061a5-dirty (Sep 02 2011 - 11:03:57)

OMAP3630/3730-GP ES2.1, CPU-OPP2, L3-165MHz, Max CPU Clock 1 Ghz
OMAP3 EVM board + LPDDR/NAND
I2C:   ready
DRAM:  384 MiB
NAND:  512 MiB
NAND read from offset 260000 failed -74
*** Warning - readenv() failed, using default environment

In:    serial
Out:   serial
Err:   serial
Read back SMSC id 0x92200000
Die ID #374000029ff80000015f02690c020022
Net:   smc911x-0Warning: failed to set MAC address

Hit any key to stop autoboot:  0
OMAP3_EVM #
[/bootlog]

~sanjeev


More information about the U-Boot mailing list