Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
pinctrl-nomadik.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/slab.h>
#include <linux/of_device.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h>
#include <linux/pinctrl/pinconf.h>
#include <linux/pinctrl/consumer.h>
#include <asm/mach/irq.h>
#include <plat/pincfg.h>
#include <plat/gpio-nomadik.h>
#include "pinctrl-nomadik.h"

Go to the source code of this file.

Data Structures

struct  nmk_gpio_chip
 
struct  nmk_pinctrl
 

Macros

#define NMK_GPIO_PER_CHIP   32
 
#define NUM_BANKS   ARRAY_SIZE(nmk_gpio_chips)
 
#define nmk_gpio_dbg_show   NULL
 

Enumerations

enum  nmk_gpio_irq_type { NORMAL, WAKE }
 

Functions

int nmk_config_pin (pin_cfg_t cfg, bool sleep)
 
 EXPORT_SYMBOL (nmk_config_pin)
 
int nmk_config_pins (pin_cfg_t *cfgs, int num)
 
 EXPORT_SYMBOL (nmk_config_pins)
 
int nmk_config_pins_sleep (pin_cfg_t *cfgs, int num)
 
 EXPORT_SYMBOL (nmk_config_pins_sleep)
 
int nmk_gpio_set_slpm (int gpio, enum nmk_gpio_slpm mode)
 
int nmk_gpio_set_pull (int gpio, enum nmk_gpio_pull pull)
 
int nmk_gpio_set_mode (int gpio, int gpio_mode)
 
 EXPORT_SYMBOL (nmk_gpio_set_mode)
 
int nmk_gpio_get_mode (int gpio)
 
 EXPORT_SYMBOL (nmk_gpio_get_mode)
 
void nmk_gpio_clocks_enable (void)
 
void nmk_gpio_clocks_disable (void)
 
void nmk_gpio_wakeups_suspend (void)
 
void nmk_gpio_wakeups_resume (void)
 
void nmk_gpio_read_pull (int gpio_bank, u32 *pull_up)
 
int nmk_gpio_irq_map (struct irq_domain *d, unsigned int irq, irq_hw_number_t hwirq)
 
int nmk_gpio_request_enable (struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *range, unsigned offset)
 
void nmk_gpio_disable_free (struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *range, unsigned offset)
 
int nmk_pin_config_get (struct pinctrl_dev *pctldev, unsigned pin, unsigned long *config)
 
int nmk_pin_config_set (struct pinctrl_dev *pctldev, unsigned pin, unsigned long config)
 
 core_initcall (nmk_gpio_init)
 
 MODULE_AUTHOR ("Prafulla WADASKAR and Alessandro Rubini")
 
 MODULE_DESCRIPTION ("Nomadik GPIO Driver")
 
 MODULE_LICENSE ("GPL")
 

Variables

struct irq_domain_ops nmk_gpio_irq_simple_ops
 

Macro Definition Documentation

#define nmk_gpio_dbg_show   NULL

Definition at line 1141 of file pinctrl-nomadik.c.

#define NMK_GPIO_PER_CHIP   32

Definition at line 63 of file pinctrl-nomadik.c.

#define NUM_BANKS   ARRAY_SIZE(nmk_gpio_chips)

Definition at line 100 of file pinctrl-nomadik.c.

Enumeration Type Documentation

Enumerator:
NORMAL 
WAKE 

Definition at line 720 of file pinctrl-nomadik.c.

Function Documentation

core_initcall ( nmk_gpio_init  )
EXPORT_SYMBOL ( nmk_config_pin  )
EXPORT_SYMBOL ( nmk_config_pins  )
EXPORT_SYMBOL ( nmk_config_pins_sleep  )
EXPORT_SYMBOL ( nmk_gpio_set_mode  )
EXPORT_SYMBOL ( nmk_gpio_get_mode  )
MODULE_AUTHOR ( "Prafulla WADASKAR and Alessandro Rubini"  )
MODULE_DESCRIPTION ( "Nomadik GPIO Driver"  )
MODULE_LICENSE ( "GPL"  )
int nmk_config_pin ( pin_cfg_t  cfg,
bool  sleep 
)

nmk_config_pin - configure a pin's mux attributes : pin confguration : Non-zero to apply the sleep mode configuration Configures a pin's mode (alternate function or GPIO), its pull up status, and its sleep mode based on the specified configuration. The is usually one of the SoC specific macros defined in mach/<soc>-pins.h. These are constructed using, and can be further enhanced with, the macros in plat/pincfg.h.

If a pin's mode is set to GPIO, it is configured as an input to avoid side-effects. The gpio can be manipulated later using standard GPIO API calls.

Definition at line 545 of file pinctrl-nomadik.c.

int nmk_config_pins ( pin_cfg_t cfgs,
int  num 
)

nmk_config_pins - configure several pins at once : array of pin configurations : number of elments in the array

Configures several pins using nmk_config_pin(). Refer to that function for further information.

Definition at line 559 of file pinctrl-nomadik.c.

int nmk_config_pins_sleep ( pin_cfg_t cfgs,
int  num 
)

Definition at line 565 of file pinctrl-nomadik.c.

void nmk_gpio_clocks_disable ( void  )

Definition at line 1171 of file pinctrl-nomadik.c.

void nmk_gpio_clocks_enable ( void  )

Definition at line 1157 of file pinctrl-nomadik.c.

void nmk_gpio_disable_free ( struct pinctrl_dev pctldev,
struct pinctrl_gpio_range *  range,
unsigned  offset 
)

Definition at line 1669 of file pinctrl-nomadik.c.

int nmk_gpio_get_mode ( int  gpio)

Definition at line 678 of file pinctrl-nomadik.c.

int nmk_gpio_irq_map ( struct irq_domain d,
unsigned int  irq,
irq_hw_number_t  hwirq 
)

Definition at line 1253 of file pinctrl-nomadik.c.

void nmk_gpio_read_pull ( int  gpio_bank,
u32 pull_up 
)

Definition at line 1241 of file pinctrl-nomadik.c.

int nmk_gpio_request_enable ( struct pinctrl_dev pctldev,
struct pinctrl_gpio_range *  range,
unsigned  offset 
)

Definition at line 1638 of file pinctrl-nomadik.c.

int nmk_gpio_set_mode ( int  gpio,
int  gpio_mode 
)

nmk_gpio_set_mode() - set the mux mode of a gpio pin : pin number : one of NMK_GPIO_ALT_GPIO, NMK_GPIO_ALT_A, NMK_GPIO_ALT_B, and NMK_GPIO_ALT_C

Sets the mode of the specified pin to one of the alternate functions or plain GPIO.

Definition at line 659 of file pinctrl-nomadik.c.

int nmk_gpio_set_pull ( int  gpio,
enum nmk_gpio_pull  pull 
)

nmk_gpio_set_pull() - enable/disable pull up/down on a gpio : pin number : one of NMK_GPIO_PULL_DOWN, NMK_GPIO_PULL_UP, and NMK_GPIO_PULL_NONE

Enables/disables pull up/down on a specified pin. This only takes effect if the pin is configured as an input (either explicitly or by the alternate function).

NOTE: If enabling the pull up/down, the caller must ensure that the GPIO is configured as an input. Otherwise, due to the way the controller registers work, this function will change the value output on the pin.

Definition at line 631 of file pinctrl-nomadik.c.

int nmk_gpio_set_slpm ( int  gpio,
enum nmk_gpio_slpm  mode 
)

nmk_gpio_set_slpm() - configure the sleep mode of a pin : pin number : NMK_GPIO_SLPM_INPUT or NMK_GPIO_SLPM_NOCHANGE,

This register is actually in the pinmux layer, not the GPIO block itself. The GPIO1B_SLPM register defines the GPIO mode when SLEEP/DEEP-SLEEP mode is entered (i.e. when signal IOFORCE is HIGH by the platform code). Each GPIO can be configured to be forced into GPIO mode when IOFORCE is HIGH, overriding the normal setting defined by GPIO_AFSELx registers. When IOFORCE returns LOW (by software, after SLEEP/DEEP-SLEEP exit), the GPIOs return to the normal setting defined by GPIO_AFSELx registers.

If is NMK_GPIO_SLPM_INPUT, the corresponding GPIO is switched to GPIO mode when signal IOFORCE is HIGH (i.e. when SLEEP/DEEP-SLEEP mode is entered) regardless of the altfunction selected. Also wake-up detection is ENABLED.

If is NMK_GPIO_SLPM_NOCHANGE, the corresponding GPIO remains controlled by NMK_GPIO_DATC, NMK_GPIO_DATS, NMK_GPIO_DIR, NMK_GPIO_PDIS (for altfunction GPIO) or respective on-chip peripherals (for other altfuncs) when IOFORCE is HIGH. Also wake-up detection DISABLED.

Note that enable_irq_wake() will automatically enable wakeup detection.

Definition at line 596 of file pinctrl-nomadik.c.

void nmk_gpio_wakeups_resume ( void  )

Definition at line 1215 of file pinctrl-nomadik.c.

void nmk_gpio_wakeups_suspend ( void  )

Definition at line 1194 of file pinctrl-nomadik.c.

int nmk_pin_config_get ( struct pinctrl_dev pctldev,
unsigned  pin,
unsigned long config 
)

Definition at line 1689 of file pinctrl-nomadik.c.

int nmk_pin_config_set ( struct pinctrl_dev pctldev,
unsigned  pin,
unsigned long  config 
)

Definition at line 1697 of file pinctrl-nomadik.c.

Variable Documentation

struct irq_domain_ops nmk_gpio_irq_simple_ops
Initial value:

Definition at line 1269 of file pinctrl-nomadik.c.