~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/unicore32/include/asm/gpio.h

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * linux/arch/unicore32/include/asm/gpio.h
  3  *
  4  * Code specific to PKUnity SoC and UniCore ISA
  5  *
  6  * Copyright (C) 2001-2010 GUAN Xue-tao
  7  *
  8  * This program is free software; you can redistribute it and/or modify
  9  * it under the terms of the GNU General Public License version 2 as
 10  * published by the Free Software Foundation.
 11  */
 12 
 13 #ifndef __UNICORE_GPIO_H__
 14 #define __UNICORE_GPIO_H__
 15 
 16 #include <linux/io.h>
 17 #include <asm/irq.h>
 18 #include <mach/hardware.h>
 19 #include <asm-generic/gpio.h>
 20 
 21 #define GPI_OTP_INT             0
 22 #define GPI_PCI_INTA            1
 23 #define GPI_PCI_INTB            2
 24 #define GPI_PCI_INTC            3
 25 #define GPI_PCI_INTD            4
 26 #define GPI_BAT_DET             5
 27 #define GPI_SD_CD               6
 28 #define GPI_SOFF_REQ            7
 29 #define GPI_SD_WP               8
 30 #define GPI_LCD_CASE_OFF        9
 31 #define GPO_WIFI_EN             10
 32 #define GPO_HDD_LED             11
 33 #define GPO_VGA_EN              12
 34 #define GPO_LCD_EN              13
 35 #define GPO_LED_DATA            14
 36 #define GPO_LED_CLK             15
 37 #define GPO_CAM_PWR_EN          16
 38 #define GPO_LCD_VCC_EN          17
 39 #define GPO_SOFT_OFF            18
 40 #define GPO_BT_EN               19
 41 #define GPO_FAN_ON              20
 42 #define GPO_SPKR                21
 43 #define GPO_SET_V1              23
 44 #define GPO_SET_V2              24
 45 #define GPO_CPU_HEALTH          25
 46 #define GPO_LAN_SEL             26
 47 
 48 #ifdef CONFIG_PUV3_NB0916
 49 #define GPI_BTN_TOUCH           14
 50 #define GPIO_IN                 0x000043ff /* 1 for input */
 51 #define GPIO_OUT                0x0fffbc00 /* 1 for output */
 52 #endif  /* CONFIG_PUV3_NB0916 */
 53 
 54 #ifdef CONFIG_PUV3_SMW0919
 55 #define GPIO_IN                 0x000003ff /* 1 for input */
 56 #define GPIO_OUT                0x0ffffc00 /* 1 for output */
 57 #endif  /* CONFIG_PUV3_SMW0919 */
 58 
 59 #ifdef CONFIG_PUV3_DB0913
 60 #define GPIO_IN                 0x000001df /* 1 for input */
 61 #define GPIO_OUT                0x03fee800 /* 1 for output */
 62 #endif  /* CONFIG_PUV3_DB0913 */
 63 
 64 #define GPIO_DIR                (~((GPIO_IN) | 0xf0000000))
 65                                 /* 0 input, 1 output */
 66 
 67 static inline int gpio_get_value(unsigned gpio)
 68 {
 69         if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
 70                 return readl(GPIO_GPLR) & GPIO_GPIO(gpio);
 71         else
 72                 return __gpio_get_value(gpio);
 73 }
 74 
 75 static inline void gpio_set_value(unsigned gpio, int value)
 76 {
 77         if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
 78                 if (value)
 79                         writel(GPIO_GPIO(gpio), GPIO_GPSR);
 80                 else
 81                         writel(GPIO_GPIO(gpio), GPIO_GPCR);
 82         else
 83                 __gpio_set_value(gpio, value);
 84 }
 85 
 86 #define gpio_cansleep   __gpio_cansleep
 87 
 88 static inline unsigned gpio_to_irq(unsigned gpio)
 89 {
 90         if ((gpio < IRQ_GPIOHIGH) && (FIELD(1, 1, gpio) & readl(GPIO_GPIR)))
 91                 return IRQ_GPIOLOW0 + gpio;
 92         else
 93                 return IRQ_GPIO0 + gpio;
 94 }
 95 
 96 static inline unsigned irq_to_gpio(unsigned irq)
 97 {
 98         if (irq < IRQ_GPIOHIGH)
 99                 return irq - IRQ_GPIOLOW0;
100         else
101                 return irq - IRQ_GPIO0;
102 }
103 
104 #endif /* __UNICORE_GPIO_H__ */
105 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp