Optical control of the spin of a magnetic atom in a semiconductor quantum dot