Three-dimensional gravity with torsion as a Chern-Simons gauge theory