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. The dynamic is exactly the same with a gain: trajectories become $C^2$. 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 (similar to a spring but instead of $sin$/$cos$ functions, its smoothly connected parabolas):
Inserting the Hamiltonian gives a better look at phase space appearance
As for solutions, here's one:As for explicit solutions, here's one:
For given initial conditions $y_0>0$, $v_0$, the (downward-facing) initial parabolic trajectory is given by
$y_{init}(t)=y_0+v_0t-\frac g2t^2$.$\,\,\,\,\,\,\,\,\,\,$(1)
It will bounce for the first time when $y_{init}(t)=0$ with $t>0$ and the "last time" it "has bounced" is the other root. The difference between the two roots is the period of bouncing $T$, given by the square root of the Bhaskara formula's $\Delta$:
$T=\sqrt{v_0^2+2g\,y_0}$.
Then, by using a sawtooth function of period $T$
$\tau(t)=t-T \lfloor t/T \rfloor$,
the bouncing trajectory is
$y(t)=y_{init}(\tau(t))$,
with $y_{init}$ given by (1).
For $C^2$ trajectories (and actual solutions to the above hamiltonian) the sign of the function should change every period.