GPIO general question

It’s there any way to use --let’s say configure-- a GPIO port as a only-input or only-output SERIALx ?