Cosmological solutions of a quadratic theory of gravity with torsion