1 static void nuc900_gpio_core_set(struct gpio_chip *gc, unsigned gpio_num, 2 int val) 3 { 4 int port_num, value; 5 const struct gpio_port *port = 6 nuc900_gpio_cla_port(gpio_num, &port_num); 7 spin_lock(&gpio_lock); 8 if ((__raw_readl(port->dir) & (1 << port_num))) { //GPIO OUT 9 value = __raw_readl(port->out); 10 if (val) 11 value |= (1 << port_num); 12 else 13 value &= ~(1 << port_num); 14 nuc900_gpio_debug("out value=0x%08x\n", value); 15 __raw_writel(value, port->out); 16 17 } else { //GPIO IN 18 value = __raw_readl(port->in); 19 if (val) 20 value |= (1 << port_num); 21 else 22 value &= ~(1 << port_num); 23 nuc900_gpio_debug("in value=0x%08x\n", value); 24 __raw_writel(value, port->in);; 25 } 26 27 spin_unlock(&gpio_lock); 28 }
插入代码显示.