/* mux the pin to the gpio controller (instead of "A" or "B" peripheral), and configure it for an output.  */
int at91_set_pio_output(unsigned port, u32 pin, int value)
/* mux the pin to the gpio controller (instead of "A" or "B" peripheral), and configure it for an output.  */
int at91_set_pio_output(unsigned port, u32 pin, int value)
{
	at91_pio_t	*pio 	= (at91_pio_t *) AT91_PIO_BASE;
	u32		mask;
	if ((port < AT91_PIO_PORTS) && (pin < 32)) {
		mask = 1 << pin;
		writel(mask, &pio->port[port].idr);
		writel(mask, &pio->port[port].pudr);
		if (value)
			writel(mask, &pio->port[port].sodr);
		else
			writel(mask, &pio->port[port].codr);
		writel(mask, &pio->port[port].oer);
		writel(mask, &pio->port[port].per);
	}
	return 0;
}