• Varadarajan, Charulatha's avatar
    OMAP: GPIO: Implement GPIO as a platform device · 77640aab
    Varadarajan, Charulatha authored
    Implement GPIO as a platform device.
    
    GPIO APIs are used in machine_init functions. Hence it is
    required to complete GPIO probe before board_init. Therefore
    GPIO device register and driver register are implemented as
    postcore_initcalls.
    
    omap_gpio_init() does nothing now and this function would be
    removed in the next patch as it's usage is spread across most
    of the board files.
    
    Inorder to convert GPIO as platform device, modifications are
    required in clockxxxx_data.c file for OMAP1 so that device names
    can be used to obtain clock instead of getting clocks by
    name/NULL ptr.
    
    Use runtime pm APIs (pm_runtime_put*/pm_runtime_get*) for enabling
    or disabling the clocks, modify sysconfig settings and remove usage
    of clock FW APIs.
    Note 1: Converting GPIO driver to use runtime PM APIs is not done as a
    separate patch because GPIO clock names are different for various OMAPs
    and are different for some of the banks in the same CPU. This would need
    usage of cpu_is checks and bank id checks while using clock FW APIs in
    the gpio driver. Hence while making GPIO a platform driver framework,
    PM runtime APIs are used directly.
    
    Note 2: While implementing GPIO as a platform device, pm runtime APIs
    are used as mentioned above and modification is not done in gpio's
    prepare for idle/ resume after idle functions. This would be done
    in the next patch series and GPIO driver would be made to use dev_pm_ops
    instead of sysdev_class in that series only.
    
    Due to the above, the GPIO driver implicitly relies on
    CM_AUTOIDLE = 1 on its iclk for power management to work, since the
    driver never disables its iclk.
    This would be taken care in the next patch series (see Note 3 below).
    
    Refer to
    http://www.mail-archive.com/linux-omap@vger.kernel.org/msg39112.html
    
    
    for more details.
    
    Note 3: only pm_runtime_get_sync is called in gpio's probe() and
    pm_runtime_put* is never called. This is to make the implementation
    similar to the existing GPIO code. Another patch series would be sent
    to correct this.
    
    In OMAP3 and OMAP4 gpio's debounce clocks are optional clocks. They
    are enabled/ disabled whenever required using clock framework APIs
    
    TODO:
    1. Cleanup the GPIO driver. Use function pointers and register
    offest pointers instead of using hardcoded values
    2. Remove all cpu_is_ checks and OMAP specific macros
    3. Remove usage of gpio_bank array so that only
       instance specific information is used in driver code
    4. Rename 'method'/ avoid it's usage
    5. Fix the non-wakeup gpios handling for OMAP2430, OMAP3 & OMAP4
    6. Modify gpio's prepare for idle/ resume after idle functions
       to use runtime pm implentation.
    Signed-off-by: default avatarCharulatha V <charu@ti.com>
    Signed-off-by: default avatarRajendra Nayak <rnayak@ti.com>
    Reviewed-by: default avatarBasak, Partha <p-basak2@ti.com>
    Acked-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
    [tony@atomide.com: updated for bank specific revision and updated boards]
    Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
    77640aab
board-3430sdp.c 19.4 KB