AFAIK it is not possible during runtime on the bone. I tried to implement it but the kernel would just silently reset those bits You'll need to apply this via a device tree overlay, probably at boot time.
If that's too much effort for you, you can use an external pullup/pulldown resistor in your circuit, that's how I do it.