Lines Matching +full:status +full:- +full:sizes

1 // SPDX-License-Identifier: GPL-2.0
8 #include <linux/fpga/fpga-mgr.h>
53 * HW status is returned on MISO in the first byte after CS went in mpf_read_status()
59 .tx_buf = &priv->tx, in mpf_read_status()
60 .rx_buf = &priv->rx, in mpf_read_status()
64 .tx_buf = &priv->tx, in mpf_read_status()
65 .rx_buf = &priv->rx, in mpf_read_status()
69 u8 status; in mpf_read_status() local
72 priv->tx = MPF_SPI_READ_STATUS; in mpf_read_status()
74 ret = spi_sync_transfer(priv->spi, xfers, 2); in mpf_read_status()
78 status = priv->rx; in mpf_read_status()
80 if ((status & MPF_STATUS_SPI_VIOLATION) || in mpf_read_status()
81 (status & MPF_STATUS_SPI_ERROR)) in mpf_read_status()
82 return -EIO; in mpf_read_status()
84 return status; in mpf_read_status()
89 struct mpf_priv *priv = mgr->priv; in mpf_ops_state()
91 int status; in mpf_ops_state() local
93 program_mode = priv->program_mode; in mpf_ops_state()
94 status = mpf_read_status(priv); in mpf_ops_state()
96 if (!program_mode && !status) in mpf_ops_state()
114 dev_err(&mgr->dev, "Image buffer is not provided\n"); in mpf_ops_parse_header()
115 return -EINVAL; in mpf_ops_parse_header()
120 info->header_size = header_size; in mpf_ops_parse_header()
121 return -EAGAIN; in mpf_ops_parse_header()
125 * Go through look-up table to find out where actual bitstream starts in mpf_ops_parse_header()
126 * and where sizes of components of the bitstream lies. in mpf_ops_parse_header()
128 blocks_num = *(buf + header_size - 1); in mpf_ops_parse_header()
134 info->header_size = header_size; in mpf_ops_parse_header()
135 return -EAGAIN; in mpf_ops_parse_header()
141 while (blocks_num--) { in mpf_ops_parse_header()
148 info->header_size = block_start; in mpf_ops_parse_header()
150 return -EAGAIN; in mpf_ops_parse_header()
168 dev_err(&mgr->dev, "Failed to parse header look-up table\n"); in mpf_ops_parse_header()
169 return -EFAULT; in mpf_ops_parse_header()
174 * Sizes of components of the bitstream are 22-bits long placed next in mpf_ops_parse_header()
190 component_size &= GENMASK(MPF_BITS_PER_COMPONENT_SIZE - 1, 0); in mpf_ops_parse_header()
192 info->data_size += component_size * MPF_SPI_FRAME_SIZE; in mpf_ops_parse_header()
200 int ret, status; in mpf_poll_status() local
203 * Busy poll HW status. Polling stops if any of the following in mpf_poll_status()
205 * - timeout is reached in mpf_poll_status()
206 * - mpf_read_status() returns an error in mpf_poll_status()
207 * - busy bit is cleared AND mask bits are set in mpf_poll_status()
209 ret = read_poll_timeout(mpf_read_status, status, in mpf_poll_status()
210 (status < 0) || in mpf_poll_status()
211 ((status & (MPF_STATUS_BUSY | mask)) == mask), in mpf_poll_status()
216 return status; in mpf_poll_status()
221 int status = mpf_poll_status(priv, 0); in mpf_spi_write() local
223 if (status < 0) in mpf_spi_write()
224 return status; in mpf_spi_write()
226 return spi_write_then_read(priv->spi, buf, buf_size, NULL, 0); in mpf_spi_write()
244 return spi_write_then_read(priv->spi, read_command, sizeof(read_command), in mpf_spi_write_then_read()
254 struct mpf_priv *priv = mgr->priv; in mpf_ops_write_init()
255 struct device *dev = &mgr->dev; in mpf_ops_write_init()
259 if (info->flags & FPGA_MGR_PARTIAL_RECONFIG) { in mpf_ops_write_init()
261 return -EOPNOTSUPP; in mpf_ops_write_init()
269 return -EFAULT; in mpf_ops_write_init()
278 priv->program_mode = true; in mpf_ops_write_init()
287 .tx_buf = &priv->tx, in mpf_spi_frame_write()
300 priv->tx = MPF_SPI_FRAME; in mpf_spi_frame_write()
302 return spi_sync_transfer(priv->spi, xfers, ARRAY_SIZE(xfers)); in mpf_spi_frame_write()
307 struct mpf_priv *priv = mgr->priv; in mpf_ops_write()
308 struct device *dev = &mgr->dev; in mpf_ops_write()
314 return -EINVAL; in mpf_ops_write()
334 struct mpf_priv *priv = mgr->priv; in mpf_ops_write_complete()
335 struct device *dev = &mgr->dev; in mpf_ops_write_complete()
352 priv->program_mode = false; in mpf_ops_write_complete()
369 struct device *dev = &spi->dev; in mpf_probe()
375 return -ENOMEM; in mpf_probe()
377 priv->spi = spi; in mpf_probe()
386 { .name = "mpf-spi-fpga-mgr", },
393 { .compatible = "microchip,mpf-spi-fpga-mgr" },