Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Functions
pincfg.h File Reference

Go to the source code of this file.

Macros

#define PIN_NUM_MASK   0x1ff
 
#define PIN_NUM(x)   ((x) & PIN_NUM_MASK)
 
#define PIN_ALT_SHIFT   9
 
#define PIN_ALT_MASK   (0x3 << PIN_ALT_SHIFT)
 
#define PIN_ALT(x)   (((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT)
 
#define PIN_GPIO   (NMK_GPIO_ALT_GPIO << PIN_ALT_SHIFT)
 
#define PIN_ALT_A   (NMK_GPIO_ALT_A << PIN_ALT_SHIFT)
 
#define PIN_ALT_B   (NMK_GPIO_ALT_B << PIN_ALT_SHIFT)
 
#define PIN_ALT_C   (NMK_GPIO_ALT_C << PIN_ALT_SHIFT)
 
#define PIN_PULL_SHIFT   11
 
#define PIN_PULL_MASK   (0x3 << PIN_PULL_SHIFT)
 
#define PIN_PULL(x)   (((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT)
 
#define PIN_PULL_NONE   (NMK_GPIO_PULL_NONE << PIN_PULL_SHIFT)
 
#define PIN_PULL_UP   (NMK_GPIO_PULL_UP << PIN_PULL_SHIFT)
 
#define PIN_PULL_DOWN   (NMK_GPIO_PULL_DOWN << PIN_PULL_SHIFT)
 
#define PIN_SLPM_SHIFT   13
 
#define PIN_SLPM_MASK   (0x1 << PIN_SLPM_SHIFT)
 
#define PIN_SLPM(x)   (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT)
 
#define PIN_SLPM_MAKE_INPUT   (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT)
 
#define PIN_SLPM_NOCHANGE   (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT)
 
#define PIN_SLPM_WAKEUP_ENABLE   (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT)
 
#define PIN_SLPM_WAKEUP_DISABLE   (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT)
 
#define PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP   PIN_SLPM_WAKEUP_DISABLE
 
#define PIN_SLPM_GPIO   PIN_SLPM_WAKEUP_ENABLE /* In SLPM, pin is a gpio */
 
#define PIN_SLPM_ALTFUNC   PIN_SLPM_WAKEUP_DISABLE /* In SLPM, pin is altfunc */
 
#define PIN_DIR_SHIFT   14
 
#define PIN_DIR_MASK   (0x1 << PIN_DIR_SHIFT)
 
#define PIN_DIR(x)   (((x) & PIN_DIR_MASK) >> PIN_DIR_SHIFT)
 
#define PIN_DIR_INPUT   (0 << PIN_DIR_SHIFT)
 
#define PIN_DIR_OUTPUT   (1 << PIN_DIR_SHIFT)
 
#define PIN_VAL_SHIFT   15
 
#define PIN_VAL_MASK   (0x1 << PIN_VAL_SHIFT)
 
#define PIN_VAL(x)   (((x) & PIN_VAL_MASK) >> PIN_VAL_SHIFT)
 
#define PIN_VAL_LOW   (0 << PIN_VAL_SHIFT)
 
#define PIN_VAL_HIGH   (1 << PIN_VAL_SHIFT)
 
#define PIN_SLPM_PULL_SHIFT   16
 
#define PIN_SLPM_PULL_MASK   (0x7 << PIN_SLPM_PULL_SHIFT)
 
#define PIN_SLPM_PULL(x)   (((x) & PIN_SLPM_PULL_MASK) >> PIN_SLPM_PULL_SHIFT)
 
#define PIN_SLPM_PULL_NONE   ((1 + NMK_GPIO_PULL_NONE) << PIN_SLPM_PULL_SHIFT)
 
#define PIN_SLPM_PULL_UP   ((1 + NMK_GPIO_PULL_UP) << PIN_SLPM_PULL_SHIFT)
 
#define PIN_SLPM_PULL_DOWN   ((1 + NMK_GPIO_PULL_DOWN) << PIN_SLPM_PULL_SHIFT)
 
#define PIN_SLPM_DIR_SHIFT   19
 
#define PIN_SLPM_DIR_MASK   (0x3 << PIN_SLPM_DIR_SHIFT)
 
#define PIN_SLPM_DIR(x)   (((x) & PIN_SLPM_DIR_MASK) >> PIN_SLPM_DIR_SHIFT)
 
