Well, at least part of the mystery seems to have been solved. For some reason the GPIO numbers for export are offset by 32. So,
gpio_138 is actually
gpio-170 in the 3.11 kernel.
root@arm:~# echo 170 > /sys/class/gpio/export
root@arm:~# cat /sys/kernel/debug/gpio
GPIOs 0-31, gpio:
GPIOs 32-63, gpio:
GPIOs 64-95, gpio:
GPIOs 96-127, gpio:
GPIOs 128-159, gpio:
gpio-132 (user ) in lo
GPIOs 160-191, gpio:
gpio-170 (sysfs ) in lo
gpio-179 (hsusb2_phy.25 ) out hi
GPIOs 492-511, platform/gpio.38, twl4030, can sleep:
gpio-510 (hsusb2_vbus ) out hi
root@arm:~# echo "high" > /sys/class/gpio/gpio170/direction - the LED lights up!
root@arm:~# cat /sys/kernel/debug/gpio
GPIOs 0-31, gpio:
GPIOs 32-63, gpio:
GPIOs 64-95, gpio:
GPIOs 96-127, gpio:
GPIOs 128-159, gpio:
gpio-132 (user ) in lo
GPIOs 160-191, gpio:
gpio-170 (sysfs ) out hi
gpio-179 (hsusb2_phy.25 ) out hi
GPIOs 492-511, platform/gpio.38, twl4030, can sleep:
gpio-510 (hsusb2_vbus ) out hi
I don't understand where this offset is coming from (unless somehow the first 32 GPIOs are counted twice - once on the CORE Control Module, and once on the Wkup Control Module?).
Also, it is very strange that the Core pinmux register value display crashes, so we cannot verify the pins are muxed the way we need them to.