Since I can’t get the devicetree working on the 4.4.62 kernel, I’m trying to set the GPIO pin configuration directly. I did this on the Beagle Board a long time ago, and am trying to adapt that code.
So, I have this code :
int fd = open("/dev/mem", O_RDWR | O_SYNC);
volatile ulong pinmux;
pinmux = (ulong) mmap(NULL, 0x2000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0x44E10000);
if (pinmux == MAP_FAILED) {
printf(“Pinmux Mapping failed\n”);
close(fd);
}
pinmux[0x0880/4] = 0x0f; // P8.25 GPIO1.0 write, no pulls, mode 7
pinmux[0x0884/4] = 0x0f; // P8.24 GPIO1.1 write, no pulls, mode 7
and then try to write values to the set and clear registers :
fd = open("/dev/mem", O_RDWR | O_SYNC);
// GPIO Configuration: configure are input
volatile ushort gpios;
gpios = (ushort) mmap(NULL, 0x2000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0x4804C000);
if (gpios == MAP_FAILED) {
printf(“Gpios Mapping failed\n”);
close(fd);
}
gpios[gpios_clear] = 0xff;
gpios[gpios_set] = j;
But I don’t see any response. More oddly, I don’t see any change in
/sys/kernel/debug/pinctrl/44e10800.pinmux/pins
Which lists the above pins as :
pin 32 (44e10880.0) 00000032 pinctrl-single
pin 33 (44e10884.0) 00000032 pinctrl-single
I think I am writing 0x0f to those registers, and I still see 0x32, which would indicate why the GPIOs are not getting through to the header pins.
If I read out the pinmux register in my program, it ALSO shows as 0x32, so apparently the write to that register is silently ignored.
Has anybody done this and know where I’m going wrong?
Thanks much,
Jon