Apple says...
I found this on Apple's compass interference page:
"Some areas have more magnetic interference than others. For example, your car's dashboard may have a high level of magnetic interference. If you wish to mount iPhone 3G S on a car's dashboard and use Compass or Maps, do not wave the device in a figure 8 to calibrate. Instead, mount iPhone 3G S, open Compass or Maps, and disregard the message to calibrate. iPhone 3G S will eventually re-calibrate after several turns. Note that it may need to periodically recalibrate while you are driving, depending on the level of magnetic interference present where you have it mounted."