Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
gpio.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/bitops.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <asm/mach-jz4740/base.h>
#include "irq.h"

Go to the source code of this file.

Data Structures

struct  jz_gpio_chip
 

Macros

#define JZ4740_GPIO_BASE_A   (32*0)
 
#define JZ4740_GPIO_BASE_B   (32*1)
 
#define JZ4740_GPIO_BASE_C   (32*2)
 
#define JZ4740_GPIO_BASE_D   (32*3)
 
#define JZ4740_GPIO_NUM_A   32
 
#define JZ4740_GPIO_NUM_B   32
 
#define JZ4740_GPIO_NUM_C   31
 
#define JZ4740_GPIO_NUM_D   32
 
#define JZ4740_IRQ_GPIO_BASE_A   (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_A)
 
#define JZ4740_IRQ_GPIO_BASE_B   (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_B)
 
#define JZ4740_IRQ_GPIO_BASE_C   (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_C)
 
#define JZ4740_IRQ_GPIO_BASE_D   (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_D)
 
#define JZ_REG_GPIO_PIN   0x00
 
#define JZ_REG_GPIO_DATA   0x10
 
#define JZ_REG_GPIO_DATA_SET   0x14
 
#define JZ_REG_GPIO_DATA_CLEAR   0x18
 
#define JZ_REG_GPIO_MASK   0x20
 
#define JZ_REG_GPIO_MASK_SET   0x24
 
#define JZ_REG_GPIO_MASK_CLEAR   0x28
 
#define JZ_REG_GPIO_PULL   0x30
 
#define JZ_REG_GPIO_PULL_SET   0x34
 
#define JZ_REG_GPIO_PULL_CLEAR   0x38
 
#define JZ_REG_GPIO_FUNC   0x40
 
#define JZ_REG_GPIO_FUNC_SET   0x44
 
#define JZ_REG_GPIO_FUNC_CLEAR   0x48
 
#define JZ_REG_GPIO_SELECT   0x50
 
#define JZ_REG_GPIO_SELECT_SET   0x54
 
#define JZ_REG_GPIO_SELECT_CLEAR   0x58
 
#define JZ_REG_GPIO_DIRECTION   0x60
 
#define JZ_REG_GPIO_DIRECTION_SET   0x64
 
#define JZ_REG_GPIO_DIRECTION_CLEAR   0x68
 
#define JZ_REG_GPIO_TRIGGER   0x70
 
#define JZ_REG_GPIO_TRIGGER_SET   0x74
 
#define JZ_REG_GPIO_TRIGGER_CLEAR   0x78
 
#define JZ_REG_GPIO_FLAG   0x80
 
#define JZ_REG_GPIO_FLAG_CLEAR   0x14
 
#define GPIO_TO_BIT(gpio)   BIT(gpio & 0x1f)
 
#define GPIO_TO_REG(gpio, reg)   (gpio_to_jz_gpio_chip(gpio)->base + (reg))
 
#define CHIP_TO_REG(chip, reg)   (gpio_chip_to_jz_gpio_chip(chip)->base + (reg))
 
#define IRQ_TO_BIT(irq)   BIT(irq_to_gpio(irq) & 0x1f)
 
#define JZ4740_GPIO_CHIP(_bank)
 

Functions

int jz_gpio_set_function (int gpio, enum jz_gpio_function function)
 
 EXPORT_SYMBOL_GPL (jz_gpio_set_function)
 
int jz_gpio_bulk_request (const struct jz_gpio_bulk_request *request, size_t num)
 
 EXPORT_SYMBOL_GPL (jz_gpio_bulk_request)
 
void jz_gpio_bulk_free (const struct jz_gpio_bulk_request *request, size_t num)
 
 EXPORT_SYMBOL_GPL (jz_gpio_bulk_free)
 
void jz_gpio_bulk_suspend (const struct jz_gpio_bulk_request *request, size_t num)
 
 EXPORT_SYMBOL_GPL (jz_gpio_bulk_suspend)
 
void jz_gpio_bulk_resume (const struct jz_gpio_bulk_request *request, size_t num)
 
 EXPORT_SYMBOL_GPL (jz_gpio_bulk_resume)
 
void jz_gpio_enable_pullup (unsigned gpio)
 
 EXPORT_SYMBOL_GPL (jz_gpio_enable_pullup)
 
void jz_gpio_disable_pullup (unsigned gpio)
 
 EXPORT_SYMBOL_GPL (jz_gpio_disable_pullup)
 
