im works with the AT91SAM9G25 board, which has 4 PIO controllers that control up to 32 programmable I / O lines. Each pin is configured as a general-purpose I / O line only or as an I / O line multiplexed to two peripheral I / Os. So, for example, according to the documentation ( SAM9G25 , p. 14), the PC0 signal can be multiplexed in this way by the general-purpose input-output line or the ISI_D0 VIDEO_ATMEL_ISI line (image sensor interface ISI).
ββββββββββββββ¦βββββββββββββ¦βββββββββββββ¦βββββββββββββ¦βββββββββββββ
β Primary β Alternates β PeripA β PeripB β PeripC β
β βββββββββββββ¬βββββββββββββ¬βββββββββββββ¬βββββββββββββ¬βββββββββββββ£
β Signal/Dir β Signal/Dir β Signal/Dir β Signal/Dir β Signal/Dir β
β --------- β --------- β --------- β --------- β --------- β
β PC0 / I/O β β β ISI_D0 / I β β
ββββββββββββββ©βββββββββββββ©βββββββββββββ©βββββββββββββ©βββββββββββββ
The reset state of all GPIO lines has an IN and Pullup direction. when I use GPIOLIB via sysfs, I read the value "1" as INPUT in several GPIOs due to pullup. Is this the normal safe state of the GPIO (INPUT with Pullup resistor) to reset on multiple boards when they can be multiplexed with other peripherals ?. I don't see how to disable pullup through user space using GPIOLIB. So, for example, I see that when the kernel boots, it checks whether the Image Sensor Peripheral device is enabled in the kernel or as a module, and therefore it installs PC0 in Peripheral B. This is in the kernel sources in / arch / arm / mach -at91 /at91sam9x5_devices.c
#if defined(CONFIG_VIDEO_ATMEL_ISI) || defined(CONFIG_VIDEO_ATMEL_ISI_MODULE)
....
at91_set_B_periph(AT91_PIN_PC0, 0);
...
#endif
Then, if I do not allow ISI support in the kernel, I can use the PC0 signal as a GPIO line. This is / sys / kernel / debug / gpio:
# cat /sys/kernel/debug/gpio
GPIOs 32-63, A:
GPIOs 64-95, B:
[atmel_usba_udc] GPIOB16: [gpio] set
[d1] GPIOB18: [gpio] clear
GPIOs 96-127, C:
GPIOs 128-159, D:
[ohci_vbus] GPIOD19: [gpio] clear
[ohci_vbus] GPIOD20: [gpio] clear
[d2] GPIOD21: [gpio] set
/sys/kernel/debug/at 91_gpio
Pin PIOA PIOB PIOC PIOD
0: A A GPIO:1 A
1: A A GPIO:1 A
2: GPIO:1 A GPIO:1 A
3: GPIO:1 A GPIO:1 A
4: GPIO:1 A GPIO:1 GPIO:1
5: GPIO:1 A GPIO:1 GPIO:1
6: GPIO:1 A GPIO:1 A
7: B A GPIO:1 A
8: GPIO:1 GPIO:1 GPIO:1 A
9: A A GPIO:1 A
10: A A GPIO:1 A
11: A GPIO:1 GPIO:1 A
12: A GPIO:1 GPIO:1 A
13: A GPIO:1 GPIO:1 A
14: A GPIO:1 GPIO:1 GPIO:1
15: GPIO:1 GPIO:1 GPIO:1 A
16: GPIO:1 GPIO:1 GPIO:0 A
17: GPIO:1 GPIO:1 GPIO:1 A
18: GPIO:1 GPIO:1 GPIO:1 A
19: GPIO:1 A GPIO:1 GPIO:0
20: GPIO:1 A GPIO:0 GPIO:0
21: GPIO:1 A GPIO:0 GPIO:1
22: GPIO:1 A GPIO:1 A
23: GPIO:1 A GPIO:1 A
24: GPIO:1 A GPIO:1 A
25: GPIO:1 A GPIO:1 A
26: GPIO:1 A GPIO:1 A
27: GPIO:0 A GPIO:1 A
28: GPIO:1 A GPIO:0 A
29: GPIO:1 A GPIO:0 A
30: GPIO:1 A GPIO:1 A
31: GPIO:1 A GPIO:1 A
, PIOA0 Peripheral A (TXD0 UART Line), , , PIOC20 , , GPIO reset INPUTS pullup, , u-boot GPIO (, GPIOs , ?)
: pullup GPIO? , /arch/arm/mach -at91/at91sam9x5_devices.c , linux-2.6.39/arch/arm/mach-at91/gpio.c.
int __init_or_module at91_set_pulldown(unsigned pin, int is_on)
{
void __iomem *pio = pin_to_controller(pin);
unsigned mask = pin_to_mask(pin);
if (!pio || !cpu_has_pio3())
return -EINVAL;
__raw_writel(mask, pio + PIO_PUDR);
__raw_writel(mask, pio + (is_on ? PIO_PPDER : PIO_PPDDR));
return 0;
}
EXPORT_SYMBOL(at91_set_pulldown);
//mach-at91/include/mach/gpio.h
#ifndef __ASSEMBLY__
.....
extern int __init_or_module at91_set_pulldown(unsigned pin, int is_on);
.....
#endif
?
PD: , , .