You can add the bouncing behavior using a mirroring method, where we relax the system and instead of bouncing the ball one allows it to cross to y<0 and changes the sign of the potential accordingly. It can be written as
$H=\frac{p^2}{2m}+mg|y|$
where $|y|=y$ if $y>=0$ and $|y|=-y$ if $y<0$. Potential then looks like (for $m,g=1$)
Equation of motion becomes
$\ddot y(t)=-mg\,sgn(y)$,
where $sgn(y)$ is the sign function of y (a Heaviside-theta-like function). To allow equlilibrium at $y=0$ to exist, we can define $sgn(0)\equiv0$.
Writing this in Wolfram Alpha (with $m=g=1$ for simplicity) gives the following graphs related to explicit solution $y(t)$ and phase diagram trajectories:
Inserting the Hamiltonian gives a better look at phase space appearance
To recover the actual bouncing ball behavior, take the absolute value of $y(t)$,
$|y(t)|$.
This approach is interesting because it allows for continuous trajectories in phase space.