Apple’s Official firmware release site can be found here, but it can be very hard to understand for the average user. I have extracted all of the firmware links and arranged them in their proper categories below. So if you have the original iPhone, download firmware from the 2G iPhone list. If you have the iPhone 3G, download the firmwares from 3G iPhone list. Lastly if you have the iPhone 3G S, download the firmware from the 3GS iPhone list.
If you need or want to downgrade your firmware on your iPhone you can get them here: