Planck intermediate results. XLVII : Planck constraints on reionization history