Lines Matching refs:offset

28 static void mscc_writel(unsigned int offset, void *addr)  in mscc_writel()  argument
30 if (offset < 32) in mscc_writel()
31 writel(BIT(offset), addr); in mscc_writel()
33 writel(BIT(offset % 32), addr + 4); in mscc_writel()
36 static unsigned int mscc_readl(unsigned int offset, void *addr) in mscc_readl() argument
38 if (offset < 32) in mscc_readl()
44 static void mscc_setbits(unsigned int offset, void *addr) in mscc_setbits() argument
46 if (offset < 32) in mscc_setbits()
47 writel(readl(addr) | BIT(offset), addr); in mscc_setbits()
49 writel(readl(addr + 4) | BIT(offset % 32), addr + 4); in mscc_setbits()
52 static void mscc_clrbits(unsigned int offset, void *addr) in mscc_clrbits() argument
54 if (offset < 32) in mscc_clrbits()
55 writel(readl(addr) & ~BIT(offset), addr); in mscc_clrbits()
57 writel(readl(addr + 4) & ~BIT(offset % 32), addr + 4); in mscc_clrbits()
94 int f, offset, regoff; in mscc_pinmux_set_mux() local
106 offset = pin->pin; in mscc_pinmux_set_mux()
108 if (offset >= 32) { in mscc_pinmux_set_mux()
109 offset = offset % 32; in mscc_pinmux_set_mux()
114 mscc_setbits(offset, info->regs + regoff); in mscc_pinmux_set_mux()
116 mscc_clrbits(offset, info->regs + regoff); in mscc_pinmux_set_mux()
119 mscc_setbits(offset, info->regs + regoff + 4); in mscc_pinmux_set_mux()
121 mscc_clrbits(offset, info->regs + regoff + 4); in mscc_pinmux_set_mux()
179 static int mscc_gpio_get(struct udevice *dev, unsigned int offset) in mscc_gpio_get() argument
184 if (mscc_readl(offset, info->regs + info->mscc_gpios[MSCC_GPIO_OE]) & in mscc_gpio_get()
185 BIT(offset % 32)) in mscc_gpio_get()
186 val = mscc_readl(offset, in mscc_gpio_get()
189 val = mscc_readl(offset, in mscc_gpio_get()
192 return !!(val & BIT(offset % 32)); in mscc_gpio_get()
195 static int mscc_gpio_set(struct udevice *dev, unsigned int offset, int value) in mscc_gpio_set() argument
200 mscc_writel(offset, in mscc_gpio_set()
203 mscc_writel(offset, in mscc_gpio_set()
209 static int mscc_gpio_get_direction(struct udevice *dev, unsigned int offset) in mscc_gpio_get_direction() argument
214 val = mscc_readl(offset, info->regs + info->mscc_gpios[MSCC_GPIO_OE]); in mscc_gpio_get_direction()
216 return (val & BIT(offset % 32)) ? GPIOF_OUTPUT : GPIOF_INPUT; in mscc_gpio_get_direction()
219 static int mscc_gpio_direction_input(struct udevice *dev, unsigned int offset) in mscc_gpio_direction_input() argument
223 mscc_clrbits(offset, info->regs + info->mscc_gpios[MSCC_GPIO_OE]); in mscc_gpio_direction_input()
229 unsigned int offset, int value) in mscc_gpio_direction_output() argument
233 mscc_setbits(offset, info->regs + info->mscc_gpios[MSCC_GPIO_OE]); in mscc_gpio_direction_output()
235 return mscc_gpio_set(dev, offset, value); in mscc_gpio_direction_output()