SPI backport from 1.5

Chris: Here is the backport for AVR I discussed with you over email.