| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * FPGA Manager Driver for Lattice iCE40. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2016 Joel Holdsworth |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; version 2 of the License. |
|---|
| 9 | 6 | * |
|---|
| 10 | 7 | * This driver adds support to the FPGA manager for configuring the SRAM of |
|---|
| 11 | 8 | * Lattice iCE40 FPGAs through slave SPI. |
|---|
| .. | .. |
|---|
| 49 | 46 | struct spi_message message; |
|---|
| 50 | 47 | struct spi_transfer assert_cs_then_reset_delay = { |
|---|
| 51 | 48 | .cs_change = 1, |
|---|
| 52 | | - .delay_usecs = ICE40_SPI_RESET_DELAY |
|---|
| 49 | + .delay = { |
|---|
| 50 | + .value = ICE40_SPI_RESET_DELAY, |
|---|
| 51 | + .unit = SPI_DELAY_UNIT_USECS |
|---|
| 52 | + } |
|---|
| 53 | 53 | }; |
|---|
| 54 | 54 | struct spi_transfer housekeeping_delay_then_release_cs = { |
|---|
| 55 | | - .delay_usecs = ICE40_SPI_HOUSEKEEPING_DELAY |
|---|
| 55 | + .delay = { |
|---|
| 56 | + .value = ICE40_SPI_HOUSEKEEPING_DELAY, |
|---|
| 57 | + .unit = SPI_DELAY_UNIT_USECS |
|---|
| 58 | + } |
|---|
| 56 | 59 | }; |
|---|
| 57 | 60 | int ret; |
|---|
| 58 | 61 | |
|---|
| .. | .. |
|---|
| 175 | 178 | return ret; |
|---|
| 176 | 179 | } |
|---|
| 177 | 180 | |
|---|
| 178 | | - mgr = fpga_mgr_create(dev, "Lattice iCE40 FPGA Manager", |
|---|
| 179 | | - &ice40_fpga_ops, priv); |
|---|
| 181 | + mgr = devm_fpga_mgr_create(dev, "Lattice iCE40 FPGA Manager", |
|---|
| 182 | + &ice40_fpga_ops, priv); |
|---|
| 180 | 183 | if (!mgr) |
|---|
| 181 | 184 | return -ENOMEM; |
|---|
| 182 | 185 | |
|---|
| 183 | 186 | spi_set_drvdata(spi, mgr); |
|---|
| 184 | 187 | |
|---|
| 185 | | - ret = fpga_mgr_register(mgr); |
|---|
| 186 | | - if (ret) |
|---|
| 187 | | - fpga_mgr_free(mgr); |
|---|
| 188 | | - |
|---|
| 189 | | - return ret; |
|---|
| 188 | + return fpga_mgr_register(mgr); |
|---|
| 190 | 189 | } |
|---|
| 191 | 190 | |
|---|
| 192 | 191 | static int ice40_fpga_remove(struct spi_device *spi) |
|---|