源码如下:注意看注释,讲的很明白。
/**
* struct s3c_gpio_cfg GPIO configuration
* @cfg_eint: Configuration setting when used for external interrupt source外部中断
* @get_pull: Read the current pull configuration for the GPIO
* @set_pull: Set the current pull configuraiton for the GPIO
* @set_config: Set the current configuration for the GPIO
* @get_config: Read the current configuration for the GPIO
*
* Each chip can have more than one type of GPIO bank available and some
* have different capabilites even when they have the same control register
* layouts. Provide an point to vector control routine and provide any
* per-bank configuration information that other systems such as the
* external interrupt code will need.
*/ 指向具体端口的函数调转表
struct s3c_gpio_cfg {
unsigned intcfg_eint;
s3c_gpio_pull_t(*get_pull)(struct s3c_gpio_chip *chip, unsigned offs);
int (*set_pull)(struct s3c_gpio_chip *chip, unsigned offs,
s3c_gpio_pull_t pull);
unsigned (*get_config)(struct s3c_gpio_chip *chip, unsigned offs);
int (*set_config)(struct s3c_gpio_chip *chip, unsigned offs,
unsigned config);
};
那么上的这三个有什么不同呢?看下面这段就可知道了:
/* GPIO bank summary:
*
* BankGPIO端口GPIOs数目Style类型控制位数目SlpCon端口A 睡眠模式配置寄存ExtInt Group外部中断
* A8 4BitYes1
* B7 4BitYes1
* C8 4BitYes2
* D5 4BitYes3
* E5 4BitYesNone
* F16 2BitYes4 [1]
* G7 4BitYes5
* H10 4Bit[2]Yes6
* I16 2BitYesNone
* J12 2BitYesNone
* K16 4Bit[2]NoNone
* L15 4Bit[2] NoNone
* M6 4BitNoIRQ_EINT
* N16 2BitNoIRQ_EINT
* O16 2BitYes7
* P15 2BitYes8
* Q9 2BitYes9
*
* [1] BANKF pins 14,15 do not form part of the external interrupt sources
* [2] BANK has two control registers, GPxCON0 and GPxCON1
*/
对照下图应该明白了上面的

下面这个图对应gpio_4bit

下面这两个图对应gpio_4bit2,4为控制,2个控制寄存器


下面这两个图对应gpio_2bit,两位控制

注:体会一下,s3c_gpio_chip和gpio_chip两个结构体的不同指出。
