Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
sh_pfc.h File Reference
#include <linux/stringify.h>
#include <asm-generic/gpio.h>

Go to the source code of this file.

Data Structures

struct  pinmux_gpio
 
struct  pinmux_cfg_reg
 
struct  pinmux_data_reg
 
struct  pinmux_irq
 
struct  pinmux_range
 
struct  pfc_window
 
struct  sh_pfc
 

Macros

#define PINMUX_FLAG_DBIT_SHIFT   5
 
#define PINMUX_FLAG_DBIT   (0x1f << PINMUX_FLAG_DBIT_SHIFT)
 
#define PINMUX_FLAG_DREG_SHIFT   10
 
#define PINMUX_FLAG_DREG   (0x3f << PINMUX_FLAG_DREG_SHIFT)
 
#define PINMUX_GPIO(gpio, data_or_mark)   [gpio] = { .name = __stringify(gpio), .enum_id = data_or_mark, .flags = PINMUX_TYPE_NONE }
 
#define PINMUX_DATA(data_or_mark, ids...)   data_or_mark, ids, 0
 
#define PINMUX_CFG_REG(name, r, r_width, f_width)
 
#define PINMUX_CFG_REG_VAR(name, r, r_width, var_fw0, var_fwn...)
 
#define PINMUX_DATA_REG(name, r, r_width)
 
#define PINMUX_IRQ(irq_nr, ids...)   { .irq = irq_nr, .enum_ids = (pinmux_enum_t []) { ids, 0 } } \
 
#define pinmux_info   sh_pfc
 
#define PORT_1(fn, pfx, sfx)   fn(pfx, sfx)
 
#define PORT_10(fn, pfx, sfx)
 
#define PORT_90(fn, pfx, sfx)
 
#define _PORT_ALL(pfx, sfx)   pfx##_##sfx
 
#define _GPIO_PORT(pfx, sfx)   PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
 
#define PORT_ALL(str)   CPU_ALL_PORT(_PORT_ALL, PORT, str)
 
#define GPIO_PORT_ALL()   CPU_ALL_PORT(_GPIO_PORT, , unused)
 
#define GPIO_FN(str)   PINMUX_GPIO(GPIO_FN_##str, str##_MARK)
 
#define PORT_DATA_I(nr)   PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN)
 
#define PORT_DATA_I_PD(nr)
 
#define PORT_DATA_I_PU(nr)
 
#define PORT_DATA_I_PU_PD(nr)
 
#define PORT_DATA_O(nr)   PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT)
 
#define PORT_DATA_IO(nr)
 
#define PORT_DATA_IO_PD(nr)
 
#define PORT_DATA_IO_PU(nr)
 
#define PORT_DATA_IO_PU_PD(nr)
 
#define _PCRH(in, in_pd, in_pu, out)
 
#define PORTCR(nr, reg)
 

Typedefs

typedef unsigned short pinmux_enum_t
 
typedef unsigned short pinmux_flag_t
 

Enumerations

enum  {
  PINMUX_TYPE_NONE, PINMUX_TYPE_FUNCTION, PINMUX_TYPE_GPIO, PINMUX_TYPE_OUTPUT,
  PINMUX_TYPE_INPUT, PINMUX_TYPE_INPUT_PULLUP, PINMUX_TYPE_INPUT_PULLDOWN, PINMUX_FLAG_TYPE
}
 
enum  { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE }
 

Functions

int sh_pfc_register_gpiochip (struct sh_pfc *pfc)
 
int sh_pfc_register_pinctrl (struct sh_pfc *pfc)
 
int register_sh_pfc (struct sh_pfc *pfc)
 
int sh_pfc_read_bit (struct pinmux_data_reg *dr, unsigned long in_pos)
 
void sh_pfc_write_bit (struct pinmux_data_reg *dr, unsigned long in_pos, unsigned long value)
 
int sh_pfc_get_data_reg (struct sh_pfc *pfc, unsigned gpio, struct pinmux_data_reg **drp, int *bitp)
 
int sh_pfc_gpio_to_enum (struct sh_pfc *pfc, unsigned gpio, int pos, pinmux_enum_t *enum_idp)
 
int sh_pfc_config_gpio (struct sh_pfc *pfc, unsigned gpio, int pinmux_type, int cfg_mode)
 

Macro Definition Documentation

#define _GPIO_PORT (   pfx,
  sfx 
)    PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)

