[Refactor][SPI] Refactor spi module (#573)