| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2012 Stefan Roese <sr@denx.de> |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 6 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 7 | | - * (at your option) any later version. |
|---|
| 8 | 4 | */ |
|---|
| 9 | 5 | |
|---|
| 10 | 6 | #include <linux/device.h> |
|---|
| .. | .. |
|---|
| 71 | 67 | struct spi_device *spi = (struct spi_device *)context; |
|---|
| 72 | 68 | struct fpga_data *data = spi_get_drvdata(spi); |
|---|
| 73 | 69 | u8 *buffer; |
|---|
| 74 | | - int ret; |
|---|
| 75 | 70 | u8 txbuf[8]; |
|---|
| 76 | 71 | u8 rxbuf[8]; |
|---|
| 77 | 72 | int rx_len = 8; |
|---|
| .. | .. |
|---|
| 96 | 91 | |
|---|
| 97 | 92 | /* Trying to speak with the FPGA via SPI... */ |
|---|
| 98 | 93 | txbuf[0] = FPGA_CMD_READ_ID; |
|---|
| 99 | | - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); |
|---|
| 94 | + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); |
|---|
| 100 | 95 | jedec_id = get_unaligned_be32(&rxbuf[4]); |
|---|
| 101 | 96 | dev_dbg(&spi->dev, "FPGA JTAG ID=%08x\n", jedec_id); |
|---|
| 102 | 97 | |
|---|
| .. | .. |
|---|
| 114 | 109 | dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); |
|---|
| 115 | 110 | |
|---|
| 116 | 111 | txbuf[0] = FPGA_CMD_READ_STATUS; |
|---|
| 117 | | - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); |
|---|
| 112 | + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); |
|---|
| 118 | 113 | status = get_unaligned_be32(&rxbuf[4]); |
|---|
| 119 | 114 | dev_dbg(&spi->dev, "FPGA Status=%08x\n", status); |
|---|
| 120 | 115 | |
|---|
| .. | .. |
|---|
| 134 | 129 | memcpy(buffer + 4, fw->data, fw->size); |
|---|
| 135 | 130 | |
|---|
| 136 | 131 | txbuf[0] = FPGA_CMD_REFRESH; |
|---|
| 137 | | - ret = spi_write(spi, txbuf, 4); |
|---|
| 132 | + spi_write(spi, txbuf, 4); |
|---|
| 138 | 133 | |
|---|
| 139 | 134 | txbuf[0] = FPGA_CMD_WRITE_EN; |
|---|
| 140 | | - ret = spi_write(spi, txbuf, 4); |
|---|
| 135 | + spi_write(spi, txbuf, 4); |
|---|
| 141 | 136 | |
|---|
| 142 | 137 | txbuf[0] = FPGA_CMD_CLEAR; |
|---|
| 143 | | - ret = spi_write(spi, txbuf, 4); |
|---|
| 138 | + spi_write(spi, txbuf, 4); |
|---|
| 144 | 139 | |
|---|
| 145 | 140 | /* |
|---|
| 146 | 141 | * Wait for FPGA memory to become cleared |
|---|
| 147 | 142 | */ |
|---|
| 148 | 143 | for (i = 0; i < FPGA_CLEAR_LOOP_COUNT; i++) { |
|---|
| 149 | 144 | txbuf[0] = FPGA_CMD_READ_STATUS; |
|---|
| 150 | | - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); |
|---|
| 145 | + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); |
|---|
| 151 | 146 | status = get_unaligned_be32(&rxbuf[4]); |
|---|
| 152 | 147 | if (status == FPGA_STATUS_CLEARED) |
|---|
| 153 | 148 | break; |
|---|
| .. | .. |
|---|
| 164 | 159 | } |
|---|
| 165 | 160 | |
|---|
| 166 | 161 | dev_info(&spi->dev, "Configuring the FPGA...\n"); |
|---|
| 167 | | - ret = spi_write(spi, buffer, fw->size + 8); |
|---|
| 162 | + spi_write(spi, buffer, fw->size + 8); |
|---|
| 168 | 163 | |
|---|
| 169 | 164 | txbuf[0] = FPGA_CMD_WRITE_DIS; |
|---|
| 170 | | - ret = spi_write(spi, txbuf, 4); |
|---|
| 165 | + spi_write(spi, txbuf, 4); |
|---|
| 171 | 166 | |
|---|
| 172 | 167 | txbuf[0] = FPGA_CMD_READ_STATUS; |
|---|
| 173 | | - ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); |
|---|
| 168 | + spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); |
|---|
| 174 | 169 | status = get_unaligned_be32(&rxbuf[4]); |
|---|
| 175 | 170 | dev_dbg(&spi->dev, "FPGA Status=%08x\n", status); |
|---|
| 176 | 171 | |
|---|