SPI flash support

I extracted these from kfoltman's master branch. Things appear to work just fine although it might be a good idea to squash away a few of the commits.