mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
463dd43bc9
Add support to the FPGA manager for programming Lattice ECP5 FPGA over slave SPI sysCONFIG interface. sysCONFIG interface core functionality is separate from both ECP5 and SPI specifics, so support for other FPGAs with different port types can be added in the future. Signed-off-by: Ivan Bornyakov <i.bornyakov@metrotek.ru> Acked-by: Xu Yilun <yilun.xu@intel.com> Link: https://lore.kernel.org/r/20221025053947.2737-2-i.bornyakov@metrotek.ru [yilun.xu@intel.com: remove redundant blank line after kmemdup] Signed-off-by: Xu Yilun <yilun.xu@intel.com>
40 lines
1.4 KiB
C
40 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef __LATTICE_SYSCONFIG_H
|
|
#define __LATTICE_SYSCONFIG_H
|
|
|
|
#define SYSCONFIG_ISC_ENABLE {0xC6, 0x00, 0x00, 0x00}
|
|
#define SYSCONFIG_ISC_DISABLE {0x26, 0x00, 0x00, 0x00}
|
|
#define SYSCONFIG_ISC_ERASE {0x0E, 0x01, 0x00, 0x00}
|
|
#define SYSCONFIG_LSC_READ_STATUS {0x3C, 0x00, 0x00, 0x00}
|
|
#define SYSCONFIG_LSC_CHECK_BUSY {0xF0, 0x00, 0x00, 0x00}
|
|
#define SYSCONFIG_LSC_REFRESH {0x79, 0x00, 0x00, 0x00}
|
|
#define SYSCONFIG_LSC_INIT_ADDR {0x46, 0x00, 0x00, 0x00}
|
|
#define SYSCONFIG_LSC_BITSTREAM_BURST {0x7a, 0x00, 0x00, 0x00}
|
|
|
|
#define SYSCONFIG_STATUS_DONE BIT(8)
|
|
#define SYSCONFIG_STATUS_BUSY BIT(12)
|
|
#define SYSCONFIG_STATUS_FAIL BIT(13)
|
|
#define SYSCONFIG_STATUS_ERR GENMASK(25, 23)
|
|
|
|
#define SYSCONFIG_POLL_INTERVAL_US 30
|
|
#define SYSCONFIG_POLL_BUSY_TIMEOUT_US 1000000
|
|
#define SYSCONFIG_POLL_GPIO_TIMEOUT_US 100000
|
|
|
|
struct sysconfig_priv {
|
|
struct gpio_desc *program;
|
|
struct gpio_desc *init;
|
|
struct gpio_desc *done;
|
|
struct device *dev;
|
|
int (*command_transfer)(struct sysconfig_priv *priv, const void *tx_buf,
|
|
size_t tx_len, void *rx_buf, size_t rx_len);
|
|
int (*bitstream_burst_write_init)(struct sysconfig_priv *priv);
|
|
int (*bitstream_burst_write)(struct sysconfig_priv *priv,
|
|
const char *tx_buf, size_t tx_len);
|
|
int (*bitstream_burst_write_complete)(struct sysconfig_priv *priv);
|
|
};
|
|
|
|
int sysconfig_probe(struct sysconfig_priv *priv);
|
|
|
|
#endif /* __LATTICE_SYSCONFIG_H */
|