Lines Matching refs:ax_spi

20 int axspi_wakeup(struct axspi_data *ax_spi)  in axspi_wakeup()  argument
24 ax_spi->cmd_buf[0] = AX_SPICMD_EXIT_PWD; /* OP */ in axspi_wakeup()
25 ret = spi_write(ax_spi->spi, ax_spi->cmd_buf, 1); in axspi_wakeup()
27 dev_err(&ax_spi->spi->dev, "%s() failed: ret = %d\n", __func__, ret); in axspi_wakeup()
31 int axspi_read_status(struct axspi_data *ax_spi, struct spi_status *status) in axspi_read_status() argument
36 ax_spi->cmd_buf[0] = AX_SPICMD_READ_STATUS; in axspi_read_status()
37 ret = spi_write_then_read(ax_spi->spi, ax_spi->cmd_buf, 1, (u8 *)status, 3); in axspi_read_status()
39 dev_err(&ax_spi->spi->dev, "%s() failed: ret = %d\n", __func__, ret); in axspi_read_status()
46 int axspi_read_rxq(struct axspi_data *ax_spi, void *data, int len) in axspi_read_rxq() argument
48 struct spi_transfer *xfer = ax_spi->spi_rx_xfer; in axspi_read_rxq()
51 memcpy(ax_spi->cmd_buf, ax88796c_rx_cmd_buf, 5); in axspi_read_rxq()
53 xfer->tx_buf = ax_spi->cmd_buf; in axspi_read_rxq()
55 xfer->len = ax_spi->comp ? 2 : 5; in axspi_read_rxq()
57 spi_message_add_tail(xfer, &ax_spi->rx_msg); in axspi_read_rxq()
64 spi_message_add_tail(xfer, &ax_spi->rx_msg); in axspi_read_rxq()
65 ret = spi_sync(ax_spi->spi, &ax_spi->rx_msg); in axspi_read_rxq()
67 dev_err(&ax_spi->spi->dev, "%s() failed: ret = %d\n", __func__, ret); in axspi_read_rxq()
72 int axspi_write_txq(const struct axspi_data *ax_spi, void *data, int len) in axspi_write_txq() argument
74 return spi_write(ax_spi->spi, data, len); in axspi_write_txq()
77 u16 axspi_read_reg(struct axspi_data *ax_spi, u8 reg) in axspi_read_reg() argument
80 int len = ax_spi->comp ? 3 : 4; in axspi_read_reg()
82 ax_spi->cmd_buf[0] = 0x03; /* OP code read register */ in axspi_read_reg()
83 ax_spi->cmd_buf[1] = reg; /* register address */ in axspi_read_reg()
84 ax_spi->cmd_buf[2] = 0xFF; /* dumy cycle */ in axspi_read_reg()
85 ax_spi->cmd_buf[3] = 0xFF; /* dumy cycle */ in axspi_read_reg()
86 ret = spi_write_then_read(ax_spi->spi, in axspi_read_reg()
87 ax_spi->cmd_buf, len, in axspi_read_reg()
88 ax_spi->rx_buf, 2); in axspi_read_reg()
90 dev_err(&ax_spi->spi->dev, in axspi_read_reg()
95 le16_to_cpus((u16 *)ax_spi->rx_buf); in axspi_read_reg()
97 return *(u16 *)ax_spi->rx_buf; in axspi_read_reg()
100 int axspi_write_reg(struct axspi_data *ax_spi, u8 reg, u16 value) in axspi_write_reg() argument
104 memset(ax_spi->cmd_buf, 0, sizeof(ax_spi->cmd_buf)); in axspi_write_reg()
105 ax_spi->cmd_buf[0] = AX_SPICMD_WRITE_REG; /* OP code read register */ in axspi_write_reg()
106 ax_spi->cmd_buf[1] = reg; /* register address */ in axspi_write_reg()
107 ax_spi->cmd_buf[2] = value; in axspi_write_reg()
108 ax_spi->cmd_buf[3] = value >> 8; in axspi_write_reg()
110 ret = spi_write(ax_spi->spi, ax_spi->cmd_buf, 4); in axspi_write_reg()
112 dev_err(&ax_spi->spi->dev, "%s() failed: ret = %d\n", __func__, ret); in axspi_write_reg()