To update to iOS 4.0.2 for iPhone, and iOS 3.2.2 for iPad, all you need to do is to connect your iPhone/iPod touch/iPad with your computer via USB and start iTunes. You should now see a message as shown below. Simply click on “Download and Install” button to get on to the new firmware.
Direct Download Links for iOS 4.0.2 (Official from Apple)
iPhone 4 4.0.2
iPhone 3GS 4.0.2
iPhone 3G 4.0.2
iPad 3G and iPad WiFi 3.2.2
iPod touch 3G 4.0.2