Here is the procedure for the CX-5, same for the CX-9
Switching On Maintenance Mode
1. Switch the ignition ON (engine off). (you have to press the start button TWICE) pressing once only gives you ACC power, (do not press on brake otherwise engine will start, engine must be off)
2. Release the electric parking brake. (to release the parking brake, you have to have your foot on the brake pedal, then press down on EPB switch to release it, you will hear the motor releasing and the light on the EPB switch light goes off)
• (I'll simplify remaining steps here: after step 2, release foot from brake pedal, and move over and press accelerator pedal down fully and press down on the EPB switch at the same time and hold, then press the start button 3 times quickly, you will hear the motor moving and the yellow parking brake with exclamation point light up)
you are now in maintenance mode.
Now go do whatever you need to do on the brakes, for the rear brake pistons DO NOT TURN THE PISTONS, compress them straight back like you would do the fronts. After they are compressed back make sure the grooves are lined up in perfect North South orientation per Mazda instructions use Lisle #28600 for minor adjustments only.
Even if you don't plan to do your own brakes, it would be a good idea to let your mechanic know about the maintenance mode. They might not be aware and turn the piston which may damage the EPB motor.
Ending Maintenance Mode
1. Switch the ignition ON (engine off). (you have to press the start button TWICE (do not press on brake otherwise engine will start, engine must be off) pressing once only gives you ACC power
(I'll simplify the remaining steps here: press accelerator pedal down fully and pull up on the EPB switch at the same time and hold, then press the start button 3 times quickly, you will hear the motor moving back and the yellow parking brake with exclamation point goes out)
you can then move your foot and press on the brake pedal and pull up the EPB, you will see the normal red brake light light up and you're done.