#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/of_gpio.h>
#include <linux/of_irq.h>
#include <linux/pm_runtime.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_bitbang.h>
#define SSC_CTL_DATA_WIDTH_9 0x8
#define SSC_CTL_DATA_WIDTH_MSK 0xf
#define SSC_CTL_HB BIT(4)
#define SSC_CTL_PH BIT(5)
#define SSC_CTL_PO BIT(6)
#define SSC_CTL_SR BIT(7)
#define SSC_CTL_MS BIT(8)
#define SSC_CTL_EN BIT(9)
#define SSC_CTL_LPB BIT(10)
#define SSC_CTL_EN_TX_FIFO BIT(11)
#define SSC_CTL_EN_RX_FIFO BIT(12)
#define SSC_CTL_EN_CLST_RX BIT(13)
#define SSC_IEN_TEEN BIT(2)
unsigned int words_remaining;
static void ssc_write_tx_fifo(struct spi_st *spi_st)
if (spi_st->words_remaining > FIFO_SIZE)
count = spi_st->words_remaining;
for (i = 0; i < count; i++) {
if (spi_st->bytes_per_word == 1) {
word = *spi_st->tx_ptr++;
word = *spi_st->tx_ptr++;
word = *spi_st->tx_ptr++ | (word << 8);
writel_relaxed(word, spi_st->base + SSC_TBUF);