/* read the pin's value (works even if it's not muxed as a gpio).  */
int at91_get_pio_value(unsigned port, unsigned pin)
/* read the pin's value (works even if it's not muxed as a gpio).  */
int at91_get_pio_value(unsigned port, unsigned pin)
{
	u32		pdsr	= 0;
	at91_pio_t	*pio 	= (at91_pio_t *) AT91_PIO_BASE;
	u32		mask;
	if ((port < AT91_PIO_PORTS) && (pin < 32)) {
		mask = 1 << pin;
		pdsr = readl(&pio->port[port].pdsr) & mask;
	}
	return pdsr != 0;
}