#define PIN_SLPM_DIR_INPUT   ((1 + 0) << PIN_SLPM_DIR_SHIFT)
 
#define PIN_SLPM_DIR_OUTPUT   ((1 + 1) << PIN_SLPM_DIR_SHIFT)
 
#define PIN_SLPM_VAL_SHIFT   21
 
#define PIN_SLPM_VAL_MASK   (0x3 << PIN_SLPM_VAL_SHIFT)
 
#define PIN_SLPM_VAL(x)   (((x) & PIN_SLPM_VAL_MASK) >> PIN_SLPM_VAL_SHIFT)
 
#define PIN_SLPM_VAL_LOW   ((1 + 0) << PIN_SLPM_VAL_SHIFT)
 
#define PIN_SLPM_VAL_HIGH   ((1 + 1) << PIN_SLPM_VAL_SHIFT)
 
#define PIN_SLPM_PDIS_SHIFT   23
 
#define PIN_SLPM_PDIS_MASK   (0x3 << PIN_SLPM_PDIS_SHIFT)
 
#define PIN_SLPM_PDIS(x)   (((x) & PIN_SLPM_PDIS_MASK) >> PIN_SLPM_PDIS_SHIFT)
 
#define PIN_SLPM_PDIS_NO_CHANGE   (0 << PIN_SLPM_PDIS_SHIFT)
 
#define PIN_SLPM_PDIS_DISABLED   (1 << PIN_SLPM_PDIS_SHIFT)
 
#define PIN_SLPM_PDIS_ENABLED   (2 << PIN_SLPM_PDIS_SHIFT)
 
#define PIN_LOWEMI_SHIFT   25
 
#define PIN_LOWEMI_MASK   (0x1 << PIN_LOWEMI_SHIFT)
 
#define PIN_LOWEMI(x)   (((x) & PIN_LOWEMI_MASK) >> PIN_LOWEMI_SHIFT)
 
#define PIN_LOWEMI_DISABLED   (0 << PIN_LOWEMI_SHIFT)
 
#define PIN_LOWEMI_ENABLED   (1 << PIN_LOWEMI_SHIFT)
 
#define PIN_GPIOMODE_SHIFT   26
 
#define PIN_GPIOMODE_MASK   (0x1 << PIN_GPIOMODE_SHIFT)
 
#define PIN_GPIOMODE(x)   (((x) & PIN_GPIOMODE_MASK) >> PIN_GPIOMODE_SHIFT)
 
#define PIN_GPIOMODE_DISABLED   (0 << PIN_GPIOMODE_SHIFT)
 
#define PIN_GPIOMODE_ENABLED   (1 << PIN_GPIOMODE_SHIFT)
 
#define PIN_SLEEPMODE_SHIFT   27
 
#define PIN_SLEEPMODE_MASK   (0x1 << PIN_SLEEPMODE_SHIFT)
 
#define PIN_SLEEPMODE(x)   (((x) & PIN_SLEEPMODE_MASK) >> PIN_SLEEPMODE_SHIFT)
 
#define PIN_SLEEPMODE_DISABLED   (0 << PIN_SLEEPMODE_SHIFT)
 
#define PIN_SLEEPMODE_ENABLED   (1 << PIN_SLEEPMODE_SHIFT)
 
#define PIN_INPUT_PULLDOWN   (PIN_DIR_INPUT | PIN_PULL_DOWN)
 
#define PIN_INPUT_PULLUP   (PIN_DIR_INPUT | PIN_PULL_UP)
 
#define PIN_INPUT_NOPULL   (PIN_DIR_INPUT | PIN_PULL_NONE)
 
#define PIN_OUTPUT_LOW   (PIN_DIR_OUTPUT | PIN_VAL_LOW)
 
#define PIN_OUTPUT_HIGH   (PIN_DIR_OUTPUT | PIN_VAL_HIGH)
 
#define PIN_SLPM_INPUT_PULLDOWN   (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_DOWN)
 
#define PIN_SLPM_INPUT_PULLUP   (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_UP)
 
#define PIN_SLPM_INPUT_NOPULL   (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_NONE)
 
#define PIN_SLPM_OUTPUT_LOW   (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_LOW)
 
#define PIN_SLPM_OUTPUT_HIGH   (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_HIGH)
 
#define PIN_CFG_DEFAULT   (0)
 
#define PIN_CFG(num, alt)
 
#define PIN_CFG_INPUT(num, alt, pull)
 
#define PIN_CFG_OUTPUT(num, alt, val)
 

Typedefs

typedef unsigned long pin_cfg_t
 

Functions

int nmk_config_pin (pin_cfg_t cfg, bool sleep)
 
int nmk_config_pins (pin_cfg_t *cfgs, int num)
 
int nmk_config_pins_sleep (pin_cfg_t *cfgs, int num)
 

Macro Definition Documentation

#define PIN_ALT (   x)    (((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT)

Definition at line 52 of file pincfg.h.

#define PIN_ALT_A   (NMK_GPIO_ALT_A << PIN_ALT_SHIFT)

Definition at line 54 of file pincfg.h.

#define PIN_ALT_B   (NMK_GPIO_ALT_B << PIN_ALT_SHIFT)

Definition at line 55 of file pincfg.h.

#define PIN_ALT_C   (NMK_GPIO_ALT_C << PIN_ALT_SHIFT)

Definition at line 56 of file pincfg.h.

#define PIN_ALT_MASK   (0x3 << PIN_ALT_SHIFT)

Definition at line 51 of file pincfg.h.

#define PIN_ALT_SHIFT   9

Definition at line 50 of file pincfg.h.

#define PIN_CFG (   num,
  alt 
)
Value:
(PIN_NUM(num) | PIN_##alt))

Definition at line 157 of file pincfg.h.

#define PIN_CFG_DEFAULT   (0)

Definition at line 155 of file pincfg.h.

#define PIN_CFG_INPUT (   num,
  alt,
  pull 
)
Value:
(PIN_NUM(num) | PIN_##alt | PIN_INPUT_##pull))

Definition at line 161 of file pincfg.h.

#define PIN_CFG_OUTPUT (   num,
  alt,
  val 
)
Value:
(PIN_NUM(num) | PIN_##alt | PIN_OUTPUT_##val))

Definition at line 165 of file pincfg.h.

#define PIN_DIR (   x)    (((x) & PIN_DIR_MASK) >> PIN_DIR_SHIFT)

Definition at line 80 of file pincfg.h.

#define PIN_DIR_INPUT   (0 << PIN_DIR_SHIFT)

Definition at line 81 of file pincfg.h.

#define PIN_DIR_MASK   (0x1 << PIN_DIR_SHIFT)

Definition at line 79 of file pincfg.h.

#define PIN_DIR_OUTPUT   (1 << PIN_DIR_SHIFT)

Definition at line 82 of file pincfg.h.

#define PIN_DIR_SHIFT   14

Definition at line 78 of file pincfg.h.

#define PIN_GPIO   (NMK_GPIO_ALT_GPIO << PIN_ALT_SHIFT)

Definition at line 53 of file pincfg.h.

#define PIN_GPIOMODE (   x)    (((x) & PIN_GPIOMODE_MASK) >> PIN_GPIOMODE_SHIFT)

Definition at line 131 of file pincfg.h.

#define PIN_GPIOMODE_DISABLED   (0 << PIN_GPIOMODE_SHIFT)

Definition at line 132 of file pincfg.h.

#define PIN_GPIOMODE_ENABLED   (1 << PIN_GPIOMODE_SHIFT)

Definition at line 133 of file pincfg.h.

#define PIN_GPIOMODE_MASK   (0x1 << PIN_GPIOMODE_SHIFT)

Definition at line 130 of file pincfg.h.

#define PIN_GPIOMODE_SHIFT   26

Definition at line 129 of file pincfg.h.

#define PIN_INPUT_NOPULL   (PIN_DIR_INPUT | PIN_PULL_NONE)

Definition at line 145 of file pincfg.h.

#define PIN_INPUT_PULLDOWN   (PIN_DIR_INPUT | PIN_PULL_DOWN)

Definition at line 143 of file pincfg.h.

#define PIN_INPUT_PULLUP   (PIN_DIR_INPUT | PIN_PULL_UP)

Definition at line 144 of file pincfg.h.

#define PIN_LOWEMI (   x)    (((x) & PIN_LOWEMI_MASK) >> PIN_LOWEMI_SHIFT)

Definition at line 125 of file pincfg.h.

#define PIN_LOWEMI_DISABLED   (0 << PIN_LOWEMI_SHIFT)

Definition at line 126 of file pincfg.h.

#define PIN_LOWEMI_ENABLED   (1 << PIN_LOWEMI_SHIFT)

Definition at line 127 of file pincfg.h.

#define PIN_LOWEMI_MASK   (0x1 << PIN_LOWEMI_SHIFT)

Definition at line 124 of file pincfg.h.

#define PIN_LOWEMI_SHIFT   25

Definition at line 123 of file pincfg.h.

#define PIN_NUM (   x)    ((x) & PIN_NUM_MASK)

Definition at line 48 of file pincfg.h.

#define PIN_NUM_MASK   0x1ff

Definition at line 47 of file pincfg.h.

#define PIN_OUTPUT_HIGH   (PIN_DIR_OUTPUT | PIN_VAL_HIGH)

Definition at line 147 of file pincfg.h.

#define PIN_OUTPUT_LOW   (PIN_DIR_OUTPUT | PIN_VAL_LOW)

Definition at line 146 of file pincfg.h.

#define PIN_PULL (   x)    (((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT)

Definition at line 60 of file pincfg.h.

#define PIN_PULL_DOWN   (NMK_GPIO_PULL_DOWN << PIN_PULL_SHIFT)

Definition at line 63 of file pincfg.h.

#define PIN_PULL_MASK   (0x3 << PIN_PULL_SHIFT)

Definition at line 59 of file pincfg.h.

#define PIN_PULL_NONE   (NMK_GPIO_PULL_NONE << PIN_PULL_SHIFT)

Definition at line 61 of file pincfg.h.

#define PIN_PULL_SHIFT   11

Definition at line 58 of file pincfg.h.

#define PIN_PULL_UP   (NMK_GPIO_PULL_UP << PIN_PULL_SHIFT)

Definition at line 62 of file pincfg.h.

#define PIN_SLEEPMODE (   x)    (((x) & PIN_SLEEPMODE_MASK) >> PIN_SLEEPMODE_SHIFT)

Definition at line 137 of file pincfg.h.

#define PIN_SLEEPMODE_DISABLED   (0 << PIN_SLEEPMODE_SHIFT)

Definition at line 138 of file pincfg.h.

#define PIN_SLEEPMODE_ENABLED   (1 << PIN_SLEEPMODE_SHIFT)

Definition at line 139 of file pincfg.h.

#define PIN_SLEEPMODE_MASK   (0x1 << PIN_SLEEPMODE_SHIFT)

Definition at line 136 of file pincfg.h.

#define PIN_SLEEPMODE_SHIFT   27

Definition at line 135 of file pincfg.h.

#define PIN_SLPM (   x)    (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT)

Definition at line 67 of file pincfg.h.

#define PIN_SLPM_ALTFUNC   PIN_SLPM_WAKEUP_DISABLE /* In SLPM, pin is altfunc */

Definition at line 76 of file pincfg.h.

#define PIN_SLPM_DIR (   x)    (((x) & PIN_SLPM_DIR_MASK) >> PIN_SLPM_DIR_SHIFT)

Definition at line 103 of file pincfg.h.

#define PIN_SLPM_DIR_INPUT   ((1 + 0) << PIN_SLPM_DIR_SHIFT)

Definition at line 105 of file pincfg.h.

#define PIN_SLPM_DIR_MASK   (0x3 << PIN_SLPM_DIR_SHIFT)

Definition at line 102 of file pincfg.h.

#define PIN_SLPM_DIR_OUTPUT   ((1 + 1) << PIN_SLPM_DIR_SHIFT)

Definition at line 106 of file pincfg.h.

#define PIN_SLPM_DIR_SHIFT   19

Definition at line 101 of file pincfg.h.

#define PIN_SLPM_GPIO   PIN_SLPM_WAKEUP_ENABLE /* In SLPM, pin is a gpio */

Definition at line 75 of file pincfg.h.

#define PIN_SLPM_INPUT_NOPULL   (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_NONE)

Definition at line 151 of file pincfg.h.

#define PIN_SLPM_INPUT_PULLDOWN   (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_DOWN)

Definition at line 149 of file pincfg.h.

#define PIN_SLPM_INPUT_PULLUP   (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_UP)

Definition at line 150 of file pincfg.h.

#define PIN_SLPM_MAKE_INPUT   (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT)

Definition at line 68 of file pincfg.h.

#define PIN_SLPM_MASK   (0x1 << PIN_SLPM_SHIFT)

Definition at line 66 of file pincfg.h.

#define PIN_SLPM_NOCHANGE   (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT)

Definition at line 69 of file pincfg.h.

#define PIN_SLPM_OUTPUT_HIGH   (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_HIGH)

Definition at line 153 of file pincfg.h.

#define PIN_SLPM_OUTPUT_LOW   (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_LOW)

Definition at line 152 of file pincfg.h.

#define PIN_SLPM_PDIS (   x)    (((x) & PIN_SLPM_PDIS_MASK) >> PIN_SLPM_PDIS_SHIFT)

Definition at line 117 of file pincfg.h.

#define PIN_SLPM_PDIS_DISABLED   (1 << PIN_SLPM_PDIS_SHIFT)

Definition at line 120 of file pincfg.h.

#define PIN_SLPM_PDIS_ENABLED   (2 << PIN_SLPM_PDIS_SHIFT)

Definition at line 121 of file pincfg.h.

#define PIN_SLPM_PDIS_MASK   (0x3 << PIN_SLPM_PDIS_SHIFT)

Definition at line 116 of file pincfg.h.

#define PIN_SLPM_PDIS_NO_CHANGE   (0 << PIN_SLPM_PDIS_SHIFT)

Definition at line 119 of file pincfg.h.

#define PIN_SLPM_PDIS_SHIFT   23

Definition at line 115 of file pincfg.h.

#define PIN_SLPM_PULL (   x)    (((x) & PIN_SLPM_PULL_MASK) >> PIN_SLPM_PULL_SHIFT)

Definition at line 92 of file pincfg.h.

#define PIN_SLPM_PULL_DOWN   ((1 + NMK_GPIO_PULL_DOWN) << PIN_SLPM_PULL_SHIFT)

Definition at line 98 of file pincfg.h.

#define PIN_SLPM_PULL_MASK   (0x7 << PIN_SLPM_PULL_SHIFT)

Definition at line 91 of file pincfg.h.

#define PIN_SLPM_PULL_NONE   ((1 + NMK_GPIO_PULL_NONE) << PIN_SLPM_PULL_SHIFT)

Definition at line 94 of file pincfg.h.

#define PIN_SLPM_PULL_SHIFT   16

Definition at line 90 of file pincfg.h.

#define PIN_SLPM_PULL_UP   ((1 + NMK_GPIO_PULL_UP) << PIN_SLPM_PULL_SHIFT)

Definition at line 96 of file pincfg.h.

#define PIN_SLPM_SHIFT   13

Definition at line 65 of file pincfg.h.

#define PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP   PIN_SLPM_WAKEUP_DISABLE

Definition at line 73 of file pincfg.h.

#define PIN_SLPM_VAL (   x)    (((x) & PIN_SLPM_VAL_MASK) >> PIN_SLPM_VAL_SHIFT)

Definition at line 110 of file pincfg.h.

#define PIN_SLPM_VAL_HIGH   ((1 + 1) << PIN_SLPM_VAL_SHIFT)

Definition at line 113 of file pincfg.h.

#define PIN_SLPM_VAL_LOW   ((1 + 0) << PIN_SLPM_VAL_SHIFT)

Definition at line 112 of file pincfg.h.

#define PIN_SLPM_VAL_MASK   (0x3 << PIN_SLPM_VAL_SHIFT)

Definition at line 109 of file pincfg.h.

#define PIN_SLPM_VAL_SHIFT   21

Definition at line 108 of file pincfg.h.

#define PIN_SLPM_WAKEUP_DISABLE   (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT)

Definition at line 72 of file pincfg.h.

#define PIN_SLPM_WAKEUP_ENABLE   (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT)

Definition at line 71 of file pincfg.h.

#define PIN_VAL (   x)    (((x) & PIN_VAL_MASK) >> PIN_VAL_SHIFT)

Definition at line 86 of file pincfg.h.

#define PIN_VAL_HIGH   (1 << PIN_VAL_SHIFT)

Definition at line 88 of file pincfg.h.

#define PIN_VAL_LOW   (0 << PIN_VAL_SHIFT)

Definition at line 87 of file pincfg.h.

#define PIN_VAL_MASK   (0x1 << PIN_VAL_SHIFT)

Definition at line 85 of file pincfg.h.

#define PIN_VAL_SHIFT   15

Definition at line 84 of file pincfg.h.

Typedef Documentation

typedef unsigned long pin_cfg_t

Definition at line 45 of file pincfg.h.

Function Documentation

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.