[bare-metal] How to configure GPIO functions?

How can I configure GPIO pins functions?

Let’s say I want to configure Pins 64 and 65 (GPIO2_A0 and GPIO2_A1) for Function 2 (UART0)?
How to do it? I believe this should be somewhere in the RK3308 Technical Reference Manual, but I failed to find it. I only found how to set GPIO pins for input/output.

Ah, finally found. Multiplexing is controlled by the GRF registers.

for rock pi s, grf_base = 0xff000000