Phonons, lithium diffusion and thermodynamics of LiMPO4 (M = Mn, Fe)