Afghan President Ashraf Ghani has flown to the besieged northern city of Mazar-i-Sharif to rally his beleaguered forces.