Critical field of MgB2 : crossover from clean to dirty regimes