How to calculate switching frequecncy
A quick and dirty ballpark estimate is 5 or 10 times the max motor speed.

For example, if your maximum motor speed will be 6000RPM:

\$\dfrac{6000~RPM}{60~sec/min}=100~\text{rotations per second or Hz}\$

\$100\text{Hz} \cdot 5 = 500\text{Hz}\$

This may or may not be okay for your application since that frequency falls in the range of human hearing. If this is a concern, 20kHz to almost always a safe starting point.

Being a DC motor, it really wants to be driven by a DC voltage. So it would be more accurate to base it on the characteristics of the motor. A motor is typically modeled as a resistor and an inductor in series which equates to a first-order inductive low pass filter so we're in luck. As long as the PWM period is lower (the frequency is higher) than the time constant of the filter, the motor will essentially see DC.

So if the time constant is:

\$\tau=\dfrac{L}{R}\$

And:

\$\tau=\dfrac{1}{f}\$

then your frequency needs to be higher than:

\$f&gt;\dfrac{1}{L/R}\$

Use that as a starting point and then measure the current ripple. Decide how much current ripple is acceptable and increase the frequency as needed.