For Raspberry Pi OS Bookworm :
Add the video information to the end of cmdline.txt :
(located at /boot/firmware/cmdline.txt or on the /boot partition of the SD Card.)
video=DSI-1:800x480@60,rotate=<rotation-value>
Replace the <rotation-value> placeholder with one of the following values, which correspond to the degree of rotation relative to the default on your display: 0 (default), 90, 180 (reversed), 270
(https://www.raspberrypi.com/documentation/accessories/display.html)
For Raspberry Pi OS Buster / Bullseye :
Add one of the following values in config.txt
(located at /boot/firmware/cmdline.txt or on the /boot partition of the SD Card.)
lcd_rotate=0 # default (normal landscape)
lcd_rotate=1 # 90 degrees (portrait, upside down)
lcd_rotate=2 # 180 degrees (landscape)
lcd_rotate=3 # 270 degrees (portrait, upside down)