Inelastic neutron scattering studies of magnetic fluctuations in the tetragonal and collapsed tetragonal phases of CaFe<sub>2</sub>As<sub>2</sub>