On Wed, Dec 12, 2007 at 04:49:46PM +0100, Jochen Friedrich wrote: > Hi Anton, > > > +int gpio_direction_input(unsigned int gpio) > > +{ > > + unsigned long flags; > > + int port = gpio / 32; > > + int pin = gpio % 32; > > + > > + spin_lock_irqsave(&cpm2_port_locks[port], flags); > > + > > + cpm2_set_pin(port, pin, CPM_PIN_INPUT | CPM_PIN_GPIO); > > > +int gpio_direction_output(unsigned int gpio, int value) > > +{ > > + struct cpm2_ioports __iomem *iop = > > + (struct cpm2_ioports __iomem *)&cpm2_immr->im_ioport; > > + int port = gpio / 32; > > + int pin = gpio % 32; > > + unsigned long flags; > > + > > + pin = 1 << (31 - pin); > > + > > + spin_lock_irqsave(&cpm2_port_locks[port], flags); > > + > > + cpm2_set_pin(port, pin, CPM_PIN_OUTPUT | CPM_PIN_GPIO); > > You seem to do the pin -> bitmask conversation twice in > gpio_direction_output(). > > cpm2_set_pin() must be executed before pin = 1 << (31 - pin);
Yup, found this just after posting. ;-) I've tried to move as much as possible out of spinlocked section, but done it obviously wrong. Will fix. Anyhow, much thanks for looking into this. -- Anton Vorontsov email: [EMAIL PROTECTED] backup email: [EMAIL PROTECTED] irc://irc.freenode.net/bd2 _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev