1. Disconnect the negative battery cable.
2. Remove the headliner.
3. Disconnect the connector.
4. Remove the screws, and then remove the sunroof motor.

Sunroof unit disassembly/assembly
Sunroof motor installationMazda 6 Service Manual: Instrument cluster configuration
1. Connect the SST (WDS or equivalent) to the DLC-2.
2. Input vehicle information following the directions on the screen.
3. Select Module programming.
4. Select Programmable module installation.
5. Select the following items and perform procedures according to directions
on the screen.
...
Mazda 6 Service Manual: Schedule 1
Chart symbols:
I: Inspect: Inspect and clean, repair, adjust, fill up, or replace if
necessary.
R: Replace
L: Lubricate
T: Tighten
Remarks:
*1 Use of FL-22 is recommended when replacing engine coolant. Using engine coolant
other than FL-22 may cause serious damage to the engine and cooli ...