Lines Matching +full:addr +full:- +full:mode

2  * Code ported from Nomadik GPIO driver in ST-Ericsson Linux kernel code.
4 * copy-paste it to U-Boot.
11 * Ported to U-Boot by:
29 * The GPIO module in the db8500 Systems-on-Chip is an
37 #define GPIO_BLOCK(pin) (((pin + GPIO_PINS_PER_BLOCK) >> 5) - 1)
83 /* Can only be called from config_pin. Don't configure alt-mode directly */
84 static void gpio_set_mode(unsigned gpio, enum db8500_gpio_alt mode) in gpio_set_mode() argument
86 void __iomem *addr = get_gpio_addr(gpio); in gpio_set_mode() local
91 afunc = readl(addr + DB8500_GPIO_AFSLA) & ~bit; in gpio_set_mode()
92 bfunc = readl(addr + DB8500_GPIO_AFSLB) & ~bit; in gpio_set_mode()
93 if (mode & DB8500_GPIO_ALT_A) in gpio_set_mode()
95 if (mode & DB8500_GPIO_ALT_B) in gpio_set_mode()
97 writel(afunc, addr + DB8500_GPIO_AFSLA); in gpio_set_mode()
98 writel(bfunc, addr + DB8500_GPIO_AFSLB); in gpio_set_mode()
102 * db8500_gpio_set_pull() - enable/disable pull up/down on a gpio
117 void __iomem *addr = get_gpio_addr(gpio); in db8500_gpio_set_pull() local
122 pdis = readl(addr + DB8500_GPIO_PDIS); in db8500_gpio_set_pull()
127 writel(pdis, addr + DB8500_GPIO_PDIS); in db8500_gpio_set_pull()
130 writel(bit, addr + DB8500_GPIO_DATS); in db8500_gpio_set_pull()
132 writel(bit, addr + DB8500_GPIO_DATC); in db8500_gpio_set_pull()
137 void __iomem *addr = get_gpio_addr(gpio); in db8500_gpio_make_input() local
140 writel(1 << offset, addr + DB8500_GPIO_DIRC); in db8500_gpio_make_input()
145 void __iomem *addr = get_gpio_addr(gpio); in db8500_gpio_get_input() local
149 printf("db8500_gpio_get_input gpio=%u addr=%p offset=%u bit=%#x\n", in db8500_gpio_get_input()
150 gpio, addr, offset, bit); in db8500_gpio_get_input()
152 return (readl(addr + DB8500_GPIO_DAT) & bit) != 0; in db8500_gpio_get_input()
157 void __iomem *addr = get_gpio_addr(gpio); in db8500_gpio_make_output() local
160 writel(1 << offset, addr + DB8500_GPIO_DIRS); in db8500_gpio_make_output()
166 void __iomem *addr = get_gpio_addr(gpio); in db8500_gpio_set_output() local
170 writel(1 << offset, addr + DB8500_GPIO_DATS); in db8500_gpio_set_output()
172 writel(1 << offset, addr + DB8500_GPIO_DATC); in db8500_gpio_set_output()
176 * config_pin - configure a pin's mux attributes
179 * Configures a pin's mode (alternate function or GPIO), its pull up status,
180 * and its sleep mode based on the specified configuration. The @cfg is
181 * usually one of the SoC specific macros defined in mach/<soc>-pins.h. These
185 * If a pin's mode is set to GPIO, it is configured as an input to avoid
186 * side-effects. The gpio can be manipulated later using standard GPIO API
208 * db8500_config_pins - configure several pins at once