Definition at line 178 of file sh_pfc.h.

#define _PCRH (   in,
  in_pd,
  in_pu,
  out 
)
Value:
0, (out), (in), 0, \
0, 0, 0, 0, \
0, 0, (in_pd), 0, \
0, 0, (in_pu), 0

Definition at line 219 of file sh_pfc.h.

#define _PORT_ALL (   pfx,
  sfx 
)    pfx##_##sfx

Definition at line 177 of file sh_pfc.h.

#define GPIO_FN (   str)    PINMUX_GPIO(GPIO_FN_##str, str##_MARK)

Definition at line 181 of file sh_pfc.h.

#define GPIO_PORT_ALL ( )    CPU_ALL_PORT(_GPIO_PORT, , unused)

Definition at line 180 of file sh_pfc.h.

#define PINMUX_CFG_REG (   name,
  r,
  r_width,
  f_width 
)
Value:
.reg = r, .reg_width = r_width, .field_width = f_width, \
.cnt = (unsigned long [r_width / f_width]) {}, \
.enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)])

Definition at line 56 of file sh_pfc.h.

#define PINMUX_CFG_REG_VAR (   name,
  r,
  r_width,
  var_fw0,
  var_fwn... 
)
Value:
.reg = r, .reg_width = r_width, \
.cnt = (unsigned long [r_width]) {}, \
.var_field_width = (unsigned long [r_width]) { var_fw0, var_fwn, 0 }, \
.enum_ids = (pinmux_enum_t [])

Definition at line 61 of file sh_pfc.h.

#define PINMUX_DATA (   data_or_mark,
  ids... 
)    data_or_mark, ids, 0

Definition at line 47 of file sh_pfc.h.

#define PINMUX_DATA_REG (   name,
  r,
  r_width 
)
Value:
.reg = r, .reg_width = r_width, \
.enum_ids = (pinmux_enum_t [r_width]) \

Definition at line 73 of file sh_pfc.h.

#define PINMUX_FLAG_DBIT   (0x1f << PINMUX_FLAG_DBIT_SHIFT)

Definition at line 34 of file sh_pfc.h.

#define PINMUX_FLAG_DBIT_SHIFT   5

Definition at line 33 of file sh_pfc.h.

#define PINMUX_FLAG_DREG   (0x3f << PINMUX_FLAG_DREG_SHIFT)

Definition at line 36 of file sh_pfc.h.

#define PINMUX_FLAG_DREG_SHIFT   10

Definition at line 35 of file sh_pfc.h.

#define PINMUX_GPIO (   gpio,
  data_or_mark 
)    [gpio] = { .name = __stringify(gpio), .enum_id = data_or_mark, .flags = PINMUX_TYPE_NONE }

Definition at line 44 of file sh_pfc.h.

#define pinmux_info   sh_pfc

Definition at line 130 of file sh_pfc.h.

#define PINMUX_IRQ (   irq_nr,
  ids... 
)    { .irq = irq_nr, .enum_ids = (pinmux_enum_t []) { ids, 0 } } \

Definition at line 82 of file sh_pfc.h.

#define PORT_1 (   fn,
  pfx,
  sfx 
)    fn(pfx, sfx)

Definition at line 161 of file sh_pfc.h.

#define PORT_10 (   fn,
  pfx,
  sfx 
)
Value:
PORT_1(fn, pfx##0, sfx), PORT_1(fn, pfx##1, sfx), \
PORT_1(fn, pfx##2, sfx), PORT_1(fn, pfx##3, sfx), \
PORT_1(fn, pfx##4, sfx), PORT_1(fn, pfx##5, sfx), \
PORT_1(fn, pfx##6, sfx), PORT_1(fn, pfx##7, sfx), \
PORT_1(fn, pfx##8, sfx), PORT_1(fn, pfx##9, sfx)

Definition at line 163 of file sh_pfc.h.

#define PORT_90 (   fn,
  pfx,
  sfx 
)
Value:
PORT_10(fn, pfx##1, sfx), PORT_10(fn, pfx##2, sfx), \
PORT_10(fn, pfx##3, sfx), PORT_10(fn, pfx##4, sfx), \
PORT_10(fn, pfx##5, sfx), PORT_10(fn, pfx##6, sfx), \
PORT_10(fn, pfx##7, sfx), PORT_10(fn, pfx##8, sfx), \
PORT_10(fn, pfx##9, sfx)

Definition at line 170 of file sh_pfc.h.

#define PORT_ALL (   str)    CPU_ALL_PORT(_PORT_ALL, PORT, str)

Definition at line 179 of file sh_pfc.h.

#define PORT_DATA_I (   nr)    PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_IN)

Definition at line 184 of file sh_pfc.h.

#define PORT_DATA_I_PD (   nr)
Value:
PORT##nr##_IN, PORT##nr##_IN_PD)

Definition at line 187 of file sh_pfc.h.

#define PORT_DATA_I_PU (   nr)
Value:
PORT##nr##_IN, PORT##nr##_IN_PU)

Definition at line 191 of file sh_pfc.h.

#define PORT_DATA_I_PU_PD (   nr)
Value:
PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)

Definition at line 195 of file sh_pfc.h.

#define PORT_DATA_IO (   nr)
Value:
PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
PORT##nr##_IN)

Definition at line 202 of file sh_pfc.h.

#define PORT_DATA_IO_PD (   nr)
Value:
PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
PORT##nr##_IN, PORT##nr##_IN_PD)

Definition at line 206 of file sh_pfc.h.

#define PORT_DATA_IO_PU (   nr)
Value:
PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
PORT##nr##_IN, PORT##nr##_IN_PU)

Definition at line 210 of file sh_pfc.h.

#define PORT_DATA_IO_PU_PD (   nr)
Value:
PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT, \
PORT##nr##_IN, PORT##nr##_IN_PD, PORT##nr##_IN_PU)

Definition at line 214 of file sh_pfc.h.

#define PORT_DATA_O (   nr)    PINMUX_DATA(PORT##nr##_DATA, PORT##nr##_FN0, PORT##nr##_OUT)

Definition at line 199 of file sh_pfc.h.

#define PORTCR (   nr,
  reg 
)
Value:
{ \
PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) { \
_PCRH(PORT##nr##_IN, PORT##nr##_IN_PD, \
PORT##nr##_IN_PU, PORT##nr##_OUT), \
PORT##nr##_FN0, PORT##nr##_FN1, \
PORT##nr##_FN2, PORT##nr##_FN3, \
PORT##nr##_FN4, PORT##nr##_FN5, \
PORT##nr##_FN6, PORT##nr##_FN7 } \
}

Definition at line 225 of file sh_pfc.h.

Typedef Documentation

typedef unsigned short pinmux_enum_t

Definition at line 17 of file sh_pfc.h.

typedef unsigned short pinmux_flag_t

Definition at line 18 of file sh_pfc.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
PINMUX_TYPE_NONE 
PINMUX_TYPE_FUNCTION 
PINMUX_TYPE_GPIO 
PINMUX_TYPE_OUTPUT 
PINMUX_TYPE_INPUT 
PINMUX_TYPE_INPUT_PULLUP 
PINMUX_TYPE_INPUT_PULLDOWN 
PINMUX_FLAG_TYPE 

Definition at line 20 of file sh_pfc.h.

anonymous enum
Enumerator:
GPIO_CFG_DRYRUN 
GPIO_CFG_REQ 
GPIO_CFG_FREE 

Definition at line 158 of file sh_pfc.h.

Function Documentation

int register_sh_pfc ( struct sh_pfc pfc)

Definition at line 505 of file core.c.

int sh_pfc_config_gpio ( struct sh_pfc pfc,
unsigned  gpio,
int  pinmux_type,
int  cfg_mode 
)

Definition at line 392 of file core.c.

int sh_pfc_get_data_reg ( struct sh_pfc pfc,
unsigned  gpio,
struct pinmux_data_reg **  drp,
int bitp 
)

Definition at line 298 of file core.c.

int sh_pfc_gpio_to_enum ( struct sh_pfc pfc,
unsigned  gpio,
int  pos,
pinmux_enum_t enum_idp 
)

Definition at line 361 of file core.c.

int sh_pfc_read_bit ( struct pinmux_data_reg dr,
unsigned long  in_pos 
)

Definition at line 144 of file core.c.

int sh_pfc_register_gpiochip ( struct sh_pfc pfc)

Definition at line 139 of file gpio.c.

int sh_pfc_register_pinctrl ( struct sh_pfc pfc)

Definition at line 511 of file pinctrl.c.

void sh_pfc_write_bit ( struct pinmux_data_reg dr,
unsigned long  in_pos,
unsigned long  value 
)

Definition at line 157 of file core.c.