int jz_gpio_port_direction_input (int port, uint32_t mask)
 
 EXPORT_SYMBOL (jz_gpio_port_direction_input)
 
int jz_gpio_port_direction_output (int port, uint32_t mask)
 
 EXPORT_SYMBOL (jz_gpio_port_direction_output)
 
void jz_gpio_port_set_value (int port, uint32_t value, uint32_t mask)
 
 EXPORT_SYMBOL (jz_gpio_port_set_value)
 
uint32_t jz_gpio_port_get_value (int port, uint32_t mask)
 
 EXPORT_SYMBOL (jz_gpio_port_get_value)
 
int gpio_to_irq (unsigned gpio)
 
 EXPORT_SYMBOL_GPL (gpio_to_irq)
 
int irq_to_gpio (unsigned irq)
 
 EXPORT_SYMBOL_GPL (irq_to_gpio)
 
 arch_initcall (jz4740_gpio_init)
 

Macro Definition Documentation

#define CHIP_TO_REG (   chip,
  reg 
)    (gpio_chip_to_jz_gpio_chip(chip)->base + (reg))

Definition at line 75 of file gpio.c.

#define GPIO_TO_BIT (   gpio)    BIT(gpio & 0x1f)

Definition at line 73 of file gpio.c.

#define GPIO_TO_REG (   gpio,
  reg 
)    (gpio_to_jz_gpio_chip(gpio)->base + (reg))

Definition at line 74 of file gpio.c.

#define IRQ_TO_BIT (   irq)    BIT(irq_to_gpio(irq) & 0x1f)

Definition at line 278 of file gpio.c.

#define JZ4740_GPIO_BASE_A   (32*0)

Definition at line 33 of file gpio.c.

#define JZ4740_GPIO_BASE_B   (32*1)

Definition at line 34 of file gpio.c.

#define JZ4740_GPIO_BASE_C   (32*2)

Definition at line 35 of file gpio.c.

#define JZ4740_GPIO_BASE_D   (32*3)

Definition at line 36 of file gpio.c.

#define JZ4740_GPIO_CHIP (   _bank)
Value:
{ \
.irq_base = JZ4740_IRQ_GPIO_BASE_ ## _bank, \
.gpio_chip = { \
.label = "Bank " # _bank, \
.owner = THIS_MODULE, \
.set = jz_gpio_set_value, \
.get = jz_gpio_get_value, \
.direction_output = jz_gpio_direction_output, \
.direction_input = jz_gpio_direction_input, \
.base = JZ4740_GPIO_BASE_ ## _bank, \
.ngpio = JZ4740_GPIO_NUM_ ## _bank, \
}, \
}

Definition at line 398 of file gpio.c.

#define JZ4740_GPIO_NUM_A   32

Definition at line 38 of file gpio.c.

#define JZ4740_GPIO_NUM_B   32

Definition at line 39 of file gpio.c.

#define JZ4740_GPIO_NUM_C   31

Definition at line 40 of file gpio.c.

#define JZ4740_GPIO_NUM_D   32

Definition at line 41 of file gpio.c.

#define JZ4740_IRQ_GPIO_BASE_A   (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_A)

Definition at line 43 of file gpio.c.

#define JZ4740_IRQ_GPIO_BASE_B   (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_B)

Definition at line 44 of file gpio.c.

#define JZ4740_IRQ_GPIO_BASE_C   (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_C)

Definition at line 45 of file gpio.c.

#define JZ4740_IRQ_GPIO_BASE_D   (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_D)

Definition at line 46 of file gpio.c.

#define JZ_REG_GPIO_DATA   0x10

Definition at line 49 of file gpio.c.

#define JZ_REG_GPIO_DATA_CLEAR   0x18

Definition at line 51 of file gpio.c.

#define JZ_REG_GPIO_DATA_SET   0x14

Definition at line 50 of file gpio.c.

#define JZ_REG_GPIO_DIRECTION   0x60

Definition at line 64 of file gpio.c.

#define JZ_REG_GPIO_DIRECTION_CLEAR   0x68

Definition at line 66 of file gpio.c.

#define JZ_REG_GPIO_DIRECTION_SET   0x64

Definition at line 65 of file gpio.c.

#define JZ_REG_GPIO_FLAG   0x80

Definition at line 70 of file gpio.c.

#define JZ_REG_GPIO_FLAG_CLEAR   0x14

