How to rotate Raspberry Pi LCD by 180°

In order to rotate a DSI-connected LCD screen like the Raspberry Pi 7″ LCD screen by 180 degrees, append

lcd_rotate=2

to /boot/config.txt