fix SPI driver, move register out of driver code