Definition at line 71 of file gpio.c.

#define JZ_REG_GPIO_FUNC   0x40

Definition at line 58 of file gpio.c.

#define JZ_REG_GPIO_FUNC_CLEAR   0x48

Definition at line 60 of file gpio.c.

#define JZ_REG_GPIO_FUNC_SET   0x44

Definition at line 59 of file gpio.c.

#define JZ_REG_GPIO_MASK   0x20

Definition at line 52 of file gpio.c.

#define JZ_REG_GPIO_MASK_CLEAR   0x28

Definition at line 54 of file gpio.c.

#define JZ_REG_GPIO_MASK_SET   0x24

Definition at line 53 of file gpio.c.

#define JZ_REG_GPIO_PIN   0x00

Definition at line 48 of file gpio.c.

#define JZ_REG_GPIO_PULL   0x30

Definition at line 55 of file gpio.c.

#define JZ_REG_GPIO_PULL_CLEAR   0x38

Definition at line 57 of file gpio.c.

#define JZ_REG_GPIO_PULL_SET   0x34

Definition at line 56 of file gpio.c.

#define JZ_REG_GPIO_SELECT   0x50

Definition at line 61 of file gpio.c.

#define JZ_REG_GPIO_SELECT_CLEAR   0x58

Definition at line 63 of file gpio.c.

#define JZ_REG_GPIO_SELECT_SET   0x54

Definition at line 62 of file gpio.c.

#define JZ_REG_GPIO_TRIGGER   0x70

Definition at line 67 of file gpio.c.

#define JZ_REG_GPIO_TRIGGER_CLEAR   0x78

Definition at line 69 of file gpio.c.

#define JZ_REG_GPIO_TRIGGER_SET   0x74

Definition at line 68 of file gpio.c.

Function Documentation

arch_initcall ( jz4740_gpio_init  )
EXPORT_SYMBOL ( jz_gpio_port_direction_input  )
EXPORT_SYMBOL ( jz_gpio_port_direction_output  )
EXPORT_SYMBOL ( jz_gpio_port_set_value  )
EXPORT_SYMBOL ( jz_gpio_port_get_value  )
EXPORT_SYMBOL_GPL ( jz_gpio_set_function  )
EXPORT_SYMBOL_GPL ( jz_gpio_bulk_request  )
EXPORT_SYMBOL_GPL ( jz_gpio_bulk_free  )
EXPORT_SYMBOL_GPL ( jz_gpio_bulk_suspend  )
EXPORT_SYMBOL_GPL ( jz_gpio_bulk_resume  )
EXPORT_SYMBOL_GPL ( jz_gpio_enable_pullup  )
EXPORT_SYMBOL_GPL ( jz_gpio_disable_pullup  )
EXPORT_SYMBOL_GPL ( gpio_to_irq  )
EXPORT_SYMBOL_GPL ( irq_to_gpio  )
int gpio_to_irq ( unsigned  gpio)

Definition at line 266 of file gpio.c.

int irq_to_gpio ( unsigned  irq)

Definition at line 272 of file gpio.c.

void jz_gpio_bulk_free ( const struct jz_gpio_bulk_request request,
size_t  num 
)

Definition at line 162 of file gpio.c.

Definition at line 138 of file gpio.c.

void jz_gpio_bulk_resume ( const struct jz_gpio_bulk_request request,
size_t  num 
)

Definition at line 186 of file gpio.c.

void jz_gpio_bulk_suspend ( const struct jz_gpio_bulk_request request,
size_t  num 
)

Definition at line 174 of file gpio.c.

void jz_gpio_disable_pullup ( unsigned  gpio)

Definition at line 201 of file gpio.c.

void jz_gpio_enable_pullup ( unsigned  gpio)

Definition at line 195 of file gpio.c.

int jz_gpio_port_direction_input ( int  port,
uint32_t  mask 
)

Definition at line 235 of file gpio.c.

int jz_gpio_port_direction_output ( int  port,
uint32_t  mask 
)

Definition at line 243 of file gpio.c.

uint32_t jz_gpio_port_get_value ( int  port,
uint32_t  mask 
)

Definition at line 258 of file gpio.c.

void jz_gpio_port_set_value ( int  port,
uint32_t  value,
uint32_t  mask 
)

Definition at line 251 of file gpio.c.

int jz_gpio_set_function ( int  gpio,
enum jz_gpio_function  function 
)

Definition at line 110 of file gpio.c.