]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/asm-arm/arch-s5pc1xx/gpio.h
s5pc1xx: support the GPIO interface
[karo-tx-uboot.git] / include / asm-arm / arch-s5pc1xx / gpio.h
index 00104053152813ce1d1fb4ec926907e464f8c9b8..8e4bb863f9cab9fc6b7b398953e17ccbbbf68bbc 100644 (file)
 
 #ifndef __ASSEMBLY__
 struct s5pc1xx_gpio_bank {
-       unsigned long   con;
-       unsigned long   dat;
-       unsigned long   pull;
-       unsigned long   drv;
-       unsigned long   pdn_con;
-       unsigned long   pdn_pull;
+       unsigned int    con;
+       unsigned int    dat;
+       unsigned int    pull;
+       unsigned int    drv;
+       unsigned int    pdn_con;
+       unsigned int    pdn_pull;
        unsigned char   res1[8];
 };
 
@@ -124,6 +124,35 @@ struct s5pc110_gpio {
        struct s5pc1xx_gpio_bank gpio_h2;
        struct s5pc1xx_gpio_bank gpio_h3;
 };
+
+/* functions */
+void gpio_cfg_pin(struct s5pc1xx_gpio_bank *bank, int gpio, int cfg);
+void gpio_direction_output(struct s5pc1xx_gpio_bank *bank, int gpio, int en);
+void gpio_direction_input(struct s5pc1xx_gpio_bank *bank, int gpio);
+void gpio_set_value(struct s5pc1xx_gpio_bank *bank, int gpio, int en);
+unsigned int gpio_get_value(struct s5pc1xx_gpio_bank *bank, int gpio);
+void gpio_set_pull(struct s5pc1xx_gpio_bank *bank, int gpio, int mode);
+void gpio_set_drv(struct s5pc1xx_gpio_bank *bank, int gpio, int mode);
+void gpio_set_rate(struct s5pc1xx_gpio_bank *bank, int gpio, int mode);
 #endif
 
+/* Pin configurations */
+#define GPIO_INPUT     0x0
+#define GPIO_OUTPUT    0x1
+#define GPIO_IRQ       0xf
+#define GPIO_FUNC(x)   (x)
+
+/* Pull mode */
+#define GPIO_PULL_NONE 0x0
+#define GPIO_PULL_DOWN 0x1
+#define GPIO_PULL_UP   0x2
+
+/* Drive Strength level */
+#define GPIO_DRV_1X    0x0
+#define GPIO_DRV_2X    0x1
+#define GPIO_DRV_3X    0x2
+#define GPIO_DRV_4X    0x3
+#define GPIO_DRV_FAST  0x0
+#define GPIO_DRV_SLOW  0x1
+
 #endif