Is $E=\hbar \omega$ correct for massive particles? From Planck's relation we can say that the energy of a photon is
$$E=h\nu=\hbar \omega \, .$$
where $\hbar \equiv h / 2\pi$.
On the other hand, the energy of a free particle can be expressed as
$$E=\frac{p^2}{2m}$$
and from de Broglie relation we have
$$p = \frac{h}{\lambda} = \hbar k \, .$$
So, we can write the dispersion relation
$$\omega = \frac{\hbar k^2}{2m} \, .$$
Is this correct? We are mixing a photon energy with a particle energy. The energy of a particle in its most general way is:
$$E = \sqrt{p^2 c^2 + m^2c^4} \, .$$
For a photon we have $m=0$, which implies $E = pc = h\nu$, but this doesn't happen for a massive particle. So, is there something that I'm missing?
 A: $\renewcommand{\ket}[1]{|#1\rangle}$
It is correct that the kinetic energy of a massive particle in the non-relativistic limit is
$$E = p^2 / 2m \, . \tag{1}$$
It is also correct that for plane waves (i.e. free particle eigenstates), the momentum is related to the wave number via
$$p = \hbar k \, . \tag{2}$$
Therefore, as proposed in the question, the frequency of a free massive particle in a plane wave state and in the non-relativistic limit, is
$$\omega = \frac{\hbar k^2}{2m} \, . \tag{3}$$

Is this correct? We are mixing a photon energy with a particle energy.

Actually yes, it is correct.
The relation
$$E = h \nu = \hbar \omega \tag{4}$$
is actually a very general relation in non-relativistic quantum mechanics, not limited to photons.
From one point of view, this relation comes from Schrodinger's equation for the time evolution of a quantum state
$$i \hbar \frac{d \ket{\Psi}}{dt} = H \ket{\Psi} \, . \tag{5}$$
If the state $\ket{\Psi}$ has definite energy (in the case of a free particle the definite energy states are plane waves) then we can replace $H\ket{\Psi}$ with $E\ket{\Psi}$ and we get
$$i \hbar \frac{d\ket{\Psi}}{dt} = E \ket{\Psi} \, . \tag{6}$$
From here, if we assume that the state has a sinusoidal time dependence $\exp(-i \omega t)$ then we get $E = \hbar \omega$.
That time dependence can be assumed because it is a solution to the equation, and any other solution can be written as a linear superposition of such solutions.
If you haven't learned about this idea yet don't worry about it.
Note, however, that you could also choose $\exp(i \omega t)$ in which case you get $E = -\hbar \omega$.
I won't get into the meaning of positive and negative energies in quantum mechanics in this post.
If you're interested in that please ask a separate question though, because it is an interesting topic.
In relativistic situations things are different.
The Schrodinger equation no longer works (at least not in quite the same way) and you have to use things like the Dirac equation, or go to a Lagrangian formulation.
You can still derive dispersion relations and you essentially get the equation with the square root as written in the main question.
